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

revise nodetypes trait #9555

Closed
Tracked by #9554
mattsse opened this issue Jul 16, 2024 · 3 comments · Fixed by #10665
Closed
Tracked by #9554

revise nodetypes trait #9555

mattsse opened this issue Jul 16, 2024 · 3 comments · Fixed by #10665
Labels
A-sdk Related to reth's use as a library M-prevent-stale Prevents old inactive issues/PRs from being closed due to inactivity S-needs-design This issue requires design work to think about how it would best be accomplished

Comments

@mattsse
Copy link
Collaborator

mattsse commented Jul 16, 2024

the nodetypes trait

pub trait NodeTypes: Send + Sync + Unpin + 'static {
/// The node's primitive types, defining basic operations and structures.
type Primitives: NodePrimitives;
/// The node's engine types, defining the interaction with the consensus engine.
type Engine: EngineTypes;
}

already makes certain assumptions, for example it expects engine types, but we might want to support node setups that don't use the engine API.

this should be relaxed in the node builder in such a way that these traits stack (using a single type instead of associated types) and are not associated types

@mattsse mattsse added S-needs-design This issue requires design work to think about how it would best be accomplished A-sdk Related to reth's use as a library labels Jul 16, 2024
Copy link
Contributor

This issue is stale because it has been open for 21 days with no activity.

@github-actions github-actions bot added the S-stale This issue/PR is stale and will close with no further activity label Aug 16, 2024
@shekhirin shekhirin added M-prevent-stale Prevents old inactive issues/PRs from being closed due to inactivity and removed S-stale This issue/PR is stale and will close with no further activity labels Aug 16, 2024
@tcoratger
Copy link
Contributor

@mattsse Maybe we could do something like:

/// The type that configures the essential types of an Ethereum-like node.
///
/// This includes the primitive types of a node.
///
/// This trait is intended to be stateless and only define the types of the node.
pub trait NodeTypes: Send + Sync + Unpin + 'static {
    /// The node's primitive types, defining basic operations and structures.
    type Primitives: NodePrimitives;
}

/// The type that configures an Ethereum-like node with an engine for consensus.
pub trait NodeTypesWithEngine: NodeTypes {
    /// The node's engine types, defining the interaction with the consensus engine.
    type Engine: EngineTypes;
}

This would allow for a two-stage implementation while retaining the Engine associated type which is used quite a few places in the code, what do you think?

@mattsse
Copy link
Collaborator Author

mattsse commented Sep 2, 2024

yes, I think this is exactly what we're looking for here

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 M-prevent-stale Prevents old inactive issues/PRs from being closed due to inactivity S-needs-design This issue requires design work to think about how it would best be accomplished
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants