Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
feat: integrate blobstore in validator (paradigmxyz#4273)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Aug 18, 2023
1 parent 82a42c9 commit cbf3eb4
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 199 deletions.
4 changes: 3 additions & 1 deletion bin/reth/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,16 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
let factory = ProviderFactory::new(Arc::clone(&db), Arc::clone(&self.chain));
let blockchain_db = BlockchainProvider::new(factory, blockchain_tree.clone())?;

let blob_store = InMemoryBlobStore::default();
let transaction_pool = reth_transaction_pool::Pool::eth_pool(
TransactionValidationTaskExecutor::eth_with_additional_tasks(
blockchain_db.clone(),
Arc::clone(&self.chain),
blob_store.clone(),
ctx.task_executor.clone(),
1,
),
InMemoryBlobStore::default(),
blob_store,
self.txpool.pool_config(),
);
info!(target: "reth::cli", "Transaction pool initialized");
Expand Down
3 changes: 2 additions & 1 deletion crates/transaction-pool/src/blobstore/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Storage for blob data of EIP4844 transactions.

use reth_primitives::{BlobTransactionSidecar, H256};
use std::fmt;
mod maintain;
mod mem;
mod noop;
Expand All @@ -15,7 +16,7 @@ pub use noop::NoopBlobStore;
/// finalization).
///
/// Note: this is Clone because it is expected to be wrapped in an Arc.
pub trait BlobStore: Send + Sync + 'static {
pub trait BlobStore: fmt::Debug + Send + Sync + 'static {
/// Inserts the blob sidecar into the store
fn insert(&self, tx: H256, data: BlobTransactionSidecar) -> Result<(), BlobStoreError>;

Expand Down
17 changes: 10 additions & 7 deletions crates/transaction-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@
//! use reth_transaction_pool::{TransactionValidationTaskExecutor, Pool, TransactionPool};
//! use reth_transaction_pool::blobstore::InMemoryBlobStore;
//! async fn t<C>(client: C) where C: StateProviderFactory + ChainSpecProvider + Clone + 'static{
//! let blob_store = InMemoryBlobStore::default();
//! let pool = Pool::eth_pool(
//! TransactionValidationTaskExecutor::eth(client, MAINNET.clone(), TokioTaskExecutor::default()),
//! InMemoryBlobStore::default(),
//! TransactionValidationTaskExecutor::eth(client, MAINNET.clone(), blob_store.clone(), TokioTaskExecutor::default()),
//! blob_store,
//! Default::default(),
//! );
//! let mut transactions = pool.pending_transactions_listener();
Expand Down Expand Up @@ -136,9 +137,10 @@
//! where C: StateProviderFactory + BlockReaderIdExt + ChainSpecProvider + Clone + 'static,
//! St: Stream<Item = CanonStateNotification> + Send + Unpin + 'static,
//! {
//! let blob_store = InMemoryBlobStore::default();
//! let pool = Pool::eth_pool(
//! TransactionValidationTaskExecutor::eth(client.clone(), MAINNET.clone(), TokioTaskExecutor::default()),
//! InMemoryBlobStore::default(),
//! TransactionValidationTaskExecutor::eth(client.clone(), MAINNET.clone(), blob_store.clone(), TokioTaskExecutor::default()),
//! blob_store,
//! Default::default(),
//! );
//!
Expand Down Expand Up @@ -296,10 +298,11 @@ where
/// use reth_tasks::TokioTaskExecutor;
/// use reth_transaction_pool::{TransactionValidationTaskExecutor, Pool};
/// use reth_transaction_pool::blobstore::InMemoryBlobStore;
/// # fn t<C>(client: C) where C: StateProviderFactory + Clone + 'static{
/// # fn t<C>(client: C) where C: StateProviderFactory + Clone + 'static {
/// let blob_store = InMemoryBlobStore::default();
/// let pool = Pool::eth_pool(
/// TransactionValidationTaskExecutor::eth(client, MAINNET.clone(), TokioTaskExecutor::default()),
/// InMemoryBlobStore::default(),
/// TransactionValidationTaskExecutor::eth(client, MAINNET.clone(), blob_store.clone(), TokioTaskExecutor::default()),
/// blob_store,
/// Default::default(),
/// );
/// # }
Expand Down
Loading

0 comments on commit cbf3eb4

Please sign in to comment.