Skip to content

chore: backport #20806 (price bump for RPC transaction replacement) to v4#21036

Merged
mrzeszutko merged 2 commits intobackport-to-v4-stagingfrom
claudebox/ff393a9b4d8e95fb-1
Mar 3, 2026
Merged

chore: backport #20806 (price bump for RPC transaction replacement) to v4#21036
mrzeszutko merged 2 commits intobackport-to-v4-stagingfrom
claudebox/ff393a9b4d8e95fb-1

Conversation

@AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Mar 3, 2026

Backport of #20806 to v4.

Adds a configurable percentage-based price bump requirement for RPC-submitted transactions that clash on nullifiers with existing pool transactions, or that need to evict the lowest-priority tx when the pool is full. This prevents spam via infinitesimally small fee increments.

Conflict resolution

Three files had conflicts due to dropTransactionsProbability (present on next, absent on v4):

  • docs/docs-operate/operators/reference/changelog/v4.md — added the price bump changelog section without the unrelated "Setup allow list" section
  • yarn-project/p2p/src/client/factory.ts — added priceBumpPercentage config pass-through (without dropTransactionsProbability)
  • yarn-project/p2p/src/mem_pools/tx_pool_v2/interfaces.ts — added priceBumpPercentage to type and defaults (without dropTransactionsProbability)

ClaudeBox log: http://ci.aztec-labs.com/ff393a9b4d8e95fb-1

Adds a configurable percentage-based "price bump" requirement for
RPC-submitted transactions that clash on nullifiers with existing pool
transactions, or that need to evict the lowest-priority tx when the pool
is full. This prevents spam via infinitesimally small fee increments.

- When a tx arrives via RPC with nullifier conflicts, it must now pay at
least X% above each conflicting tx's priority fee (default: 10%) — i.e.
`>= existingFee + existingFee * bump / 100`
- The same bump applies to pool-full eviction via
`LowPriorityPreAddRule`
- P2P gossip path is unchanged — continues using `comparePriority` (fee
+ hash tiebreaker) with no bump
- Rejection errors now include the minimum required fee so callers know
how much to bid
- New env var `P2P_RPC_PRICE_BUMP_PERCENTAGE` (default: 10) controls the
bump percentage

- `getMinimumPriceBumpFee(existingFee, priceBumpPercentage)` helper
computes the threshold using integer arithmetic: `existingFee +
max(existingFee * bump / 100, 1)` — the minimum bump is always at least
1 unit, so replacement always requires paying strictly more (even with
0% bump or zero existing fee)
- `priceBumpPercentage` is typed as `bigint` throughout the config chain
to avoid `BigInt()` conversion issues with non-integer values
- `checkNullifierConflict` accepts an optional `priceBumpPercentage`
param; when set, uses fee-only `>=` comparison against the bumped
threshold instead of `comparePriority`
- `NullifierConflictRule` now passes `context.priceBumpPercentage`
through to the conflict check (previously ignored context entirely)
- `LowPriorityPreAddRule` uses the bumped fee threshold when both
`feeComparisonOnly` and `priceBumpPercentage` are set
- Config flows: `P2P_RPC_PRICE_BUMP_PERCENTAGE` env var -> `P2PConfig`
-> `TxPoolV2Config` -> `PreAddContext` (only for RPC path)
- `NULLIFIER_CONFLICT` rejection error enriched with
`minimumPriceBumpFee` and `txPriorityFee` fields

- 15 new unit tests across `tx_metadata.test.ts`,
`nullifier_conflict_rule.test.ts`, and
`low_priority_pre_add_rule.test.ts`
- Tests cover: exact threshold acceptance, below-threshold rejection,
well-above threshold, 0% bump edge case, P2P path unchanged, error field
population
- All existing tests continue to pass

Fixes A-452
@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label Mar 3, 2026
@mrzeszutko mrzeszutko changed the base branch from v4 to backport-to-v4-staging March 3, 2026 11:29
@mrzeszutko mrzeszutko marked this pull request as ready for review March 3, 2026 11:33
@AztecBot
Copy link
Collaborator Author

AztecBot commented Mar 3, 2026

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/d25306aaf3f03fc8�d25306aaf3f03fc88;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_invalidate_block.parallel.test.ts "proposer invalidates previous block with shuffled attestations" (188s) (code: 0) group:e2e-p2p-epoch-flakes

@mrzeszutko mrzeszutko merged commit 0dd0a07 into backport-to-v4-staging Mar 3, 2026
9 checks passed
@mrzeszutko mrzeszutko deleted the claudebox/ff393a9b4d8e95fb-1 branch March 3, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants