Altair validator client and HTTP API (#2404)

## Proposed Changes

* Implement the validator client and HTTP API changes necessary to support Altair


Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
Michael Sproul
2021-08-06 00:47:31 +00:00
parent 350b6f19de
commit 17a2c778e3
44 changed files with 3144 additions and 705 deletions

View File

@@ -23,8 +23,8 @@ use std::time::Duration;
use tokio::runtime::Runtime;
use tokio::sync::mpsc;
use types::{
test_utils::generate_deterministic_keypairs, Attestation, AttesterSlashing, MainnetEthSpec,
ProposerSlashing, SignedBeaconBlock, SignedVoluntaryExit, SubnetId,
test_utils::generate_deterministic_keypairs, Attestation, AttesterSlashing, EthSpec,
MainnetEthSpec, ProposerSlashing, SignedBeaconBlock, SignedVoluntaryExit, SubnetId,
};
type E = MainnetEthSpec;
@@ -71,9 +71,13 @@ impl Drop for TestRig {
impl TestRig {
pub fn new(chain_length: u64) -> Self {
let mut harness = BeaconChainHarness::new(
// This allows for testing voluntary exits without building out a massive chain.
let mut spec = E::default_spec();
spec.shard_committee_period = 2;
let harness = BeaconChainHarness::new(
MainnetEthSpec,
None,
Some(spec),
generate_deterministic_keypairs(VALIDATOR_COUNT),
);
@@ -151,13 +155,7 @@ impl TestRig {
let proposer_slashing = harness.make_proposer_slashing(2);
let voluntary_exit = harness.make_voluntary_exit(3, harness.chain.epoch().unwrap());
// Changing this *after* the chain has been initialized is a bit cheeky, but it shouldn't
// cause issue.
//
// This allows for testing voluntary exits without building out a massive chain.
harness.chain.spec.shard_committee_period = 2;
let chain = Arc::new(harness.chain);
let chain = harness.chain;
let (network_tx, _network_rx) = mpsc::unbounded_channel();

View File

@@ -27,8 +27,8 @@ impl<T: BeaconChainTypes> Worker<T> {
/// Creates a log if there is an internal error.
fn send_sync_message(&self, message: SyncMessage<T::EthSpec>) {
self.sync_tx.send(message).unwrap_or_else(|e| {
debug!(self.log, "Could not send message to the sync service, likely shutdown";
"error" => %e)
debug!(self.log, "Could not send message to the sync service";
"error" => %e)
});
}

View File

@@ -35,15 +35,13 @@ mod tests {
fn test_dht_persistence() {
let log = get_logger(false);
let beacon_chain = Arc::new(
BeaconChainHarness::new_with_store_config(
MinimalEthSpec,
None,
generate_deterministic_keypairs(8),
StoreConfig::default(),
)
.chain,
);
let beacon_chain = BeaconChainHarness::new_with_store_config(
MinimalEthSpec,
None,
generate_deterministic_keypairs(8),
StoreConfig::default(),
)
.chain;
let store = beacon_chain.store.clone();