-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add discv5 #72
Add discv5 #72
Changes from 13 commits
248466c
f8ca4b4
c016651
daff657
e1b09d6
467b48a
a12a8e9
f71df58
1f3d955
b5cdbca
2ca4167
cc5004e
e532014
3080f3d
c091041
2cd0e43
afcfe99
14fc072
ae8d4a9
19cdba9
92c0468
a323635
a8b5f52
24fa59a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,6 +131,25 @@ pub fn from_cli(cli_args: &Anchor) -> Result<Config, String> { | |
*/ | ||
config.network.listen_addresses = parse_listening_addresses(cli_args)?; | ||
|
||
for addr in cli_args.boot_nodes_enr.clone() { | ||
match addr.parse() { | ||
Ok(enr) => config.network.boot_nodes_enr.push(enr), | ||
Err(_) => { | ||
// parsing as ENR failed, try as Multiaddr | ||
// let multi: Multiaddr = addr | ||
// .parse() | ||
// .map_err(|_| format!("Not valid as ENR nor Multiaddr: {}", addr))?; | ||
// if !multi.iter().any(|proto| matches!(proto, Protocol::Udp(_))) { | ||
// slog::error!(log, "Missing UDP in Multiaddr {}", multi.to_string()); | ||
// } | ||
// if !multi.iter().any(|proto| matches!(proto, Protocol::P2p(_))) { | ||
// slog::error!(log, "Missing P2P in Multiaddr {}", multi.to_string()); | ||
// } | ||
// multiaddrs.push(multi); | ||
} | ||
} | ||
} | ||
Comment on lines
+134
to
+151
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we are currently iterating the bootnode list twice, first here and then when adding to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is adding the ENRs from the cli into the network config. LH does the same https://github.com/sigp/lighthouse/blob/stable/beacon_node/src/config.rs#L1159 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LH doing something shouldn't be used as the only source of truth to follow for config.network.boot_nodes_enr.append(cli_args.boot_nodes_enr) and then on https://github.com/sigp/anchor/pull/72/files#diff-377ff7ebcbab6b7243aedbcf1c9139b355dd5294398ca8b0b218c32ccf2f1387R121 we parse them, so that we we only iterate the enr bootnodes list once There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for clarifying, I understand now. In this case, the vector will only contain a few values. Would this optimization have a significant impact on performance? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no worries Diego. probably it won't have a big impact on the performance but it isn't only about performance, it also makes the code more elegant at no cost There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's also the validation perspective. It's probably a good idea to parse and check if the ENR is valid here and add only valid ones to the network config. |
||
|
||
config.beacon_nodes_tls_certs = cli_args.beacon_nodes_tls_certs.clone(); | ||
config.execution_nodes_tls_certs = cli_args.execution_nodes_tls_certs.clone(); | ||
|
||
|
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.
We can declare the default boot nodes somewhere (like
anchor/network/src/config.rs
) with:and then import it and use it 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.
It seems LH defines them in
yaml
files https://github.com/sigp/lighthouse/blob/stable/common/eth2_network_config/built_in_network_configs/holesky/boot_enr.yamlThere 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.
yeah can also be, but then we should get them by default, if you prefer it can be done in a subsequent PR
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.
Yes, it's probably better in another PR.