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

Integrate Node traits into LaunchContextWith #8967

Closed
mattsse opened this issue Jun 19, 2024 · 1 comment · Fixed by #8993
Closed

Integrate Node traits into LaunchContextWith #8967

mattsse opened this issue Jun 19, 2024 · 1 comment · Fixed by #8993
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 Jun 19, 2024

Describe the feature

It would be nice to have access to the FullNodeComponents and FullNodeTypes traits, so we can also move this into the context:

// fetch the head block from the database
let head = ctx.lookup_head()?;
let builder_ctx = BuilderContext::new(
head,
ctx.blockchain_db().clone(),
ctx.task_executor().clone(),
ctx.configs().clone(),
);

this could be done with a new state type, similar to

pub struct WithMeteredProvider<DB> {

but with access to the FullNodeTypes trait, either by providing this here

.with_blockchain_db().await?;

via with_blockchain_db::<T> and then keep the type T in a phantomType for example.

so we can just call let builder_ctx = ctx.builder_ctx()?

and later by attaching the adapter via fn with_components<N: FullNodeComponents> to the launchcontext with an additional attachment type like WithMeteredProvider

let node_adapter = NodeAdapter {
components,
task_executor: ctx.task_executor().clone(),
provider: blockchain_db.clone(),
};

This way, we can push a ton of setup code currently in fn launch into the context.

FYI @fgimenez in case you find some time

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request S-needs-triage This issue needs to be labelled A-sdk Related to reth's use as a library and removed S-needs-triage This issue needs to be labelled labels Jun 19, 2024
@fgimenez
Copy link
Member

FYI @fgimenez in case you find some time

absolutely, thx!

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