Skip to content

Commit

Permalink
feat: return empty list for post-merge blocks in BlockchainProvider2:…
Browse files Browse the repository at this point in the history
…:ommers (paradigmxyz#10286)
  • Loading branch information
fgimenez authored Aug 13, 2024
1 parent 91c1df3 commit 80e79bd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion crates/storage/provider/src/providers/blockchain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,22 @@ where
}

fn ommers(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Vec<Header>>> {
self.database.ommers(id)
match self.convert_hash_or_number(id)? {
Some(number) => {
// If the Paris (Merge) hardfork block is known and block is after it, return empty
// ommers.
if self.database.chain_spec().final_paris_total_difficulty(number).is_some() {
return Ok(Some(Vec::new()));
}

// Check in-memory state first
self.canonical_in_memory_state
.state_by_number(number)
.map(|o| o.block().block().ommers.clone())
.map_or_else(|| self.database.ommers(id), |ommers| Ok(Some(ommers)))
}
None => self.database.ommers(id),
}
}

fn block_body_indices(
Expand Down

0 comments on commit 80e79bd

Please sign in to comment.