Skip to content

Commit 6234f61

Browse files
authored
fix: forward unknown hashes pre bedrock (paradigmxyz#17709)
1 parent f74efdb commit 6234f61

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

crates/optimism/rpc/src/historical.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,18 @@ where
159159

160160
// if we've extracted a block ID, check if it's pre-Bedrock
161161
if let Some(block_id) = maybe_block_id {
162-
let is_pre_bedrock = if let Ok(Some(num)) =
163-
historical.provider.block_number_for_id(block_id)
164-
{
165-
num < historical.bedrock_block
166-
} else {
167-
// If we can't convert the hash to a number, assume it's post-Bedrock
168-
debug!(target: "rpc::historical", ?block_id, "hash unknown; not forwarding");
169-
false
162+
let is_pre_bedrock = match historical.provider.block_number_for_id(block_id) {
163+
Ok(Some(num)) => num < historical.bedrock_block,
164+
Ok(None) if block_id.is_hash() => {
165+
// if we couldn't find the block number for the hash then we assume it is
166+
// pre-Bedrock
167+
true
168+
}
169+
_ => {
170+
// If we can't convert blockid to a number, assume it's post-Bedrock
171+
debug!(target: "rpc::historical", ?block_id, "hash unknown; not forwarding");
172+
false
173+
}
170174
};
171175

172176
// if the block is pre-Bedrock, forward the request to the historical client

0 commit comments

Comments
 (0)