Skip to content

Latest commit

 

History

History
110 lines (76 loc) · 2.66 KB

File metadata and controls

110 lines (76 loc) · 2.66 KB

SafeLens Testing Guide

This document describes how to test the SafeLens apps and CLI.

Generator (Next.js)

  1. Start the dev server:
bun --cwd apps/generator dev
  1. Navigate to http://localhost:3000

  2. Enter this test URL:

https://app.safe.global/transactions/tx?safe=eth:0x9fC3dc011b461664c835F2527fffb1169b3C213e&id=multisig_0x9fC3dc011b461664c835F2527fffb1169b3C213e_0x8bcba9ed52545bdc89eebc015757cda83c2468d3f225cea01c2a844b8a15cf17
  1. Click "Analyze"

  2. Verify:

  • Evidence package is generated
  • Safe address, chain, and hashes display correctly
  • Signatures count is shown
  1. Click "Download JSON" and save the file

Desktop verifier (Tauri)

  1. Start the Vite dev server:
bun --cwd apps/desktop dev
  1. Launch Tauri:
bun --cwd apps/desktop tauri dev
  1. Upload the evidence.json from the generator

  2. Click "Verify Evidence"

  3. Verify:

  • Success toast appears
  • Safe TX hash is displayed
  • Transaction details match
  • Signatures list appears

Offline check

Disconnect from the network and repeat step 3. Verification should still succeed.

CLI

bun --cwd packages/cli dev -- analyze "https://app.safe.global/transactions/tx?safe=eth:0x9fC3dc011b461664c835F2527fffb1169b3C213e&id=multisig_0x9fC3dc011b461664c835F2527fffb1169b3C213e_0x8bcba9ed52545bdc89eebc015757cda83c2468d3f225cea01c2a844b8a15cf17" --out evidence.json
bun --cwd packages/cli dev -- verify --file evidence.json
bun --cwd packages/cli dev -- settings init

Expected:

  • Analyze writes a JSON file
  • Verify returns "Evidence verified"
  • Settings file created at ~/.safelens/settings.json

Automated tests

bun run test

This now runs:

  • packages/core unit tests
  • packages/cli command/output tests
  • apps/generator utility tests
  • apps/desktop airgap configuration tests

Type checks

bun run type-check

This includes packages/core, packages/cli, apps/generator, and apps/desktop.

Replay benchmark (desktop)

cargo test --manifest-path apps/desktop/src-tauri/Cargo.toml benchmark_replay_latency_profiles -- --ignored --nocapture

This prints p50/p95 latency for deterministic local replay profiles and is used to track replay performance regressions.

URL parsing tests

Valid URLs

https://app.safe.global/transactions/tx?safe=eth:0x9fC3dc011b461664c835F2527fffb1169b3C213e&id=multisig_0x9fC3dc011b461664c835F2527fffb1169b3C213e_0x8bcba9ed52545bdc89eebc015757cda83c2468d3f225cea01c2a844b8a15cf17

Expected: parses successfully (chain: Ethereum Mainnet)

Invalid URLs

https://app.safe.global/transactions/tx?id=multisig_0x123_0x456

Expected: error: "Missing 'safe' parameter"