feat: integrate evm in OP payload builder (#7527)

This commit is contained in:
Matthias Seitz
2024-04-09 17:41:52 +02:00
committed by GitHub
parent cfd335b9b7
commit fe27dc64dc
5 changed files with 70 additions and 43 deletions

View File

@ -547,7 +547,15 @@ where
let blockchain_db =
BlockchainProvider::new(provider_factory.clone(), blockchain_tree.clone())?;
let ctx = BuilderContext::new(head, blockchain_db, executor, data_dir, config, reth_config);
let ctx = BuilderContext::new(
head,
blockchain_db,
executor,
data_dir,
config,
reth_config,
evm_config.clone(),
);
debug!(target: "reth::cli", "creating components");
let NodeComponents { transaction_pool, network, payload_builder } =
@ -1119,18 +1127,8 @@ pub struct BuilderContext<Node: FullNodeTypes> {
config: NodeConfig,
/// loaded config
reth_config: reth_config::Config,
}
impl<Node: FullNodeTypes> std::fmt::Debug for BuilderContext<Node> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("BuilderContext")
.field("head", &self.head)
.field("provider", &std::any::type_name::<Node::Provider>())
.field("executor", &self.executor)
.field("data_dir", &self.data_dir)
.field("config", &self.config)
.finish()
}
/// EVM config of the node
evm_config: Node::Evm,
}
impl<Node: FullNodeTypes> BuilderContext<Node> {
@ -1142,8 +1140,9 @@ impl<Node: FullNodeTypes> BuilderContext<Node> {
data_dir: ChainPath<DataDirPath>,
config: NodeConfig,
reth_config: reth_config::Config,
evm_config: Node::Evm,
) -> Self {
Self { head, provider, executor, data_dir, config, reth_config }
Self { head, provider, executor, data_dir, config, reth_config, evm_config }
}
/// Returns the configured provider to interact with the blockchain.
@ -1151,6 +1150,11 @@ impl<Node: FullNodeTypes> BuilderContext<Node> {
&self.provider
}
/// Returns the configured evm.
pub fn evm_config(&self) -> &Node::Evm {
&self.evm_config
}
/// Returns the current head of the blockchain at launch.
pub fn head(&self) -> Head {
self.head
@ -1254,6 +1258,18 @@ impl<Node: FullNodeTypes> BuilderContext<Node> {
}
}
impl<Node: FullNodeTypes> std::fmt::Debug for BuilderContext<Node> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("BuilderContext")
.field("head", &self.head)
.field("provider", &std::any::type_name::<Node::Provider>())
.field("executor", &self.executor)
.field("data_dir", &self.data_dir)
.field("config", &self.config)
.finish()
}
}
/// The initial state of the node builder process.
#[derive(Debug, Default)]
#[non_exhaustive]