Repository navigation
fix: reject tips above a zero maxFeePerGas - #5319
Merged
Merged
Conversation
Also covers the `TipAboveFeeCapError` check in `call` with a zero fee cap. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWippSLpSLcDYYWNVZU
🦋 Changeset detectedLatest commit: ae0c775 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis 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 viem@pr-5319
pnpm add [email protected] |
jxom
added a commit
to wevm/ox
that referenced
this pull request
Nov 1, 2026
…s, and `AbiItem` (#561) * fix: validate struct names and field types in `TypedData.assert` Ports wevm/viem#5308 and wevm/viem#5370. A struct name must contain only letters, digits, `_` and `$`, and must not be a Solidity type. A field type must be a struct in `types` or an EIP-712 atomic or dynamic type, so `uint`, `uint7` and `bytes0` throw the new `TypedData.InvalidTypeError`. Every struct is checked, including structs referenced only as array elements. `findTypeDependencies` strips only the array suffix, so struct names with `$` are encoded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq * fix: reject a tip above a zero `maxFeePerGas` in transaction envelopes Ports wevm/viem#5318 and wevm/viem#5319. `TxEnvelopeEip1559.assert` and `TxEnvelopeTempo.assert` compared fees only when both were truthy, so a zero `maxFeePerGas` skipped the check. `deserialize` for EIP-1559, EIP-4844, EIP-7702, and Tempo envelopes reads an empty `maxFeePerGas` as zero when a tip is set. `TipAboveFeeCapError` and `FeeCapTooHighError` now show zero values. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq * fix: treat indistinguishable overloads as ambiguous in `AbiItem.fromAbi` Ports wevm/viem#5339. Distinct types that both match an argument, such as `bytes32` and `bytes` or `uint256` and `int256`, and arrays of the same element type with different shapes now throw `AbiItem.AmbiguityError` instead of resolving to the last match. An integer overload matches only a value in its range, and a fixed bytes overload matches only a value of its size. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq --------- Co-authored-by: Claude <[email protected]>
jxom
added a commit
to wevm/ox
that referenced
this pull request
Nov 1, 2026
…d `AbiItem` (#560) * fix: validate struct names and field types in `TypedData.assert` Ports wevm/viem#5308 and wevm/viem#5370. A struct name must contain only letters, digits, `_` and `$`, and must not be a Solidity type. A field type must be a struct in `types` or an EIP-712 atomic or dynamic type, so `uint`, `uint7` and `bytes0` throw the new `TypedData.InvalidTypeError`. Every struct is checked, including structs referenced only as array elements. `findTypeDependencies` strips only the array suffix, so struct names with `$` are encoded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq * fix: reject a tip above a zero `maxFeePerGas` in transaction envelopes Ports wevm/viem#5318 and wevm/viem#5319. `TxEnvelopeEip1559.assert` and `TxEnvelopeTempo.assert` compared fees only when both were truthy, so a zero `maxFeePerGas` skipped the check. `deserialize` for EIP-1559, EIP-4844, EIP-7702, and Tempo envelopes reads an empty `maxFeePerGas` as zero when a tip is set. `TipAboveFeeCapError` and `FeeCapTooHighError` now show zero values. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq * fix: treat indistinguishable overloads as ambiguous in `AbiItem.fromAbi` Ports wevm/viem#5339. Distinct types that both match an argument, such as `bytes32` and `bytes` or `uint256` and `int256`, and arrays of the same element type with different shapes now throw `AbiItem.AmbiguityError` instead of resolving to the last match. An integer overload matches only a value in its range, and a fixed bytes overload matches only a value of its size. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq --------- Co-authored-by: Claude <[email protected]>
This branch was successfully 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.
Replaces #5313 and keeps @mortezashojaei's change as its own commit, with their authorship. Thank you for the fix and the detailed write-up.
Problem
EIP-1559 makes a transaction invalid when
maxPriorityFeePerGasis greater thanmaxFeePerGas. The tip-vs-cap checks tested truthiness, so amaxFeePerGasof0nskipped them and the transaction was signed anyway:Changes
From #5313:
assertTransactionEIP1559andassertRequestnow check that both fees are bigints instead of truthy. EIP-7702 and EIP-4844 transactions go throughassertTransactionEIP1559, so they are covered too.prepareTransactionRequestnow throwsMaxFeePerGasTooLowErrorbefore signing whenmaxFeePerGas: 0nis passed without a tip and Viem estimates the tip itself.TipAboveFeeCapErrorandFeeCapTooLowErrornow print a0nfee (= 0 gwei) instead of dropping it.FeeCapTooLowErroralso no longer prints a straygweiwhen no fee is given.nullfees from untyped callers or raw RPC JSON are still skipped, as before, so formatting the error message can't crash.Added in review:
FeeCapTooHighErrornow uses the sametypeof === 'bigint'check as the other fee errors.calltest formaxFeePerGas: 0nwith a non-zero tip. It shows that read-only actions now throwTipAboveFeeCapErrorbefore the request reaches the node, as the changeset says.Behavior note:
call,estimateGas,createAccessListandsimulateBlocksnow reject a zero fee cap paired with a non-zero tip before the request is sent. Geth already rejects this combination ineth_callandeth_estimateGas, so only the source of the error changes.Not included:
fillTransactiononly applies the caller's fee preferences when the node returned a non-zero fee. That changes a different action's behavior, so it belongs in its own PR.Testing
assertRequest,assertTransaction,getNodeError): 60 pass. 7 of the new ones fail againstmain's source and pass with this change.callsnapshot was generated against an unreachable RPC URL. It throws before any request is sent.prepareTransactionRequestandsignTransactiontests from fix: reject tips above a zeromaxFeePerGas#5313. On fix: reject tips above a zeromaxFeePerGas#5313, CI cancelled those shards after an unrelatedeth_getProoffork failure (distance to target block exceeds maximum proof window), so this PR's CI run is their first full run.pnpm check:typesreports no errors in the changed files. The only errors come from contract artifacts that weren't generated here, plus follow-on errors inmulticall.test.tsandreadContract.test.ts.Generated by Claude Code