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: Introduce NodeBuilder #5824

Merged
merged 33 commits into from
Dec 27, 2023
Merged

feat: Introduce NodeBuilder #5824

merged 33 commits into from
Dec 27, 2023

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Dec 18, 2023

This implements the node builder designed in #5693, and adds a simple block number test with the following UX:

// this launches a test node with http
let rpc_args = RpcServerArgs::default().with_http();
let handle = spawn_node(NodeBuilder::test().with_rpc(rpc_args)).await.unwrap();

// call a function on the node
let client = handle.rpc_server_handles().rpc.http_client().unwrap();
let block_number = client.block_number().await.unwrap();

// it should be zero, since this is an ephemeral test node
assert_eq!(block_number, U256::ZERO);

TODO:

  • Fix tests - we currently install the prometheus recorder more than once if we spin up multiple nodes in a test

For follow-up:

  • Provide a handle method for shutting down the node. It might also need to run when all handles are dropped?

Fixes #5693

@Rjected Rjected added C-enhancement New feature or request C-test A change that impacts how or what we test A-cli Related to the reth CLI labels Dec 18, 2023
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.

this is great!

I like this a lot.

I have a few ideas for followups, but these will be related to better node type abstraction.

with the builder we now have the flexibility to make incremental changes.

as immediate followup, I suggest we refactor the bin/reth crate layout:

group commands in commands folder,

move NodeBuilder and related to node, this is prep for extracting that code to a standalone repo

bin/reth/src/node/mod.rs Outdated Show resolved Hide resolved
@Rjected Rjected marked this pull request as ready for review December 26, 2023 18:55
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.

I like this a lot.

this unblocks more generalization.
we can now make more incremental changes and improve extensions and UX

@mattsse mattsse added this pull request to the merge queue Dec 27, 2023
Merged via the queue into main with commit 8e9b02f Dec 27, 2023
28 checks passed
@mattsse mattsse deleted the dan/node-builder branch December 27, 2023 13:06
mattsse added a commit that referenced this pull request Dec 27, 2023
@mattsse mattsse restored the dan/node-builder branch December 27, 2023 13:32
@mattsse mattsse mentioned this pull request Dec 27, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Related to the reth CLI C-enhancement New feature or request C-test A change that impacts how or what we test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node Builder for e2e testing
2 participants