Skip to content

feat(p2p): reject and evict txs with insufficient max fee per gas#22118

Merged
PhilWindle merged 14 commits intomerge-train/spartanfrom
palla/max-fee-per-gas-validation-v2
Apr 22, 2026
Merged

feat(p2p): reject and evict txs with insufficient max fee per gas#22118
PhilWindle merged 14 commits intomerge-train/spartanfrom
palla/max-fee-per-gas-validation-v2

Conversation

@spalladino
Copy link
Copy Markdown
Contributor

@spalladino spalladino commented Mar 27, 2026

Motivation

The tx pool currently accepts transactions with maxFeesPerGas below the current block fees, marking them as skipped to wait for lower fees. This fills the pool with low-fee txs unlikely to be mined. We need to reject them outright and evict existing txs that fall below the fee threshold after a new block.

Original PR: #21281

Fixes A-878

Approach

Changes GasTxValidator to return invalid instead of skipped for txs below current fees. Extracts MaxFeePerGasValidator as a standalone validator. Adds InsufficientFeePerGasEvictionRule that evicts pending txs after each block if their fees no longer meet the minimum.

Changes

  • p2p: MaxFeePerGasValidator extracted from GasTxValidator, InsufficientFeePerGasEvictionRule added to tx pool eviction
  • p2p (tests): Tests for max fee per gas validation, eviction rule, and pool behavior
  • stdlib: BlockMinFeesProvider interface for providing min fees to the tx pool
  • aztec-node: Passes globalVariableBuilder as BlockMinFeesProvider to createP2PClient
  • p2p: Uses projected next-block fees (via BlockMinFeesProvider) in gossip validator instead of stale block header fees
  • end-to-end: Unified fee padding constants (DEFAULT_MIN_FEE_PADDING=5, LARGE_MIN_FEE_PADDING=15 for long-lived txs), switched from getCurrentMinFees to getPredictedMinFees
  • cli-wallet: Reverted MIN_FEE_PADDING to original 0.5

@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-next labels Mar 27, 2026
@spalladino spalladino force-pushed the palla/max-fee-per-gas-validation-v2 branch from 45746b9 to 809ca2f Compare March 30, 2026 12:59
@spalladino spalladino force-pushed the palla/max-fee-per-gas-validation-v2 branch from 0492bf0 to 17f5fca Compare April 8, 2026 16:16
Base automatically changed from palla/fee-prediction to merge-train/spartan April 10, 2026 20:36
spalladino and others added 10 commits April 13, 2026 12:36
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…f stale block header

The gossip validator was checking tx maxFeePerGas against the last block's
header fees, while the wallet and tx pool already use projected next-block
fees from L1. When the L1 fee oracle transitions from high to low values
(e.g. after a time warp in tests), this caused a large discrepancy where
valid transactions were rejected at the gossip layer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nResult

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@spalladino spalladino force-pushed the palla/max-fee-per-gas-validation-v2 branch from 9f191d6 to cffa74e Compare April 13, 2026 12:44
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@spalladino spalladino added the ci-full Run all master checks. label Apr 13, 2026
spalladino and others added 2 commits April 13, 2026 20:59
…eason

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merges TEST_DEFAULT_MIN_FEE_PADDING and E2E_DEFAULT_MIN_FEE_PADDING into
a single DEFAULT_MIN_FEE_PADDING (set to 5). Adds LARGE_MIN_FEE_PADDING
(15) for txs that may be mined much later (spartan benchmarks). Updates
all e2e usages to call getPredictedMinFees instead of getCurrentMinFees.
Reverts cli-wallet MIN_FEE_PADDING to its original value of 0.5.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@PhilWindle PhilWindle enabled auto-merge (squash) April 22, 2026 16:39
@PhilWindle PhilWindle merged commit 0fa563c into merge-train/spartan Apr 22, 2026
12 checks passed
@PhilWindle PhilWindle deleted the palla/max-fee-per-gas-validation-v2 branch April 22, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks. 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.

2 participants