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

chore(net): integrate discv5 config builder #8289

Merged
merged 9 commits into from
May 20, 2024

Conversation

emhane
Copy link
Member

@emhane emhane commented May 16, 2024

  • Integrates reth_discv5::ConfigBuilder into NetworkConfigBuilder.

The point of having the builder pattern is to build an immutable type. In this case, the config. The way that the network config is currently being built, makes this difficult. This PR tries to keep discv5 config building coherent with discv4 config building, but respecting the builder pattern.

  • As many args as possible are added in DiscoveryArgs::apply_to_builder, but without passing more other NetworkArgs as parameters than necessary. all DiscoveryArgs added in outer scope, to enable discv5 by default for optimism
  • Bootnodes, a parallel field to DiscoveryArgs on NetworkArgs type, are added in the outer scope (NetworkArgs::network_config).
  • Listen sockets are added, wrt to instance, in the outer scope of NetworkArgs, in the same function they are added wrt to instance to discv4 (NetworkArgs::load_network_config).

At best, an issue is made to design the discv4 config to be immutable too, instead of modifying it after it has been built. Another issue that would make sense, is to move the instance flag into NetworkArgs. --instance is used in RpcArgs too, so must exist parallel to NetworkArgs and RpcArgs.

@emhane emhane added C-debt A section of code is hard to understand or change A-networking Related to networking in general labels May 16, 2024
@emhane emhane requested a review from joshieDo May 17, 2024 01:39
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.

does this supersede #7856?

bin/reth/src/commands/p2p/mod.rs Show resolved Hide resolved
crates/net/common/src/ip.rs Outdated Show resolved Hide resolved
crates/net/network/src/config.rs Outdated Show resolved Hide resolved
crates/net/network/src/config.rs Outdated Show resolved Hide resolved
@emhane
Copy link
Member Author

emhane commented May 17, 2024

does this supersede #7856?

that pr is the base of this branch

@emhane emhane requested a review from mattsse May 17, 2024 15:39
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.

pedantic suggestions, otherwise lgtm

bin/reth/src/commands/p2p/mod.rs Outdated Show resolved Hide resolved
crates/node-core/src/node_config.rs Outdated Show resolved Hide resolved
@emhane emhane merged commit 4891353 into matt/integrate-discv5 May 20, 2024
24 checks passed
@emhane emhane deleted the emhane/integrate-discv5 branch May 20, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-networking Related to networking in general C-debt A section of code is hard to understand or change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants