Repository navigation
fix: raise TipAboveFeeCapError when parsing a zero maxFeePerGas - #5316
Closed
mortezashojaei wants to merge 10 commits into
Closed
mortezashojaei wants to merge 10 commits into
mortezashojaei wants to merge 10 commits into
Conversation
…n fee cap guards
|
@mortezashojaei 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: aa115c2 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 |
commit: |
Member
|
Thanks @mortezashojaei! Superseded by #5318, which keeps your commit and adds a follow-up: the Generated by Claude Code |
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.
Stacked on #5313; until it merges, review only the last commit (aa115c2). On
main,assertTransactionEIP1559still skips a0nfee cap, so this fix needs #5313.Summary
RLP encodes
0as0x, and the EIP-1559, EIP-7702 and EIP-4844 parsers drop0xfields. A zero fee cap came back asundefined, soassertTransactionEIP1559skipped the tip check and a transaction with a tip above a zero fee cap parsed without error.The parsed output changes only when the tip is non-empty and the fee cap is zero. With canonical encoding, those transactions are invalid anyway. If both fees are
0x, the output is unchanged.Evidence
parseTransaction(0x02 + rlp([1, 0, tip = 1, maxFeePerGas = 0x, ...]))returned{ maxPriorityFeePerGas: 1n }with no fee cap (same for0x03and0x04). The new error tests failed with "function didn't throw".After: all three throw
TipAboveFeeCapError: The provided tip (maxPriorityFeePerGas = 0.000000001 gwei) cannot be higher than the fee cap (maxFeePerGas = 0 gwei).zero feestest (both fees0x) keeps the output it had before the fix: no fee fields.CI=true pnpm test --run src/utils/transaction src/zksync/serializers.test.ts src/accounts/utils/signTransaction.test.ts: 220 passed, including the existing round trips.Merge Danger
Door: two-way
Blast Radius: small
parseTransactionnow rejects serialized type-2, type-3 and type-4 transactions whose tip is above a zero fee cap. Nodes already reject these.