Update Simulator tests (#5520)

* Rewrite Simulator

* Add fallback simulator

* Try Sean's test fix

* More fixes

* Cleanup

* Merge branch 'unstable' into update-simulator

* Update cli.rs

* Add sync sim to basic sim

* Formatting

* Add fixes and new block production check

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into update-simulator

* fix compile
This commit is contained in:
Mac L
2024-04-23 01:08:36 +10:00
committed by GitHub
parent 9b5895ca89
commit 67f8405921
18 changed files with 944 additions and 1036 deletions

View File

@@ -6,120 +6,121 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.author("Sigma Prime <contact@sigmaprime.io>")
.about("Options for interacting with simulator")
.subcommand(
SubCommand::with_name("eth1-sim")
.about(
"Lighthouse Beacon Chain Simulator creates `n` beacon node and validator clients, \
each with `v` validators. A deposit contract is deployed at the start of the \
simulation using a local `anvil` instance (you must have `anvil` \
installed and avaliable on your path). All beacon nodes independently listen \
for genesis from the deposit contract, then start operating. \
\
SubCommand::with_name("basic-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, there are checks made to ensure that all components \
are running correctly. If any of these checks fail, the simulation will \
exit immediately.",
)
.arg(Arg::with_name("nodes")
)
.arg(
Arg::with_name("nodes")
.short("n")
.long("nodes")
.takes_value(true)
.default_value("4")
.help("Number of beacon nodes"))
.arg(Arg::with_name("proposer-nodes")
.default_value("3")
.help("Number of beacon nodes"),
)
.arg(
Arg::with_name("proposer-nodes")
.short("p")
.long("proposer_nodes")
.takes_value(true)
.default_value("2")
.help("Number of proposer-only beacon nodes"))
.arg(Arg::with_name("validators_per_node")
.short("v")
.long("validators_per_node")
.takes_value(true)
.default_value("20")
.help("Number of validators"))
.arg(Arg::with_name("speed_up_factor")
.short("s")
.long("speed_up_factor")
.long("proposer-nodes")
.takes_value(true)
.default_value("3")
.help("Speed up factor. Please use a divisor of 12."))
.arg(Arg::with_name("post-merge")
.short("m")
.long("post-merge")
.takes_value(false)
.help("Simulate the merge transition"))
.arg(Arg::with_name("continue_after_checks")
.help("Number of proposer-only beacon nodes"),
)
.arg(
Arg::with_name("validators-per-node")
.short("v")
.long("validators-per-node")
.takes_value(true)
.default_value("20")
.help("Number of validators"),
)
.arg(
Arg::with_name("speed-up-factor")
.short("s")
.long("speed-up-factor")
.takes_value(true)
.default_value("3")
.help("Speed up factor. Please use a divisor of 12."),
)
.arg(
Arg::with_name("debug-level")
.short("d")
.long("debug-level")
.takes_value(true)
.default_value("debug")
.help("Set the severity level of the logs."),
)
.arg(
Arg::with_name("continue-after-checks")
.short("c")
.long("continue_after_checks")
.takes_value(false)
.help("Continue after checks (default false)"))
.help("Continue after checks (default false)"),
),
)
.subcommand(
SubCommand::with_name("no-eth1-sim")
.about("Runs a simulator that bypasses the eth1 chain. Useful for faster testing of
components that don't rely upon eth1")
.arg(Arg::with_name("nodes")
.short("n")
.long("nodes")
.takes_value(true)
.default_value("4")
.help("Number of beacon nodes"))
.arg(Arg::with_name("proposer-nodes")
.short("p")
.long("proposer_nodes")
.takes_value(true)
.default_value("2")
.help("Number of proposer-only beacon nodes"))
.arg(Arg::with_name("validators_per_node")
.short("v")
.long("validators_per_node")
.takes_value(true)
.default_value("20")
.help("Number of validators"))
.arg(Arg::with_name("speed_up_factor")
.short("s")
.long("speed_up_factor")
SubCommand::with_name("fallback-sim")
.about(
"Runs a Beacon Chain simulation with `c` validator clients where each VC is \
connected to `b` beacon nodes with `v` validators. \
During the simulation, all but the last connected BN for each VC are \
disconnected from the execution layer, which causes the VC to fallback to the \
single remaining BN. \
At the end of the simulation, there are checks made to ensure that all VCs \
efficiently performed this fallback, within a certain tolerance. \
Otherwise, the simulation will exit and an error will be reported.",
)
.arg(
Arg::with_name("vc-count")
.short("c")
.long("vc-count")
.takes_value(true)
.default_value("3")
.help("Speed up factor"))
.arg(Arg::with_name("continue_after_checks")
.help("Number of validator clients."),
)
.arg(
Arg::with_name("bns-per-vc")
.short("b")
.long("bns-per-vc")
.takes_value(true)
.default_value("2")
.help("Number of beacon nodes per validator client."),
)
.arg(
Arg::with_name("validators-per-vc")
.short("v")
.long("validators-per-vc")
.takes_value(true)
.default_value("20")
.help("Number of validators per client."),
)
.arg(
Arg::with_name("speed-up-factor")
.short("s")
.long("speed-up-factor")
.takes_value(true)
.default_value("3")
.help("Speed up factor. Please use a divisor of 12."),
)
.arg(
Arg::with_name("debug-level")
.short("d")
.long("debug-level")
.takes_value(true)
.default_value("debug")
.help("Set the severity level of the logs."),
)
.arg(
Arg::with_name("continue-after-checks")
.short("c")
.long("continue_after_checks")
.takes_value(false)
.help("Continue after checks (default false)"))
)
.subcommand(
SubCommand::with_name("syncing-sim")
.about("Run the syncing simulation")
.arg(
Arg::with_name("speedup")
.short("s")
.long("speedup")
.takes_value(true)
.default_value("15")
.help("Speed up factor for eth1 blocks and slot production"),
)
.arg(
Arg::with_name("initial_delay")
.short("i")
.long("initial_delay")
.takes_value(true)
.default_value("5")
.help("Epoch delay for new beacon node to start syncing"),
)
.arg(
Arg::with_name("sync_timeout")
.long("sync_timeout")
.takes_value(true)
.default_value("10")
.help("Number of epochs after which newly added beacon nodes must be synced"),
)
.arg(
Arg::with_name("strategy")
.long("strategy")
.takes_value(true)
.default_value("all")
.possible_values(&["one-node", "two-nodes", "mixed", "all"])
.help("Sync verification strategy to run."),
.help("Continue after checks (default false)"),
),
)
}