Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move network setup code from node-core to node-builder launch/ BuilderContext types #7953

Closed
mattsse opened this issue Apr 29, 2024 · 0 comments · Fixed by #8648
Closed

Move network setup code from node-core to node-builder launch/ BuilderContext types #7953

mattsse opened this issue Apr 29, 2024 · 0 comments · Fixed by #8648
Assignees
Labels
A-sdk Related to reth's use as a library C-enhancement New feature or request

Comments

@mattsse
Copy link
Collaborator

mattsse commented Apr 29, 2024

Describe the feature

currently the NodeConfig type contains various helpers for setting up the network

pub async fn build_network<C>(

/// Creates the [NetworkBuilder] for the node.
pub async fn network_builder(&self) -> eyre::Result<NetworkBuilder<Node::Provider, (), ()>> {
self.config
.build_network(
&self.reth_config,
self.provider.clone(),
self.executor.clone(),
self.head,
self.data_dir(),
)
.await
}

which is used as convenience fn during NetworkBuilder:

let network = ctx.network_builder().await?;

with the new launch types, I think we can simplify this and ideally remove the network code from node-core

the entrypoint is here:

let builder_ctx = BuilderContext::new(
head,
blockchain_db.clone(),
ctx.task_executor().clone(),
ctx.data_dir().clone(),
ctx.node_config().clone(),
ctx.toml_config().clone(),
evm_config.clone(),
);
debug!(target: "reth::cli", "creating components");
let components = components_builder.build_components(&builder_ctx).await?;

TODO

  • move network related code to BuilderContext, we can probably change a few things in BuilderContext, for example using this type

/// Helper container type to bundle the initial [NodeConfig] and the loaded settings from the
/// reth.toml config
#[derive(Debug, Clone)]
pub struct WithConfigs {
/// The configured, usually derived from the CLI.
pub config: NodeConfig,
/// The loaded reth.toml config.
pub toml_config: reth_config::Config,
}

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Apr 29, 2024
@mattsse mattsse added A-sdk Related to reth's use as a library and removed S-needs-triage This issue needs to be labelled labels Apr 29, 2024
@fgimenez fgimenez moved this from Todo to In Progress in Reth Tracker Jun 4, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sdk Related to reth's use as a library C-enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants