mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: FetchFullBlockRangeFuture doesn't return on bad header (#10449)
This commit is contained in:
4
.github/assets/hive/expected_failures.yaml
vendored
4
.github/assets/hive/expected_failures.yaml
vendored
@ -48,8 +48,6 @@ engine-api:
|
||||
- Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=False, CanonicalReOrg=False, Invalid P9 (Paris) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=True, CanonicalReOrg=True, Invalid P9 (Paris) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=False, CanonicalReOrg=True, Invalid P9 (Paris) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, GasLimit, EmptyTxs=False, CanonicalReOrg=False, Invalid P8 (Paris) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, Timestamp, EmptyTxs=False, CanonicalReOrg=False, Invalid P8 (Paris) (reth)
|
||||
|
||||
# https://github.com/paradigmxyz/reth/issues/8305
|
||||
# https://github.com/paradigmxyz/reth/issues/6217
|
||||
@ -65,8 +63,6 @@ engine-cancun:
|
||||
- Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=False, CanonicalReOrg=False, Invalid P9 (Cancun) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=True, CanonicalReOrg=True, Invalid P9 (Cancun) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=False, CanonicalReOrg=True, Invalid P9 (Cancun) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, GasLimit, EmptyTxs=False, CanonicalReOrg=False, Invalid P8 (Cancun) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, Timestamp, EmptyTxs=False, CanonicalReOrg=False, Invalid P8 (Cancun) (reth)
|
||||
- Invalid PayloadAttributes, Missing BeaconRoot, Syncing=True (Cancun) (reth)
|
||||
- Invalid NewPayload, ParentBeaconBlockRoot, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Cancun) (reth)
|
||||
- Invalid NewPayload, BlobGasUsed, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Cancun) (reth)
|
||||
|
||||
@ -40,9 +40,6 @@ engine-withdrawals:
|
||||
# https://github.com/paradigmxyz/reth/issues/8305
|
||||
# https://github.com/paradigmxyz/reth/issues/6217
|
||||
engine-api:
|
||||
- Invalid Missing Ancestor Syncing ReOrg, GasLimit, EmptyTxs=False, CanonicalReOrg=False, Invalid P8 (Paris) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, Timestamp, EmptyTxs=False, CanonicalReOrg=False, Invalid P8 (Paris) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, Transaction Nonce, EmptyTxs=False, CanonicalReOrg=True, Invalid P8 (Paris) (reth)
|
||||
- Re-org to Previously Validated Sidechain Payload (Paris) (reth)
|
||||
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=False, Invalid P9 (Paris) (reth)
|
||||
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=True, Invalid P9 (Paris) (reth)
|
||||
@ -55,8 +52,6 @@ engine-api:
|
||||
# https://github.com/paradigmxyz/reth/issues/7144
|
||||
engine-cancun:
|
||||
- Blob Transaction Ordering, Multiple Clients (Cancun) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, GasLimit, EmptyTxs=False, CanonicalReOrg=False, Invalid P8 (Cancun) (reth)
|
||||
- Invalid Missing Ancestor Syncing ReOrg, Timestamp, EmptyTxs=False, CanonicalReOrg=False, Invalid P8 (Cancun) (reth)
|
||||
- Invalid PayloadAttributes, Missing BeaconRoot, Syncing=True (Cancun) (reth)
|
||||
- Invalid NewPayload, BlobGasUsed, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Cancun) (reth)
|
||||
- Invalid NewPayload, Blob Count on BlobGasUsed, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Cancun) (reth)
|
||||
|
||||
@ -496,11 +496,10 @@ where
|
||||
self.client.report_bad_message(peer);
|
||||
} else {
|
||||
let headers_rising = headers_falling.iter().rev().cloned().collect::<Vec<_>>();
|
||||
// ensure the downloaded headers are valid
|
||||
// check if the downloaded headers are valid
|
||||
if let Err(err) = self.consensus.validate_header_range(&headers_rising) {
|
||||
debug!(target: "downloaders", %err, ?self.start_hash, "Received bad header response");
|
||||
self.client.report_bad_message(peer);
|
||||
return
|
||||
}
|
||||
|
||||
// get the bodies request so it can be polled later
|
||||
@ -762,4 +761,23 @@ mod tests {
|
||||
assert_eq!(block.header.number, expected_number);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn download_full_block_range_with_invalid_header() {
|
||||
let client = TestFullBlockClient::default();
|
||||
let range_length: usize = 3;
|
||||
let (header, _) = insert_headers_into_client(&client, 0..range_length);
|
||||
|
||||
let test_consensus = reth_consensus::test_utils::TestConsensus::default();
|
||||
test_consensus.set_fail_validation(true);
|
||||
let client = FullBlockClient::new(client, Arc::new(test_consensus));
|
||||
|
||||
let received = client.get_full_block_range(header.hash(), range_length as u64).await;
|
||||
|
||||
assert_eq!(received.len(), range_length);
|
||||
for (i, block) in received.iter().enumerate() {
|
||||
let expected_number = header.number - i as u64;
|
||||
assert_eq!(block.header.number, expected_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user