fix(metamask-pay): cp-7.80.0 use latest on-chain nonce for EIP-7702 authorization list#30297
Conversation
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
Description
When building the EIP-7702 authorization list for a Pay delegation transaction, the nonce was previously read from
NonceLock.nextNonce— the value computed by the nonce tracker, which accounts for locally-pending transactions the Relay has no visibility into. This could produce a nonce ahead of the true on-chain state, causing the Relay to reject the authorization as invalid.The fix reads
NonceLock.nonceDetails.params.nextNetworkNonceinstead — the raweth_getTransactionCountresult that the nonce tracker already fetches internally. This gives the committed on-chain nonce the Relay needs to verify the authorization signature, without introducing a separate provider call or adding a new Engine dependency.Changelog
CHANGELOG entry: null
Related issues
Related to: #30798
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an examplePre-merge reviewer checklist
Note
Medium Risk
Changes nonce selection for EIP-7702 authorization signing in Pay flows; wrong nonce would break Relay submission but scope is limited to delegation authorization building.
Overview
EIP-7702 Pay delegation now signs the authorization list with the committed on-chain nonce (
nonceLock.nonceDetails.params.nextNetworkNonce) instead of the nonce tracker’snextNonce, which can include locally pending txs the Relay cannot see.Tests were updated to mock
networkClientIdon transaction meta and to return the new nonce lock shape soKeyringController:signEip7702Authorizationstill receives the expected nonce.Reviewed by Cursor Bugbot for commit 7d0387b. Bugbot is set up for automated code reviews on this repo. Configure here.