mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Attribute invalid column proof error to correct peer (#6377)
* Attribute invalid column proof error to correct peer * Update beacon_node/beacon_chain/src/data_availability_checker.rs Co-authored-by: Pawan Dhananjay <pawandhananjay@gmail.com> * fix conflicts
This commit is contained in:
@@ -29,7 +29,9 @@ use crate::metrics;
|
||||
use crate::sync::block_lookups::common::ResponseType;
|
||||
use crate::sync::block_lookups::parent_chain::find_oldest_fork_ancestor;
|
||||
use beacon_chain::block_verification_types::AsBlock;
|
||||
use beacon_chain::data_availability_checker::AvailabilityCheckErrorCategory;
|
||||
use beacon_chain::data_availability_checker::{
|
||||
AvailabilityCheckError, AvailabilityCheckErrorCategory,
|
||||
};
|
||||
use beacon_chain::{AvailabilityProcessingStatus, BeaconChainTypes, BlockError};
|
||||
pub use common::RequestState;
|
||||
use fnv::FnvHashMap;
|
||||
@@ -591,8 +593,16 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
other => {
|
||||
debug!(self.log, "Invalid lookup component"; "block_root" => ?block_root, "component" => ?R::response_type(), "error" => ?other);
|
||||
let peer_group = request_state.on_processing_failure()?;
|
||||
// TOOD(das): only downscore peer subgroup that provided the invalid proof
|
||||
for peer in peer_group.all() {
|
||||
let peers_to_penalize: Vec<_> = match other {
|
||||
// Note: currenlty only InvalidColumn errors have index granularity,
|
||||
// but future errors may follow the same pattern. Generalize this
|
||||
// pattern with https://github.com/sigp/lighthouse/pull/6321
|
||||
BlockError::AvailabilityCheck(
|
||||
AvailabilityCheckError::InvalidColumn(index, _),
|
||||
) => peer_group.of_index(index as usize).collect(),
|
||||
_ => peer_group.all().collect(),
|
||||
};
|
||||
for peer in peers_to_penalize {
|
||||
cx.report_peer(
|
||||
*peer,
|
||||
PeerAction::MidToleranceError,
|
||||
|
||||
@@ -2449,7 +2449,7 @@ mod deneb_only {
|
||||
self.rig.single_blob_component_processed(
|
||||
self.blob_req_id.expect("blob request id").lookup_id,
|
||||
BlockProcessingResult::Err(BlockError::AvailabilityCheck(
|
||||
AvailabilityCheckError::KzgVerificationFailed,
|
||||
AvailabilityCheckError::InvalidBlobs(kzg::Error::KzgVerificationFailed),
|
||||
)),
|
||||
);
|
||||
self.rig.assert_single_lookups_count(1);
|
||||
|
||||
@@ -139,6 +139,15 @@ impl PeerGroup {
|
||||
pub fn all(&self) -> impl Iterator<Item = &PeerId> + '_ {
|
||||
self.peers.keys()
|
||||
}
|
||||
pub fn of_index(&self, index: usize) -> impl Iterator<Item = &PeerId> + '_ {
|
||||
self.peers.iter().filter_map(move |(peer, indices)| {
|
||||
if indices.contains(&index) {
|
||||
Some(peer)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Sequential ID that uniquely identifies ReqResp outgoing requests
|
||||
|
||||
Reference in New Issue
Block a user