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

@@ -42,7 +42,7 @@ impl LocalSignerTestData<BeaconBlock<E>> {
&self.spec,
);
signed_block.signature.to_string()
signed_block.signature().to_string()
}
}

View File

@@ -239,31 +239,39 @@ pub fn get_block<E: EthSpec>(seed: u64) -> BeaconBlock<E> {
let mut block: BeaconBlock<E> = BeaconBlock::empty(spec);
for _ in 0..E::MaxProposerSlashings::to_usize() {
block
.body
.proposer_slashings
.body_mut()
.proposer_slashings_mut()
.push(proposer_slashing.clone())
.unwrap();
}
for _ in 0..E::MaxDeposits::to_usize() {
block.body.deposits.push(deposit.clone()).unwrap();
block
.body_mut()
.deposits_mut()
.push(deposit.clone())
.unwrap();
}
for _ in 0..E::MaxVoluntaryExits::to_usize() {
block
.body
.voluntary_exits
.body_mut()
.voluntary_exits_mut()
.push(signed_voluntary_exit.clone())
.unwrap();
}
for _ in 0..E::MaxAttesterSlashings::to_usize() {
block
.body
.attester_slashings
.body_mut()
.attester_slashings_mut()
.push(attester_slashing.clone())
.unwrap();
}
for _ in 0..E::MaxAttestations::to_usize() {
block.body.attestations.push(attestation.clone()).unwrap();
block
.body_mut()
.attestations_mut()
.push(attestation.clone())
.unwrap();
}
block
}