fix blob slot validation
This commit is contained in:
parent
dbc57ba2d9
commit
6d4fb41b84
@ -19,15 +19,15 @@ pub enum BlobError {
|
|||||||
message_slot: Slot,
|
message_slot: Slot,
|
||||||
latest_permissible_slot: Slot,
|
latest_permissible_slot: Slot,
|
||||||
},
|
},
|
||||||
/// The blob sidecar is from a slot that is prior to the earliest permissible slot (with
|
|
||||||
/// respect to the gossip clock disparity).
|
/// The blob sidecar has a different slot than the block.
|
||||||
///
|
///
|
||||||
/// ## Peer scoring
|
/// ## Peer scoring
|
||||||
///
|
///
|
||||||
/// Assuming the local clock is correct, the peer has sent an invalid message.
|
/// Assuming the local clock is correct, the peer has sent an invalid message.
|
||||||
PastSlot {
|
SlotMismatch {
|
||||||
message_slot: Slot,
|
blob_slot: Slot,
|
||||||
earliest_permissible_slot: Slot,
|
block_slot: Slot,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// The blob sidecar contains an incorrectly formatted `BLSFieldElement` > `BLS_MODULUS`.
|
/// The blob sidecar contains an incorrectly formatted `BLSFieldElement` > `BLS_MODULUS`.
|
||||||
@ -122,14 +122,10 @@ pub fn validate_blob_for_gossip<T: BeaconChainTypes>(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let earliest_permissible_slot = chain
|
if blob_slot != block_slot {
|
||||||
.slot_clock
|
return Err(BlobError::SlotMismatch {
|
||||||
.now_with_past_tolerance(MAXIMUM_GOSSIP_CLOCK_DISPARITY)
|
blob_slot,
|
||||||
.ok_or(BeaconChainError::UnableToReadSlot)?;
|
block_slot,
|
||||||
if blob_slot > earliest_permissible_slot {
|
|
||||||
return Err(BlobError::PastSlot {
|
|
||||||
message_slot: earliest_permissible_slot,
|
|
||||||
earliest_permissible_slot: blob_slot,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,7 +840,17 @@ impl<T: BeaconChainTypes> Worker<T> {
|
|||||||
);
|
);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
Err(blob_errors) => unimplemented!("handle")
|
Err(e@ BlockError::BlobValidation(_)) => {
|
||||||
|
warn!(self.log, "Could not verify blob for gossip. Rejecting the block and blob";
|
||||||
|
"error" => %e);
|
||||||
|
self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Reject);
|
||||||
|
self.gossip_penalize_peer(
|
||||||
|
peer_id,
|
||||||
|
PeerAction::LowToleranceError,
|
||||||
|
"gossip_blob_low",
|
||||||
|
);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
metrics::inc_counter(&metrics::BEACON_PROCESSOR_GOSSIP_BLOCK_VERIFIED_TOTAL);
|
metrics::inc_counter(&metrics::BEACON_PROCESSOR_GOSSIP_BLOCK_VERIFIED_TOTAL);
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
"berlinBlock": 0,
|
"berlinBlock": 0,
|
||||||
"londonBlock": 0,
|
"londonBlock": 0,
|
||||||
"mergeNetsplitBlock": 0,
|
"mergeNetsplitBlock": 0,
|
||||||
"shanghaiTime": 1670428733,
|
"shanghaiTime": 1670438240,
|
||||||
"shardingForkTime": 1670428829,
|
"shardingForkTime": 1670438336,
|
||||||
"terminalTotalDifficulty": 0
|
"terminalTotalDifficulty": 0
|
||||||
},
|
},
|
||||||
"alloc": {
|
"alloc": {
|
||||||
|
Loading…
Reference in New Issue
Block a user