feat(evm): share browser payment APIs and durable payment recovery - #17
Draft
mickvandijke wants to merge 8 commits into
Draft
mickvandijke wants to merge 8 commits into
mickvandijke wants to merge 8 commits into
Conversation
This was referenced Sep 15, 2026
Draft
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
Allows browser clients to use the same EVM payment types, quote hashing, pricing, Merkle algorithms, and vault encodings as native clients. The portable layer excludes native process and environment facilities; optional RPC uses browser Fetch and timers, while the default native feature retains Anvil and native wallet support.
Merkle checkpoints preserve the original salts and random padding so recovery reconstructs the same payment intent. Native wallets can prepare and sign a payment without broadcasting, persist its exact transaction bytes, then submit or observe that same transaction after interruption. Journal validation binds the transaction to its wallet, chain, vault, and intended calldata.
Recovery distinguishes pending transactions, unfinalized failures, finalized reverts, and finalized nonce replacements. A same-intent fee replacement returns its successful receipt and settlement hash; a different finalized nonce consumer permits a fresh attempt. Missing history, RPC errors, and unexplained nonce advances retain the journal. Failed-payment retry decisions use canonical receipts and the RPC
finalizedtag; successful payments keep the existing optimistic canonical-inclusion semantics. See PAYMENT_RECOVERY.md for finality and historical-RPC requirements.Native-only tests are feature-gated, and CI covers both portable and RPC-only test configurations.
Linear issue
Closes V2-803 — Linear issue
Risk tier
Proposed for human review: changes payment submission and recovery behavior.
Compatibility
Consumers of the draft journal API must handle
PaymentStatus::FinalizingandPaymentStatus::Replaced. The storedSignedPaymentrepresentation is unchanged.Semver impact
Test evidence
Validated on the current revision during this refresh:
cargo test --test wallet journaled: 7 passed, covering canonical success, Merkle winner recovery, reverted transactions across a reorg, finality before retry, finalized nonce replacement, successful fee replacement, and unexplained nonce consumption.cargo test --no-default-features: 10 tests passed; native-only integration targets are gated out.cargo test --lib --test cryptography --no-default-features --features rpc,external-signer: 19 passed.cargo clippy --all-targets --all-features -- -D warnings: passed.cargo check --lib --no-default-features --features rpc,external-signer --target wasm32-unknown-unknown: passed.The coordinated ant-client recovery suite also exercises the native caller's handling of finalized replacements. Local results do not replace CI or production RPC validation.
New dependency
Adds
web-timefor portable clocks and WASM-targetgloo-timers,futures-util, and JavaScript-enabledgetrandom. Existing Alloy and Tokio dependencies use explicit feature gates. No new standalone crate or parallel browser payment implementation is introduced.ADR
ant-client ADR-0004: Direct browser immutable-data client documents shared payment preparation, journals, and recovery across native/browser adapters. Saorsa Core ADR-019 covers the shared portable dependency architecture.
Mitigation / rollback
Keep consumers on the default native feature or revert the coordinated client/EVM revisions together. Preserve unresolved transaction journals; a missing receipt is not proof that another payment is safe.
Coordinated consumers
Current stack revisions
All PRs link to V2-803. Immutable Git pins are aligned with these pushed branch heads:
cf424c04d557f5e1dc00a2c1bc6dcd804c1509dd2b0aa66229a2b272EVM recovery now retains ambiguous journals until finalized failure/replacement evidence is available. The protocol and native client include the matching consumer changes. Existing browser wire and payment formats are retained.