Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrDuplicateSidecar = errors.New("duplicate sidecar stashed in AvailabilityStore")
)
Functions ¶
This section is empty.
Types ¶
type AvailabilityStore ¶
type AvailabilityStore interface { IsDataAvailable(ctx context.Context, current primitives.Slot, b blocks.ROBlock) error Persist(current primitives.Slot, sc ...blocks.ROBlob) error }
AvailabilityStore describes a component that can verify and save sidecars for a given block, and confirm previously verified and saved sidecars. Persist guarantees that the sidecar will be available to perform a DA check for the life of the beacon node process. IsDataAvailable guarantees that all blobs committed to in the block have been durably persisted before returning a non-error value.
type BlobBatchVerifier ¶
type BlobBatchVerifier interface {
VerifiedROBlobs(ctx context.Context, blk blocks.ROBlock, sc []blocks.ROBlob) ([]blocks.VerifiedROBlob, error)
}
BlobBatchVerifier enables LazyAvailabilityStore to manage the verification process going from ROBlob->VerifiedROBlob, while avoiding the decision of which individual verifications to run and in what order. Since LazilyPersistentStore always tries to verify and save blobs only when they are all available, the interface takes a slice of blobs, enabling the implementation to optimize batch verification.
type LazilyPersistentStore ¶
type LazilyPersistentStore struct {
// contains filtered or unexported fields
}
LazilyPersistentStore is an implementation of AvailabilityStore to be used when batch syncing. This implementation will hold any blobs passed to Persist until the IsDataAvailable is called for their block, at which time they will undergo full verification and be saved to the disk.
func NewLazilyPersistentStore ¶
func NewLazilyPersistentStore(store *filesystem.BlobStorage, verifier BlobBatchVerifier) *LazilyPersistentStore
NewLazilyPersistentStore creates a new LazilyPersistentStore. This constructor should always be used when creating a LazilyPersistentStore because it needs to initialize the cache under the hood.
func (*LazilyPersistentStore) IsDataAvailable ¶
func (s *LazilyPersistentStore) IsDataAvailable(ctx context.Context, current primitives.Slot, b blocks.ROBlock) error
IsDataAvailable returns nil if all the commitments in the given block are persisted to the db and have been verified. BlobSidecars already in the db are assumed to have been previously verified against the block.
func (*LazilyPersistentStore) Persist ¶
func (s *LazilyPersistentStore) Persist(current primitives.Slot, sc ...blocks.ROBlob) error
Persist adds blobs to the working blob cache. Blobs stored in this cache will be persisted for at least as long as the node is running. Once IsDataAvailable succeeds, all blobs referenced by the given block are guaranteed to be persisted for the remainder of the retention period.
type MockAvailabilityStore ¶
type MockAvailabilityStore struct { VerifyAvailabilityCallback func(ctx context.Context, current primitives.Slot, b blocks.ROBlock) error PersistBlobsCallback func(current primitives.Slot, sc ...blocks.ROBlob) error }
MockAvailabilityStore is an implementation of AvailabilityStore that can be used by other packages in tests.
func (*MockAvailabilityStore) IsDataAvailable ¶
func (m *MockAvailabilityStore) IsDataAvailable(ctx context.Context, current primitives.Slot, b blocks.ROBlock) error
IsDataAvailable satisfies the corresponding method of the AvailabilityStore interface in a way that is useful for tests.
func (*MockAvailabilityStore) Persist ¶
func (m *MockAvailabilityStore) Persist(current primitives.Slot, sc ...blocks.ROBlob) error
Persist satisfies the corresponding method of the AvailabilityStore interface in a way that is useful for tests.