Fix consensus, SSZ, tree hash & run merge EF tests (#2622)

* Update to v1.1.0-beta.4 (squash of #2548)

* SSZ, cached tree hash, EF tests
This commit is contained in:
Michael Sproul
2021-09-24 14:55:21 +10:00
committed by Paul Hauner
parent 5687c56d51
commit cce855f9ea
21 changed files with 282 additions and 186 deletions

View File

@@ -139,10 +139,10 @@ pub fn per_block_processing<T: EthSpec>(
process_eth1_data(state, block.body().eth1_data())?;
process_operations(state, block.body(), proposer_index, verify_signatures, spec)?;
if let BeaconBlockRef::Altair(inner) = block {
if let Some(sync_aggregate) = block.body().sync_aggregate() {
process_sync_aggregate(
state,
&inner.body.sync_aggregate,
sync_aggregate,
proposer_index,
verify_signatures,
spec,
@@ -150,7 +150,11 @@ pub fn per_block_processing<T: EthSpec>(
}
if is_execution_enabled(state, block.body()) {
process_execution_payload(state, block.body().execution_payload().unwrap(), spec)?
let payload = block
.body()
.execution_payload()
.ok_or(BlockProcessingError::IncorrectStateType)?;
process_execution_payload(state, payload, spec)?;
}
Ok(())

View File

@@ -77,6 +77,7 @@ pub enum BlockProcessingError {
expected: u64,
found: u64,
},
ExecutionInvalid,
}
impl From<BeaconStateError> for BlockProcessingError {

View File

@@ -353,15 +353,15 @@ pub fn process_deposit<T: EthSpec>(
state.validators_mut().push(validator)?;
state.balances_mut().push(deposit.data.amount)?;
// Altair-specific initializations.
if let BeaconState::Altair(altair_state) = state {
altair_state
.previous_epoch_participation
.push(ParticipationFlags::default())?;
altair_state
.current_epoch_participation
.push(ParticipationFlags::default())?;
altair_state.inactivity_scores.push(0)?;
// Altair or later initializations.
if let Ok(previous_epoch_participation) = state.previous_epoch_participation_mut() {
previous_epoch_participation.push(ParticipationFlags::default())?;
}
if let Ok(current_epoch_participation) = state.current_epoch_participation_mut() {
current_epoch_participation.push(ParticipationFlags::default())?;
}
if let Ok(inactivity_scores) = state.inactivity_scores_mut() {
inactivity_scores.push(0)?;
}
}