mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 04:54:05 -05:00
**What type of PR is this?** Feature **What does this PR do? Why is it needed?** Adds data column support to backfill. **Acknowledgements** - [x] I have read [CONTRIBUTING.md](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md). - [x] I have included a uniquely named [changelog fragment file](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md#maintaining-changelogmd). - [x] I have added a description to this PR with sufficient context for reviewers to understand this PR. --------- Co-authored-by: Kasey <kasey@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Preston Van Loon <preston@pvl.dev>
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package das
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
|
|
"github.com/OffchainLabs/prysm/v7/consensus-types/primitives"
|
|
)
|
|
|
|
// MockAvailabilityStore is an implementation of AvailabilityStore that can be used by other packages in tests.
|
|
type MockAvailabilityStore struct {
|
|
VerifyAvailabilityCallback func(ctx context.Context, current primitives.Slot, b ...blocks.ROBlock) error
|
|
ErrIsDataAvailable error
|
|
PersistBlobsCallback func(current primitives.Slot, blobSidecar ...blocks.ROBlob) error
|
|
}
|
|
|
|
var _ AvailabilityChecker = &MockAvailabilityStore{}
|
|
|
|
// IsDataAvailable satisfies the corresponding method of the AvailabilityStore interface in a way that is useful for tests.
|
|
func (m *MockAvailabilityStore) IsDataAvailable(ctx context.Context, current primitives.Slot, b ...blocks.ROBlock) error {
|
|
if m.ErrIsDataAvailable != nil {
|
|
return m.ErrIsDataAvailable
|
|
}
|
|
if m.VerifyAvailabilityCallback != nil {
|
|
return m.VerifyAvailabilityCallback(ctx, current, b...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Persist satisfies the corresponding method of the AvailabilityStore interface in a way that is useful for tests.
|
|
func (m *MockAvailabilityStore) Persist(current primitives.Slot, blobSidecar ...blocks.ROBlob) error {
|
|
if m.PersistBlobsCallback != nil {
|
|
return m.PersistBlobsCallback(current, blobSidecar...)
|
|
}
|
|
return nil
|
|
}
|