diff --git a/packages/beacon-node/src/chain/errors/blobSidecarError.ts b/packages/beacon-node/src/chain/errors/blobSidecarError.ts index 38a125bbb21e..f38aa883002c 100644 --- a/packages/beacon-node/src/chain/errors/blobSidecarError.ts +++ b/packages/beacon-node/src/chain/errors/blobSidecarError.ts @@ -38,7 +38,7 @@ export type BlobSidecarErrorType = | {code: BlobSidecarErrorCode.PARENT_UNKNOWN; parentRoot: RootHex} | {code: BlobSidecarErrorCode.NOT_LATER_THAN_PARENT; parentSlot: Slot; slot: Slot} | {code: BlobSidecarErrorCode.PROPOSAL_SIGNATURE_INVALID} - | {code: BlobSidecarErrorCode.INCLUSION_PROOF_INVALID} + | {code: BlobSidecarErrorCode.INCLUSION_PROOF_INVALID; slot: Slot; blobIdx: number} | {code: BlobSidecarErrorCode.INCORRECT_PROPOSER; proposerIndex: ValidatorIndex}; export class BlobSidecarGossipError extends GossipActionError {} diff --git a/packages/beacon-node/src/chain/validation/blobSidecar.ts b/packages/beacon-node/src/chain/validation/blobSidecar.ts index 29aa4e763380..f1ea7bfa95c8 100644 --- a/packages/beacon-node/src/chain/validation/blobSidecar.ts +++ b/packages/beacon-node/src/chain/validation/blobSidecar.ts @@ -1,4 +1,3 @@ -import {ChainForkConfig} from "@lodestar/config"; import {deneb, Root, Slot, ssz} from "@lodestar/types"; import {toHex, verifyMerkleBranch} from "@lodestar/utils"; import {computeStartSlotAtEpoch, getBlockHeaderProposerSignatureSet} from "@lodestar/state-transition"; @@ -12,7 +11,6 @@ import {IBeaconChain} from "../interface.js"; import {RegenCaller} from "../regen/index.js"; export async function validateGossipBlobSidecar( - config: ChainForkConfig, chain: IBeaconChain, blobSidecar: deneb.BlobSidecar, gossipIndex: number @@ -116,9 +114,11 @@ export async function validateGossipBlobSidecar( } // verify if the blob inclusion proof is correct - if (!validateInclusionProof(config, blobSidecar)) { + if (!validateInclusionProof(blobSidecar)) { throw new BlobSidecarGossipError(GossipAction.REJECT, { code: BlobSidecarErrorCode.INCLUSION_PROOF_INVALID, + slot: blobSidecar.signedBlockHeader.message.slot, + blobIdx: blobSidecar.index, }); } @@ -216,7 +216,7 @@ function validateBlobsAndProofs( } } -function validateInclusionProof(config: ChainForkConfig, blobSidecar: deneb.BlobSidecar): boolean { +function validateInclusionProof(blobSidecar: deneb.BlobSidecar): boolean { return verifyMerkleBranch( ssz.deneb.KZGCommitment.hashTreeRoot(blobSidecar.kzgCommitment), blobSidecar.kzgCommitmentInclusionProof, diff --git a/packages/beacon-node/src/network/processor/gossipHandlers.ts b/packages/beacon-node/src/network/processor/gossipHandlers.ts index 831b18670add..d31183828b85 100644 --- a/packages/beacon-node/src/network/processor/gossipHandlers.ts +++ b/packages/beacon-node/src/network/processor/gossipHandlers.ts @@ -211,7 +211,7 @@ function getDefaultHandlers(modules: ValidatorFnsModules, options: GossipHandler }); try { - await validateGossipBlobSidecar(config, chain, blobSidecar, gossipIndex); + await validateGossipBlobSidecar(chain, blobSidecar, gossipIndex); return blockInput; } catch (e) { if (e instanceof BlobSidecarGossipError) { diff --git a/packages/beacon-node/test/unit/util/kzg.test.ts b/packages/beacon-node/test/unit/util/kzg.test.ts index b50bd2c0f1a7..cfe35e8fc76e 100644 --- a/packages/beacon-node/test/unit/util/kzg.test.ts +++ b/packages/beacon-node/test/unit/util/kzg.test.ts @@ -66,7 +66,7 @@ describe("C-KZG", async () => { blobSidecars.forEach(async (blobSidecar) => { try { - await validateGossipBlobSidecar(chain.config, chain, blobSidecar, blobSidecar.index); + await validateGossipBlobSidecar(chain, blobSidecar, blobSidecar.index); } catch (error) { // We expect some error from here // console.log(error);