feat: use new ChainHardforks type on ChainSpec (#9065)

This commit is contained in:
joshieDo
2024-06-27 19:39:35 +02:00
committed by GitHub
parent c23fe39dd3
commit 50ee497c75
57 changed files with 1708 additions and 1465 deletions

View File

@ -10,7 +10,7 @@ use reth_payload_primitives::{
validate_payload_timestamp, EngineApiMessageVersion, PayloadAttributes,
PayloadBuilderAttributes, PayloadOrAttributes,
};
use reth_primitives::{BlockHash, BlockHashOrNumber, BlockNumber, Hardfork, B256, U64};
use reth_primitives::{BlockHash, BlockHashOrNumber, BlockNumber, EthereumHardfork, B256, U64};
use reth_rpc_api::EngineApiServer;
use reth_rpc_types::engine::{
CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1,
@ -457,7 +457,7 @@ where
let merge_terminal_td = self
.inner
.chain_spec
.fork(Hardfork::Paris)
.fork(EthereumHardfork::Paris)
.ttd()
.expect("the engine API should not be running for chains w/o paris");
@ -1036,7 +1036,11 @@ mod tests {
let (handle, api) = setup_engine_api();
let transition_config = TransitionConfiguration {
terminal_total_difficulty: handle.chain_spec.fork(Hardfork::Paris).ttd().unwrap() +
terminal_total_difficulty: handle
.chain_spec
.fork(EthereumHardfork::Paris)
.ttd()
.unwrap() +
U256::from(1),
..Default::default()
};
@ -1046,7 +1050,7 @@ mod tests {
assert_matches!(
res,
Err(EngineApiError::TerminalTD { execution, consensus })
if execution == handle.chain_spec.fork(Hardfork::Paris).ttd().unwrap() && consensus == U256::from(transition_config.terminal_total_difficulty)
if execution == handle.chain_spec.fork(EthereumHardfork::Paris).ttd().unwrap() && consensus == U256::from(transition_config.terminal_total_difficulty)
);
}
@ -1063,7 +1067,11 @@ mod tests {
random_block(&mut rng, terminal_block_number, None, None, None);
let transition_config = TransitionConfiguration {
terminal_total_difficulty: handle.chain_spec.fork(Hardfork::Paris).ttd().unwrap(),
terminal_total_difficulty: handle
.chain_spec
.fork(EthereumHardfork::Paris)
.ttd()
.unwrap(),
terminal_block_hash: consensus_terminal_block.hash(),
terminal_block_number: U64::from(terminal_block_number),
};
@ -1101,7 +1109,11 @@ mod tests {
random_block(&mut generators::rng(), terminal_block_number, None, None, None);
let transition_config = TransitionConfiguration {
terminal_total_difficulty: handle.chain_spec.fork(Hardfork::Paris).ttd().unwrap(),
terminal_total_difficulty: handle
.chain_spec
.fork(EthereumHardfork::Paris)
.ttd()
.unwrap(),
terminal_block_hash: terminal_block.hash(),
terminal_block_number: U64::from(terminal_block_number),
};