Skip to content

fix: accept unpadded r and s in zod Authorization.Signed - #694

Open
gomesalexandre wants to merge 1 commit into
wevm:mainfrom
gomesalexandre:fix_zod_authorization_quantity
Open

gomesalexandre wants to merge 1 commit into
wevm:mainfrom
gomesalexandre:fix_zod_authorization_quantity

Conversation

@gomesalexandre

Copy link
Copy Markdown
Contributor

Nodes return the r and s of an authorization list entry as uint256 quantities (execution-apis src/schemas/transaction.yaml), so any value below 2**248 has fewer than 32 bytes. The zod Authorization.Signed / SignedToRpc schemas typed them as Hex32 and rejected those values. That's about 1 in 128 authorizations, and it fails the whole Transaction.Eip7702 decode with expected 32 bytes. Core Authorization.fromRpc accepts them and pads them.

On live data from publicnode (30 latest blocks), 2 of 103 mainnet type-4 transactions and 1 of 30 on BSC failed z.decode(Transaction.Transaction, tx). One example is mainnet tx 0x701f5911c66298aee60c1fc2b56063de81efcde3186d0ad317d083098bbb7b51, which fails at authorizationList.0.s, a 62-digit 0xcd04…ce84. With this change none fail.

r and s now use a codec that takes a uint256 quantity and decodes it to 32-byte hex, like Authorization.fromRpc. On encode it emits a quantity. The decoded type is still 0x${string}, so the type tests are unchanged. The new test decodes that mainnet authorization, re-encodes it to the exact node JSON through Signed and SignedToRpc, and decodes it through ListSigned. It fails on main.

Left out: Authorization.TupleSigned and the Signature schemas use Hex32 the same way. The tuple one needs an RLP-specific codec, because zero is 0x there. I can follow up if you want them.

🤖 Generated with Claude Code

Nodes return authorization list `r` and `s` as `uint256` quantities, so
any value below 2**248 has fewer than 32 bytes. The schemas typed them as
`Hex32` and rejected those, failing the whole `Transaction.Eip7702`
decode with "expected 32 bytes" on about 1 in 128 authorizations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 16, 2026

Copy link
Copy Markdown

@gomesalexandre is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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