Skip to content

Audit v14: one wallet per create (CLI-1002), VK-751, note-store merge, block-body checks - #12

Merged
dendisuhubdy merged 7 commits into
mainfrom
fix/audit-v14
Nov 17, 2026
Merged

dendisuhubdy merged 7 commits into
mainfrom
fix/audit-v14

Conversation

@dendisuhubdy

Copy link
Copy Markdown
Member

Fixes for the audit v14 addendum. Includes the one Medium row, CLI-1002.

Changes

  • CLI-1002 — one wallet per create: single-flight backend, the vault check repeated at the write under a Web Lock, and an in-flight guard on the create and import forms.
  • CLI-1001 — the note-store merge is monotone; shells without a conditional write merge instead of overwrite.
  • VK-751 — a note is Sent only when its creator is this wallet; a chain-fixed creator is "sent, sender unverified"; anything else is dropped (JS engine and wallet-core).
  • CLI-1006 — a transfer's outcome is decided by its phase first; nothing after the broadcast reads as cancelled.
  • CLI-1009 — a block whose header announced transactions but whose body is null or short is not read as empty (JS, Android, iOS).
  • CLI-751 — README note on fleet snapshot tags.

Tests

  • JS: 1336 tests, 1277 pass, 59 skipped (with fullnode vendored).
  • cargo test -p wallet-core: 151 passed, 2 ignored. wallet-ffi and wallet-wasm type-check.

Not verified

  • Android was not compiled. iOS was type-checked only.

Release note

The VK-751 change spans the JS engine and the rebuilt core; they must ship together.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx

dendisuhubdy and others added 6 commits November 17, 2026 15:18
…repeated at the write, in-flight guard on the create and import forms

A second submit while PBKDF2 was still deriving passed both existence
checks: two creates succeeded with different keys, the backup screen
revealed the first and the vault ended on the second.

- backend-shared.js: wallet.create/import are single-flight (the
  identical call gets the same promise, any other is refused), and the
  vault is written only after re-reading that none is stored, under an
  exclusive Web Lock where the platform has one. Never overwrites.
- onboarding.js: the create and import forms hold an in-flight guard
  and disable the submit button until the call settles.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
…itional write merge instead of overwrite

- A lost conditional write merged notes by index and kept the winner's
  copy whole, dropping the loser's spent flags and pending marks while
  the height cursor was kept: a spent note stayed spendable until a
  rescan. Notes now merge mark by mark (spent OR, pending kept),
  submissions only move forward, and the merged scanned_height is the
  nearer cursor when the further-read side did not hold every note.
- The extension and desktop shells have no compareAndSet, so a scan
  that straddled a send's save wrote its stale copy over the submission
  record. The engine now keeps the same conditional-write contract
  itself (write_seq, read-compare-write under an in-process lock) and
  merges on a lost race.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
…fixed creator is "sent, sender unverified"; anything else is dropped

The sender part of an envelope opens under the viewing key, which is
handed out (delegated prover, auditor), so its holder could plant sent
payments in the wallet's history. The bundle guest commits every output
with from = the spender's pk, which the holder cannot choose.

- ui/engine/wallet.js: the scan judges every row whose sender part
  opened by its creator (sentRole): own pk -> Sent; zero / rpl-mint /
  rpl2-pay / rpl3-pay -> kept with unverified: true, its own activity
  kind, never matched to a submission; anything else, a row with no
  creator included, is dropped. A page replaces what was stored for its
  leaves, so a rescan removes rows an older build kept.
- backend-shared.js, lib/rows.js, backend.js, locales: the new
  'out-unverified' activity kind and its title in all 20 languages.
- core/crates/wallet-core: classify applies the same rule; scan_page
  reports `from` on every sent row and the unverified ones in their own
  list (sent_unverified), so the mobile apps, which read `sent` alone,
  never count one. Two tests added. NOT compiled or run here: the
  vendored node is not checked out in this worktree.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
…g after the broadcast reads as cancelled

outcomeOf (send and withdraw) tested the abort before the phase, safe
only because the engine's last abort checkpoint sits immediately before
the broadcast. And isAbortError took code 20 for an abort, so a node
answering the confirmation read with JSON-RPC code 20 made a broadcast
transfer read as cancelled while Activity listed it pending.

- From 'submitting' on the outcome is 'unknown' (or 'not-sent' when the
  node refused the broadcast), whatever the error or the cancel flag.
- RpcError is named, and a node's own error is never an abort.
- Tests pin the engine invariant for completeSend/Burn/Invoke: an
  abort signalled at the broadcast still records and resolves. Adding
  a checkpoint after the broadcast turns them red (checked by mutation).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
…is null or short is not read as empty — the deposit cursor stays under it

The shared JS engine, the Android walk and the iOS walk all advanced
the bridge-deposit cursor past a block whose header said tx_count > 0
and whose body came back null or with no transactions: a deposit in it
was never looked for again.

- ui/engine: checkBlockActions takes the header's tx_count and refuses
  a null or short body; depositsByHeader passes it, so the walk stops
  under the block, reports it (bridgeUnknown) and the next scan asks
  again. The one-block-at-a-time path stops at a null block under the
  node's own tip. Tests added; two fixtures that served an empty body
  under a header announcing one now serve what the header says.
- android DepositWalk.java: the same rule (served()), with unit tests.
  NOT compiled or run: no JDK on this machine.
- ios DepositWalk.swift / RpcClient.swift / WalletService.swift: the
  walk hands tx_count to the block read, and RpcClient.actions(ofBlock:)
  refuses a null or short body, with unit tests. Type-checked with
  swiftc only (RpcClient, DepositWalk, the walk tests); not built or
  run, and the WalletService call site was not type-checked.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
…eet snapshot tag, not a wallet release

v0.8.6 on this repository marks the snapshot at the fullnode v0.8.6
release (manifests 0.8.3, vendored node v0.8.5). The note sits beside
the build step's `git checkout v0.8.3`; the tag itself is untouched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.52941% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
core/crates/wallet-core/src/lib.rs 98.52% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…seq is a write counter, and the wallet's RPC error is named RpcError

A second scan that adds nothing still writes the store (last_sync_ms), so write_seq moves the way rev does; the comparison leaves it out. The JSON-RPC refusal now carries name 'RpcError' (CLI-1006), which the send screen reads.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
@dendisuhubdy
dendisuhubdy merged commit 13d8ec1 into main Nov 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant