Files
prysm/beacon-chain/verification/interface.go
Manu NALEPA 3d4e2c5568 Implement data column sidecars verifications. (#15232)
* Logging: Add `DataColumnFields`.

* `RODataColumn`: Implement `Slot`, `ParentRoot` and `ProposerIndex`.

* Implement verification for data column sidecars.

* Add changelog.

* Fix Terence's comment.

* Fix Terence's comment.

* `SidecarProposerExpected`: Stop returning "sidecar was not proposed by the expected proposer_index" when there is any error in the function.

* `SidecarProposerExpected` & `ValidProposerSignature`: Cache the parent state.

* `VerifyDataColumnsSidecarKZGProofs`: Add benchmarks.

* Fix Kasey's comment.

* Add additional benchmark.

* Fix Kasey's comment.

* Fix Kasey's comment.

* Fix Kasey's comment.

* Fix Preston's comment.

* Fix Preston's comment.

* Fix Preston's comment.
2025-05-20 21:15:29 +00:00

57 lines
2.3 KiB
Go

package verification
import (
"context"
fieldparams "github.com/OffchainLabs/prysm/v6/config/fieldparams"
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
)
// BlobVerifier defines the methods implemented by the ROBlobVerifier.
// It is mainly intended to make mocks and tests more straightforward, and to deal
// with the awkwardness of mocking a concrete type that returns a concrete type
// in tests outside of this package.
type BlobVerifier interface {
VerifiedROBlob() (blocks.VerifiedROBlob, error)
BlobIndexInBounds() (err error)
NotFromFutureSlot() (err error)
SlotAboveFinalized() (err error)
ValidProposerSignature(ctx context.Context) (err error)
SidecarParentSeen(parentSeen func([32]byte) bool) (err error)
SidecarParentValid(badParent func([32]byte) bool) (err error)
SidecarParentSlotLower() (err error)
SidecarDescendsFromFinalized() (err error)
SidecarInclusionProven() (err error)
SidecarKzgProofVerified() (err error)
SidecarProposerExpected(ctx context.Context) (err error)
SatisfyRequirement(Requirement)
}
// NewBlobVerifier is a function signature that can be used by code that needs to be
// able to mock Initializer.NewBlobVerifier without complex setup.
type NewBlobVerifier func(b blocks.ROBlob, reqs []Requirement) BlobVerifier
// DataColumnsVerifier defines the methods implemented by the RODataColumnVerifier.
// It serves a very similar purpose as the blob verifier interface for data columns.
type DataColumnsVerifier interface {
VerifiedRODataColumns() ([]blocks.VerifiedRODataColumn, error)
SatisfyRequirement(Requirement)
ValidFields() error
CorrectSubnet(dataColumnSidecarSubTopic string, expectedTopics []string) error
NotFromFutureSlot() error
SlotAboveFinalized() error
ValidProposerSignature(ctx context.Context) error
SidecarParentSeen(parentSeen func([fieldparams.RootLength]byte) bool) error
SidecarParentValid(badParent func([fieldparams.RootLength]byte) bool) error
SidecarParentSlotLower() error
SidecarDescendsFromFinalized() error
SidecarInclusionProven() error
SidecarKzgProofVerified() error
SidecarProposerExpected(ctx context.Context) error
}
// NewDataColumnsVerifier is a function signature that can be used to mock a setup where a
// column verifier can be easily initialized.
type NewDataColumnsVerifier func(dataColumns []blocks.RODataColumn, reqs []Requirement) DataColumnsVerifier