mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 17:26:04 +00:00
Make account manager submit deposits
This commit is contained in:
@@ -2,11 +2,11 @@ mod cli;
|
|||||||
|
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use deposit_contract::DEPOSIT_GAS;
|
use deposit_contract::DEPOSIT_GAS;
|
||||||
use environment::RuntimeContext;
|
use environment::{Environment, RuntimeContext};
|
||||||
use eth2_testnet::Eth2TestnetDir;
|
use eth2_testnet::Eth2TestnetDir;
|
||||||
use futures::{stream::unfold, Future, IntoFuture, Stream};
|
use futures::{stream::unfold, Future, IntoFuture, Stream};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use slog::{crit, error, info};
|
use slog::{crit, error, info, Logger};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use types::{ChainSpec, EthSpec};
|
use types::{ChainSpec, EthSpec};
|
||||||
@@ -20,9 +20,9 @@ use web3::{
|
|||||||
pub use cli::cli_app;
|
pub use cli::cli_app;
|
||||||
|
|
||||||
/// Run the account manager, logging an error if the operation did not succeed.
|
/// Run the account manager, logging an error if the operation did not succeed.
|
||||||
pub fn run<T: EthSpec>(matches: &ArgMatches, context: RuntimeContext<T>) {
|
pub fn run<T: EthSpec>(matches: &ArgMatches, mut env: Environment<T>) {
|
||||||
let log = context.log.clone();
|
let log = env.core_context().log.clone();
|
||||||
match run_account_manager(matches, context) {
|
match run_account_manager(matches, env) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(e) => crit!(log, "Account manager failed"; "error" => e),
|
Err(e) => crit!(log, "Account manager failed"; "error" => e),
|
||||||
}
|
}
|
||||||
@@ -31,8 +31,9 @@ pub fn run<T: EthSpec>(matches: &ArgMatches, context: RuntimeContext<T>) {
|
|||||||
/// Run the account manager, returning an error if the operation did not succeed.
|
/// Run the account manager, returning an error if the operation did not succeed.
|
||||||
fn run_account_manager<T: EthSpec>(
|
fn run_account_manager<T: EthSpec>(
|
||||||
matches: &ArgMatches,
|
matches: &ArgMatches,
|
||||||
context: RuntimeContext<T>,
|
mut env: Environment<T>,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
|
let context = env.core_context();
|
||||||
let log = context.log.clone();
|
let log = context.log.clone();
|
||||||
|
|
||||||
let datadir = matches
|
let datadir = matches
|
||||||
@@ -60,7 +61,7 @@ fn run_account_manager<T: EthSpec>(
|
|||||||
|
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
("validator", Some(matches)) => match matches.subcommand() {
|
("validator", Some(matches)) => match matches.subcommand() {
|
||||||
("new", Some(matches)) => run_new_validator_subcommand(matches, datadir, context)?,
|
("new", Some(matches)) => run_new_validator_subcommand(matches, datadir, env)?,
|
||||||
_ => {
|
_ => {
|
||||||
return Err("Invalid 'validator new' command. See --help.".to_string());
|
return Err("Invalid 'validator new' command. See --help.".to_string());
|
||||||
}
|
}
|
||||||
@@ -85,8 +86,9 @@ enum KeygenMethod {
|
|||||||
fn run_new_validator_subcommand<T: EthSpec>(
|
fn run_new_validator_subcommand<T: EthSpec>(
|
||||||
matches: &ArgMatches,
|
matches: &ArgMatches,
|
||||||
datadir: PathBuf,
|
datadir: PathBuf,
|
||||||
context: RuntimeContext<T>,
|
mut env: Environment<T>,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
|
let context = env.core_context();
|
||||||
let log = context.log.clone();
|
let log = context.log.clone();
|
||||||
|
|
||||||
let methods: Vec<KeygenMethod> = match matches.subcommand() {
|
let methods: Vec<KeygenMethod> = match matches.subcommand() {
|
||||||
@@ -130,6 +132,12 @@ fn run_new_validator_subcommand<T: EthSpec>(
|
|||||||
.parse::<usize>()
|
.parse::<usize>()
|
||||||
.map_err(|e| format!("Unable to parse account-index: {}", e))?;
|
.map_err(|e| format!("Unable to parse account-index: {}", e))?;
|
||||||
|
|
||||||
|
info!(
|
||||||
|
log,
|
||||||
|
"Submitting validator deposits";
|
||||||
|
"eth1_node_http_endpoint" => eth1_endpoint
|
||||||
|
);
|
||||||
|
|
||||||
let deposit_contract = if let Some(testnet_dir_str) = matches.value_of("testnet-dir") {
|
let deposit_contract = if let Some(testnet_dir_str) = matches.value_of("testnet-dir") {
|
||||||
let testnet_dir = testnet_dir_str
|
let testnet_dir = testnet_dir_str
|
||||||
.parse::<PathBuf>()
|
.parse::<PathBuf>()
|
||||||
@@ -152,13 +160,23 @@ fn run_new_validator_subcommand<T: EthSpec>(
|
|||||||
.map_err(|e| format!("Unable to parse deposit-contract: {}", e))?
|
.map_err(|e| format!("Unable to parse deposit-contract: {}", e))?
|
||||||
};
|
};
|
||||||
|
|
||||||
context.executor.spawn(deposit_validators(
|
if let Err(()) = env.runtime().block_on(deposit_validators(
|
||||||
context.clone(),
|
context.clone(),
|
||||||
eth1_endpoint.to_string(),
|
eth1_endpoint.to_string(),
|
||||||
deposit_contract,
|
deposit_contract,
|
||||||
validators.clone(),
|
validators.clone(),
|
||||||
account_index,
|
account_index,
|
||||||
));
|
)) {
|
||||||
|
error!(
|
||||||
|
log,
|
||||||
|
"Failed to deposit validators";
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
info!(
|
||||||
|
log,
|
||||||
|
"Validator deposits complete";
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
@@ -179,16 +197,24 @@ fn deposit_validators<E: EthSpec>(
|
|||||||
account_index: usize,
|
account_index: usize,
|
||||||
) -> impl Future<Item = (), Error = ()> {
|
) -> impl Future<Item = (), Error = ()> {
|
||||||
let deposit_amount = context.eth2_config.spec.max_effective_balance;
|
let deposit_amount = context.eth2_config.spec.max_effective_balance;
|
||||||
let log = context.log.clone();
|
let log_1 = context.log.clone();
|
||||||
|
let log_2 = context.log.clone();
|
||||||
|
|
||||||
Http::new(ð1_endpoint)
|
Http::new(ð1_endpoint)
|
||||||
.map_err(|e| format!("Failed to start web3 HTTP transport: {:?}", e))
|
.map_err(move |e| {
|
||||||
|
error!(
|
||||||
|
log_1,
|
||||||
|
"Failed to start web3 HTTP transport";
|
||||||
|
"error" => format!("{:?}", e)
|
||||||
|
)
|
||||||
|
})
|
||||||
.into_future()
|
.into_future()
|
||||||
.and_then(move |(_event_loop, transport)| {
|
.and_then(move |(event_loop, transport)| {
|
||||||
let web3 = Web3::new(transport);
|
let web3 = Web3::new(transport);
|
||||||
|
|
||||||
unfold(validators.into_iter(), move |mut validators| {
|
unfold(validators.into_iter(), move |mut validators| {
|
||||||
let web3 = web3.clone();
|
let web3 = web3.clone();
|
||||||
|
let log = log_2.clone();
|
||||||
|
|
||||||
validators.next().map(move |validator| {
|
validators.next().map(move |validator| {
|
||||||
deposit_validator(
|
deposit_validator(
|
||||||
@@ -197,14 +223,16 @@ fn deposit_validators<E: EthSpec>(
|
|||||||
&validator,
|
&validator,
|
||||||
deposit_amount,
|
deposit_amount,
|
||||||
account_index,
|
account_index,
|
||||||
|
log,
|
||||||
)
|
)
|
||||||
.map(|()| ((), validators))
|
.map(|()| ((), validators))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
.map(|_| event_loop)
|
||||||
})
|
})
|
||||||
.map_err(move |e| error!(log, "Error whilst depositing validator"; "error" => e))
|
// Web3 gives errors if the event loop is dropped whilst performing requests.
|
||||||
.map(|_| ())
|
.map(|event_loop| drop(event_loop))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deposit_validator(
|
fn deposit_validator(
|
||||||
@@ -213,9 +241,20 @@ fn deposit_validator(
|
|||||||
validator: &ValidatorDirectory,
|
validator: &ValidatorDirectory,
|
||||||
deposit_amount: u64,
|
deposit_amount: u64,
|
||||||
account_index: usize,
|
account_index: usize,
|
||||||
) -> impl Future<Item = (), Error = String> {
|
log: Logger,
|
||||||
|
) -> impl Future<Item = (), Error = ()> {
|
||||||
let web3_1 = web3.clone();
|
let web3_1 = web3.clone();
|
||||||
|
|
||||||
|
let log_1 = log.clone();
|
||||||
|
let log_2 = log.clone();
|
||||||
|
|
||||||
|
let validator_voting_pubkey_1 = validator
|
||||||
|
.voting_keypair
|
||||||
|
.clone()
|
||||||
|
.expect("Validators must have a voting public key")
|
||||||
|
.pk;
|
||||||
|
let validator_voting_pubkey_2 = validator_voting_pubkey_1.clone();
|
||||||
|
|
||||||
let deposit_data = validator
|
let deposit_data = validator
|
||||||
.deposit_data
|
.deposit_data
|
||||||
.clone()
|
.clone()
|
||||||
@@ -236,7 +275,7 @@ fn deposit_validator(
|
|||||||
to: Some(deposit_contract),
|
to: Some(deposit_contract),
|
||||||
gas: Some(U256::from(DEPOSIT_GAS)),
|
gas: Some(U256::from(DEPOSIT_GAS)),
|
||||||
gas_price: None,
|
gas_price: None,
|
||||||
value: Some(U256::from(deposit_amount)),
|
value: Some(U256::from(from_gwei(deposit_amount))),
|
||||||
data: Some(deposit_data.into()),
|
data: Some(deposit_data.into()),
|
||||||
nonce: None,
|
nonce: None,
|
||||||
condition: None,
|
condition: None,
|
||||||
@@ -247,7 +286,26 @@ fn deposit_validator(
|
|||||||
.send_transaction(tx_request)
|
.send_transaction(tx_request)
|
||||||
.map_err(|e| format!("Failed to call deposit fn: {:?}", e))
|
.map_err(|e| format!("Failed to call deposit fn: {:?}", e))
|
||||||
})
|
})
|
||||||
.map(|_| ())
|
.map(move |tx| {
|
||||||
|
info!(
|
||||||
|
log_1,
|
||||||
|
"Validator deposit successful";
|
||||||
|
"eth1_tx_hash" => format!("{:?}", tx),
|
||||||
|
"validator_voting_pubkey" => format!("{:?}", validator_voting_pubkey_1)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.map_err(move |e| {
|
||||||
|
error!(
|
||||||
|
log_2,
|
||||||
|
"Validator deposit_failed";
|
||||||
|
"error" => e,
|
||||||
|
"validator_voting_pubkey" => format!("{:?}", validator_voting_pubkey_2)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn from_gwei(gwei: u64) -> U256 {
|
||||||
|
U256::from(gwei) * U256::exp10(9)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a validator directory for each of the key generation methods provided in `methods`.
|
/// Produces a validator directory for each of the key generation methods provided in `methods`.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use std::hash::{Hash, Hasher};
|
|||||||
///
|
///
|
||||||
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
|
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
|
||||||
/// serialization).
|
/// serialization).
|
||||||
#[derive(Debug, Clone, Eq)]
|
#[derive(Clone, Eq)]
|
||||||
pub struct FakePublicKey {
|
pub struct FakePublicKey {
|
||||||
bytes: Vec<u8>,
|
bytes: Vec<u8>,
|
||||||
/// Never used, only use for compatibility with "real" `PublicKey`.
|
/// Never used, only use for compatibility with "real" `PublicKey`.
|
||||||
@@ -93,6 +93,12 @@ impl fmt::Display for FakePublicKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for FakePublicKey {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "0x{}", self.as_hex_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl default::Default for FakePublicKey {
|
impl default::Default for FakePublicKey {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let secret_key = SecretKey::random();
|
let secret_key = SecretKey::random();
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ impl fmt::Display for PublicKey {
|
|||||||
|
|
||||||
impl fmt::Debug for PublicKey {
|
impl fmt::Debug for PublicKey {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{}", self.as_hex_string())
|
write!(f, "0x{}", self.as_hex_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ use web3::{transports::Http, Web3};
|
|||||||
|
|
||||||
pub const DEFAULT_DATA_DIR: &str = ".lighthouse/testnet";
|
pub const DEFAULT_DATA_DIR: &str = ".lighthouse/testnet";
|
||||||
|
|
||||||
pub fn new_testnet<T: EthSpec>(
|
pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<(), String> {
|
||||||
mut env: Environment<T>,
|
|
||||||
matches: &ArgMatches,
|
|
||||||
) -> Result<(), String> {
|
|
||||||
let min_genesis_time = matches
|
let min_genesis_time = matches
|
||||||
.value_of("min_genesis_time")
|
.value_of("min_genesis_time")
|
||||||
.ok_or_else(|| "min_genesis_time not specified")?
|
.ok_or_else(|| "min_genesis_time not specified")?
|
||||||
@@ -65,6 +62,8 @@ pub fn new_testnet<T: EthSpec>(
|
|||||||
|
|
||||||
info!("Present eth1 block number is {}", deploy_block);
|
info!("Present eth1 block number is {}", deploy_block);
|
||||||
|
|
||||||
|
info!("Deploying the bytecode at https://github.com/sigp/unsafe-eth2-deposit-contract",);
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"Submitting deployment transaction, waiting for {} confirmations",
|
"Submitting deployment transaction, waiting for {} confirmations",
|
||||||
confirmations
|
confirmations
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
use clap::ArgMatches;
|
|
||||||
use environment::Environment;
|
|
||||||
use eth1_test_rig::{DelayThenDeposit, DepositContract};
|
|
||||||
use futures::Future;
|
|
||||||
use std::time::Duration;
|
|
||||||
use types::{test_utils::generate_deterministic_keypair, EthSpec, Hash256};
|
|
||||||
use web3::{transports::Http, Web3};
|
|
||||||
|
|
||||||
pub fn run_deposit_contract<T: EthSpec>(
|
|
||||||
mut env: Environment<T>,
|
|
||||||
matches: &ArgMatches,
|
|
||||||
) -> Result<(), String> {
|
|
||||||
let count = matches
|
|
||||||
.value_of("count")
|
|
||||||
.ok_or_else(|| "Deposit count not specified")?
|
|
||||||
.parse::<usize>()
|
|
||||||
.map_err(|e| format!("Failed to parse deposit count: {}", e))?;
|
|
||||||
|
|
||||||
let delay = matches
|
|
||||||
.value_of("delay")
|
|
||||||
.ok_or_else(|| "Deposit count not specified")?
|
|
||||||
.parse::<u64>()
|
|
||||||
.map(Duration::from_millis)
|
|
||||||
.map_err(|e| format!("Failed to parse deposit count: {}", e))?;
|
|
||||||
|
|
||||||
let confirmations = matches
|
|
||||||
.value_of("confirmations")
|
|
||||||
.ok_or_else(|| "Confirmations not specified")?
|
|
||||||
.parse::<usize>()
|
|
||||||
.map_err(|e| format!("Failed to parse confirmations: {}", e))?;
|
|
||||||
|
|
||||||
let endpoint = matches
|
|
||||||
.value_of("endpoint")
|
|
||||||
.ok_or_else(|| "Endpoint not specified")?;
|
|
||||||
|
|
||||||
let (_event_loop, transport) = Http::new(&endpoint).map_err(|e| {
|
|
||||||
format!(
|
|
||||||
"Failed to start HTTP transport connected to ganache: {:?}",
|
|
||||||
e
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
let web3 = Web3::new(transport);
|
|
||||||
|
|
||||||
let deposit_contract = env
|
|
||||||
.runtime()
|
|
||||||
.block_on(DepositContract::deploy(web3, confirmations))
|
|
||||||
.map_err(|e| format!("Failed to deploy contract: {}", e))?;
|
|
||||||
|
|
||||||
info!(
|
|
||||||
"Deposit contract deployed. Address: {}",
|
|
||||||
deposit_contract.address()
|
|
||||||
);
|
|
||||||
|
|
||||||
env.runtime()
|
|
||||||
.block_on(do_deposits::<T>(deposit_contract, count, delay))
|
|
||||||
.map_err(|e| format!("Failed to submit deposits: {}", e))?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn do_deposits<T: EthSpec>(
|
|
||||||
deposit_contract: DepositContract,
|
|
||||||
count: usize,
|
|
||||||
delay: Duration,
|
|
||||||
) -> impl Future<Item = (), Error = String> {
|
|
||||||
let deposits = (0..count)
|
|
||||||
.map(|i| DelayThenDeposit {
|
|
||||||
deposit: deposit_contract.deposit_helper::<T>(
|
|
||||||
generate_deterministic_keypair(i),
|
|
||||||
Hash256::from_low_u64_le(i as u64),
|
|
||||||
32_000_000_000,
|
|
||||||
),
|
|
||||||
delay,
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
deposit_contract.deposit_multiple(deposits)
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
mod deposit_contract;
|
mod deploy_deposit_contract;
|
||||||
mod parse_hex;
|
mod parse_hex;
|
||||||
mod pycli;
|
mod pycli;
|
||||||
mod testnet;
|
|
||||||
mod transition_blocks;
|
mod transition_blocks;
|
||||||
|
|
||||||
use clap::{App, Arg, SubCommand};
|
use clap::{App, Arg, SubCommand};
|
||||||
use deposit_contract::run_deposit_contract;
|
|
||||||
use environment::EnvironmentBuilder;
|
use environment::EnvironmentBuilder;
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use parse_hex::run_parse_hex;
|
use parse_hex::run_parse_hex;
|
||||||
@@ -113,46 +111,10 @@ fn main() {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("deposit-contract")
|
SubCommand::with_name("deploy-deposit-contract")
|
||||||
.about(
|
.about(
|
||||||
"Uses an eth1 test rpc (e.g., ganache-cli) to simulate the deposit contract.",
|
"Deploy an eth1 deposit contract and create a ~/.lighthouse/testnet directory \
|
||||||
)
|
(unless another directory is specified).",
|
||||||
.arg(
|
|
||||||
Arg::with_name("count")
|
|
||||||
.short("c")
|
|
||||||
.value_name("INTEGER")
|
|
||||||
.takes_value(true)
|
|
||||||
.required(true)
|
|
||||||
.help("The number of deposits to be submitted."),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("delay")
|
|
||||||
.short("d")
|
|
||||||
.value_name("MILLIS")
|
|
||||||
.takes_value(true)
|
|
||||||
.required(true)
|
|
||||||
.help("The delay (in milliseconds) between each deposit"),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("endpoint")
|
|
||||||
.short("e")
|
|
||||||
.value_name("HTTP_SERVER")
|
|
||||||
.takes_value(true)
|
|
||||||
.default_value("http://localhost:8545")
|
|
||||||
.help("The URL to the eth1 JSON-RPC http API."),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("confirmations")
|
|
||||||
.value_name("INTEGER")
|
|
||||||
.takes_value(true)
|
|
||||||
.default_value("3")
|
|
||||||
.help("The number of block confirmations before declaring the contract deployed."),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.subcommand(
|
|
||||||
SubCommand::with_name("testnet")
|
|
||||||
.about(
|
|
||||||
"Deploy an eth1 deposit contract and create files with testnet details.",
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("output")
|
Arg::with_name("output")
|
||||||
@@ -254,10 +216,10 @@ fn main() {
|
|||||||
}
|
}
|
||||||
("pycli", Some(matches)) => run_pycli::<LocalEthSpec>(matches)
|
("pycli", Some(matches)) => run_pycli::<LocalEthSpec>(matches)
|
||||||
.unwrap_or_else(|e| error!("Failed to run pycli: {}", e)),
|
.unwrap_or_else(|e| error!("Failed to run pycli: {}", e)),
|
||||||
("deposit-contract", Some(matches)) => run_deposit_contract::<LocalEthSpec>(env, matches)
|
("deploy-deposit-contract", Some(matches)) => {
|
||||||
.unwrap_or_else(|e| error!("Failed to run deposit contract sim: {}", e)),
|
deploy_deposit_contract::run::<LocalEthSpec>(env, matches)
|
||||||
("testnet", Some(matches)) => testnet::new_testnet::<LocalEthSpec>(env, matches)
|
.unwrap_or_else(|e| error!("Failed to run deploy-deposit-contract commmand: {}", e))
|
||||||
.unwrap_or_else(|e| error!("Failed to run testnet commmand: {}", e)),
|
}
|
||||||
(other, _) => error!("Unknown subcommand {}. See --help.", other),
|
(other, _) => error!("Unknown subcommand {}. See --help.", other),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,10 +133,12 @@ fn run<E: EthSpec>(
|
|||||||
// Creating a command which can run both might be useful future works.
|
// Creating a command which can run both might be useful future works.
|
||||||
|
|
||||||
if let Some(sub_matches) = matches.subcommand_matches("account_manager") {
|
if let Some(sub_matches) = matches.subcommand_matches("account_manager") {
|
||||||
let runtime_context = environment.core_context();
|
// Pass the entire `environment` to the account manager so it can run blocking operations.
|
||||||
|
account_manager::run(sub_matches, environment);
|
||||||
|
|
||||||
account_manager::run(sub_matches, runtime_context);
|
// Exit as soon as account manager returns control.
|
||||||
}
|
return Ok(());
|
||||||
|
};
|
||||||
|
|
||||||
let beacon_node = if let Some(sub_matches) = matches.subcommand_matches("beacon_node") {
|
let beacon_node = if let Some(sub_matches) = matches.subcommand_matches("beacon_node") {
|
||||||
let runtime_context = environment.core_context();
|
let runtime_context = environment.core_context();
|
||||||
|
|||||||
Reference in New Issue
Block a user