mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
* upgrade clap to v4.5 * cli fixes * Merge branch 'unstable' of https://github.com/sigp/lighthouse into upgrade-clap-cli * value parser for mnemonic * Merge branch 'unstable' of https://github.com/sigp/lighthouse into upgrade-clap-cli * merge unstable * default --format val * fix eth sim * fix eth sim * merge conflicts * resolve beta compiler issue * add num args, version * add custom flag parser, make rate limiter flags clap friendly * remove unneeded check * fmt * update * alphabetic order * resolve merge conflict * fix test * resolve conflicts * fix test * revert removed if statement * fmt got me again * fix broken flag * make cli * make cli * update * remove -e files * update * cli help updates * Merge branch 'unstable' of https://github.com/sigp/lighthouse into upgrade-clap-cli * cli help updates * md files * merge conflict * merge conflicts * md * help text, text width, and a few flag fixes * fmt * merge * revert * revert * resolve merge conflicts * merge conflicts * revert simulator changes * require at least one arg * fix eth sim cli * resolve merge conflicts * book changes * md changes * cli check * cli check * retry cli check * retry cli check * Merge branch 'unstable' of https://github.com/sigp/lighthouse into upgrade-clap-cli * cli * Merge remote-tracking branch 'origin/unstable' into upgrade-clap-cli * Update CLI docs for Goerli removal * Fix cargo lock
33 lines
1.3 KiB
Rust
33 lines
1.3 KiB
Rust
use clap::ArgMatches;
|
|
use environment::Environment;
|
|
use types::EthSpec;
|
|
|
|
use eth1_test_rig::{Http, Provider};
|
|
|
|
pub fn run<E: EthSpec>(env: Environment<E>, matches: &ArgMatches) -> Result<(), String> {
|
|
let eth1_http: String = clap_utils::parse_required(matches, "eth1-http")?;
|
|
let confirmations: usize = clap_utils::parse_required(matches, "confirmations")?;
|
|
let validator_count: Option<usize> = clap_utils::parse_optional(matches, "validator-count")?;
|
|
|
|
let client = Provider::<Http>::try_from(ð1_http)
|
|
.map_err(|e| format!("Unable to connect to eth1 HTTP: {:?}", e))?;
|
|
|
|
env.runtime().block_on(async {
|
|
let contract = eth1_test_rig::DepositContract::deploy(client, confirmations, None)
|
|
.await
|
|
.map_err(|e| format!("Failed to deploy deposit contract: {:?}", e))?;
|
|
|
|
println!("Deposit contract address: {:?}", contract.address());
|
|
|
|
// Deposit insecure validators to the deposit contract created
|
|
if let Some(validator_count) = validator_count {
|
|
let amount = env.eth2_config.spec.max_effective_balance;
|
|
for i in 0..validator_count {
|
|
println!("Submitting deposit for validator {}...", i);
|
|
contract.deposit_deterministic_async::<E>(i, amount).await?;
|
|
}
|
|
}
|
|
Ok(())
|
|
})
|
|
}
|