Repository navigation
fix: accept an EIP-7702 authorization yParity above 1 in parseTransaction - #5367
erkancamli wants to merge 1 commit into
Conversation
…saction` `parseAuthorizationList` parsed each authorization signature with `parseEIP155Signature`, which throws `InvalidYParityError` for any `yParity` other than 0 or 1. EIP-7702 permits any `y_parity` below 2**8 in an authorization tuple, and wevm#5304 made `serializeTransaction` keep such a value, so a transaction viem serializes, for example mainnet 0xaec84209...cb09 whose authorization has a `y_parity` of 28, could not be parsed back, and `recoverTransactionAddress` threw on it. An authorization `yParity` from 2 to 255 is now kept as is, with `r` and `s` padded as before. 0 and 1 parse as before, and 256 or more still throws.
|
@erkancamli is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 5538146 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Superseded by #5371, which includes this commit unchanged. That PR also changes how recovery handles these values. Once a Thanks for the fix! Generated by Claude Code |
Follow-up to #5304. That PR made
serializeTransactionkeep an EIP-7702 authorizationyParityabove 1, butparseTransactionstill parses each authorization signature withparseEIP155Signature, which throws for anything other than 0 or 1:So the mainnet transaction from #5297 (
0xaec84209...cb09, authorizationy_parity= 28) can be serialized but not parsed back:recoverTransactionAddress({ serializedTransaction })throws the same way, and so do the OP Stack and Celo parsers, which hand type0x04to the same function. As #5297 notes, EIP-7702 allows anyy_paritybelow 2**8 in an authorization tuple, and a tuple that fails recovery is skipped without invalidating the transaction. ox'sAuthorization.fromTuplealready accepts 0 to 255.With this change, an authorization
yParityfrom 2 to 255 is kept as is, withrandspadded to 32 bytes as before. 0 and 1 parse exactly as before, the outer transaction signature check is unchanged, and a value of 256 or more still throwsInvalidYParityError.Tests: in
parseTransaction.test.ts, "behavior: authorization yParity above 1" parses the #5297 transaction and checks that it serializes back to the same bytes. It fails onmainwith the error above and passes with this change. The existing "invalid authorization list yParity" case now uses 256, since 2 is a valid value. The file passes 70/70. A changeset is included.