From ea8ef5799e6eb494be4345624412a426077ecc9d Mon Sep 17 00:00:00 2001 From: henridf Date: Wed, 26 Apr 2023 19:33:33 +0200 Subject: [PATCH] Fill in missing BlobSidecar gossip check (#4863) --- beacon_chain/gossip_processing/eth2_processor.nim | 2 +- .../gossip_processing/gossip_validation.nim | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/beacon_chain/gossip_processing/eth2_processor.nim b/beacon_chain/gossip_processing/eth2_processor.nim index 58568bc37..f99a6080b 100644 --- a/beacon_chain/gossip_processing/eth2_processor.nim +++ b/beacon_chain/gossip_processing/eth2_processor.nim @@ -292,7 +292,7 @@ proc processSignedBlobSidecar*( debug "Blob received", delay let v = - self.dag.validateBlobSidecar(self.quarantine, + self.dag.validateBlobSidecar(self.quarantine, self.blob_quarantine, signedBlobSidecar, wallTime, idx) if v.isErr(): diff --git a/beacon_chain/gossip_processing/gossip_validation.nim b/beacon_chain/gossip_processing/gossip_validation.nim index 5a010398a..ebc1c217e 100644 --- a/beacon_chain/gossip_processing/gossip_validation.nim +++ b/beacon_chain/gossip_processing/gossip_validation.nim @@ -16,8 +16,8 @@ import ../spec/[ beaconstate, state_transition_block, forks, helpers, network, signatures], ../consensus_object_pools/[ - attestation_pool, blockchain_dag, block_quarantine, exit_pool, spec_cache, - light_client_pool, sync_committee_msg_pool], + attestation_pool, blockchain_dag, blob_quarantine, block_quarantine, + exit_pool, spec_cache, light_client_pool, sync_committee_msg_pool], ".."/[beacon_clock], ./batch_validation @@ -223,7 +223,7 @@ template validateBeaconBlockBellatrix( # https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/p2p-interface.md#blob_sidecar_index proc validateBlobSidecar*( dag: ChainDAGRef, quarantine: ref Quarantine, - sbs: SignedBlobSidecar, + blobQuarantine: ref BlobQuarantine,sbs: SignedBlobSidecar, wallTime: BeaconTime, idx: BlobIndex): Result[void, ValidationError] = # [REJECT] The sidecar is for the correct topic -- @@ -286,9 +286,10 @@ proc validateBlobSidecar*( sbs.signature): return errReject("SignedBlobSidecar: invalid blob signature") - # [IGNORE] The sidecar is the only sidecar with valid signature received for the tuple (sidecar.block_root, sidecar.index). - # TODO - # check that there isn't a conflicting sidecar in blob_quarantine + # [IGNORE] The sidecar is the only sidecar with valid signature + # received for the tuple (sidecar.block_root, sidecar.index). + if blobQuarantine[].hasBlob(sbs.message): + return errReject("SignedBlobSidecar: already have blob with valid signature") ok()