Skip to content

Commit 6fecdac

Browse files
authored
fix(reth-bench): return error on invalid range (#14198)
1 parent 17dfad5 commit 6fecdac

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

bin/reth-bench/src/bench/new_payload_fcu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl Command {
8383
let (payload, _) =
8484
ExecutionPayload::from_block_unchecked(block.hash(), &block.into_block());
8585

86-
debug!(?block_number, "Sending payload",);
86+
debug!(target: "reth-bench", ?block_number, "Sending payload",);
8787

8888
// construct fcu to call
8989
let forkchoice_state = ForkchoiceState {

bin/reth-bench/src/bench/new_payload_only.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ impl Command {
7070
let block_number = payload.block_number();
7171

7272
debug!(
73+
target: "reth-bench",
7374
number=?payload.block_number(),
7475
"Sending payload to engine",
7576
);

bin/reth-bench/src/valid_payload.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ where
119119
);
120120
panic!("Invalid newPayloadV3: {status:?}");
121121
}
122+
if status.is_syncing() {
123+
return Err(alloy_json_rpc::RpcError::UnsupportedFeature(
124+
"invalid range: no canonical state found for parent of requested block",
125+
))
126+
}
122127
status = self
123128
.new_payload_v3(payload.clone(), versioned_hashes.clone(), parent_beacon_block_root)
124129
.await?;
@@ -144,6 +149,11 @@ where
144149
);
145150
panic!("Invalid forkchoiceUpdatedV1: {status:?}");
146151
}
152+
if status.is_syncing() {
153+
return Err(alloy_json_rpc::RpcError::UnsupportedFeature(
154+
"invalid range: no canonical state found for parent of requested block",
155+
))
156+
}
147157
status =
148158
self.fork_choice_updated_v1(fork_choice_state, payload_attributes.clone()).await?;
149159
}
@@ -169,6 +179,11 @@ where
169179
);
170180
panic!("Invalid forkchoiceUpdatedV2: {status:?}");
171181
}
182+
if status.is_syncing() {
183+
return Err(alloy_json_rpc::RpcError::UnsupportedFeature(
184+
"invalid range: no canonical state found for parent of requested block",
185+
))
186+
}
172187
status =
173188
self.fork_choice_updated_v2(fork_choice_state, payload_attributes.clone()).await?;
174189
}

0 commit comments

Comments
 (0)