mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(op): headers above merge (#7622)
This commit is contained in:
@ -14,4 +14,7 @@ workspace = true
|
||||
# reth
|
||||
reth-consensus-common.workspace = true
|
||||
reth-primitives.workspace = true
|
||||
reth-interfaces.workspace = true
|
||||
reth-interfaces.workspace = true
|
||||
|
||||
[features]
|
||||
optimism = ["reth-primitives/optimism"]
|
||||
@ -46,14 +46,27 @@ impl Consensus for BeaconConsensus {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(unused_assignments)]
|
||||
#[allow(unused_mut)]
|
||||
fn validate_header_with_total_difficulty(
|
||||
&self,
|
||||
header: &Header,
|
||||
total_difficulty: U256,
|
||||
) -> Result<(), ConsensusError> {
|
||||
if self.chain_spec.fork(Hardfork::Paris).active_at_ttd(total_difficulty, header.difficulty)
|
||||
let mut is_post_merge = self
|
||||
.chain_spec
|
||||
.fork(Hardfork::Paris)
|
||||
.active_at_ttd(total_difficulty, header.difficulty);
|
||||
|
||||
#[cfg(feature = "optimism")]
|
||||
{
|
||||
if !header.is_zero_difficulty() {
|
||||
// If OP-Stack then bedrock activation number determines when TTD (eth Merge) has been
|
||||
// reached.
|
||||
is_post_merge = self.chain_spec.is_bedrock_active_at_block(header.number);
|
||||
}
|
||||
|
||||
if is_post_merge {
|
||||
if !self.chain_spec.is_optimism() && !header.is_zero_difficulty() {
|
||||
return Err(ConsensusError::TheMergeDifficultyIsNotZero)
|
||||
}
|
||||
|
||||
@ -94,10 +107,10 @@ impl Consensus for BeaconConsensus {
|
||||
})
|
||||
}
|
||||
|
||||
// Goerli exception:
|
||||
// Goerli and early OP exception:
|
||||
// * If the network is goerli pre-merge, ignore the extradata check, since we do not
|
||||
// support clique.
|
||||
if self.chain_spec.chain != Chain::goerli() {
|
||||
// support clique. Same goes for OP blocks below Bedrock.
|
||||
if self.chain_spec.chain != Chain::goerli() && !self.chain_spec.is_optimism() {
|
||||
validate_header_extradata(header)?;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,4 +65,5 @@ optimism = [
|
||||
"reth-interfaces/optimism",
|
||||
"reth-provider/optimism",
|
||||
"reth-blockchain-tree/optimism",
|
||||
"reth-beacon-consensus-core/optimism"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user