Conversation
nonceBitmap is keyed by the EIP-712 signer. validatePermit passed the spender, so isPermitValid fail-opened after the owner nonce was spent.
Graphite Automations"Request reviewers once CI passes on sdks monorepo" took an action on this PR • (09/18/26)3 reviewers were added and 1 assignee was added to this PR based on Siyu Jiang (See-You John)'s automation. |
This branch has not been deployed
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.
PR Scope
fix(permit2-sdk):correctness ofisPermitValid/validatePermit.Description
SignatureProvider.isNonceUseddocuments its first argument as the owner and callspermit2.nonceBitmap(owner, wordPos).validatePermitpassedpermit.spenderinstead.Permit2 signature-transfer nonces are keyed by the EIP-712 signer. After the owner spends nonce N, the spender (usually a router) still has that bit unset.
isPermitValidreturned true. On-chain Permit2 still revertsInvalidNonce. The harmed caller is an off-chain consumer that treats this helper as the live-permit check (quotes, inventory, replay gates).isPermitValidandvalidatePermitnow takeownerand checkisNonceUsed(owner, nonce).Threat model: the attacker already holds a spent owner nonce and a permit that names a spender whose bitmap bit is unused. The remaining library guard is this verify API. Checking the spender turns that guard into a no-op.
How Has This Been Tested?
Unit test spies
isNonceUsedand asserts it is called withowner, notspender.Revert-tested: putting
permit.spenderback makes that assertion fail.tsc -p tsconfig.types.jsonclean. Existing fork-based tests needFORK_URLand were not re-run here. Call sites in this file now passowner.Are there any breaking changes?
Yes, TypeScript callers must pass
owneras the second argument. The old one-argument form checked the wrong account, so keeping that signature would keep the fail-open. If you want this titledfeat(breaking):and a major bump, I can retitle.(Optional) Feedback Focus
Whether
minor(changeset) vsmajoris the right version bump for the extra required argument.Made with Cursor