Repository navigation
fix: port recent viem fixes to Bytes, Hex, Siwe, TypedData, AbiItem, AbiEvent and RpcTransport - #600
Merged
Merged
Conversation
…ytes Ports wevm/viem#5444. An odd-length value now gets its leading 0 before it is right-padded to size, so 0x1 with size 2 decodes to [1, 0] instead of [16, 0]. Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544 Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: jxom <jake@tempo.xyz>
…Message Ports wevm/viem#5440. EIP-4361 requires an alphanumeric nonce of at least 8 characters and version 1. Absent fields are still skipped. Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544 Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: jxom <jake@tempo.xyz>
Ports wevm/viem#5403. Payloads such as HyperliquidTransaction:SendAsset failed TypedData.assert. The encoded type and hash are unchanged. Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544 Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: jxom <jake@tempo.xyz>
Ports wevm/viem#5384. Dynamic bytes now matches only hex strings and Uint8Array values, so a plain string selects the string overload instead of throwing AbiItem.AmbiguityError. Hex strings still throw when both overloads match. Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544 Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: jxom <jake@tempo.xyz>
Ports wevm/viem#5428. Integer arguments compare by value, so a number matches a decoded bigint and a bigint matches a small integer decoded as a number. A non-integer number still mismatches. Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544 Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: jxom <jake@tempo.xyz>
Ports wevm/viem#5404. Default and caller headers are merged through Headers into a plain object, so a caller's Content-Type replaces the default whatever its casing, and Headers instances and tuple arrays keep their entries. Amp-Thread-ID: https://ampcode.com/threads/T-01a1bcb4-18f0-70ab-84d3-47f6d9755544 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. |
Contributor
|
Published pnpm add ox@pr-600
pnpm add ox@0.0.0-pr-600-d24a038 |
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 over the past week (wevm/viem#5318 to wevm/viem#5444) that ox did not have yet. One commit per fix.
Bytes.fromHexandHex.toByteswithsizeput an odd-length value's extra nibble at the end:0x1with size 2 became[16, 0],0xabcbecame[171, 192]. The leading0is now added before padding, so they return[1, 0]and[10, 188]. Unsized odd-length input still throwsHex.InvalidLengthError.Siwe.validateMessagereturnsfalsefor a nonce shorter than 8 alphanumeric characters or a version other than1. Absent fields are still skipped.TypedDataaccepts struct names that contain:, such asHyperliquidTransaction:SendAsset. The struct-name check added in #560 rejected them.AbiItem.fromAbimatched any string to dynamicbytes, sostring/bytesoverloads threwAbiItem.AmbiguityErrorfor'hello'.bytesnow matches only hex strings andUint8Array. Hex strings still throw when both overloads match.AbiEvent.assertArgsandAbiEvent.extractLogscompared integer arguments with===, so anumbernever matched a decodedbigintand abigintnever matched a small integer decoded asnumber. Integers now compare by value. A non-integer number such as5.5still mismatches instead of throwing aRangeError.RpcTransport.fromHttpalready acceptedHeadersand tuple arrays onmain, but it lowercased the caller's headers next to the defaultContent-Type, so a caller'sContent-Typewas sent asapplication/json, <value>. Headers are now merged throughHeaders, so the caller's value replaces the default.Review note: the
Bytes.fromHex/Hex.toByteschange replaces a comment that said the right-padding kept the old odd-nibble behavior on purpose. The new output matches viem and the unsized conversion followed by zero bytes.Not ported, because ox already has the fix or has no counterpart:
vin recoverPublicKey viem#5430 (Signature.vToYParityalready accepts EIP-155v; ox modelsvas a number), fix(account-abstraction): format user operation receipt nonce as bigint viem#5345 (UserOperationReceipt.fromRpcalready convertsnonce), fix: decode anonymous event logs when requested viem#5375 and perf: skip retries for method refusals and trim per-request overhead viem#5392 (ported in fix: decode anonymous event logs in AbiEvent.decodeLog and extractLogs #564 and perf: cache signature hashes by normalized signature #570), and fix: raise TipAboveFeeCapError when parsing a zero maxFeePerGas viem#5318, fix: reject tips above a zeromaxFeePerGasviem#5319, fix: treat indistinguishable ABI overloads as ambiguous viem#5339, fix(typedData): reject invalid field types in validateTypedData viem#5370, fix: parse an EIP-7702 authorizationyParityabove 1 and reject it in recovery viem#5371 (ported in fix: port recent viem fixes toTypedData, transaction envelopes, andAbiItem#560).noncediscriminators viem#5360, fix(tempo): mark aggregateAbisexports as pure viem#5401, feat(chains): add Multicall3 to Tempo chains viem#5405, feat(tempo): sync configurable accounts with Tempo T14 viem#5408, fix(tempo): omit access key frometh_callrequests viem#5409, fix(tempo): skipgetKeyread before access key sends viem#5411, fix(tempo): send each attempt of withRelay's inner transports once viem#5427), and viem actions, watchers, clients and chains.0.xcounterpart: #601.Validation:
pnpm check:typesandvp checkon the changed files pass. Every new test fails without its fix. Thecoreandtempo-unitprojects pass withSKIP_GLOBAL_SETUP=1, except tests that need a local Anvil node, which fail the same way on unmodifiedmain.