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

feat(sdk, node-builder): add BuilderInternals trait #14686

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fgimenez
Copy link
Member

@fgimenez fgimenez commented Feb 24, 2025

Closes #14592

@fgimenez fgimenez added the A-sdk Related to reth's use as a library label Feb 24, 2025
@fgimenez fgimenez changed the title feat(builder): add BuilderInternals trait feat(sadk, node-builder): add BuilderInternals trait Feb 24, 2025
@fgimenez fgimenez changed the title feat(sadk, node-builder): add BuilderInternals trait feat(sdk, node-builder): add BuilderInternals trait Feb 24, 2025
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the internals trait makes sense if we can erase a bunch of additional generics,

but this currently cascades, because we no longer use any (internal) adapter types to deconstruct the builder state.

I think one issue here is that NodeBuilderWithComponents directly wraps T and not some (internal) helper struct that is generic over T.

I need to experiment with this a bit

@@ -165,7 +165,9 @@ where
let NodeHandle { node, node_exit_future: _ } = NodeBuilder::new(node_config.clone())
.testing_node(exec.clone())
.with_types_and_provider::<N, BlockchainProvider<_>>()
.with_components(node.components_builder())
.with_components::<BuilderComponentsAdapter<FullNodeTypesAdapter<_, _, _>, _>>(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this we don't want because this leaks into user code, forcing the user to provide this adapter mapping

Comment on lines 71 to 72
for EngineNodeLauncher
where
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I see because we removed the adapter type here this requires more bloat now?

pub components_builder: CB,
/// Additional node extensions.
pub add_ons: AddOns<NodeAdapter<T, CB::Components>, AO>,
pub adapter: T,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what we should try here is introducing an actual Adapter struct on this level, which I should would allow us to hide most of this, this is like nodeadapter but over internals.

then this maybe doesn't cascade

@@ -65,36 +67,42 @@ impl EngineNodeLauncher {
}
}

impl<Types, DB, T, CB, AO> LaunchNode<NodeBuilderWithComponents<T, CB, AO>> for EngineNodeLauncher
impl<T> LaunchNode<NodeBuilderWithComponents<T>>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks a loot better I think

@fgimenez fgimenez force-pushed the fgimenez/builder-internals branch from d8e9603 to d0c05fa Compare February 25, 2025 15:26
@fgimenez fgimenez force-pushed the fgimenez/builder-internals branch from d0c05fa to fd54886 Compare February 25, 2025 20:10
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
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Introduce BuilderInternals trait
2 participants