Skip to content

Document x402 nonce-burn cancellation and add signer to deploy script - #113

Open
Agusx1211 wants to merge 1 commit into
x402-sapientfrom
x402-spec-deploy-gaps
Open

Agusx1211 wants to merge 1 commit into
x402-sapientfrom
x402-spec-deploy-gaps

Conversation

@Agusx1211

Copy link
Copy Markdown
Member

Section 15 claimed there is no cheap per-position cancel without a configuration update. That is wrong. The wallet is the Permit2 owner, so it can call invalidateUnorderedNonces(wordPos, mask) on its own tape words in a normal transaction. permit2NonceWord(policyRoot, nonceIndex) gives the word and the low byte of the index gives the bit, so a payer can kill a signed-but-unsettled payment or pre-burn a range of future positions to pause a policy, without touching the sapient leaf. Removing the leaf is still the only permanent revocation. Section 15 now documents the derivation and the pause-versus-revoke distinction, and also states that the signer reads block.timestamp and so cannot be validated inside ERC-4337 validateUserOp, which only constrains the approval setup path.

Section 13 gained the point that the stateless exposure formula is per Permit2 owner rather than per policy root. The tape word base commits to the signer and the policy root but not the wallet, so a parent wallet nesting the same leaf becomes a second Permit2 owner with an untouched tape, and the bound multiplies by the number of reachable owners. Nesting has to be signed for explicitly. A new section 16 covers deployment: the two constructor addresses, the canonical values, and the cast call checks for WITNESS_TYPE_STRING() and PERMIT2() on the target chain. The witness typestring is a compile-time constant and the x402 exact-EVM scheme has already changed that struct once, so a proxy that disagrees makes every payment revert with InvalidDigest. It also notes that the signer address feeds permit2NonceWordBase, so per-chain constructor differences mean per-chain tapes.

script/Deploy.s.sol did not deploy X402SessionSapientSigner at all; it now does, reading PERMIT2 and X402_PERMIT2_PROXY from the environment with the canonical addresses as defaults, and both are added to .env.sample. Verified with forge build and forge fmt --check on the script, plus forge test on test/extensions/x402/X402SessionSapientSigner.t.sol as a smoke check: 47 passed, 0 failed. The contract itself is unchanged, so no new tests. An actual deployment still needs the per-chain proxy verification described in section 16.

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