Skip to content

fix: port recent viem fixes to SignatureErc6492 and AbiParameters.encodePacked - #683

Merged
jxom merged 2 commits into
mainfrom
jxom/port-viem-fixes-2026-11-15
Nov 15, 2026
Merged

jxom merged 2 commits into
mainfrom
jxom/port-viem-fixes-2026-11-15

Conversation

@jxom

@jxom jxom commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Ports the viem fixes merged since the last port (wevm/viem#5437 to wevm/viem#5516) that touch code ox owns. One commit per fix.

viem ox change
wevm/viem#5468 SignatureErc6492.universalSignatureValidatorBytecode returns false when ecrecover yields the zero address. UniversalSigValidator.sol gets the same one-line change, and the bytecode is rebuilt from it.
wevm/viem#5466 (encodePacked half) AbiParameters.encodePacked throws Hex.InvalidLengthError for an odd-length bytes value.
// ecrecover maps r = 0, s = 0 to the zero address.
const signature = Hex.concat(Hex.fromNumber(0, { size: 64 }), '0x1b')
// deployless eth_call with signer 0x0000…0000
// before: "0x01" (valid), after: "0x00"

AbiParameters.encodePacked(['bytes', 'uint8'], ['0x123', 1])
// before: "0x12301" (every later value shifted by a nibble)
// after: throws Hex.InvalidLengthError

Review notes

  • The bytecode comes from forge build --use 0.8.26 --optimize --optimizer-runs 200 --evm-version paris --no-metadata on contracts/src/deployless/DeploylessUniversalSigValidator.sol. With the same settings, the previous source rebuilds the previous constant byte for byte. The new bytecode is identical to viem's erc6492SignatureValidatorByteCode.
  • viem left-pads odd-length bytes (0x123 becomes 0x0123). This PR rejects them instead, which matches what AbiParameters.encode and TypedData.assert have done since fix: reject odd-length hex for bytes and bytesN in ABI encoding #617.

Not ported

0.x counterpart: #684

Validation

The new tests run eth_call against the deployless validator on Anvil, and encode packed odd-length bytes. With the source changes reverted, the zero-address test gets 0x01 and the encodePacked test fails. pnpm check:types and vp check pass. Full core run: 4,003 passed; the 3 failures are Anvil behavior: network transaction tests in TransactionEnvelopeEip1559 and TransactionEnvelopeEip7702, which also fail on unchanged main here.

ampagent and others added 2 commits November 15, 2026 06:26
…he zero address

Ports wevm/viem#5468. ecrecover returns the zero address for a malformed signature, so the deployless validator accepted any such signature for the zero address. The bytecode is rebuilt from the updated UniversalSigValidator.sol with solc 0.8.26, 200 optimizer runs, the paris EVM version, and no metadata, which reproduces the previous constant from the previous source.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1ddd3-d469-72eb-a88c-673c40859557
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: jxom <jake@tempo.xyz>
Ports the encodePacked half of wevm/viem#5466. An odd-length bytes value was concatenated as is, shifting every later value by a nibble. It now throws Hex.InvalidLengthError, matching AbiParameters.encode since #617; viem left-pads instead.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1ddd3-d469-72eb-a88c-673c40859557
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: jxom <jake@tempo.xyz>
@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ox Error Error Nov 15, 2026 6:34am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T06:33:06.636710Z 032a208 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jxom
jxom merged commit 7421689 into main Nov 15, 2026
14 of 15 checks passed
@jxom
jxom deleted the jxom/port-viem-fixes-2026-11-15 branch November 15, 2026 06:34
@github-actions github-actions Bot mentioned this pull request Nov 15, 2026

This branch had an error being deployed

1 failed deployment
Preview — 032a2082 Deployed Nov 15, 2026 by vercel[bot]
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.

2 participants