feat: SDK hardening integration (sign-callback recovery + apply-after-submit)#268
Open
WiktorStarczewski wants to merge 4 commits into
Open
feat: SDK hardening integration (sign-callback recovery + apply-after-submit)#268WiktorStarczewski wants to merge 4 commits into
WiktorStarczewski wants to merge 4 commits into
Conversation
…-submit) Thinned from the original #189 to contain only the improvements backed by outside SDK PRs, dropping the MidenClient singleton unification entirely: - Typed sign-callback failure recovery: a sign callback that fails because the wallet locked mid-tx is recovered via the SDK's lastAuthError(); the tx is left Queued for retry after unlock instead of marked Failed (miden-client#2058). - ApplyTransactionAfterSubmitFailed / errorCode dispatch: a tx that submits on-chain but fails to apply locally is marked Completed, not Failed (miden-client#2059, #2060). InputNoteAlreadyConsumedOnChain is cancelled. - Transaction-stage progress UI (syncing/sending/confirming/delivering) and the stress suite's transport-failure perturbation for the SDK relay outbox (miden-client#2127). Dropped vs #189: the singleton unification (keystore-bridge/keystore-wiring, Vault.encryptKeystoreEntry, two-instance->one collapse) and item 3 (waitForIdle in lock(), backed by draft #2057). The sign-callback is wired through the existing getMidenClient(options) path; the client singleton is untouched.
# Conflicts: # playwright/e2e/stress/stress-driver.ts # playwright/e2e/stress/stress.spec.ts # src/components/TransactionProgressModal.tsx # src/lib/miden/activity/transactions.ts # src/screens/generating-transaction/GeneratingTransaction.tsx
… gate Export buildSignCallbackError and readLastAuthReason and add branch-coverage tests for the SDK-hardening error recovery: reason classification, all four lastAuthError reasons + invalid/throw, the locked->leave-Queued path, and the wrapped sign callback's success/failure paths. Lifts global branch coverage back over 95% (the new error-recovery code had introduced uncovered branches).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Thinned-down replacement for #189. Contains only the SDK-hardening improvements that are backed by external SDK PRs (miden-client / web-sdk) — the
MidenClientsingleton unification is dropped entirely, and the client singleton is left untouched.Supersedes #189.
What's included
lastAuthError()and the tx is left Queued for retry after unlock instead of marked Failed (which previously caused note loss).ApplyTransactionAfterSubmitFailedhandling — a tx that submits on-chain but fails the local apply step is marked Completed (not Failed) via the SDK'serrorCodedispatch, so the user sees "Transaction sent" rather than a confusing failure for a tx that IS on chain.InputNoteAlreadyConsumedOnChainis cancelled.stagefield (syncing / sending / confirming / delivering) drives per-stage labels in the progress modal during the spinner window.STRESS_TRANSPORT_FAIL_PROB) — end-to-end coverage of the SDK's durable relay outbox (fix(rust): durable NTL relay for Client::send_private_note miden-client#2127).The per-tx sign callback is wired through the existing
getMidenClient(options)path; the error classification (buildSignCallbackError+lastAuthError()recovery) all degrades gracefully if the SDK methods aren't present.What's dropped vs #189
MidenClientsingleton unification —keystore-bridge.ts,keystore-wiring.ts,Vault.encryptKeystoreEntry(), the two-instance→one-singleton collapse, thegetMidenClient()signature change, and the adapter/main.tswiring.miden-client.ts,vault.ts,miden-client-interface.ts, and the intercom adapters are unchanged from base.waitForIdle()inActions.lock()), which was backed by the draft/exploratory miden-client#2057 — switchinglock()to a runtime-guardedwaitForIdle()would no-op (regressing the existingwithWasmClientLockdrain) until #2057 lands, solock()is left as-is.Verification
tsc --noEmit: cleanDiff: 26 files, +1216 / −70 (vs #189's 44 files, +1867 / −577).