diff --git a/beacond/cmd/defaults.go b/beacond/cmd/defaults.go index 158ecf19c0..7d88537e24 100644 --- a/beacond/cmd/defaults.go +++ b/beacond/cmd/defaults.go @@ -54,12 +54,9 @@ func DefaultComponents() []any { components.ProvideBlsSigner, components.ProvideBlobProcessor[ *AvailabilityStore, *BeaconBlockBody, *BeaconBlockHeader, - *BlobSidecar, *BlobSidecars, *Logger, + *ConsensusSidecars, *BlobSidecar, *BlobSidecars, *Logger, ], components.ProvideBlobProofVerifier, - components.ProvideBlobVerifier[ - *BeaconBlockHeader, *BlobSidecar, *BlobSidecars, - ], components.ProvideChainService[ *AvailabilityStore, *ConsensusBlock, *BeaconBlock, *BeaconBlockBody, @@ -77,8 +74,8 @@ func DefaultComponents() []any { // *BeaconStateMarshallable, *BlockStore, *KVStore, *StorageBackend, // ], components.ProvideDAService[ - *AvailabilityStore, *BeaconBlockBody, *BlobSidecar, - *BlobSidecars, *Logger, + *AvailabilityStore, *BeaconBlockBody, *BeaconBlockHeader, + *ConsensusSidecars, *BlobSidecar, *BlobSidecars, *Logger, ], components.ProvideDBManager[*AvailabilityStore, *DepositStore, *Logger], components.ProvideDepositPruner[ @@ -92,7 +89,9 @@ func DefaultComponents() []any { ], components.ProvideDepositStore[*Deposit], components.ProvideDispatcher[ - *ConsensusBlock, *BeaconBlock, *BlobSidecars, *Genesis, *Logger, + *ConsensusBlock, *BeaconBlock, + *ConsensusSidecars, *BlobSidecars, + *Genesis, *Logger, ], components.ProvideEngineClient[ *ExecutionPayload, *ExecutionPayloadHeader, *Logger, @@ -111,7 +110,8 @@ func DefaultComponents() []any { *AvailabilityStore, *ConsensusBlock, *BeaconBlock, *BeaconBlockBody, *BeaconBlockHeader, *BlockStore, *BeaconState, - *BeaconStateMarshallable, *BlobSidecar, *BlobSidecars, + *BeaconStateMarshallable, + *ConsensusSidecars, *BlobSidecar, *BlobSidecars, *Deposit, *DepositStore, *ExecutionPayload, *ExecutionPayloadHeader, *Genesis, *KVStore, *Logger, NodeAPIContext, diff --git a/beacond/cmd/types.go b/beacond/cmd/types.go index b8ef47f2f9..449bd573dd 100644 --- a/beacond/cmd/types.go +++ b/beacond/cmd/types.go @@ -74,13 +74,7 @@ type ( *AvailabilityStore, *BeaconBlockBody, *BeaconBlockHeader, - *BlobSidecar, - *BlobSidecars, - ] - - // BlobVerifier is a type alias for the blob verifier. - BlobVerifier = dablob.Verifier[ - *BeaconBlockHeader, + *ConsensusSidecars, *BlobSidecar, *BlobSidecars, ] @@ -107,7 +101,10 @@ type ( CometBFTService = cometbft.Service[*Logger] // DAService is a type alias for the DA service. - DAService = da.Service[*AvailabilityStore, *BlobSidecars] + DAService = da.Service[ + *AvailabilityStore, + *ConsensusSidecars, *BlobSidecars, *BeaconBlockHeader, + ] // DBManager is a type alias for the database manager. DBManager = manager.DBManager @@ -267,10 +264,12 @@ type ( Validator, ] - // BlobSidecar is a type alias for the blob sidecar. - BlobSidecar = datypes.BlobSidecar - - // BlobSidecars is a type alias for the blob sidecars. + // BlobSidecars type aliases. + ConsensusSidecars = consruntimetypes.ConsensusSidecars[ + *BlobSidecars, + *BeaconBlockHeader, + ] + BlobSidecar = datypes.BlobSidecar BlobSidecars = datypes.BlobSidecars // BlockStore is a type alias for the block store. diff --git a/mod/consensus-types/pkg/types/header.go b/mod/consensus-types/pkg/types/header.go index 4a11e4e5a9..47c5ab1454 100644 --- a/mod/consensus-types/pkg/types/header.go +++ b/mod/consensus-types/pkg/types/header.go @@ -174,6 +174,15 @@ func (b *BeaconBlockHeader) GetTree() (*fastssz.Node, error) { /* Getters and Setters */ /* -------------------------------------------------------------------------- */ +// Equals returns true if the Withdrawal is equal to the other. +func (b *BeaconBlockHeader) Equals(rhs *BeaconBlockHeader) bool { + return b.Slot == rhs.Slot && + b.ProposerIndex == rhs.ProposerIndex && + b.ParentBlockRoot == rhs.ParentBlockRoot && + b.StateRoot == rhs.StateRoot && + b.BodyRoot == rhs.BodyRoot +} + // GetSlot retrieves the slot of the BeaconBlockHeader. func (b *BeaconBlockHeader) GetSlot() math.Slot { return b.Slot diff --git a/mod/consensus-types/pkg/types/header_test.go b/mod/consensus-types/pkg/types/header_test.go index f04ab2c3ca..b2ccce2627 100644 --- a/mod/consensus-types/pkg/types/header_test.go +++ b/mod/consensus-types/pkg/types/header_test.go @@ -30,6 +30,86 @@ import ( "github.com/stretchr/testify/require" ) +func TestBeaconBlockHeader_Equals(t *testing.T) { + var ( + slot = math.Slot(100) + valIdx = math.ValidatorIndex(200) + parentBlockRoot = common.Root{1} + stateRoot = common.Root{2} + bodyRoot = common.Root{3} + + lhs = types.NewBeaconBlockHeader( + slot, valIdx, parentBlockRoot, stateRoot, bodyRoot, + ) + ) + + tests := []struct { + name string + rhs *types.BeaconBlockHeader + want bool + }{ + { + name: "equal", + rhs: types.NewBeaconBlockHeader( + slot, valIdx, parentBlockRoot, stateRoot, bodyRoot, + ), + want: true, + }, + { + name: "slot differs", + rhs: types.NewBeaconBlockHeader( + 2*slot, valIdx, parentBlockRoot, stateRoot, bodyRoot, + ), + want: false, + }, + { + name: "validator index differs", + rhs: types.NewBeaconBlockHeader( + slot, 2*valIdx, parentBlockRoot, stateRoot, bodyRoot, + ), + want: false, + }, + { + name: "parent block root differs", + rhs: types.NewBeaconBlockHeader( + slot, valIdx, common.Root{0xff}, stateRoot, bodyRoot, + ), + want: false, + }, + { + name: "state root differs", + rhs: types.NewBeaconBlockHeader( + slot, valIdx, parentBlockRoot, common.Root{0xff}, bodyRoot, + ), + want: false, + }, + { + name: "body root differs", + rhs: types.NewBeaconBlockHeader( + slot, valIdx, parentBlockRoot, stateRoot, common.Root{0xff}, + ), + want: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got1 := lhs.Equals(tt.rhs) + require.Equal(t, tt.want, got1) + + // check commutativity as well + got2 := tt.rhs.Equals(lhs) + require.Equal(t, got1, got2) + + // copies stays equal/disequal + rhsCopy := &types.BeaconBlockHeader{} + *rhsCopy = *tt.rhs + got3 := rhsCopy.Equals(lhs) + require.Equal(t, got1, got3) + }) + } +} + func TestBeaconBlockHeader_Serialization(t *testing.T) { original := types.NewBeaconBlockHeader( math.Slot(100), diff --git a/mod/consensus/pkg/cometbft/service/middleware/abci.go b/mod/consensus/pkg/cometbft/service/middleware/abci.go index 63fe834404..1143b54d8a 100644 --- a/mod/consensus/pkg/cometbft/service/middleware/abci.go +++ b/mod/consensus/pkg/cometbft/service/middleware/abci.go @@ -40,9 +40,7 @@ import ( /* -------------------------------------------------------------------------- */ // InitGenesis is called by the base app to initialize the state of the. -func (h *ABCIMiddleware[ - _, _, GenesisT, _, -]) InitGenesis( +func (h *ABCIMiddleware[_, _, _, GenesisT, _]) InitGenesis( ctx sdk.Context, bz []byte, ) (transition.ValidatorUpdates, error) { @@ -65,9 +63,7 @@ func (h *ABCIMiddleware[ // waitForGenesisProcessed waits until the genesis data has been processed and // returns the validator updates, or err if the context is cancelled. -func (h *ABCIMiddleware[ - _, _, _, _, -]) waitForGenesisProcessed( +func (h *ABCIMiddleware[_, _, _, _, _]) waitForGenesisProcessed( ctx context.Context, ) (transition.ValidatorUpdates, error) { select { @@ -84,8 +80,7 @@ func (h *ABCIMiddleware[ // prepareProposal is the internal handler for preparing proposals. func (h *ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, _, SlotDataT, -]) PrepareProposal( + BeaconBlockT, _, BlobSidecarsT, _, SlotDataT]) PrepareProposal( ctx sdk.Context, slotData SlotDataT, ) ([]byte, []byte, error) { @@ -133,7 +128,7 @@ func (h *ABCIMiddleware[ // waitForBuiltBeaconBlock waits for the built beacon block to be received. func (h *ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, _, SlotDataT, + BeaconBlockT, _, BlobSidecarsT, _, SlotDataT, ]) waitForBuiltBeaconBlock( ctx context.Context, ) (BeaconBlockT, error) { @@ -147,7 +142,7 @@ func (h *ABCIMiddleware[ // waitForBuiltSidecars waits for the built sidecars to be received. func (h *ABCIMiddleware[ - _, BlobSidecarsT, _, _, + _, _, BlobSidecarsT, _, _, ]) waitForBuiltSidecars( ctx context.Context, ) (BlobSidecarsT, error) { @@ -162,7 +157,7 @@ func (h *ABCIMiddleware[ // handleBuiltBeaconBlockAndSidecars gossips the built beacon block and blob // sidecars to the network. func (h *ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, _, _, + BeaconBlockT, _, BlobSidecarsT, _, _, ]) handleBuiltBeaconBlockAndSidecars( bb BeaconBlockT, sc BlobSidecarsT, @@ -185,7 +180,7 @@ func (h *ABCIMiddleware[ // ProcessProposal processes the proposal for the ABCI middleware. // It handles both the beacon block and blob sidecars concurrently. func (h *ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, _, _, + BeaconBlockT, BeaconBlockHeaderT, BlobSidecarsT, _, _, ]) ProcessProposal( ctx sdk.Context, req *cmtabci.ProcessProposalRequest, @@ -209,7 +204,7 @@ func (h *ABCIMiddleware[ defer h.metrics.measureProcessProposalDuration(startTime) - // Request the beacon block. + // Decode the beacon block. blk, err := encoding. UnmarshalBeaconBlockFromABCIRequest[BeaconBlockT]( req, @@ -221,18 +216,18 @@ func (h *ABCIMiddleware[ } // notify that the beacon block has been received. - var enrichedBlk *types.ConsensusBlock[BeaconBlockT] - enrichedBlk = enrichedBlk.New( + var consensusBlk *types.ConsensusBlock[BeaconBlockT] + consensusBlk = consensusBlk.New( blk, req.GetProposerAddress(), req.GetTime().Add(h.minPayloadDelay), ) - blkEvent := async.NewEvent(ctx, async.BeaconBlockReceived, enrichedBlk) + blkEvent := async.NewEvent(ctx, async.BeaconBlockReceived, consensusBlk) if err = h.dispatcher.Publish(blkEvent); err != nil { return h.createProcessProposalResponse(errors.WrapNonFatal(err)) } - // Request the blob sidecars. + // Decode the blob sidecars. sidecars, err := encoding. UnmarshalBlobSidecarsFromABCIRequest[BlobSidecarsT]( req, @@ -243,7 +238,15 @@ func (h *ABCIMiddleware[ } // notify that the sidecars have been received. - blobEvent := async.NewEvent(ctx, async.SidecarsReceived, sidecars) + var consensusSidecars *types.ConsensusSidecars[ + BlobSidecarsT, + BeaconBlockHeaderT, + ] + consensusSidecars = consensusSidecars.New( + sidecars, + blk.GetHeader(), + ) + blobEvent := async.NewEvent(ctx, async.SidecarsReceived, consensusSidecars) if err = h.dispatcher.Publish(blobEvent); err != nil { return h.createProcessProposalResponse(errors.WrapNonFatal(err)) } @@ -263,7 +266,7 @@ func (h *ABCIMiddleware[ // waitForBeaconBlockVerification waits for the built beacon block to be // verified. func (h *ABCIMiddleware[ - BeaconBlockT, _, _, _, + BeaconBlockT, _, _, _, _, ]) waitForBeaconBlockVerification( ctx context.Context, ) (BeaconBlockT, error) { @@ -277,7 +280,7 @@ func (h *ABCIMiddleware[ // waitForSidecarVerification waits for the built sidecars to be verified. func (h *ABCIMiddleware[ - _, BlobSidecarsT, _, _, + _, _, BlobSidecarsT, _, _, ]) waitForSidecarVerification( ctx context.Context, ) (BlobSidecarsT, error) { @@ -292,7 +295,7 @@ func (h *ABCIMiddleware[ // createResponse generates the appropriate ProcessProposalResponse based on the // error. func (*ABCIMiddleware[ - BeaconBlockT, _, BlobSidecarsT, _, + BeaconBlockT, _, _, BlobSidecarsT, _, ]) createProcessProposalResponse( err error, ) (*cmtabci.ProcessProposalResponse, error) { @@ -310,7 +313,7 @@ func (*ABCIMiddleware[ // EndBlock returns the validator set updates from the beacon state. func (h *ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, _, _, + BeaconBlockT, _, BlobSidecarsT, _, _, ]) FinalizeBlock( ctx sdk.Context, req *cmtabci.FinalizeBlockRequest, @@ -339,13 +342,17 @@ func (h *ABCIMiddleware[ // notify that the final beacon block has been received. // notify that the beacon block has been received. - var enrichedBlk *types.ConsensusBlock[BeaconBlockT] - enrichedBlk = enrichedBlk.New( + var consensusBlk *types.ConsensusBlock[BeaconBlockT] + consensusBlk = consensusBlk.New( blk, req.GetProposerAddress(), req.GetTime().Add(h.minPayloadDelay), ) - blkEvent := async.NewEvent(ctx, async.FinalBeaconBlockReceived, enrichedBlk) + blkEvent := async.NewEvent( + ctx, + async.FinalBeaconBlockReceived, + consensusBlk, + ) if err = h.dispatcher.Publish(blkEvent); err != nil { return nil, err } @@ -364,7 +371,7 @@ func (h *ABCIMiddleware[ // waitForFinalValidatorUpdates waits for the final validator updates to be // received. func (h *ABCIMiddleware[ - _, _, _, _, + _, _, _, _, _, ]) waitForFinalValidatorUpdates( ctx context.Context, ) (transition.ValidatorUpdates, error) { diff --git a/mod/consensus/pkg/cometbft/service/middleware/middleware.go b/mod/consensus/pkg/cometbft/service/middleware/middleware.go index 978115dfb0..97427ebbad 100644 --- a/mod/consensus/pkg/cometbft/service/middleware/middleware.go +++ b/mod/consensus/pkg/cometbft/service/middleware/middleware.go @@ -34,7 +34,8 @@ import ( // ABCIMiddleware is a middleware between ABCI and the validator logic. type ABCIMiddleware[ - BeaconBlockT BeaconBlock[BeaconBlockT], + BeaconBlockT BeaconBlock[BeaconBlockT, BeaconBlockHeaderT], + BeaconBlockHeaderT any, BlobSidecarsT BlobSidecars[BlobSidecarsT], GenesisT json.Unmarshaler, SlotDataT any, @@ -67,7 +68,8 @@ type ABCIMiddleware[ // NewABCIMiddleware creates a new instance of the Handler struct. func NewABCIMiddleware[ - BeaconBlockT BeaconBlock[BeaconBlockT], + BeaconBlockT BeaconBlock[BeaconBlockT, BeaconBlockHeaderT], + BeaconBlockHeaderT any, BlobSidecarsT BlobSidecars[BlobSidecarsT], GenesisT json.Unmarshaler, SlotDataT any, @@ -78,7 +80,7 @@ func NewABCIMiddleware[ logger log.Logger, telemetrySink TelemetrySink, ) *ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, GenesisT, SlotDataT, + BeaconBlockT, BeaconBlockHeaderT, BlobSidecarsT, GenesisT, SlotDataT, ] { // We may build execution payload optimistically (i.e. build the execution // payload for next block while current block is being verified and not yet @@ -100,7 +102,7 @@ func NewABCIMiddleware[ ) return &ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, GenesisT, SlotDataT, + BeaconBlockT, BeaconBlockHeaderT, BlobSidecarsT, GenesisT, SlotDataT, ]{ chainSpec: chainSpec, minPayloadDelay: minPayloadDelay, @@ -117,7 +119,7 @@ func NewABCIMiddleware[ } // Start subscribes the middleware to the events it needs to listen for. -func (am *ABCIMiddleware[_, _, _, _]) Start( +func (am *ABCIMiddleware[_, _, _, _, _]) Start( _ context.Context, ) error { var err error @@ -155,8 +157,6 @@ func (am *ABCIMiddleware[_, _, _, _]) Start( } // Name returns the name of the middleware. -func (am *ABCIMiddleware[ - _, _, _, _, -]) Name() string { +func (am *ABCIMiddleware[_, _, _, _, _]) Name() string { return "abci-middleware" } diff --git a/mod/consensus/pkg/cometbft/service/middleware/types.go b/mod/consensus/pkg/cometbft/service/middleware/types.go index 53423b6520..c79e6333db 100644 --- a/mod/consensus/pkg/cometbft/service/middleware/types.go +++ b/mod/consensus/pkg/cometbft/service/middleware/types.go @@ -28,11 +28,13 @@ import ( ) // BeaconBlock is an interface for accessing the beacon block. -type BeaconBlock[SelfT any] interface { +type BeaconBlock[BeaconBlockT any, BeaconBlockHeaderT any] interface { constraints.SSZMarshallable constraints.Nillable - constraints.Empty[SelfT] - NewFromSSZ([]byte, uint32) (SelfT, error) + constraints.Empty[BeaconBlockT] + NewFromSSZ([]byte, uint32) (BeaconBlockT, error) + + GetHeader() BeaconBlockHeaderT } // TelemetrySink is an interface for sending metrics to a telemetry backend. diff --git a/mod/consensus/pkg/types/consensus_sidecars.go b/mod/consensus/pkg/types/consensus_sidecars.go new file mode 100644 index 0000000000..062e4e606e --- /dev/null +++ b/mod/consensus/pkg/types/consensus_sidecars.go @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2024, Berachain Foundation. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package types + +type ConsensusSidecars[SidecarsT any, BeaconBlockHeaderT any] struct { + sidecars SidecarsT + + blkHeader BeaconBlockHeaderT +} + +// New creates a new ConsensusSidecars instance. +func (s *ConsensusSidecars[SidecarsT, BeaconBlockHeaderT]) New( + sidecars SidecarsT, + blkHeader BeaconBlockHeaderT, +) *ConsensusSidecars[SidecarsT, BeaconBlockHeaderT] { + s = &ConsensusSidecars[SidecarsT, BeaconBlockHeaderT]{ + sidecars: sidecars, + blkHeader: blkHeader, + } + return s +} + +func (s *ConsensusSidecars[ + SidecarsT, + _, +]) GetSidecars() SidecarsT { + return s.sidecars +} + +func (s *ConsensusSidecars[ + SidecarsT, + BeaconBlockHeaderT, +]) GetHeader() BeaconBlockHeaderT { + return s.blkHeader +} diff --git a/mod/da/pkg/blob/processor.go b/mod/da/pkg/blob/processor.go index 1674707699..38695937b3 100644 --- a/mod/da/pkg/blob/processor.go +++ b/mod/da/pkg/blob/processor.go @@ -23,6 +23,7 @@ package blob import ( "time" + "github.com/berachain/beacon-kit/mod/da/pkg/kzg" "github.com/berachain/beacon-kit/mod/log" "github.com/berachain/beacon-kit/mod/primitives/pkg/common" "github.com/berachain/beacon-kit/mod/primitives/pkg/math" @@ -35,7 +36,8 @@ type Processor[ BeaconBlockBodyT, BlobSidecarsT, ], BeaconBlockBodyT any, - BeaconBlockHeaderT BeaconBlockHeader, + BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], + ConsensusSidecarsT ConsensusSidecars[BlobSidecarsT, BeaconBlockHeaderT], BlobSidecarT Sidecar[BeaconBlockHeaderT], BlobSidecarsT Sidecars[BlobSidecarT], ] struct { @@ -44,7 +46,7 @@ type Processor[ // chainSpec defines the specifications of the blockchain. chainSpec common.ChainSpec // verifier is responsible for verifying the blobs. - verifier BlobVerifier[BlobSidecarsT] + verifier *verifier[BeaconBlockHeaderT, BlobSidecarT, BlobSidecarsT] // blockBodyOffsetFn is a function that calculates the block body offset // based on the slot and chain specifications. blockBodyOffsetFn func(math.Slot, common.ChainSpec) uint64 @@ -58,22 +60,28 @@ func NewProcessor[ BeaconBlockBodyT, BlobSidecarsT, ], BeaconBlockBodyT any, - BeaconBlockHeaderT BeaconBlockHeader, + BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], + ConsensusSidecarsT ConsensusSidecars[BlobSidecarsT, BeaconBlockHeaderT], BlobSidecarT Sidecar[BeaconBlockHeaderT], BlobSidecarsT Sidecars[BlobSidecarT], ]( logger log.Logger, chainSpec common.ChainSpec, - verifier BlobVerifier[BlobSidecarsT], + proofVerifier kzg.BlobProofVerifier, blockBodyOffsetFn func(math.Slot, common.ChainSpec) uint64, telemetrySink TelemetrySink, ) *Processor[ AvailabilityStoreT, BeaconBlockBodyT, BeaconBlockHeaderT, - BlobSidecarT, BlobSidecarsT, + ConsensusSidecarsT, BlobSidecarT, BlobSidecarsT, ] { + verifier := newVerifier[ + BeaconBlockHeaderT, + BlobSidecarT, + BlobSidecarsT, + ](proofVerifier, telemetrySink) return &Processor[ AvailabilityStoreT, BeaconBlockBodyT, BeaconBlockHeaderT, - BlobSidecarT, BlobSidecarsT, + ConsensusSidecarsT, BlobSidecarT, BlobSidecarsT, ]{ logger: logger, chainSpec: chainSpec, @@ -84,12 +92,17 @@ func NewProcessor[ } // VerifySidecars verifies the blobs and ensures they match the local state. -func (sp *Processor[AvailabilityStoreT, _, _, _, BlobSidecarsT]) VerifySidecars( - sidecars BlobSidecarsT, +func (sp *Processor[ + AvailabilityStoreT, _, _, ConsensusSidecarsT, _, _, +]) VerifySidecars( + cs ConsensusSidecarsT, ) error { - startTime := time.Now() + var ( + sidecars = cs.GetSidecars() + blkHeader = cs.GetHeader() + ) defer sp.metrics.measureVerifySidecarsDuration( - startTime, math.U64(sidecars.Len()), + time.Now(), math.U64(sidecars.Len()), ) // Abort if there are no blobs to store. @@ -98,25 +111,25 @@ func (sp *Processor[AvailabilityStoreT, _, _, _, BlobSidecarsT]) VerifySidecars( } // Verify the blobs and ensure they match the local state. - return sp.verifier.VerifySidecars( + return sp.verifier.verifySidecars( sidecars, sp.blockBodyOffsetFn( sidecars.Get(0).GetBeaconBlockHeader().GetSlot(), sp.chainSpec, ), + blkHeader, ) } // slot := processes the blobs and ensures they match the local state. func (sp *Processor[ - AvailabilityStoreT, _, _, _, BlobSidecarsT, + AvailabilityStoreT, _, _, _, _, BlobSidecarsT, ]) ProcessSidecars( avs AvailabilityStoreT, sidecars BlobSidecarsT, ) error { - startTime := time.Now() defer sp.metrics.measureProcessSidecarsDuration( - startTime, math.U64(sidecars.Len()), + time.Now(), math.U64(sidecars.Len()), ) // Abort if there are no blobs to store. diff --git a/mod/da/pkg/blob/types.go b/mod/da/pkg/blob/types.go index eae7914c6d..7577bbca66 100644 --- a/mod/da/pkg/blob/types.go +++ b/mod/da/pkg/blob/types.go @@ -55,15 +55,14 @@ type BeaconBlockBody interface { Length() uint64 } -type BeaconBlockHeader interface { +type BeaconBlockHeader[BeaconBlockHeaderT any] interface { GetSlot() math.Slot + Equals(BeaconBlockHeaderT) bool } -//nolint:revive // name conflict -type BlobVerifier[BlobSidecarsT any] interface { - VerifyInclusionProofs(scs BlobSidecarsT, kzgOffset uint64) error - VerifyKZGProofs(scs BlobSidecarsT) error - VerifySidecars(sidecars BlobSidecarsT, kzgOffset uint64) error +type ConsensusSidecars[BlobSidecarsT any, BeaconBlockHeaderT any] interface { + GetSidecars() BlobSidecarsT + GetHeader() BeaconBlockHeaderT } type Sidecar[BeaconBlockHeaderT any] interface { diff --git a/mod/da/pkg/blob/verifier.go b/mod/da/pkg/blob/verifier.go index 8f1a698b2b..fa0acde3fd 100644 --- a/mod/da/pkg/blob/verifier.go +++ b/mod/da/pkg/blob/verifier.go @@ -22,6 +22,7 @@ package blob import ( "context" + "fmt" "time" "github.com/berachain/beacon-kit/mod/da/pkg/kzg" @@ -29,10 +30,10 @@ import ( "golang.org/x/sync/errgroup" ) -// Verifier is responsible for verifying blobs, including their +// verifier is responsible for verifying blobs, including their // inclusion and KZG proofs. -type Verifier[ - BeaconBlockHeaderT BeaconBlockHeader, +type verifier[ + BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], BlobSidecarT Sidecar[BeaconBlockHeaderT], BlobSidecarsT Sidecars[BlobSidecarT], ] struct { @@ -42,48 +43,54 @@ type Verifier[ metrics *verifierMetrics } -// NewVerifier creates a new Verifier with the given proof verifier. -func NewVerifier[ - BeaconBlockHeaderT BeaconBlockHeader, +// newVerifier creates a new Verifier with the given proof verifier. +func newVerifier[ + BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], BlobSidecarT Sidecar[BeaconBlockHeaderT], BlobSidecarsT Sidecars[BlobSidecarT], ]( proofVerifier kzg.BlobProofVerifier, telemetrySink TelemetrySink, -) *Verifier[BeaconBlockHeaderT, BlobSidecarT, BlobSidecarsT] { - return &Verifier[BeaconBlockHeaderT, BlobSidecarT, BlobSidecarsT]{ +) *verifier[BeaconBlockHeaderT, BlobSidecarT, BlobSidecarsT] { + return &verifier[BeaconBlockHeaderT, BlobSidecarT, BlobSidecarsT]{ proofVerifier: proofVerifier, metrics: newVerifierMetrics(telemetrySink), } } -// VerifySidecars verifies the blobs for both inclusion as well +// verifySidecars verifies the blobs for both inclusion as well // as the KZG proofs. -func (bv *Verifier[_, _, BlobSidecarsT]) VerifySidecars( - sidecars BlobSidecarsT, kzgOffset uint64, +func (bv *verifier[BeaconBlockHeaderT, _, BlobSidecarsT]) verifySidecars( + sidecars BlobSidecarsT, + kzgOffset uint64, + blkHeader BeaconBlockHeaderT, ) error { - var ( - g, _ = errgroup.WithContext(context.Background()) - startTime = time.Now() - ) - defer bv.metrics.measureVerifySidecarsDuration( - startTime, math.U64(sidecars.Len()), + time.Now(), math.U64(sidecars.Len()), bv.proofVerifier.GetImplementation(), ) + // check that sideracs block headers match with header of the + // corresponding block + for i, s := range sidecars.GetSidecars() { + if !s.GetBeaconBlockHeader().Equals(blkHeader) { + return fmt.Errorf("unequal block header: idx: %d", i) + } + } + // Verify the inclusion proofs on the blobs concurrently. + g, _ := errgroup.WithContext(context.Background()) g.Go(func() error { // TODO: KZGOffset needs to be configurable and not // passed in. - return bv.VerifyInclusionProofs( + return bv.verifyInclusionProofs( sidecars, kzgOffset, ) }) // Verify the KZG proofs on the blobs concurrently. g.Go(func() error { - return bv.VerifyKZGProofs(sidecars) + return bv.verifyKZGProofs(sidecars) }) g.Go(func() error { @@ -94,7 +101,7 @@ func (bv *Verifier[_, _, BlobSidecarsT]) VerifySidecars( return g.Wait() } -func (bv *Verifier[_, _, BlobSidecarsT]) VerifyInclusionProofs( +func (bv *verifier[_, _, BlobSidecarsT]) verifyInclusionProofs( scs BlobSidecarsT, kzgOffset uint64, ) error { @@ -105,8 +112,8 @@ func (bv *Verifier[_, _, BlobSidecarsT]) VerifyInclusionProofs( return scs.VerifyInclusionProofs(kzgOffset) } -// VerifyKZGProofs verifies the sidecars. -func (bv *Verifier[_, _, BlobSidecarsT]) VerifyKZGProofs( +// verifyKZGProofs verifies the sidecars. +func (bv *verifier[_, _, BlobSidecarsT]) verifyKZGProofs( scs BlobSidecarsT, ) error { start := time.Now() diff --git a/mod/da/pkg/da/service.go b/mod/da/pkg/da/service.go index 7ea196d659..35d0c074f5 100644 --- a/mod/da/pkg/da/service.go +++ b/mod/da/pkg/da/service.go @@ -34,17 +34,19 @@ import ( type Service[ AvailabilityStoreT any, + ConsensusSidecarsT ConsensusSidecars[BlobSidecarsT, BeaconBlockHeaderT], BlobSidecarsT BlobSidecar, + BeaconBlockHeaderT any, ] struct { avs AvailabilityStoreT bp BlobProcessor[ AvailabilityStoreT, - BlobSidecarsT, + ConsensusSidecarsT, BlobSidecarsT, ] dispatcher asynctypes.EventDispatcher logger log.Logger // subSidecarsReceived is a channel holding SidecarsReceived events. - subSidecarsReceived chan async.Event[BlobSidecarsT] + subSidecarsReceived chan async.Event[ConsensusSidecarsT] // subFinalBlobSidecars is a channel holding FinalSidecarsReceived events. subFinalBlobSidecars chan async.Event[BlobSidecarsT] } @@ -52,37 +54,41 @@ type Service[ // NewService returns a new DA service. func NewService[ AvailabilityStoreT any, + ConsensusSidecarsT ConsensusSidecars[BlobSidecarsT, BeaconBlockHeaderT], BlobSidecarsT BlobSidecar, + BeaconBlockHeaderT any, ]( avs AvailabilityStoreT, bp BlobProcessor[ - AvailabilityStoreT, BlobSidecarsT, + AvailabilityStoreT, + ConsensusSidecarsT, BlobSidecarsT, ], dispatcher asynctypes.EventDispatcher, logger log.Logger, ) *Service[ - AvailabilityStoreT, BlobSidecarsT, + AvailabilityStoreT, ConsensusSidecarsT, BlobSidecarsT, BeaconBlockHeaderT, ] { return &Service[ - AvailabilityStoreT, BlobSidecarsT, + AvailabilityStoreT, + ConsensusSidecarsT, BlobSidecarsT, BeaconBlockHeaderT, ]{ avs: avs, bp: bp, dispatcher: dispatcher, logger: logger, - subSidecarsReceived: make(chan async.Event[BlobSidecarsT]), + subSidecarsReceived: make(chan async.Event[ConsensusSidecarsT]), subFinalBlobSidecars: make(chan async.Event[BlobSidecarsT]), } } // Name returns the name of the service. -func (s *Service[_, _]) Name() string { +func (s *Service[_, _, _, _]) Name() string { return "da" } // Start subscribes the DA service to SidecarsReceived and FinalSidecarsReceived // events and begins the main event loop to handle them accordingly. -func (s *Service[_, _]) Start(ctx context.Context) error { +func (s *Service[_, _, _, _]) Start(ctx context.Context) error { var err error // subscribe to SidecarsReceived events @@ -106,7 +112,7 @@ func (s *Service[_, _]) Start(ctx context.Context) error { // eventLoop listens and handles SidecarsReceived and FinalSidecarsReceived // events. -func (s *Service[_, _]) eventLoop(ctx context.Context) { +func (s *Service[_, _, _, _]) eventLoop(ctx context.Context) { for { select { case <-ctx.Done(): @@ -126,7 +132,7 @@ func (s *Service[_, _]) eventLoop(ctx context.Context) { // handleFinalSidecarsReceived handles the BlobSidecarsProcessRequest // event. // It processes the sidecars and publishes a BlobSidecarsProcessed event. -func (s *Service[_, BlobSidecarsT]) handleFinalSidecarsReceived( +func (s *Service[_, _, BlobSidecarsT, _]) handleFinalSidecarsReceived( msg async.Event[BlobSidecarsT], ) { if err := s.processSidecars(msg.Context(), msg.Data()); err != nil { @@ -140,25 +146,26 @@ func (s *Service[_, BlobSidecarsT]) handleFinalSidecarsReceived( // handleSidecarsReceived handles the SidecarsVerifyRequest event. // It verifies the sidecars and publishes a SidecarsVerified event. -func (s *Service[_, BlobSidecarsT]) handleSidecarsReceived( - msg async.Event[BlobSidecarsT], +func (s *Service[_, ConsensusSidecarsT, _, _]) handleSidecarsReceived( + cs async.Event[ConsensusSidecarsT], ) { - var sidecarsErr error // verify the sidecars. - if sidecarsErr = s.verifySidecars(msg.Data()); sidecarsErr != nil { + sidecarsErr := s.verifySidecars(cs.Data()) + if sidecarsErr != nil { s.logger.Error( "Failed to receive blob sidecars", - "error", - sidecarsErr, + "error", sidecarsErr, ) } // emit the sidecars verification event with error from verifySidecars - if err := s.dispatcher.Publish( - async.NewEvent( - msg.Context(), async.SidecarsVerified, msg.Data(), sidecarsErr, - ), - ); err != nil { + event := async.NewEvent( + cs.Context(), + async.SidecarsVerified, + cs.Data().GetSidecars(), + sidecarsErr, + ) + if err := s.dispatcher.Publish(event); err != nil { s.logger.Error("failed to publish event", "err", err) } } @@ -168,7 +175,7 @@ func (s *Service[_, BlobSidecarsT]) handleSidecarsReceived( /* -------------------------------------------------------------------------- */ // ProcessSidecars processes the blob sidecars. -func (s *Service[_, BlobSidecarsT]) processSidecars( +func (s *Service[_, _, BlobSidecarsT, _]) processSidecars( _ context.Context, sidecars BlobSidecarsT, ) error { @@ -181,20 +188,19 @@ func (s *Service[_, BlobSidecarsT]) processSidecars( } // VerifyIncomingBlobs receives blobs from the network and processes them. -func (s *Service[_, BlobSidecarsT]) verifySidecars( - sidecars BlobSidecarsT, +func (s *Service[_, ConsensusSidecarsT, _, _]) verifySidecars( + cs ConsensusSidecarsT, ) error { - // If there are no blobs to verify, return early. + sidecars := cs.GetSidecars() if sidecars.IsNil() || sidecars.Len() == 0 { + // nothing to verify return nil } - s.logger.Info( - "Received incoming blob sidecars", - ) + s.logger.Info("Received incoming blob sidecars") // Verify the blobs and ensure they match the local state. - if err := s.bp.VerifySidecars(sidecars); err != nil { + if err := s.bp.VerifySidecars(cs); err != nil { s.logger.Error( "rejecting incoming blob sidecars", "reason", err, diff --git a/mod/da/pkg/da/types.go b/mod/da/pkg/da/types.go index 4e24bc70a7..8cc0be4e5e 100644 --- a/mod/da/pkg/da/types.go +++ b/mod/da/pkg/da/types.go @@ -21,7 +21,10 @@ package da // BlobProcessor is the interface for the blobs processor. -type BlobProcessor[AvailabilityStoreT any, BlobSidecarsT any] interface { +type BlobProcessor[ + AvailabilityStoreT, + ConsensusSidecarsT, BlobSidecarsT any, +] interface { // ProcessSidecars processes the blobs and ensures they match the local // state. ProcessSidecars( @@ -29,9 +32,12 @@ type BlobProcessor[AvailabilityStoreT any, BlobSidecarsT any] interface { sidecars BlobSidecarsT, ) error // VerifySidecars verifies the blobs and ensures they match the local state. - VerifySidecars( - sidecars BlobSidecarsT, - ) error + VerifySidecars(sidecars ConsensusSidecarsT) error +} + +type ConsensusSidecars[BlobSidecarsT any, BeaconBlockHeaderT any] interface { + GetSidecars() BlobSidecarsT + GetHeader() BeaconBlockHeaderT } // BlobSidecar is the interface for the blob sidecar. diff --git a/mod/node-core/pkg/components/blobs.go b/mod/node-core/pkg/components/blobs.go index d7fb582c6f..7fc97405fa 100644 --- a/mod/node-core/pkg/components/blobs.go +++ b/mod/node-core/pkg/components/blobs.go @@ -54,40 +54,18 @@ func ProvideBlobProofVerifier( ) } -// BlobVerifierInput is the input for the BlobVerifier. -type BlobVerifierInput struct { - depinject.In - BlobProofVerifier kzg.BlobProofVerifier - TelemetrySink *metrics.TelemetrySink -} - -// ProvideBlobVerifier is a function that provides the BlobVerifier to the -// depinject framework. -func ProvideBlobVerifier[ - BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], - BlobSidecarT BlobSidecar[BeaconBlockHeaderT], - BlobSidecarsT BlobSidecars[BlobSidecarsT, BlobSidecarT], -](in BlobVerifierInput) *dablob.Verifier[ - BeaconBlockHeaderT, BlobSidecarT, BlobSidecarsT, -] { - return dablob.NewVerifier[ - BeaconBlockHeaderT, - BlobSidecarT, - BlobSidecarsT, - ](in.BlobProofVerifier, in.TelemetrySink) -} - // BlobProcessorIn is the input for the BlobProcessor. type BlobProcessorIn[ BlobSidecarsT any, + BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], LoggerT any, ] struct { depinject.In - BlobVerifier BlobVerifier[BlobSidecarsT] - ChainSpec common.ChainSpec - Logger LoggerT - TelemetrySink *metrics.TelemetrySink + BlobProofVerifier kzg.BlobProofVerifier + ChainSpec common.ChainSpec + Logger LoggerT + TelemetrySink *metrics.TelemetrySink } // ProvideBlobProcessor is a function that provides the BlobProcessor to the @@ -96,25 +74,27 @@ func ProvideBlobProcessor[ AvailabilityStoreT AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT], BeaconBlockBodyT any, BeaconBlockHeaderT BeaconBlockHeader[BeaconBlockHeaderT], + ConsensusSidecarsT ConsensusSidecars[BlobSidecarsT, BeaconBlockHeaderT], BlobSidecarT BlobSidecar[BeaconBlockHeaderT], BlobSidecarsT BlobSidecars[BlobSidecarsT, BlobSidecarT], LoggerT log.AdvancedLogger[LoggerT], ]( - in BlobProcessorIn[BlobSidecarsT, LoggerT], + in BlobProcessorIn[BlobSidecarsT, BeaconBlockHeaderT, LoggerT], ) *dablob.Processor[ AvailabilityStoreT, BeaconBlockBodyT, BeaconBlockHeaderT, - BlobSidecarT, BlobSidecarsT, + ConsensusSidecarsT, BlobSidecarT, BlobSidecarsT, ] { return dablob.NewProcessor[ AvailabilityStoreT, BeaconBlockBodyT, BeaconBlockHeaderT, + ConsensusSidecarsT, BlobSidecarT, BlobSidecarsT, ]( in.Logger.With("service", "blob-processor"), in.ChainSpec, - in.BlobVerifier, + in.BlobProofVerifier, types.BlockBodyKZGOffset, in.TelemetrySink, ) @@ -123,7 +103,7 @@ func ProvideBlobProcessor[ // DAServiceIn is the input for the BlobService. type DAServiceIn[ AvailabilityStoreT any, - BeaconBlockBodyT any, + ConsensusSidecarsT any, BlobSidecarsT any, LoggerT any, ] struct { @@ -131,7 +111,7 @@ type DAServiceIn[ AvailabilityStore AvailabilityStoreT BlobProcessor BlobProcessor[ - AvailabilityStoreT, BeaconBlockBodyT, BlobSidecarsT, + AvailabilityStoreT, ConsensusSidecarsT, BlobSidecarsT, ] Dispatcher Dispatcher Logger LoggerT @@ -142,17 +122,24 @@ type DAServiceIn[ func ProvideDAService[ AvailabilityStoreT AvailabilityStore[BeaconBlockBodyT, BlobSidecarsT], BeaconBlockBodyT any, + BeaconBlockHeaderT any, + ConsensusSidecarsT ConsensusSidecars[BlobSidecarsT, BeaconBlockHeaderT], BlobSidecarT any, BlobSidecarsT BlobSidecars[BlobSidecarsT, BlobSidecarT], LoggerT log.AdvancedLogger[LoggerT], ]( in DAServiceIn[ - AvailabilityStoreT, BeaconBlockBodyT, BlobSidecarsT, LoggerT, + AvailabilityStoreT, ConsensusSidecarsT, BlobSidecarsT, LoggerT, ], -) *da.Service[AvailabilityStoreT, BlobSidecarsT] { +) *da.Service[ + AvailabilityStoreT, + ConsensusSidecarsT, BlobSidecarsT, BeaconBlockHeaderT, +] { return da.NewService[ AvailabilityStoreT, + ConsensusSidecarsT, BlobSidecarsT, + BeaconBlockHeaderT, ]( in.AvailabilityStore, in.BlobProcessor, diff --git a/mod/node-core/pkg/components/dispatcher.go b/mod/node-core/pkg/components/dispatcher.go index fab905457b..028bbe2e3f 100644 --- a/mod/node-core/pkg/components/dispatcher.go +++ b/mod/node-core/pkg/components/dispatcher.go @@ -39,6 +39,7 @@ type DispatcherInput[ func ProvideDispatcher[ ConsensusBlockT any, BeaconBlockT any, + ConsensusSidecars any, BlobSidecarsT any, GenesisT any, LoggerT log.AdvancedLogger[LoggerT], @@ -53,7 +54,7 @@ func ProvideDispatcher[ dp.WithEvent[async.Event[BeaconBlockT]](async.BuiltBeaconBlock), dp.WithEvent[async.Event[BlobSidecarsT]](async.BuiltSidecars), dp.WithEvent[async.Event[ConsensusBlockT]](async.BeaconBlockReceived), - dp.WithEvent[async.Event[BlobSidecarsT]](async.SidecarsReceived), + dp.WithEvent[async.Event[ConsensusSidecars]](async.SidecarsReceived), dp.WithEvent[async.Event[BeaconBlockT]](async.BeaconBlockVerified), dp.WithEvent[async.Event[BlobSidecarsT]](async.SidecarsVerified), dp.WithEvent[async.Event[ConsensusBlockT]](async.FinalBeaconBlockReceived), diff --git a/mod/node-core/pkg/components/interfaces.go b/mod/node-core/pkg/components/interfaces.go index 28a118993e..83401123f9 100644 --- a/mod/node-core/pkg/components/interfaces.go +++ b/mod/node-core/pkg/components/interfaces.go @@ -189,12 +189,13 @@ type ( SetStateRoot(common.Root) GetBodyRoot() common.Root GetTree() (*fastssz.Node, error) + Equals(T) bool } // BeaconStateMarshallable represents an interface for a beacon state // with generic types. BeaconStateMarshallable[ - T any, + T, BeaconBlockHeaderT, Eth1DataT, ExecutionPayloadHeaderT, @@ -227,7 +228,7 @@ type ( // BlobProcessor is the interface for the blobs processor. BlobProcessor[ AvailabilityStoreT any, - BeaconBlockBodyT any, + ConsensusSidecarsT any, BlobSidecarsT any, ] interface { // ProcessSidecars processes the blobs and ensures they match the local @@ -239,7 +240,7 @@ type ( // VerifySidecars verifies the blobs and ensures they match the local // state. VerifySidecars( - sidecars BlobSidecarsT, + sidecars ConsensusSidecarsT, ) error } @@ -250,6 +251,14 @@ type ( GetKzgCommitment() eip4844.KZGCommitment } + ConsensusSidecars[ + BlobSidecarsT any, + BeaconBlockHeaderT any, + ] interface { + GetSidecars() BlobSidecarsT + GetHeader() BeaconBlockHeaderT + } + // BlobSidecars is the interface for blobs sidecars. BlobSidecars[T, BlobSidecarT any] interface { constraints.Nillable @@ -262,10 +271,14 @@ type ( VerifyInclusionProofs(kzgOffset uint64) error } - BlobVerifier[BlobSidecarsT any] interface { + BlobVerifier[BlobSidecarsT, BeaconBlockHeaderT any] interface { VerifyInclusionProofs(scs BlobSidecarsT, kzgOffset uint64) error VerifyKZGProofs(scs BlobSidecarsT) error - VerifySidecars(sidecars BlobSidecarsT, kzgOffset uint64) error + VerifySidecars( + sidecars BlobSidecarsT, + kzgOffset uint64, + blkHeader BeaconBlockHeaderT, + ) error } // // BlockchainService defines the interface for interacting with the diff --git a/mod/node-core/pkg/components/middleware.go b/mod/node-core/pkg/components/middleware.go index 477eb9c9dc..df9c8298ff 100644 --- a/mod/node-core/pkg/components/middleware.go +++ b/mod/node-core/pkg/components/middleware.go @@ -58,10 +58,11 @@ func ProvideABCIMiddleware[ ]( in ABCIMiddlewareInput[BeaconBlockT, BlobSidecarsT, LoggerT], ) (*middleware.ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, GenesisT, *SlotData, + BeaconBlockT, BeaconBlockHeaderT, BlobSidecarsT, GenesisT, *SlotData, ], error) { return middleware.NewABCIMiddleware[ BeaconBlockT, + BeaconBlockHeaderT, BlobSidecarsT, GenesisT, *SlotData, diff --git a/mod/node-core/pkg/components/service_registry.go b/mod/node-core/pkg/components/service_registry.go index 41b8838b8e..332df87ad6 100644 --- a/mod/node-core/pkg/components/service_registry.go +++ b/mod/node-core/pkg/components/service_registry.go @@ -55,6 +55,7 @@ type ServiceRegistryInput[ *Validator, Validators, WithdrawalT, ], BeaconStateMarshallableT any, + ConsensusSidecarsT ConsensusSidecars[BlobSidecarsT, BeaconBlockHeaderT], BlobSidecarT any, BlobSidecarsT BlobSidecars[BlobSidecarsT, BlobSidecarT], DepositT Deposit[DepositT, *ForkData, WithdrawalCredentials], @@ -72,7 +73,7 @@ type ServiceRegistryInput[ ] struct { depinject.In ABCIService *middleware.ABCIMiddleware[ - BeaconBlockT, BlobSidecarsT, GenesisT, *SlotData, + BeaconBlockT, BeaconBlockHeaderT, BlobSidecarsT, GenesisT, *SlotData, ] BlockStoreService *blockstore.Service[ BeaconBlockT, BeaconBlockStoreT, @@ -84,7 +85,10 @@ type ServiceRegistryInput[ ExecutionPayloadHeaderT, GenesisT, *engineprimitives.PayloadAttributes[WithdrawalT], ] - DAService *da.Service[AvailabilityStoreT, BlobSidecarsT] + DAService *da.Service[ + AvailabilityStoreT, + ConsensusSidecarsT, BlobSidecarsT, BeaconBlockHeaderT, + ] DBManager *DBManager DepositService *deposit.Service[ BeaconBlockT, BeaconBlockBodyT, DepositT, @@ -126,6 +130,7 @@ func ProvideServiceRegistry[ *Validator, Validators, WithdrawalT, ], BeaconStateMarshallableT any, + ConsensusSidecarsT ConsensusSidecars[BlobSidecarsT, BeaconBlockHeaderT], BlobSidecarT any, BlobSidecarsT BlobSidecars[BlobSidecarsT, BlobSidecarT], DepositT Deposit[DepositT, *ForkData, WithdrawalCredentials], @@ -144,7 +149,8 @@ func ProvideServiceRegistry[ AvailabilityStoreT, ConsensusBlockT, BeaconBlockT, BeaconBlockBodyT, BeaconBlockHeaderT, BeaconBlockStoreT, BeaconStateT, - BeaconStateMarshallableT, BlobSidecarT, BlobSidecarsT, + BeaconStateMarshallableT, + ConsensusSidecarsT, BlobSidecarT, BlobSidecarsT, DepositT, DepositStoreT, ExecutionPayloadT, ExecutionPayloadHeaderT, GenesisT, KVStoreT, LoggerT, NodeAPIContextT, WithdrawalT, WithdrawalsT, ],