mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Drop block data from BlockError and BlobError (#5735)
* Drop block data from BlockError and BlobError * Debug release tests * Fix release tests * Revert unnecessary changes to lighthouse_metrics
This commit is contained in:
@@ -473,7 +473,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
pub fn on_processing_result(
|
||||
&mut self,
|
||||
process_type: BlockProcessType,
|
||||
result: BlockProcessingResult<T::EthSpec>,
|
||||
result: BlockProcessingResult,
|
||||
cx: &mut SyncNetworkContext<T>,
|
||||
) {
|
||||
let lookup_result = match process_type {
|
||||
@@ -493,7 +493,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
pub fn on_processing_result_inner<R: RequestState<T>>(
|
||||
&mut self,
|
||||
lookup_id: SingleLookupId,
|
||||
result: BlockProcessingResult<T::EthSpec>,
|
||||
result: BlockProcessingResult,
|
||||
cx: &mut SyncNetworkContext<T>,
|
||||
) -> Result<LookupResult, LookupRequestError> {
|
||||
let Some(lookup) = self.single_block_lookups.get_mut(&lookup_id) else {
|
||||
@@ -556,16 +556,14 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
error!(self.log, "Beacon chain error processing lookup component"; "block_root" => %block_root, "error" => ?e);
|
||||
Action::Drop
|
||||
}
|
||||
BlockError::ParentUnknown(block) => {
|
||||
BlockError::ParentUnknown { parent_root, .. } => {
|
||||
// Reverts the status of this request to `AwaitingProcessing` holding the
|
||||
// downloaded data. A future call to `continue_requests` will re-submit it
|
||||
// once there are no pending parent requests.
|
||||
// Note: `BlockError::ParentUnknown` is only returned when processing
|
||||
// blocks, not blobs.
|
||||
request_state.revert_to_awaiting_processing()?;
|
||||
Action::ParentUnknown {
|
||||
parent_root: block.parent_root(),
|
||||
}
|
||||
Action::ParentUnknown { parent_root }
|
||||
}
|
||||
ref e @ BlockError::ExecutionPayloadError(ref epe) if !epe.penalize_peer() => {
|
||||
// These errors indicate that the execution layer is offline
|
||||
|
||||
@@ -9,7 +9,7 @@ use super::*;
|
||||
|
||||
use crate::sync::block_lookups::common::ResponseType;
|
||||
use beacon_chain::blob_verification::GossipVerifiedBlob;
|
||||
use beacon_chain::block_verification_types::{BlockImportData, RpcBlock};
|
||||
use beacon_chain::block_verification_types::BlockImportData;
|
||||
use beacon_chain::builder::Witness;
|
||||
use beacon_chain::data_availability_checker::Availability;
|
||||
use beacon_chain::eth1_chain::CachingEth1Backend;
|
||||
@@ -211,11 +211,7 @@ impl TestRig {
|
||||
|
||||
fn trigger_unknown_parent_block(&mut self, peer_id: PeerId, block: Arc<SignedBeaconBlock<E>>) {
|
||||
let block_root = block.canonical_root();
|
||||
self.send_sync_message(SyncMessage::UnknownParentBlock(
|
||||
peer_id,
|
||||
RpcBlock::new_without_blobs(Some(block_root), block),
|
||||
block_root,
|
||||
))
|
||||
self.send_sync_message(SyncMessage::UnknownParentBlock(peer_id, block, block_root))
|
||||
}
|
||||
|
||||
fn trigger_unknown_parent_blob(&mut self, peer_id: PeerId, blob: BlobSidecar<E>) {
|
||||
@@ -440,12 +436,12 @@ impl TestRig {
|
||||
*parent_chain.last().unwrap()
|
||||
}
|
||||
|
||||
fn parent_block_processed(&mut self, chain_hash: Hash256, result: BlockProcessingResult<E>) {
|
||||
fn parent_block_processed(&mut self, chain_hash: Hash256, result: BlockProcessingResult) {
|
||||
let id = self.find_single_lookup_for(self.find_oldest_parent_lookup(chain_hash));
|
||||
self.single_block_component_processed(id, result);
|
||||
}
|
||||
|
||||
fn parent_blob_processed(&mut self, chain_hash: Hash256, result: BlockProcessingResult<E>) {
|
||||
fn parent_blob_processed(&mut self, chain_hash: Hash256, result: BlockProcessingResult) {
|
||||
let id = self.find_single_lookup_for(self.find_oldest_parent_lookup(chain_hash));
|
||||
self.single_blob_component_processed(id, result);
|
||||
}
|
||||
@@ -457,7 +453,7 @@ impl TestRig {
|
||||
);
|
||||
}
|
||||
|
||||
fn single_block_component_processed(&mut self, id: Id, result: BlockProcessingResult<E>) {
|
||||
fn single_block_component_processed(&mut self, id: Id, result: BlockProcessingResult) {
|
||||
self.send_sync_message(SyncMessage::BlockComponentProcessed {
|
||||
process_type: BlockProcessType::SingleBlock { id },
|
||||
result,
|
||||
@@ -472,7 +468,7 @@ impl TestRig {
|
||||
)
|
||||
}
|
||||
|
||||
fn single_blob_component_processed(&mut self, id: Id, result: BlockProcessingResult<E>) {
|
||||
fn single_blob_component_processed(&mut self, id: Id, result: BlockProcessingResult) {
|
||||
self.send_sync_message(SyncMessage::BlockComponentProcessed {
|
||||
process_type: BlockProcessType::SingleBlob { id },
|
||||
result,
|
||||
@@ -1440,7 +1436,9 @@ fn test_single_block_lookup_becomes_parent_request() {
|
||||
// parent request after processing.
|
||||
rig.single_block_component_processed(
|
||||
id.lookup_id,
|
||||
BlockError::ParentUnknown(RpcBlock::new_without_blobs(None, block)).into(),
|
||||
BlockProcessingResult::Err(BlockError::ParentUnknown {
|
||||
parent_root: block.parent_root(),
|
||||
}),
|
||||
);
|
||||
assert_eq!(rig.active_single_lookups_count(), 2); // 2 = current + parent
|
||||
rig.expect_block_parent_request(parent_root);
|
||||
@@ -1661,7 +1659,9 @@ fn test_parent_lookup_too_deep_grow_ancestor() {
|
||||
// the processing result
|
||||
rig.parent_block_processed(
|
||||
chain_hash,
|
||||
BlockError::ParentUnknown(RpcBlock::new_without_blobs(None, block)).into(),
|
||||
BlockProcessingResult::Err(BlockError::ParentUnknown {
|
||||
parent_root: block.parent_root(),
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1685,7 +1685,10 @@ fn test_parent_lookup_too_deep_grow_tip() {
|
||||
rig.expect_block_process(ResponseType::Block);
|
||||
rig.single_block_component_processed(
|
||||
id.lookup_id,
|
||||
BlockError::ParentUnknown(RpcBlock::new_without_blobs(None, block)).into(),
|
||||
BlockError::ParentUnknown {
|
||||
parent_root: block.parent_root(),
|
||||
}
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1840,7 +1843,9 @@ fn test_same_chain_race_condition() {
|
||||
rig.log(&format!("Block {i} ParentUnknown"));
|
||||
rig.parent_block_processed(
|
||||
chain_hash,
|
||||
BlockError::ParentUnknown(RpcBlock::new_without_blobs(None, block)).into(),
|
||||
BlockProcessingResult::Err(BlockError::ParentUnknown {
|
||||
parent_root: block.parent_root(),
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -2130,7 +2135,7 @@ mod deneb_only {
|
||||
RequestTrigger::GossipUnknownParentBlock { .. } => {
|
||||
rig.send_sync_message(SyncMessage::UnknownParentBlock(
|
||||
peer_id,
|
||||
RpcBlock::new_without_blobs(Some(block_root), block.clone()),
|
||||
block.clone(),
|
||||
block_root,
|
||||
));
|
||||
|
||||
@@ -2412,7 +2417,9 @@ mod deneb_only {
|
||||
.unwrap();
|
||||
self.rig.parent_block_processed(
|
||||
self.block_root,
|
||||
BlockProcessingResult::Err(BlockError::ParentUnknown(block)),
|
||||
BlockProcessingResult::Err(BlockError::ParentUnknown {
|
||||
parent_root: block.parent_root(),
|
||||
}),
|
||||
);
|
||||
assert_eq!(self.rig.active_parent_lookups_count(), 1);
|
||||
self
|
||||
|
||||
Reference in New Issue
Block a user