lighthouse/testing/simulator/src/cli.rs
Michael Sproul aad397f00a Resolve Rust 1.56 lints and warnings (#2728)
## Issue Addressed

When compiling with Rust 1.56.0 the compiler generates 3 instances of this warning:

```
warning: trailing semicolon in macro used in expression position
   --> common/eth2_network_config/src/lib.rs:181:24
    |
181 |                     })?;
    |                        ^
...
195 |         let deposit_contract_deploy_block = load_from_file!(DEPLOY_BLOCK_FILE);
    |                                             ---------------------------------- in this macro invocation
    |
    = note: `#[warn(semicolon_in_expressions_from_macros)]` on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
    = note: this warning originates in the macro `load_from_file` (in Nightly builds, run with -Z macro-backtrace for more info)
```

This warning is completely harmless, but will be visible to users compiling Lighthouse v2.0.1 (or earlier) with Rust 1.56.0 (to be released October 21st). It is **completely safe** to ignore this warning, it's just a superficial change to Rust's syntax.

## Proposed Changes

This PR removes the semi-colon as recommended, and fixes the new Clippy lints from 1.56.0
2021-10-19 00:30:42 +00:00

109 lines
5.0 KiB
Rust

use clap::{App, Arg, SubCommand};
pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
App::new("simulator")
.version(crate_version!())
.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 `ganache-cli` instance (you must have `ganache-cli` \
installed and avaliable on your path). All beacon nodes independently listen \
for genesis from the deposit contract, then start operating. \
\
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")
.short("n")
.long("nodes")
.takes_value(true)
.default_value("4")
.help("Number of 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("continue_after_checks")
.short("c")
.long("continue_after_checks")
.takes_value(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("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"))
.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."),
),
)
}