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: declarative builder v2 #6447

Merged
merged 43 commits into from
Feb 13, 2024
Merged

feat: declarative builder v2 #6447

merged 43 commits into from
Feb 13, 2024

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Feb 6, 2024

supersedes #5932

Introduces a declarative node builder that configures the node step by step using types and components.

Future work

currently, type traits are just placeholders that can be configured once everything is generic over types. Ideally we start with the Engine types (ethereum/optimism) but this needs more work on the existing components first (make them generic over EngineConfig).

Update

This currently only adds the node-builder, I want to do the replacement in a followup. because the PR is already gigantic

TODO

  • more ergonomics and helper types

Breaking changes

This phases out the NodeCommandConfig trait in it's existing form, instead all of its functionality will be moved into the NodeBuilder directly (hooks + helper functions for customizing payload builder for example)

@mattsse mattsse requested a review from gakonst as a code owner February 6, 2024 15:49
@mattsse mattsse marked this pull request as draft February 6, 2024 15:49
@mattsse mattsse added the C-enhancement New feature or request label Feb 6, 2024
@Rjected Rjected added the A-sdk Related to reth's use as a library label Feb 6, 2024
@mattsse mattsse force-pushed the matt/declarative-node-builderv2 branch from 30ac64e to 9511150 Compare February 13, 2024 19:05
@mattsse mattsse marked this pull request as ready for review February 13, 2024 19:06
@mattsse mattsse requested a review from Rjected as a code owner February 13, 2024 19:06
@mattsse mattsse requested a review from onbjerg as a code owner February 13, 2024 19:17
Comment on lines +29 to +30
pub fn components<Node>(
) -> ComponentsBuilder<Node, EthereumPoolBuilder, EthereumPayloadBuilder, EthereumNetwork>
Copy link
Collaborator

Choose a reason for hiding this comment

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

how did this pass lint 🤔

@onbjerg
Copy link
Collaborator

onbjerg commented Feb 13, 2024

general q: i can see that network, engine, payload builder, pool is all configured as components, but rpc seems separate, is this deliberate or will that config be unified later?

@mattsse
Copy link
Collaborator Author

mattsse commented Feb 13, 2024

but rpc seems separate, is this deliberate or will that config be unified later?

RPC is based on the configured modules this can be extended with a hook.

I think we can/want to move away from this as well but for now it's significantly easier to rely on the RpcServerArgs

@onbjerg
Copy link
Collaborator

onbjerg commented Feb 13, 2024

gotcha

Copy link
Collaborator

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

lgtm, hyped

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

LGTM, have one question and suggestion to add docs

Comment on lines 203 to 204
// TODO simplify registry trait bounds
pub registry: &'a mut RpcRegistry<Node>,
Copy link
Member

Choose a reason for hiding this comment

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

trait bound is just Node: FullNodeComponents, so I'm guessing this todo is complete?

Comment on lines +58 to +60
pub struct EthereumPoolBuilder {
// TODO add options for txpool args
}
Copy link
Member

Choose a reason for hiding this comment

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

wdyt would go in here eventually?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

additional values to override cli args

@mattsse mattsse added this pull request to the merge queue Feb 13, 2024
Merged via the queue into main with commit cfc9146 Feb 13, 2024
30 checks passed
@mattsse mattsse deleted the matt/declarative-node-builderv2 branch February 13, 2024 23:06
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
None yet
Development

Successfully merging this pull request may close these issues.

3 participants