Update merge consensus to v1.1.0-beta.5 (#2630)

This commit is contained in:
Michael Sproul
2021-09-27 09:42:29 +10:00
committed by Paul Hauner
parent b48f133a8c
commit 251ddbd696
5 changed files with 43 additions and 45 deletions

View File

@@ -127,6 +127,17 @@ pub fn per_block_processing<T: EthSpec>(
state.build_committee_cache(RelativeEpoch::Previous, spec)?;
state.build_committee_cache(RelativeEpoch::Current, spec)?;
// The call to the `process_execution_payload` must happen before the call to the
// `process_randao` as the former depends on the `randao_mix` computed with the reveal of the
// previous block.
if is_execution_enabled(state, block.body()) {
let payload = block
.body()
.execution_payload()
.ok_or(BlockProcessingError::IncorrectStateType)?;
process_execution_payload(state, payload, spec)?;
}
process_randao(state, block, verify_signatures, spec)?;
process_eth1_data(state, block.body().eth1_data())?;
process_operations(state, block.body(), proposer_index, verify_signatures, spec)?;
@@ -141,14 +152,6 @@ pub fn per_block_processing<T: EthSpec>(
)?;
}
if is_execution_enabled(state, block.body()) {
let payload = block
.body()
.execution_payload()
.ok_or(BlockProcessingError::IncorrectStateType)?;
process_execution_payload(state, payload, spec)?;
}
Ok(())
}
@@ -344,13 +347,6 @@ pub fn process_execution_payload<T: EthSpec>(
found: payload.block_number,
}
);
block_verify!(
payload.random == *state.get_randao_mix(state.current_epoch())?,
BlockProcessingError::ExecutionRandaoMismatch {
expected: *state.get_randao_mix(state.current_epoch())?,
found: payload.random,
}
);
block_verify!(
is_valid_gas_limit(payload, state.latest_execution_payload_header()?)?,
BlockProcessingError::ExecutionInvalidGasLimit {
@@ -359,6 +355,13 @@ pub fn process_execution_payload<T: EthSpec>(
}
);
}
block_verify!(
payload.random == *state.get_randao_mix(state.current_epoch())?,
BlockProcessingError::ExecutionRandaoMismatch {
expected: *state.get_randao_mix(state.current_epoch())?,
found: payload.random,
}
);
let timestamp = compute_timestamp_at_slot(state, spec)?;
block_verify!(
@@ -380,6 +383,7 @@ pub fn process_execution_payload<T: EthSpec>(
gas_limit: payload.gas_limit,
gas_used: payload.gas_used,
timestamp: payload.timestamp,
extra_data: payload.extra_data.clone(),
base_fee_per_gas: payload.base_fee_per_gas,
block_hash: payload.block_hash,
transactions_root: payload.transactions.tree_hash_root(),