Sigil documentation
ReferenceRust referencesigil-node

sigil-node · mempool

Source declarations, signatures and documentation for mempool.

Source: sigil/node/sigil-node/src/mempool.rs. SHA-256: c555aae6b9ab47f89fb78cd0c50fd8afeb0fb78b8eadfaedbf5844f148e0446f.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

mempool::MAX_MEMPOOL_SIZE

Maximum number of transactions the mempool will hold.

pub const MAX_MEMPOOL_SIZE: usize;

Source line: 13.

mempool::DEFAULT_MAX_TX_BYTES

Default maximum serialized transaction size: 256 KiB.

pub const DEFAULT_MAX_TX_BYTES: usize;

Source line: 15.

mempool::DEFAULT_MAX_MEMPOOL_BYTES

Default total serialized mempool memory cap: 256 MiB.

pub const DEFAULT_MAX_MEMPOOL_BYTES: usize;

Source line: 17.

mempool::DEFAULT_MIN_GAS_PRICE

Default minimum gas price accepted into the mempool.

pub const DEFAULT_MIN_GAS_PRICE: u64;

Source line: 19.

mempool::DEFAULT_PER_SENDER_TX_PER_WINDOW

Default per-sender admission rate in a one-second window.

pub const DEFAULT_PER_SENDER_TX_PER_WINDOW: u32;

Source line: 21.

mempool::DEFAULT_PER_SENDER_IN_FLIGHT

Default per-sender in-flight transaction cap.

pub const DEFAULT_PER_SENDER_IN_FLIGHT: usize;

Source line: 23.

mempool::DEFAULT_RATE_WINDOW

Default per-sender rate window.

pub const DEFAULT_RATE_WINDOW: Duration;

Source line: 25.

mempool::DEFAULT_LOCAL_FEE_MARKET_HOT_ACCOUNT_THRESHOLD

Default local fee-market contention threshold per write-locked key.

pub const DEFAULT_LOCAL_FEE_MARKET_HOT_ACCOUNT_THRESHOLD: usize;

Source line: 27.

mempool::DEFAULT_LOCAL_FEE_MARKET_STEP

Default local fee-market gas-price increment per threshold step.

pub const DEFAULT_LOCAL_FEE_MARKET_STEP: u64;

Source line: 29.

mempool::MempoolConfig

#[derive(Debug, Clone)]
pub struct MempoolConfig {
/// Chain ID the mempool accepts. `None` is only for legacy tests/tools.

pub expected_chain_id: Option<String>,
/// Maximum transaction count.

pub max_transactions: usize,
/// Maximum serialized transaction size.

pub max_tx_bytes: usize,
/// Minimum accepted gas price.

pub min_gas_price: u64,
/// Optional maximum gas limit for a single transaction.

pub max_tx_gas: Option<u64>,
/// Per-sender accepted transaction count per `sender_rate_window`.

pub per_sender_tx_per_window: u32,
/// Per-sender in-flight transaction cap.

pub per_sender_in_flight: usize,
/// Total serialized transaction memory cap.

pub max_memory_bytes: usize,
/// Per-sender admission rate window.

pub sender_rate_window: Duration,
/// Enable per-write-key local fee floors.

pub local_fee_markets_enabled: bool,
/// Number of in-flight txs touching the same local fee key before the

/// account-local floor increases by one step.

pub local_fee_market_hot_account_threshold: usize,
/// Gas-price increment per local fee-market threshold step.

pub local_fee_market_step: u64,
/// Stake-weighted sender quota policy for validator/RPC ingress.

pub stake_weighted_ingress: StakeWeightedIngressConfig
}

Source line: 41.

mempool::MempoolConfig::for_chain_with_block_time

Create a chain-bound mempool config whose sender admission window tracks the configured block cadence. This keeps the default sender allowance at 64 tx/sec while making accounting align with proposer drain cadence on 1.0s/1.5s launch networks.

pub fn for_chain_with_block_time(
        chain_id: impl Into<String>,
        target_block_time_ms: u64,
    ) -> Self;

Source line: 96.

mempool::Mempool

In-memory transaction pool with fee-ordered draining.

pub struct Mempool {

}

Source line: 154.

mempool::Mempool::new

Create a new empty mempool.

pub fn new() -> Self;

Source line: 182.

mempool::Mempool::for_chain

Create a new mempool bound to a specific chain ID.

pub fn for_chain(chain_id: impl Into<String>) -> Self;

Source line: 187.

mempool::Mempool::for_chain_with_block_time

Create a chain-bound mempool whose sender admission window matches the configured block time.

pub fn for_chain_with_block_time(
        chain_id: impl Into<String>,
        target_block_time_ms: u64,
    ) -> Self;

Source line: 197.

mempool::Mempool::with_config

Create a new mempool with explicit admission limits.

pub fn with_config(config: MempoolConfig) -> Self;

Source line: 208.

mempool::Mempool::insert

Insert a transaction into the mempool.

Returns an error if the mempool is full or the transaction is a duplicate. Note: tx_hash() returns Result<SigilHash, CoreError> after Task 3 changes.

pub fn insert(&mut self, tx: SignedTransaction) -> Result<(), NodeError>;

Source line: 229.

mempool::Mempool::insert_with_sender_stake

Insert a transaction with the sender's effective validator stake.

Validator RPC ingress calls this so staked senders receive deterministic quota priority under flood. Plain insert remains available for tests and transports that have not supplied stake metadata yet.

pub fn insert_with_sender_stake(
        &mut self,
        tx: SignedTransaction,
        sender_effective_stake: u64,
    ) -> Result<(), NodeError>;

Source line: 238.

mempool::Mempool::requeue_transactions

Requeue transactions that were already admitted and drained for a local proposal that did not finalize.

Requeue still enforces chain ID, size, gas-price, signature, nonce, and memory limits, but it does not count against the fresh-submission rate window because these transactions already paid that admission cost. Duplicate hashes are skipped because another path may already have restored the same transaction.

pub fn requeue_transactions<I>(&mut self, txs: I) -> Result<usize, NodeError>
    where
        I: IntoIterator<Item = SignedTransaction>,;

Source line: 255.

mempool::Mempool::remove

Remove a transaction by hash.

pub fn remove(&mut self, hash: &SigilHash);

Source line: 405.

mempool::Mempool::drain_for_block

Drain transactions for block production.

Selection preserves per-sender nonce order by only considering each sender's next nonce as a candidate. Across candidate senders it chooses higher fee first, with transaction hash as the deterministic tie-break.

Returns up to max_gas worth of transactions.

pub fn drain_for_block(&mut self, max_gas: u64) -> Vec<SignedTransaction>;

Source line: 523.

mempool::Mempool::len

Returns the number of transactions in the mempool.

pub fn len(&self) -> usize;

Source line: 625.

mempool::Mempool::current_bytes

Returns approximate serialized transaction bytes currently held.

pub fn current_bytes(&self) -> usize;

Source line: 630.

mempool::Mempool::is_empty

Returns true if the mempool is empty.

pub fn is_empty(&self) -> bool;

Source line: 635.

mempool::Mempool::contains

Returns true if the mempool contains a transaction with the given hash.

pub fn contains(&self, hash: &SigilHash) -> bool;

Source line: 640.

mempool::Mempool::local_fee_floor

Current account-local admission floor for a write-locked key.

pub fn local_fee_floor(&self, account: &str) -> u64;

Source line: 645.

mempool::Mempool::get

Returns the transaction with the given hash, if present.

pub fn get(&self, hash: &SigilHash) -> Option<&SignedTransaction>;

Source line: 653.

On this page