Altair consensus changes and refactors (#2279)

## Proposed Changes

Implement the consensus changes necessary for the upcoming Altair hard fork.

## Additional Info

This is quite a heavy refactor, with pivotal types like the `BeaconState` and `BeaconBlock` changing from structs to enums. This ripples through the whole codebase with field accesses changing to methods, e.g. `state.slot` => `state.slot()`.


Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
Michael Sproul
2021-07-09 06:15:32 +00:00
parent 89361573d4
commit b4689e20c6
271 changed files with 9652 additions and 8444 deletions

View File

@@ -209,7 +209,7 @@ impl<E: EthSpec> CandidateBeaconNode<E> {
/// Checks if the node has the correct specification.
async fn is_compatible(&self, spec: &ChainSpec, log: &Logger) -> Result<(), CandidateError> {
let yaml_config = self
let config_and_preset = self
.beacon_node
.get_config_spec()
.await
@@ -224,9 +224,8 @@ impl<E: EthSpec> CandidateBeaconNode<E> {
})?
.data;
let beacon_node_spec = yaml_config
.apply_to_chain_spec::<E>(&E::default_spec())
.ok_or_else(|| {
let beacon_node_spec =
ChainSpec::from_config::<E>(&config_and_preset.config).ok_or_else(|| {
error!(
log,
"The minimal/mainnet spec type of the beacon node does not match the validator \
@@ -236,11 +235,12 @@ impl<E: EthSpec> CandidateBeaconNode<E> {
CandidateError::Incompatible
})?;
if !yaml_config.extra_fields.is_empty() {
if !config_and_preset.extra_fields.is_empty() {
debug!(
log,
"Beacon spec includes unknown fields";
"fields" => ?yaml_config.extra_fields
"endpoint" => %self.beacon_node,
"fields" => ?config_and_preset.extra_fields,
);
}