mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Verify inclusion proof should not be fallible (#5787)
* Verify inclusion proof should not be fallible * Add blob sidecar inclusion test (#33) * Add blob sidecar inclusion test. * Fix lint
This commit is contained in:
@@ -10,7 +10,6 @@ use crate::block_verification::{
|
||||
use crate::kzg_utils::{validate_blob, validate_blobs};
|
||||
use crate::{metrics, BeaconChainError};
|
||||
use kzg::{Error as KzgError, Kzg, KzgCommitment};
|
||||
use merkle_proof::MerkleTreeError;
|
||||
use slog::debug;
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use ssz_types::VariableList;
|
||||
@@ -128,13 +127,6 @@ pub enum GossipBlobError<E: EthSpec> {
|
||||
/// The blob sidecar is invalid and the peer is faulty.
|
||||
KzgError(kzg::Error),
|
||||
|
||||
/// The kzg commitment inclusion proof failed.
|
||||
///
|
||||
/// ## Peer scoring
|
||||
///
|
||||
/// The blob sidecar is invalid
|
||||
InclusionProof(MerkleTreeError),
|
||||
|
||||
/// The pubkey cache timed out.
|
||||
///
|
||||
/// ## Peer scoring
|
||||
@@ -459,10 +451,7 @@ pub fn validate_blob_sidecar_for_gossip<T: BeaconChainTypes>(
|
||||
|
||||
// Verify the inclusion proof in the sidecar
|
||||
let _timer = metrics::start_timer(&metrics::BLOB_SIDECAR_INCLUSION_PROOF_VERIFICATION);
|
||||
if !blob_sidecar
|
||||
.verify_blob_sidecar_inclusion_proof()
|
||||
.map_err(GossipBlobError::InclusionProof)?
|
||||
{
|
||||
if !blob_sidecar.verify_blob_sidecar_inclusion_proof() {
|
||||
return Err(GossipBlobError::InvalidInclusionProof);
|
||||
}
|
||||
drop(_timer);
|
||||
|
||||
@@ -690,7 +690,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
| GossipBlobError::InvalidSubnet { .. }
|
||||
| GossipBlobError::InvalidInclusionProof
|
||||
| GossipBlobError::KzgError(_)
|
||||
| GossipBlobError::InclusionProof(_)
|
||||
| GossipBlobError::NotFinalizedDescendant { .. } => {
|
||||
warn!(
|
||||
self.log,
|
||||
|
||||
@@ -120,7 +120,7 @@ impl<E: EthSpec> ActiveBlobsByRootRequest<E> {
|
||||
if self.request.block_root != block_root {
|
||||
return Err(LookupVerifyError::UnrequestedBlockRoot(block_root));
|
||||
}
|
||||
if !blob.verify_blob_sidecar_inclusion_proof().unwrap_or(false) {
|
||||
if !blob.verify_blob_sidecar_inclusion_proof() {
|
||||
return Err(LookupVerifyError::InvalidInclusionProof);
|
||||
}
|
||||
if !self.request.indices.contains(&blob.index) {
|
||||
|
||||
Reference in New Issue
Block a user