fix(reth-bench): return error on invalid range (#14198)

This commit is contained in:
Federico Gimenez
2025-02-04 16:51:03 +01:00
committed by GitHub
parent 17dfad5828
commit 6fecdac4ea
3 changed files with 17 additions and 1 deletions

View File

@ -83,7 +83,7 @@ impl Command {
let (payload, _) = let (payload, _) =
ExecutionPayload::from_block_unchecked(block.hash(), &block.into_block()); ExecutionPayload::from_block_unchecked(block.hash(), &block.into_block());
debug!(?block_number, "Sending payload",); debug!(target: "reth-bench", ?block_number, "Sending payload",);
// construct fcu to call // construct fcu to call
let forkchoice_state = ForkchoiceState { let forkchoice_state = ForkchoiceState {

View File

@ -70,6 +70,7 @@ impl Command {
let block_number = payload.block_number(); let block_number = payload.block_number();
debug!( debug!(
target: "reth-bench",
number=?payload.block_number(), number=?payload.block_number(),
"Sending payload to engine", "Sending payload to engine",
); );

View File

@ -119,6 +119,11 @@ where
); );
panic!("Invalid newPayloadV3: {status:?}"); panic!("Invalid newPayloadV3: {status:?}");
} }
if status.is_syncing() {
return Err(alloy_json_rpc::RpcError::UnsupportedFeature(
"invalid range: no canonical state found for parent of requested block",
))
}
status = self status = self
.new_payload_v3(payload.clone(), versioned_hashes.clone(), parent_beacon_block_root) .new_payload_v3(payload.clone(), versioned_hashes.clone(), parent_beacon_block_root)
.await?; .await?;
@ -144,6 +149,11 @@ where
); );
panic!("Invalid forkchoiceUpdatedV1: {status:?}"); panic!("Invalid forkchoiceUpdatedV1: {status:?}");
} }
if status.is_syncing() {
return Err(alloy_json_rpc::RpcError::UnsupportedFeature(
"invalid range: no canonical state found for parent of requested block",
))
}
status = status =
self.fork_choice_updated_v1(fork_choice_state, payload_attributes.clone()).await?; self.fork_choice_updated_v1(fork_choice_state, payload_attributes.clone()).await?;
} }
@ -169,6 +179,11 @@ where
); );
panic!("Invalid forkchoiceUpdatedV2: {status:?}"); panic!("Invalid forkchoiceUpdatedV2: {status:?}");
} }
if status.is_syncing() {
return Err(alloy_json_rpc::RpcError::UnsupportedFeature(
"invalid range: no canonical state found for parent of requested block",
))
}
status = status =
self.fork_choice_updated_v2(fork_choice_state, payload_attributes.clone()).await?; self.fork_choice_updated_v2(fork_choice_state, payload_attributes.clone()).await?;
} }