Repository navigation
fix: port recent viem fixes to SignatureErc6492 and AbiParameters.encodePacked - #683
Merged
Merged
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merged
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
SignatureErc6492.universalSignatureValidatorBytecodereturnsfalsewhenecrecoveryields the zero address.UniversalSigValidator.solgets the same one-line change, and the bytecode is rebuilt from it.encodePackedhalf)AbiParameters.encodePackedthrowsHex.InvalidLengthErrorfor an odd-lengthbytesvalue.Review notes
forge build --use 0.8.26 --optimize --optimizer-runs 200 --evm-version paris --no-metadataoncontracts/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'serc6492SignatureValidatorByteCode.bytes(0x123becomes0x0123). This PR rejects them instead, which matches whatAbiParameters.encodeandTypedData.asserthave done since fix: reject odd-length hex forbytesandbytesNin ABI encoding #617.Not ported
fromRlpviem#5513 (fix: reject non-canonical RLP length encodings #596), and fix: reject compressed public keys in publicKeyToAddress viem#5515 (fix: reject compressed public keys in Address.fromPublicKey #624). perf: share checksum cache across address casings and document checksum behavior viem#5514 (checksum cache shared across casings) is already howAddress.checksumworks onmain. fix(siwe): reject a short nonce and a version other than 1 in validateSiweMessage viem#5440 and fix: preserve odd-length hex bytes in sized hexToBytes viem#5444 went out in fix: port recent viem fixes toBytes,Hex,Siwe,TypedData,AbiItem,AbiEventandRpcTransport#600.verifyHashhooks; tokens; and viem error classes (Two error classes never passnametosuper, and oneErrorTypealias points at the wrong class viem#5494).0.xcounterpart: #684Validation
The new tests run
eth_callagainst the deployless validator on Anvil, and encode packed odd-lengthbytes. With the source changes reverted, the zero-address test gets0x01and theencodePackedtest fails.pnpm check:typesandvp checkpass. Fullcorerun: 4,003 passed; the 3 failures are Anvilbehavior: networktransaction tests inTransactionEnvelopeEip1559andTransactionEnvelopeEip7702, which also fail on unchangedmainhere.