Allow serializing EIP-1559 txs where priority fee exceeds max fee (Arbitrum) - #5175
Open
SnowingFox wants to merge 1 commit into
Open
Allow serializing EIP-1559 txs where priority fee exceeds max fee (Arbitrum)#5175SnowingFox wants to merge 1 commit into
SnowingFox wants to merge 1 commit into
Conversation
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.
Problem
Transaction.inferTypes()throwsBAD_DATA: priorityFee cannot be more than maxFeefor valid EIP-1559 transactions on Arbitrum, where the base fee is zero and the priority fee may legitimately exceedmaxFeePerGas(see the example Arbitrum One tx referenced in the issue).As a result
transaction.unsignedSerialized/transaction.serialized/transaction.fromall throw for transactions that are perfectly valid on Arbitrum, so such transactions cannot be serialized or signed.Root cause
inferTypes()insrc.ts/transaction/transaction.tsenforces the EIP-1559 ordering invariantmaxFeePerGas >= maxPriorityFeePerGasas a hardBAD_DATAassertion:This invariant does not hold on chains with a zero base fee (Arbitrum One, Arbitrum Nova and similar L2s), and it is not a serialization invariant:
_serializeEip1559/_serializeEip4844write both fee fields verbatim and round-trip correctly regardless of the ordering.Fix
Relax the ordering check in
inferTypes(): do not reject a transaction solely becausemaxPriorityFeePerGas > maxFeePerGas. Fee ordering is a chain-level policy, not a serialization invariant, and should be enforced (if at all) by the chain at submission time. This also restores the v5 behavior, where no such assertion existed.Test
Added regression tests in
src.ts/_tests/test-transaction.tsthat build a type-2 transaction withmaxPriorityFeePerGas > maxFeePerGasand assert that it serializes, round-trips, and infers type 2 without throwing.Fixes #4771