mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 12:11:59 +00:00
1.1.5 merge spec tests (#2781)
* Fix arbitrary check kintsugi * Add merge chain spec fields, and a function to determine which constant to use based on the state variant * increment spec test version * Remove `Transaction` enum wrapper * Remove Transaction new-type * Remove gas validations * Add `--terminal-block-hash-epoch-override` flag * Increment spec tests version to 1.1.5 * Remove extraneous gossip verification https://github.com/ethereum/consensus-specs/pull/2687 * - Remove unused Error variants - Require both "terminal-block-hash-epoch-override" and "terminal-block-hash-override" when either flag is used * - Remove a couple more unused Error variants Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
@@ -295,50 +295,6 @@ pub fn get_new_eth1_data<T: EthSpec>(
|
||||
}
|
||||
}
|
||||
|
||||
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#is_valid_gas_limit
|
||||
pub fn verify_is_valid_gas_limit<T: EthSpec>(
|
||||
payload: &ExecutionPayload<T>,
|
||||
parent: &ExecutionPayloadHeader<T>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
// check if payload used too much gas
|
||||
if payload.gas_used > payload.gas_limit {
|
||||
return Err(BlockProcessingError::ExecutionInvalidGasLimit {
|
||||
used: payload.gas_used,
|
||||
limit: payload.gas_limit,
|
||||
});
|
||||
}
|
||||
// check if payload changed the gas limit too much
|
||||
if payload.gas_limit
|
||||
>= parent
|
||||
.gas_limit
|
||||
.safe_add(parent.gas_limit.safe_div(T::gas_limit_denominator())?)?
|
||||
{
|
||||
return Err(BlockProcessingError::ExecutionInvalidGasLimitIncrease {
|
||||
limit: payload.gas_limit,
|
||||
parent_limit: parent.gas_limit,
|
||||
});
|
||||
}
|
||||
if payload.gas_limit
|
||||
<= parent
|
||||
.gas_limit
|
||||
.safe_sub(parent.gas_limit.safe_div(T::gas_limit_denominator())?)?
|
||||
{
|
||||
return Err(BlockProcessingError::ExecutionInvalidGasLimitDecrease {
|
||||
limit: payload.gas_limit,
|
||||
parent_limit: parent.gas_limit,
|
||||
});
|
||||
}
|
||||
// check if the gas limit is at least the minimum gas limit
|
||||
if payload.gas_limit < T::min_gas_limit() {
|
||||
return Err(BlockProcessingError::ExecutionInvalidGasLimitTooSmall {
|
||||
limit: payload.gas_limit,
|
||||
min: T::min_gas_limit(),
|
||||
});
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#process_execution_payload
|
||||
pub fn process_execution_payload<T: EthSpec>(
|
||||
state: &mut BeaconState<T>,
|
||||
@@ -353,21 +309,6 @@ pub fn process_execution_payload<T: EthSpec>(
|
||||
found: payload.parent_hash,
|
||||
}
|
||||
);
|
||||
block_verify!(
|
||||
payload.block_number
|
||||
== state
|
||||
.latest_execution_payload_header()?
|
||||
.block_number
|
||||
.safe_add(1)?,
|
||||
BlockProcessingError::ExecutionBlockNumberIncontiguous {
|
||||
expected: state
|
||||
.latest_execution_payload_header()?
|
||||
.block_number
|
||||
.safe_add(1)?,
|
||||
found: payload.block_number,
|
||||
}
|
||||
);
|
||||
verify_is_valid_gas_limit(payload, state.latest_execution_payload_header()?)?;
|
||||
}
|
||||
block_verify!(
|
||||
payload.random == *state.get_randao_mix(state.current_epoch())?,
|
||||
|
||||
Reference in New Issue
Block a user