Update Validator RPC and cache building
This commit is contained in:
parent
d7289ab55e
commit
6f0c0e47c3
@ -348,6 +348,11 @@ where
|
|||||||
|
|
||||||
per_slot_processing(&mut *state, &latest_block_header, &self.spec)?;
|
per_slot_processing(&mut *state, &latest_block_header, &self.spec)?;
|
||||||
}
|
}
|
||||||
|
state.build_epoch_cache(RelativeEpoch::Previous, &self.spec)?;
|
||||||
|
state.build_epoch_cache(RelativeEpoch::Current, &self.spec)?;
|
||||||
|
state.build_epoch_cache(RelativeEpoch::NextWithoutRegistryChange, &self.spec)?;
|
||||||
|
state.build_epoch_cache(RelativeEpoch::NextWithRegistryChange, &self.spec)?;
|
||||||
|
state.update_pubkey_cache()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -58,13 +58,13 @@ impl ValidatorService for ValidatorServiceInstance {
|
|||||||
.collect();
|
.collect();
|
||||||
let validator_proposers = match validator_proposers {
|
let validator_proposers = match validator_proposers {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(_) => {
|
Err(e) => {
|
||||||
// could not get the validator proposer index
|
// could not get the validator proposer index
|
||||||
let log_clone = self.log.clone();
|
let log_clone = self.log.clone();
|
||||||
let f = sink
|
let f = sink
|
||||||
.fail(RpcStatus::new(
|
.fail(RpcStatus::new(
|
||||||
RpcStatusCode::InvalidArgument,
|
RpcStatusCode::FailedPrecondition,
|
||||||
Some("Invalid public_key".to_string()),
|
Some(format!("Could not find beacon proposers: {:?}", e)),
|
||||||
))
|
))
|
||||||
.map_err(move |e| warn!(log_clone, "failed to reply {:?} : {:?}", req, e));
|
.map_err(move |e| warn!(log_clone, "failed to reply {:?} : {:?}", req, e));
|
||||||
return ctx.spawn(f);
|
return ctx.spawn(f);
|
||||||
@ -82,7 +82,7 @@ impl ValidatorService for ValidatorServiceInstance {
|
|||||||
let f = sink
|
let f = sink
|
||||||
.fail(RpcStatus::new(
|
.fail(RpcStatus::new(
|
||||||
RpcStatusCode::InvalidArgument,
|
RpcStatusCode::InvalidArgument,
|
||||||
Some("Invalid public_key".to_string()),
|
Some("apurple Invalid public_key".to_string()),
|
||||||
))
|
))
|
||||||
.map_err(move |e| warn!(log_clone, "failed to reply {:?}", req));
|
.map_err(move |e| warn!(log_clone, "failed to reply {:?}", req));
|
||||||
return ctx.spawn(f);
|
return ctx.spawn(f);
|
||||||
|
@ -120,7 +120,7 @@ impl TestingBeaconStateBuilder {
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let genesis_time = 1553647464; // arbitrary
|
let genesis_time = 1553740824; // arbitrary
|
||||||
|
|
||||||
let mut state = BeaconState::genesis(
|
let mut state = BeaconState::genesis(
|
||||||
genesis_time,
|
genesis_time,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use clap::ArgMatches;
|
|
||||||
use bincode;
|
use bincode;
|
||||||
use bls::Keypair;
|
use bls::Keypair;
|
||||||
|
use clap::ArgMatches;
|
||||||
use slog::{debug, error, info};
|
use slog::{debug, error, info};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
@ -67,6 +67,7 @@ impl Config {
|
|||||||
config.spec = match spec_str {
|
config.spec = match spec_str {
|
||||||
"foundation" => ChainSpec::foundation(),
|
"foundation" => ChainSpec::foundation(),
|
||||||
"few_validators" => ChainSpec::few_validators(),
|
"few_validators" => ChainSpec::few_validators(),
|
||||||
|
"lighthouse_testnet" => ChainSpec::lighthouse_testnet(),
|
||||||
// Should be impossible due to clap's `possible_values(..)` function.
|
// Should be impossible due to clap's `possible_values(..)` function.
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
@ -43,8 +43,8 @@ fn main() {
|
|||||||
.short("s")
|
.short("s")
|
||||||
.help("Configuration of Beacon Chain")
|
.help("Configuration of Beacon Chain")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.possible_values(&["foundation", "few_validators"])
|
.possible_values(&["foundation", "few_validators", "lighthouse_testnet"])
|
||||||
.default_value("foundation"),
|
.default_value("lighthouse_testnet"),
|
||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user