Skip to content

Commit

Permalink
fix(op): configure discv5 properly in op builder (#9058)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jun 24, 2024
1 parent c5aee02 commit 83d412d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/net/discv5/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl ConfigBuilder {
}

/// Adds boot nodes in the form a list of [`NodeRecord`]s, parsed enodes.
pub fn add_unsigned_boot_nodes(mut self, enodes: impl Iterator<Item = NodeRecord>) -> Self {
pub fn add_unsigned_boot_nodes(mut self, enodes: impl IntoIterator<Item = NodeRecord>) -> Self {
for node in enodes {
if let Ok(node) = BootNode::from_unsigned(node) {
self.bootstrap_nodes.insert(node);
Expand Down
2 changes: 1 addition & 1 deletion crates/node-core/src/args/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl NetworkArgs {
} = self.discovery;

builder
.add_unsigned_boot_nodes(chain_bootnodes.into_iter())
.add_unsigned_boot_nodes(chain_bootnodes)
.lookup_interval(discv5_lookup_interval)
.bootstrap_lookup_interval(discv5_bootstrap_lookup_interval)
.bootstrap_lookup_countdown(discv5_bootstrap_lookup_countdown)
Expand Down
12 changes: 12 additions & 0 deletions crates/optimism/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,18 @@ where
}

builder
})
// ensure we configure discv5
.map_discv5_config_builder(|builder| {
builder
.add_unsigned_boot_nodes(ctx.chain_spec().bootnodes().unwrap_or_default())
.lookup_interval(ctx.config().network.discovery.discv5_lookup_interval)
.bootstrap_lookup_interval(
ctx.config().network.discovery.discv5_bootstrap_lookup_interval,
)
.bootstrap_lookup_countdown(
ctx.config().network.discovery.discv5_bootstrap_lookup_countdown,
)
});

let mut network_config = ctx.build_network_config(network_builder);
Expand Down

0 comments on commit 83d412d

Please sign in to comment.