Repository navigation
fix(stake): gasless deposit follow-ups before the flag goes on (stacked on #1558) - #1564
Closed
DealAppSeo wants to merge 7 commits into
Closed
DealAppSeo wants to merge 7 commits into
DealAppSeo wants to merge 7 commits into
Conversation
…_MODE, default off) A newcomer has testnet USDC and no ETH. The owner signs a transferWithAuthorization (owner -> stake escrow) in their wallet; POST /api/v1/stake/deposit/gasless checks it, the escrow submits it and pays the gas, and depositStake's verified path credits it. Nothing new verifies a signature: verifyEip3009Local (the x402 path) checks it against USDC's name/version read from the chain and matched to its DOMAIN_SEPARATOR (resolveAndVerifyDomain). The send is the escrow's guarded path: realSender's body is now escrowCall, shared by the refund, the stake payout and the relay, and the relay joins the same one-at-a-time queue (one nonce). Refused before the escrow spends gas: wrong recipient, zero amount, expired or expiring within 120 s, bad signature, no account for the payer, nonce already used on chain (replay), balance too low, any unreadable read. A concurrent second submission of one authorization is serialized and refused. off: refused without reading. shadow: every check, nothing sent. on: submit, credit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x hash (Grok r1 lead on #1558) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of the escrow queue (Strix on #1558) The keyless route refused only value <= 0, so a 1-micro-USDC authorization made the escrow pay a full transaction; and the per-authorization lock never makes two different authorizations wait, so a caller could queue more escrow sends than one signer drains, ahead of refunds and agent payouts. - MIN_GASLESS_DEPOSIT = 1 USDC, refused before any send. - createGaslessAdmission(4/min), process-wide, injected as deps.admit: past it, 429 escrow_busy and nothing is queued. Shadow mode and refused deposits use no admission. Not changed: depositStake and the owner-signed withdraw have no floor of their own; withdrawal needs the owner's signature, so it is not this keyless path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sion after the in-lock re-check - No chain, DB, relay or credit error text reaches a gasless answer; it is logged server-side. ethers puts the request URL in its messages and a provider URL can carry an API key (the class Strix found on #1559). depositStake's error can carry verifyDeposit's raw RPC text too, so it is logged. - The admission slot is now taken after the in-lock authorizationState re-check, just before the relay, so a concurrent replay refused there uses no slot (Grok r3 on #1558). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f the global cap (Strix on #1558) One wallet could take all 4 global slots with concurrent deposits the escrow then refused, keeping the keyless route at 429 for everyone else. createGaslessAdmission(4, 1) now also bounds each payer (case-insensitive) to 1 a minute; rotating wallets still meets the global cap, and each wallet needs an account and the USDC it signs for. Tests fail on the previous source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a wallet), not 'key' credential-safety-architecture flagged `r.payer === key` as a secret comparison. It compares wallet addresses, so the variable is renamed rather than allowlisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A relay that fails re-reads authorizationState: used (or canceled) answers 202 authorization_used_elsewhere, an unreadable state answers 202 send_not_checked, and only an unused one answers 502 "no USDC moved". A signed authorization can be submitted by anyone and pays the escrow, so a revert can mean the USDC did move. - Refuse with 503 wrong_network unless NETWORK resolves to Base Sepolia: verifyEip3009Local takes the EIP-712 chainId from NETWORK while the escrow sends only on 84532. - The route's catch-all answers a fixed message; the error text goes to the log. - The global 4/min admission budget can be griefed by four funded wallets: stated as a ponytail ceiling with the upgrade options (a decision, not decided here). - escrow-refunder.ts header names all three kinds of send on the escrow's one queue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Superseded by #1568. #1558 squash-merged, so this branch conflicted with 🤖 Addressed by Claude Code |
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.
Owner action
You merge (MAJOR: money path), and only after #1558. This PR is stacked on #1558 (base
claude/r3-gasless-deposit-eip3009). When #1558 squash-merges, retarget this PR tomainwithgh pr edit <this> --base mainand rebase it. One decision is needed from you, item 4 below. Nothing here turns the flag on;GASLESS_DEPOSIT_MODEstaysoffby default.What this is
These are follow-ups for #1558 from an independent review, to fix before
GASLESS_DEPOSIT_MODE=on. They live here so #1558's reviewed head (64e02092) stays fixed for tonight's packet.authorizationStatebefore it says "no USDC moved". Anyone can submit a signed authorization, and itstois the escrow, so a revert can mean another submitter used it and the USDC moved.authorization_used_elsewheresend_not_checkednot_sentverifyEip3009Localtakes the EIP-712chainIdfromNETWORK(getActiveNetwork), but the escrow sends only on Base Sepolia (84532). A server withNETWORKset to another chain, or to an unknown name, now refuses with 503wrong_networkbefore any chain read.src/routes/v1.ts) answers a fixed message. The error text goes to the log only. ethers puts the RPC URL, and any key in it, in its messages.ponytail:ceiling increateGaslessAdmissionand does not pick a fix. The options are to gate admission on something a rotated wallet cannot make for free (account age, a stake already held, a signed connect), or to charge the gas back from the deposit.escrow-refunder.tsheader now names all three kinds of send on the escrow's one queue: refunds, gasless relays and agent payouts.Evidence
E:\dev\reports\2026-11-16\r-loop\r3b.test-output-head.txt: 46/46 pass across the gasless, route, auth-bypass and relay suites.r3b.test-output-old-src.txt: the new tests against feat(stake): gasless owner deposit via USDC EIP-3009, default off (R3) #1558'sgasless-deposit.tsandv1.tsat64e02092. 4 fail: used-elsewhere, re-read-fails, wrong-network and route catch-all. The still-unused → 502 control passes on both.tsc --noEmitis clean.Not merged by Claude. Strix and the fenced Grok review have not run on this PR yet.
🤖 Generated with Claude Code