Skip to content

Commit 256f012

Browse files
authored
Attempt to fix flaky basic sim test (#6134)
* Fix `target_peer` config for basic_sim, so a node doesn't disconnected by peers because of `TooManyPeers`.
1 parent 647992b commit 256f012

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

testing/simulator/src/basic_sim.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
3737
.unwrap_or(&String::from("0"))
3838
.parse::<usize>()
3939
.unwrap_or(0);
40+
// extra beacon node added with delay
41+
let extra_nodes: usize = 1;
4042
println!("PROPOSER-NODES: {}", proposer_nodes);
4143
let validators_per_node = matches
4244
.get_one::<String>("validators-per-node")
@@ -133,6 +135,7 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
133135
LocalNetworkParams {
134136
validator_count: total_validator_count,
135137
node_count,
138+
extra_nodes,
136139
proposer_nodes,
137140
genesis_delay,
138141
},

testing/simulator/src/fallback_sim.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
143143
LocalNetworkParams {
144144
validator_count: total_validator_count,
145145
node_count,
146+
extra_nodes: 0,
146147
proposer_nodes: 0,
147148
genesis_delay,
148149
},

testing/simulator/src/local_network.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub struct LocalNetworkParams {
2727
pub validator_count: usize,
2828
pub node_count: usize,
2929
pub proposer_nodes: usize,
30+
pub extra_nodes: usize,
3031
pub genesis_delay: u64,
3132
}
3233

@@ -38,7 +39,7 @@ fn default_client_config(network_params: LocalNetworkParams, genesis_time: u64)
3839
genesis_time,
3940
};
4041
beacon_config.network.target_peers =
41-
network_params.node_count + network_params.proposer_nodes - 1;
42+
network_params.node_count + network_params.proposer_nodes + network_params.extra_nodes - 1;
4243
beacon_config.network.enr_address = (Some(Ipv4Addr::LOCALHOST), None);
4344
beacon_config.network.enable_light_client_server = true;
4445
beacon_config.network.discv5_config.enable_packet_filter = false;

0 commit comments

Comments
 (0)