Skip to content

fix(txpool): cap priority fee with max fees when computing priority#21279

Merged
spalladino merged 3 commits intomerge-train/spartanfrom
palla/cap-tx-pool-priority
Mar 11, 2026
Merged

fix(txpool): cap priority fee with max fees when computing priority#21279
spalladino merged 3 commits intomerge-train/spartanfrom
palla/cap-tx-pool-priority

Conversation

@spalladino
Copy link
Contributor

Otherwise a tx could be sent with a max priority fee greater than its max fee, which cannot be realized (see computeEffectiveGasFees), and get a better priority in the mempool than it should.

@spalladino spalladino added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure backport-to-v4 labels Mar 10, 2026
@spalladino spalladino force-pushed the palla/cap-tx-pool-priority branch 2 times, most recently from a35b38a to 3f5b6c1 Compare March 10, 2026 01:42
Copy link
Collaborator

@PhilWindle PhilWindle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great catch.

Could you add a test demonstrating this in tx_pool_v2.test.ts.

This PR reminds me I need to remove the old tx_pool.

spalladino and others added 2 commits March 10, 2026 20:53
Otherwise a tx could be sent with a max priority fee greater than its
max fee, which cannot be realized (see `computeEffectiveGasFees`), and
get a better priority in the mempool than it should.

Alternatively, we could just reject txs that have a max priority fee
greater than their max fee, but this would mean we reject txs that are
valid from the circuits perspective.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@spalladino spalladino force-pushed the palla/cap-tx-pool-priority branch from 3f5b6c1 to dc0e7fe Compare March 10, 2026 20:55
@spalladino spalladino enabled auto-merge (squash) March 11, 2026 01:06
@spalladino spalladino merged commit c4d0807 into merge-train/spartan Mar 11, 2026
10 checks passed
@spalladino spalladino deleted the palla/cap-tx-pool-priority branch March 11, 2026 12:31
AztecBot pushed a commit that referenced this pull request Mar 11, 2026
…21279)

Otherwise a tx could be sent with a max priority fee greater than its max fee, which cannot be realized (see `computeEffectiveGasFees`), and get a better priority in the mempool than it should.
@AztecBot
Copy link
Collaborator

✅ Successfully backported to backport-to-v4-staging #21355.

AztecBot added a commit that referenced this pull request Mar 11, 2026
The test used GasFees(1n, 0n) to give the deploy tx higher priority,
but DA gas fees are zero in the test environment. Since priority fees
are now capped by maxFeesPerGas (PR #21279), min(0, 1) = 0, making
both txs have equal priority and the deploy tx no longer guaranteed
to be ordered first. Switch to GasFees(0n, 1n) so the L2 priority
fee is effective (L2 gas fees are non-zero).
PhilWindle pushed a commit that referenced this pull request Mar 11, 2026
## Summary

Fixes flaky `deploy_method.test.ts` failure on `merge-train/spartan`
caused by interaction with PR #21279 (priority fee capping).

The test used `GasFees(1n, 0n)` to give the deploy tx higher priority,
but DA gas fees are zero in the test environment. Since priority fees
are now capped by `maxFeesPerGas`, `min(0, 1) = 0` made both txs have
equal priority — the deploy tx was no longer guaranteed to be ordered
first.

Switched to `GasFees(0n, 1n)` so the L2 priority fee is effective (L2
gas fees are non-zero).

Full analysis:
https://gist.github.com/AztecBot/6ac6f06f68d7507d726c596a67ae350b

## Test plan

- All 11 tests in `deploy_method.test.ts` pass locally (ran twice)

ClaudeBox log: https://claudebox.work/s/e9857814f97604f8?run=3
ludamad added a commit that referenced this pull request Mar 11, 2026
BEGIN_COMMIT_OVERRIDE
chore: chonk proof compression poc (#20645)
feat: Update L1 to L2 message APIs (#20913)
fix: adapt chonk proof compression for v4 Translator layout (#21067)
fix: omit bigint priceBumpPercentage from IPC config in testbench worker
(#21086)
feat: standby mode for prover broker (#21098)
fix(p2p): remove default block handler in favor of block handler
(#21105)
chore: prepare barretenberg-rs for crates.io publishing (#20496)
feat: reenable function selectors + additional validation in public
setup allowlist (backport #20909, #21122) (#21129)
chore: remove stale aes comments (#21133)
chore: remove auto-tag job (#21127)
feat: calldata length validation of public setup function allowlist
(#21139)
feat: run AVM NAPI simulations on dedicated threads instead of libuv
pool (#21138)
feat: Remove non-protocol contracts from public setup allowlist (#21154)
feat!: Expose offchain effects when simulating/sending txs (backport
#20563) (#21110)
chore: bump minor version (#21171)
chore: backport #21161 (tally slashing pruning improvements) to v4
(#21166)
chore: More updated Alpha configuration (backport #21155) (#21165)
fix(p2p): report most severe failure in runValidations (#21185)
feat: add ergonomic conversions for Noir's `Option<T>` (#21107)
docs: clarifying Noir fields vs struct fields in event metadata (#21172)
fix: bump lighthouse consensus client v7.1.0 -> v8.0.1 (#21170)
fix: update dependencies (#20997)
chore: New alpha-net environment (#20800) (#21202)
chore: code decuplication + refactor (public setup allowlist) (#21200)
feat: mask all ciphertext fields with Poseidon2-derived values (backport
#21009) (#21140)
chore: disable sponsored FPC in testnet (#21235)
feat!: exposing pub event pagination on wallet (#21197)
refactor(pxe): narrow tryGetPublicKeysAndPartialAddress return type
(backport #21208) (#21236)
feat: orchestrator enqueues via serial queue (#21247)
feat: rollup mana limit gas validation (#21219)
chore: deploy SPONSORED_FPC in test networks (#21254)
fix(sequencer): fix log when not enough txs (#21297)
fix: Simulate gas in n tps test. Set min txs per block to 1 (backport
#21312) (#21329)
fix(log): do not log validation error if unregistered handler (#21111)
fix(node): fix index misalignment in findLeavesIndexes (#21327)
fix: limit parallel blocks in prover to max AVM parallel simulations
(#21320)
fix: use native sha256 to speed up proving job id generation (#21292)
fix(validator): wait for l1 sync before processing block proposals
(#21336)
fix(txpool): cap priority fee with max fees when computing priority
(#21279)
chore: reduce severity of errors due to HA node not acquiring signature
(#21311)
fix: (A-643) add buffer to maxFeePerBlobGas for gas estimation and fix
bump loop truncation (#21323)
END_COMMIT_OVERRIDE
github-merge-queue bot pushed a commit that referenced this pull request Mar 11, 2026
BEGIN_COMMIT_OVERRIDE
fix: (A-623) increase committee timeout in scenario smoke test (#21193)
feat: orchestrator enqueues via serial queue (#21247)
feat: rollup mana limit gas validation (#21219)
fix: make e2e HA test more deterministic (#21199)
chore: fix chonk_browser lint warning (#21265)
chore: deploy SPONSORED_FPC in test networks (#21254)
fix: (A-635) e2e bot flake on nonce mismatch (#21288)
chore: deflake duplicate attestations and proposals slash tests (#21294)
fix(sequencer): fix log when not enough txs (#21297)
chore: send env var to pods (#21307)
fix: Simulate gas in n tps test. Set min txs per block to 1 (#21312)
fix: update dependabot dependencies (#21238)
test: run nightly bench of block capacity (#20726)
fix: update block_capacity test to use new send() result types (#21345)
fix(node): fix index misalignment in findLeavesIndexes (#21327)
fix(log): do not log validation error if unregistered handler (#21111)
fix: limit parallel blocks in prover to max AVM parallel simulations
(#21320)
fix: use native sha256 to speed up proving job id generation (#21292)
chore: remove v4-devnet-1 (#21044)
fix(validator): wait for l1 sync before processing block proposals
(#21336)
fix(txpool): cap priority fee with max fees when computing priority
(#21279)
chore: Properly compute finalized block (#21156)
fix: remove extra argument in KVArchiverDataStore constructor call
(#21361)
chore: revert l2 slot time 72 -> 36 on scenario network (#21291)
fix(archiver): do not error if proposed block matches checkpointed
(#21367)
fix(claude): rule to not append echo exit (#21368)
chore: reduce severity of errors due to HA node not acquiring signature
(#21311)
fix: make reqresp batch retry test deterministic (#21322)
fix: (A-643) add buffer to maxFeePerBlobGas for gas estimation and fix
bump loop truncation (#21323)
fix(e2e): use L2 priority fee in deploy_method same-block test (#21373)
fix: reqresp flake & add logging (#21334)
END_COMMIT_OVERRIDE
mverzilli pushed a commit that referenced this pull request Mar 13, 2026
## Summary

Fixes flaky `deploy_method.test.ts` failure on `merge-train/spartan`
caused by interaction with PR #21279 (priority fee capping).

The test used `GasFees(1n, 0n)` to give the deploy tx higher priority,
but DA gas fees are zero in the test environment. Since priority fees
are now capped by `maxFeesPerGas`, `min(0, 1) = 0` made both txs have
equal priority — the deploy tx was no longer guaranteed to be ordered
first.

Switched to `GasFees(0n, 1n)` so the L2 priority fee is effective (L2
gas fees are non-zero).

Full analysis:
https://gist.github.com/AztecBot/6ac6f06f68d7507d726c596a67ae350b

## Test plan

- All 11 tests in `deploy_method.test.ts` pass locally (ran twice)

ClaudeBox log: https://claudebox.work/s/e9857814f97604f8?run=3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v4 ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants