Skip to content

Conversation

@0xMuang
Copy link
Collaborator

@0xMuang 0xMuang commented Dec 29, 2025

CipherBFT Mempool Implementation Review

This document summarizes the CipherBFT mempool components implemented so far.

Implemented Components

1. CipherBftPool Wrapper

CipherBftPool – lib.rs

A thin wrapper over the Reth transaction pool, delegating core pool logic and configuration to Reth.

pub struct CipherBftPool { /* ... */ }

2. BFT Policy Validation

add_transaction() – lib.rs

Performs CipherBFT-specific checks (minimum gas price, nonce gap) before forwarding transactions to the Reth pool.

pub async fn add_transaction(&self, tx: TransactionSigned) -> Result<...>

3. Pool Configuration Mapping

MempoolConfigPoolConfig – config.rs

Maps CipherBFT’s MempoolConfig to Reth’s PoolConfig, exposing price bump and replacement settings.

impl From<MempoolConfig> for PoolConfig { /* ... */ }

4. Priority/Replacement Policy Example

Pool Instantiation Example – lib.rs (documented)

Provides an example of initializing the pool with Reth’s ordering (CoinbaseTipOrdering) and replacement policy.

let pool_config = mempool_config.into();
let ordering = CoinbaseTipOrdering::default();
let pool = Pool::new(tx_validator, ordering, blob_store, pool_config);

5. Adapter: Pending/Queued Access

CipherBftPoolAdaptercrates/mempool/src/adapter.rs

Provides helper APIs for batch selection and pending/queued access.

let pending = pool.adapter().pending_transactions();
let queued = pool.adapter().queued_transactions();

Architecture Overview

Component Status for CipherBFT Mempool

Component Status Location / Helper Function
CipherBftPool ✅ Complete lib.rs
BFT Policy Validation ✅ Complete add_transaction()
Config Mapping ✅ Complete config.rs
Priority/Replacement Example ✅ Documented Pool instantiation (lib.rs)
Adapter (pending/queued) ✅ Complete adapter.rs
Worker Integration ❌ Not implemented -

Usage Flow Example

let pool_config: PoolConfig = mempool_config.into();
let ordering = CoinbaseTipOrdering::default();
let pool = Pool::new(tx_validator, ordering, blob_store, pool_config);
let pending = pool.adapter().pending_transactions();
let queued = pool.adapter().queued_transactions();

Next Steps

  1. Worker Integration: Implement actual worker wiring and lifecycle management.
  2. Test Coverage: Add integration and edge-case tests.

@0xMuang 0xMuang linked an issue Dec 29, 2025 that may be closed by this pull request
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MP-1: Mempool data structure design

2 participants