Txpool Policy
This document summarizes the mempool policy, eviction rules, and the knobs that control pool behavior. Defaults are in code; there is no runtime config surface yet, so changing these requires code edits.
Eviction Policy (Normal Txpool)
Section titled “Eviction Policy (Normal Txpool)”- Ordering: lowest
(max_fee, priority_tip)evicted first, with(inserted_at_ms, tx_hash)as tie-breakers. - Trigger: when
txpool.len() > max_txs. - Location:
src/txpool.rs(fee-orderedby_feeindex).
Eviction Policy (Sealed / Private Mempool)
Section titled “Eviction Policy (Sealed / Private Mempool)”- Ordering: FIFO by arrival time.
- Trigger: when
sealed_len() > max_sealed_txs. - Location:
src/txpool.rs(sealedBTreeMapby arrival).
Admission Limits (RPC Ingress)
Section titled “Admission Limits (RPC Ingress)”These are enforced before the tx enters the pool:
| Limit | Description |
|---|---|
TX_MAX_SIZE_BYTES | Max serialized tx size |
TX_MAX_CALLDATA_BYTES | Max calldata size |
TX_MAX_DEPLOY_BUNDLE_BYTES | Max deploy payload |
TX_MIN_FEE_FLOOR | Minimum fee threshold |
TX_MAX_PENDING_PER_SENDER | Per-sender queue cap |
Location: src/bin/node.rs.
Txpool Configuration Knobs
Section titled “Txpool Configuration Knobs”These live in txpool::Config (src/txpool.rs) and are wired into the application config via AppConfig (src/application/config.rs).
| Knob | Description |
|---|---|
max_txs | Pool size cap |
max_txs_per_block | Max txs selected per block |
max_age_ms | TTL for stale tx pruning |
max_txs_per_sender | Per-sender limit |
max_txs_per_lane | Per-lane limit |
max_lanes_per_sender | Lanes per sender |
max_tx_bytes | Estimated size limit |
max_sealed_txs | Sealed pool size cap |
max_sealed_per_block | Max sealed txs per block |
Fee Thresholds
Section titled “Fee Thresholds”- Minimum fee:
TX_MIN_FEE_FLOOR(currently1). - Eviction comparator:
(max_fee, priority_tip)fromFeeIntent::V1.
Tuning Guidance
Section titled “Tuning Guidance”Until a runtime config file is added, changes require editing the constants in src/bin/node.rs and/or defaults in src/txpool.rs.
Recommended Adjustments
Section titled “Recommended Adjustments”| Scenario | Adjustment |
|---|---|
| High throughput | Increase max_txs, max_txs_per_block |
| Resource constrained | Decrease max_txs, max_tx_bytes |
| Spam protection | Increase TX_MIN_FEE_FLOOR, decrease max_txs_per_sender |
| Sealed tx heavy | Increase max_sealed_txs, max_sealed_per_block |