-
Notifications
You must be signed in to change notification settings - Fork 13
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: add bootnode support and basic discv5 support #38
Conversation
fb19cc9
to
6cd7bac
Compare
6cd7bac
to
29f9d44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit, but I got peer responses from teku and nimbus, let's get this in we'll work on keeping the connection alive
@@ -64,16 +74,18 @@ impl Discovery { | |||
} | |||
|
|||
let _ = discv5.add_enr(bootnode_enr).map_err(|e| { | |||
println!("Discv5 service failed. Error: {:?}", e); | |||
info!("Discv5 service failed. Error: {:?}", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nits. It looks work as expected within its scope. Once we have bootstrapping network done, we probably want to refactor it.
@@ -64,16 +74,18 @@ impl Discovery { | |||
} | |||
|
|||
let _ = discv5.add_enr(bootnode_enr).map_err(|e| { | |||
println!("Discv5 service failed. Error: {:?}", e); | |||
info!("Discv5 service failed. Error: {:?}", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
info!("Discv5 service failed. Error: {:?}", e); | |
info!("Failed to add bootnode to DHT {e:?}"); |
Same here.
let enr_local = convert_to_enr(local_key)?; | ||
let enr = Enr::builder().build(&enr_local).unwrap(); | ||
let node_local_id = enr.node_id(); | ||
|
||
let mut discv5 = Discv5::new(enr, enr_local, config.discv5_config.clone()) | ||
.map_err(|e| format!("Discv5 service failed. Error: {:?}", e))?; | ||
.map_err(|e| anyhow!("Discv5 service failed. Error: {:?}", e))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.map_err(|e| anyhow!("Discv5 service failed. Error: {:?}", e))?; | |
.map_err(|e| anyhow!("Failed to create discv5 {e:?}"))?; |
Can we have consistent and more descriptive error message something like this?
crates/networking/p2p/src/network.rs
Outdated
|
||
#[derive(NetworkBehaviour)] | ||
pub(crate) struct ReamBehaviour { | ||
pub identify: identify::Behaviour, | ||
|
||
/// The discovery domain: discv5 | ||
pub discovery: Discovery, | ||
|
||
pub connection_registry: libp2p::connection_limits::Behaviour, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub connection_registry: libp2p::connection_limits::Behaviour, | |
pub connection_registry: connection_limits::Behaviour, |
what do you mean refactor it? |
I see some room for improvements. Could be just trimming or refactor depending on rest of the implementation. |
fixes #91
Followup PR's
In my next PR I am going to be implementing basic Req/Resp for the Req/Resp domain of the consensus p2p-interface spec https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/p2p-interface.md#the-reqresp-domain
There is still work to do like finding subnets, and setting a key-value in the enr to specify the node is an eth2 node