Skip to content

Commit

Permalink
rbuilder runs
Browse files Browse the repository at this point in the history
  • Loading branch information
CeciliaZ030 committed Oct 27, 2024
1 parent 7279566 commit 4cc8022
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
9 changes: 4 additions & 5 deletions bin/reth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
use std::sync::Arc;

use gwyneth::{engine_api::RpcServerArgsExEx, GwynethNode};
use reth::args::{DiscoveryArgs, NetworkArgs, RpcServerArgs};
use reth::{args::{DiscoveryArgs, NetworkArgs, RpcServerArgs}, dirs::ChainPath};
use reth_chainspec::ChainSpecBuilder;
use reth_cli_commands::node::L2Args;
use reth_db::init_db;
Expand Down Expand Up @@ -45,7 +45,7 @@ fn main() -> eyre::Result<()> {
)
.cancun_activated()
.build();

let node_config = NodeConfig::test()
.with_chain(chain_spec.clone())
.with_network(network_config.clone())
Expand All @@ -56,12 +56,11 @@ fn main() -> eyre::Result<()> {
.with_ports_and_ipc(ext.ports.get(idx), ext.ipc_path.clone(), chain_id)
);

let db = Arc::new(init_db(datadir, reth_db::mdbx::DatabaseArguments::default())?);
// let db = Arc::new(init_db(node_config.datadir().db(), reth_db::mdbx::DatabaseArguments::default())?);

let NodeHandle { node: gwyneth_node, node_exit_future: _ } =
NodeBuilder::new(node_config.clone())
.with_database(db)
.with_launch_context(exec.clone())
.gwyneth_node(exec.clone(), datadir)
.node(GwynethNode::default())
.launch()
.await?;
Expand Down
12 changes: 6 additions & 6 deletions crates/gwyneth/src/exex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
GwynethPayloadBuilderAttributes,
};
use reth_consensus::Consensus;
use reth_db::DatabaseEnv;
use reth_db::{test_utils::TempDatabase, DatabaseEnv};
use reth_ethereum_engine_primitives::EthPayloadAttributes;
use reth_evm_ethereum::EthEvmConfig;
use reth_execution_types::Chain;
Expand Down Expand Up @@ -38,19 +38,19 @@ pub type GwynethFullNode = FullNode<
NodeAdapter<
FullNodeTypesAdapter<
GwynethNode,
Arc<DatabaseEnv>,
BlockchainProvider<Arc<DatabaseEnv>>,
Arc<TempDatabase<DatabaseEnv>>,
BlockchainProvider<Arc<TempDatabase<DatabaseEnv>>>,
>,
Components<
FullNodeTypesAdapter<
GwynethNode,
Arc<DatabaseEnv>,
BlockchainProvider<Arc<DatabaseEnv>>,
Arc<TempDatabase<DatabaseEnv>>,
BlockchainProvider<Arc<TempDatabase<DatabaseEnv>>>,
>,
Pool<
TransactionValidationTaskExecutor<
EthTransactionValidator<
BlockchainProvider<Arc<DatabaseEnv>>,
BlockchainProvider<Arc<TempDatabase<DatabaseEnv>>>,
EthPooledTransaction,
>,
>,
Expand Down
25 changes: 25 additions & 0 deletions crates/node/builder/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,31 @@ impl<DB> NodeBuilder<DB> {
WithLaunchContext { builder: self, task_executor }
}

/// Creates a Gwyneth node
pub fn gwyneth_node(
mut self,
task_executor: TaskExecutor,
datadir: PathBuf,
) -> WithLaunchContext<NodeBuilder<Arc<reth_db::test_utils::TempDatabase<reth_db::DatabaseEnv>>>>
{
let path = reth_node_core::dirs::MaybePlatformPath::<DataDirPath>::from(datadir);
self.config = self.config.with_datadir_args(reth_node_core::args::DatadirArgs {
datadir: path.clone(),
..Default::default()
});

let data_dir =
path.unwrap_or_chain_default(self.config.chain.chain, self.config.datadir.clone());

println!("data_dir: {:?}", data_dir);

let db = reth_db::test_utils::create_test_rw_db_with_path(data_dir.db());

WithLaunchContext { builder: self.with_database(db), task_executor }
}





/// Creates an _ephemeral_ preconfigured node for testing purposes.
Expand Down

0 comments on commit 4cc8022

Please sign in to comment.