Update Validator RPC and cache building

This commit is contained in:
Age Manning 2019-03-28 14:32:02 +11:00
parent d7289ab55e
commit 6f0c0e47c3
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93
5 changed files with 14 additions and 8 deletions

View File

@ -348,6 +348,11 @@ where
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(())
}

View File

@ -58,13 +58,13 @@ impl ValidatorService for ValidatorServiceInstance {
.collect();
let validator_proposers = match validator_proposers {
Ok(v) => v,
Err(_) => {
Err(e) => {
// could not get the validator proposer index
let log_clone = self.log.clone();
let f = sink
.fail(RpcStatus::new(
RpcStatusCode::InvalidArgument,
Some("Invalid public_key".to_string()),
RpcStatusCode::FailedPrecondition,
Some(format!("Could not find beacon proposers: {:?}", e)),
))
.map_err(move |e| warn!(log_clone, "failed to reply {:?} : {:?}", req, e));
return ctx.spawn(f);
@ -82,7 +82,7 @@ impl ValidatorService for ValidatorServiceInstance {
let f = sink
.fail(RpcStatus::new(
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));
return ctx.spawn(f);

View File

@ -120,7 +120,7 @@ impl TestingBeaconStateBuilder {
})
.collect();
let genesis_time = 1553647464; // arbitrary
let genesis_time = 1553740824; // arbitrary
let mut state = BeaconState::genesis(
genesis_time,

View File

@ -1,6 +1,6 @@
use clap::ArgMatches;
use bincode;
use bls::Keypair;
use clap::ArgMatches;
use slog::{debug, error, info};
use std::fs;
use std::fs::File;
@ -67,6 +67,7 @@ impl Config {
config.spec = match spec_str {
"foundation" => ChainSpec::foundation(),
"few_validators" => ChainSpec::few_validators(),
"lighthouse_testnet" => ChainSpec::lighthouse_testnet(),
// Should be impossible due to clap's `possible_values(..)` function.
_ => unreachable!(),
};

View File

@ -43,8 +43,8 @@ fn main() {
.short("s")
.help("Configuration of Beacon Chain")
.takes_value(true)
.possible_values(&["foundation", "few_validators"])
.default_value("foundation"),
.possible_values(&["foundation", "few_validators", "lighthouse_testnet"])
.default_value("lighthouse_testnet"),
)
.get_matches();