Skip to content

fix: use decodeAuthorizationSignature util from transaction-controller#29717

Merged
matthewwalsh0 merged 1 commit into
mainfrom
fix/use-decode-authorization-signature-util
May 8, 2026
Merged

fix: use decodeAuthorizationSignature util from transaction-controller#29717
matthewwalsh0 merged 1 commit into
mainfrom
fix/use-decode-authorization-signature-util

Conversation

@matthewwalsh0

@matthewwalsh0 matthewwalsh0 commented May 5, 2026

Copy link
Copy Markdown
Member

Description

Replace local EIP-7702 authorization signature decoding with the decodeAuthorizationSignature util from @metamask/transaction-controller (added in core#8656). The util produces RLP-canonical hex (no leading zero nibbles, 0x0 for zero), which the Sentinel relay and public RPCs require. The local copies under-canonicalised: delegation.ts did nothing, delegation-7702-publish.ts only stripped a single leading zero.

Changelog

CHANGELOG entry: Fixed an issue where EIP-7702 authorization signatures with leading zero bytes in r or s could be rejected by relays and public RPCs.

Related issues

Fixes: CONF-1133

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Touches EIP-7702 authorization encoding used for relay/RPC submission; small change but in a transaction-critical path and could affect signature validity if the upstream util behavior differs.

Overview
Replaces two local EIP-7702 authorization signature parsing implementations with decodeAuthorizationSignature from @metamask/transaction-controller.

This removes custom r/s/yParity slicing/normalization (and related helpers/imports) so authorization lists use the shared, canonical decoding expected by relays and public RPCs.

Reviewed by Cursor Bugbot for commit 8202337. Bugbot is set up for automated code reviews on this repo. Configure here.

@metamaskbotv2 metamaskbotv2 Bot added the team-confirmations Push issues to confirmations team label May 5, 2026
@github-actions github-actions Bot added the size-S label May 5, 2026
@matthewwalsh0 matthewwalsh0 force-pushed the fix/use-decode-authorization-signature-util branch from 890ff46 to 5138245 Compare May 8, 2026 08:19
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review May 8, 2026 08:22
@matthewwalsh0 matthewwalsh0 force-pushed the fix/use-decode-authorization-signature-util branch from 5138245 to 66ebc58 Compare May 8, 2026 10:46
Replace local 7702 authorization signature decoding logic with the new
`decodeAuthorizationSignature` util exported from
`@metamask/transaction-controller`. The util produces RLP-canonical
hex (no leading zero nibbles, `0x0` for zero) so values are accepted
by go-ethereum-style decoders (Sentinel relay, public RPCs).

The local copy in `delegation.ts` did no canonicalization at all, and
`delegation-7702-publish.ts` only stripped a single leading zero
nibble — both could emit non-canonical `r`/`s` values that the relay
or RPC would reject.

References: MetaMask/core#8656
@matthewwalsh0 matthewwalsh0 force-pushed the fix/use-decode-authorization-signature-util branch from 66ebc58 to 8202337 Compare May 8, 2026 11:59
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are a targeted refactoring of EIP-7702 delegation authorization signature decoding:

  1. delegation.ts: Removed local decodeAuthorizationSignature function and replaced with the upstream version from @metamask/transaction-controller. The local version was a simpler implementation.

  2. delegation-7702-publish.ts: Removed local #decodeAuthorizationSignature private method (which used stripSingleLeadingZero on r and s values) and replaced with the upstream decodeAuthorizationSignature from @metamask/transaction-controller. Also removed unused imports (add0x, toHex, stripSingleLeadingZero).

Behavioral change risk: The old local implementation in delegation-7702-publish.ts used stripSingleLeadingZero on r and s values before returning them, while the new upstream implementation may handle this differently. This is a subtle but potentially impactful change in how authorization signatures are decoded for EIP-7702 transactions.

Test coverage: There is a dedicated E2E test file tests/smoke/confirmations/transactions/gas-fee-tokens-eip-7702-sponsored.spec.ts tagged with SmokeConfirmations that specifically tests EIP-7702 sponsored gas fee transactions. This directly validates the changed code path.

Scope: The changes are isolated to EIP-7702 delegation/authorization signature handling. No UI components, navigation, shared infrastructure, or other transaction types are affected. No performance-sensitive code paths are changed.

Performance Test Selection:
The changes are pure refactoring of authorization signature decoding logic (replacing local implementations with upstream library functions). No UI rendering, data loading, state management, or performance-critical paths are affected. No performance tests are needed.

View GitHub Actions results

@matthewwalsh0 matthewwalsh0 enabled auto-merge May 8, 2026 12:01

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8202337. Configure here.

import { NetworkClientId } from '@metamask/network-controller';
import { toHex } from '@metamask/controller-utils';
import { isE2ETest, stripSingleLeadingZero } from '../util';
import { isE2ETest } from '../util';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stripSingleLeadingZero is now dead production code

Low Severity

This PR removed the only production caller of stripSingleLeadingZero (from delegation-7702-publish.ts), but the function definition in util.ts and its dedicated tests in util.test.ts were left behind. The function is now dead code — exported but never imported anywhere in production. Both the function and its tests can be removed as part of this cleanup.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8202337. Configure here.

@sonarqubecloud

sonarqubecloud Bot commented May 8, 2026

Copy link
Copy Markdown

@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit 9d7c607 May 8, 2026
94 of 96 checks passed
@matthewwalsh0 matthewwalsh0 deleted the fix/use-decode-authorization-signature-util branch May 8, 2026 13:15
@github-actions github-actions Bot locked and limited conversation to collaborators May 8, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.78.0 Issue or pull request that will be included in release 7.78.0 size-S team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants