Skip to content

fix(web): a paid identity create whose proof cannot be verified checks what landed (L-06, L-20) - #100

Merged
PastaPastaPasta merged 6 commits into
masterfrom
fix/identity-create-stale-quorum
Sep 27, 2026
Merged

PastaPastaPasta merged 6 commits into
masterfrom
fix/identity-create-stale-quorum

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Summary

Fixes L-06, a false "Failed to create identity" on a paid browser create. It also adds step-timing instrumentation for L-20. Both are in group G3 of the live fix list.

L-06: root cause

Checked in the pinned platform source (6c95cd8), and unchanged in v4.2.0-beta.5.

  • wasm-sdk identityCreate (packages/wasm-sdk/src/state_transitions/identity.rs:95-131) calls rs-sdk's put_to_platform_and_wait_for_response_with_private_key.
  • That call proof-checks the result against the trusted context's cached quorum keys and never calls refresh_quorums.
  • refresh_quorums is crate-private (context_provider.rs:254). It runs only in prepare_state_transition_context (broadcast.rs:76-81), which the generic broadcastAndWait / waitForResponse use.
  • The context is built with with_refetch_if_not_found(false).
  • So after a quorum rotation, a create that Platform accepted is reported as Quorum not found in cache.

#80 only covered reads.

The fix

lib/sdk/service.ts

  • EvoSdkService.ensureFresh() builds a new trusted connection (a fresh quorum prefetch) before the create, unless the current one is under 30 s old.
  • pathElements is added to the retryable reads.

lib/auth/create-identity.ts: after an error that leaves the outcome open, the flow asks Platform what happened. Open errors are stale quorum, proof, transport, timeout, "no available addresses", and already-used / already-exists.

  • Bounded identity reads: 4 after an error that came with Platform's answer, 12 after transport errors or timeouts. On a stale-quorum error the keys are renewed first.
  • Identity found: finish. Key 5 is renewed with the master key only when it is provably not the key this run stored. A transient key-check failure is a named error, and "Try again" checks the stored key again; it never pays for a renewal.
  • Identity absent: read Platform's spent-asset-lock record for the lock's outpoint. This is a proven getPathElements on root tree 72, per rs-drive fetch_asset_lock_outpoint_info.
    • Unused: IdentityNotCreatedError, and the sheet offers "Try again with the same deposit". The journal keeps the lock, so no new payment is needed.
    • Partly used (an attempt was rejected and Platform kept a fee): the message says so and shows what remains, decoded from AssetLockValue::V0. It warns that a retry rejected for the same reason costs another fee. If less than the create minimum remains, the sheet offers "Discard this creation" instead.
    • Fully used without a visible identity, or an unreadable answer: "could not confirm". This case never offers the same deposit.

components/auth/create-identity-flow.tsx: the catch now reflects those outcomes. "Try again" works on a resumed creation too, and it reuses the key this sheet stored.

L-20 (instrumentation only)

  • lib/step-timing.ts records each sign-in step and each enable-private-repos sub-step as a User Timing measure named forge:<flow>:<step>.
  • With localStorage['forge.debug'] = 'timing' set, each measure is also logged to the console.
  • vault.ts is untouched; G1 owns it.

Upstream

A report is drafted, not filed: dash-forge-qa/upstream/wasm-sdk-identity-create-quorum.md. It covers identityCreate and the other typed wasm-sdk writes that skip refresh_quorums.

Tests

Unit (lib/auth/create-identity.test.ts, 35 tests): a stale-quorum error is injected after the broadcast.

  • The identity landed: the flow finishes.
  • It landed with an earlier attempt's key 5: the key is renewed as key 6.
  • It did not land and the lock is unused: IdentityNotCreatedError, and the retry reuses the lock.
  • Partly used lock, with enough left and with too little.
  • Lock fully used and identity absent: unknown, with no same-deposit offer.
  • Unknown results: the lock read throws, returns ≠1 element, or returns a non-item.
  • Aborts: during the probe, and between freshen and the broadcast.
  • M1 cases: a transient key check gives no renewal, and a retry keeps the stored key.
  • Probe length: longer for transport errors and "no available addresses".
  • A golden AssetLockValue vector serialized by rs-dpp.

Every new case fails on the previous code.

Service (service.test.ts): ensureFresh reuses a connection under 30 s old, rebuilds an older one, and keeps the current one when a rebuild fails.

Live (e2e/create-identity-recovery.spec.ts, moutai on drive 4.2.0-beta.5, Chromium, a fresh context per test; both pass):

  • cr-1: the quorum lists served for the pre-create renewal are emptied, so the real create hits L-06 after the broadcast. The sheet shows "Checking whether Platform recorded your identity…" and signs in with no error.
  • cr-2: every broadcast answers "deadline exceeded". The sheet shows "Platform shows no record of identity…" and "Try again with the same deposit". With the network back, the retry creates the identity from the same deposit.

The spent-asset-lock probe was also checked live against beta.5: a consumed lock returns an empty item, and a random outpoint returns no element.

Evidence: dash-forge-qa/evidence/impl/fix-identity-create-stale-quorum/.

🤖 Generated with Claude Code

PastaPastaPasta and others added 5 commits September 27, 2026 16:38
…at landed (L-06)

wasm-sdk identityCreate verifies its result against the connection's quorum keys without refreshing them, so a quorum rotation reported 'Failed to create identity: Quorum not found in cache' for an identity Platform had created. The connection is renewed before the create; after an unverifiable answer the flow reads the identity (bounded retry) and finishes if it is there, and otherwise checks the spent-asset-lock tree and offers 'Try again with the same deposit' (no second payment).

L-20: step timing (User Timing measures, console with forge.debug=timing) for the sign-in steps and the enable-private-repos sub-steps. vault.ts is not touched.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Apply the simplifier review: a shared balance read, private probe constants, one freshen call, the same-deposit label cleared before the words check, the private-repos timing flow named once, and tighter tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Renew the browser key after a landed-but-unverified create only when key 5 is provably not ours; describe a partly used lock (fee kept, what remains, whether a retry can succeed); call 'not created' a snapshot; probe longer after transport errors; abort check before the broadcast; classify only a single item element; a failed existence read is not 'no identity'; one step clock per sign-in run; the live spec intercepts from the start and records stages with a MutationObserver.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…inal state

When the identity already exists, the key the earlier run stored (held in the sheet's memory) is checked and kept instead of paying for a renewal; a key check that fails after a landed create is a named error that 'Try again' checks again. 'No available addresses' gets the long probe. A lock with too little left offers 'Discard this creation' instead of a retry. Golden AssetLockValue vector from rs-dpp; minimal varint markers in the test helper.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…try the Node-side identity read

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a321da63-30fd-4eef-9519-e714ac5e550e

📥 Commits

Reviewing files that changed from the base of the PR and between 71481af and 0efde23.

📒 Files selected for processing (12)
  • forge-web/components/auth/create-identity-flow.tsx
  • forge-web/components/auth/step-status.tsx
  • forge-web/e2e/create-identity-recovery.spec.ts
  • forge-web/lib/auth/controller.ts
  • forge-web/lib/auth/create-identity.test.ts
  • forge-web/lib/auth/create-identity.ts
  • forge-web/lib/auth/encryption-key.ts
  • forge-web/lib/sdk/facade.ts
  • forge-web/lib/sdk/service.test.ts
  • forge-web/lib/sdk/service.ts
  • forge-web/lib/step-timing.test.ts
  • forge-web/lib/step-timing.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Resolve with #87 (per-facade retryable reads; pathElements added under system) and #94 (staged key persist in the renewal, D-016; the sheet remembers only a committed key).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@PastaPastaPasta
PastaPastaPasta merged commit 35f699a into master Sep 27, 2026
6 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