Skip to content

Add Peering Simulator #6395

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

Open
wants to merge 7 commits into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,20 @@ jobs:
cache-target: release
- name: Run a beacon chain sim which tests VC fallback behaviour
run: cargo run --release --bin simulator fallback-sim
peering-simulator-ubuntu:
name: peering-simulator-ubuntu
needs: [check-labels]
if: needs.check-labels.outputs.skip_ci != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get latest version of stable Rust
uses: moonrepo/setup-rust@v1
with:
channel: stable
cache-target: release
- name: Run a beacon chain sim which tests BN peering behaviour
run: cargo run --release --bin simulator peering-sim
execution-engine-integration-ubuntu:
name: execution-engine-integration-ubuntu
needs: [check-labels]
Expand Down Expand Up @@ -466,6 +480,7 @@ jobs:
'ef-tests-ubuntu',
'basic-simulator-ubuntu',
'fallback-simulator-ubuntu',
'peering-simulator-ubuntu',
'execution-engine-integration-ubuntu',
'check-code',
'check-msrv',
Expand Down
2 changes: 1 addition & 1 deletion testing/simulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ logging = { workspace = true }
node_test_rig = { path = "../node_test_rig" }
parking_lot = { workspace = true }
rayon = { workspace = true }
sensitive_url = { path = "../../common/sensitive_url" }
sensitive_url = { path = "../../common/sensitive_url" }
serde_json = { workspace = true }
tokio = { workspace = true }
tracing-subscriber = { workspace = true }
Expand Down
50 changes: 50 additions & 0 deletions testing/simulator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,54 @@ pub fn cli_app() -> Command {
.help("Continue after checks (default false)"),
),
)
.subcommand(
Command::new("peering-sim")
.about(
"Runs a Beacon Chain simulation with `n` beacon node and validator clients, \
each with `v` validators. \
The simulation runs with a post-Merge Genesis using `mock-el`. \
As the simulation runs, additional nodes are periodically added and \
there are checks made to ensure that the nodes are able to sync to the \
network. If a node fails to sync, the simulation will exit immediately.",
)
.arg(
Arg::new("nodes")
.short('n')
.long("nodes")
.action(ArgAction::Set)
.default_value("2")
.help("Number of beacon nodes"),
)
.arg(
Arg::new("validators-per-node")
.short('v')
.long("validators-per-node")
.action(ArgAction::Set)
.default_value("10")
.help("Number of validators"),
)
.arg(
Arg::new("speed-up-factor")
.short('s')
.long("speed-up-factor")
.action(ArgAction::Set)
.default_value("3")
.help("Speed up factor. Please use a divisor of 12."),
)
.arg(
Arg::new("debug-level")
.short('d')
.long("debug-level")
.action(ArgAction::Set)
.default_value("debug")
.help("Set the severity level of the logs."),
)
.arg(
Arg::new("continue-after-checks")
.short('c')
.long("continue_after_checks")
.action(ArgAction::SetTrue)
.help("Continue after checks (default false)"),
),
)
}
1 change: 1 addition & 0 deletions testing/simulator/src/local_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ impl<E: EthSpec> LocalNetwork<E> {
beacon_config.network.enr_udp4_port = Some(BOOTNODE_PORT.try_into().expect("non zero"));
beacon_config.network.enr_tcp4_port = Some(BOOTNODE_PORT.try_into().expect("non zero"));
beacon_config.network.discv5_config.table_filter = |_| true;
beacon_config.network.subscribe_all_data_column_subnets = true;

let execution_node = LocalExecutionNode::new(
self.context.service_context("boot_node_el".into()),
Expand Down
8 changes: 8 additions & 0 deletions testing/simulator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod checks;
mod cli;
mod fallback_sim;
mod local_network;
mod peering_sim;
mod retry;

use cli::cli_app;
Expand Down Expand Up @@ -44,6 +45,13 @@ fn main() {
std::process::exit(1)
}
},
Some(("peering-sim", matches)) => match peering_sim::run_peering_sim(matches) {
Ok(()) => println!("Simulation exited successfully"),
Err(e) => {
eprintln!("Simulation exited with error: {}", e);
std::process::exit(1)
}
},
_ => {
eprintln!("Invalid subcommand. Use --help to see available options");
std::process::exit(1)
Expand Down
Loading
Loading