Skip to content

Commit 4727125

Browse files
authored
New Data Column Sidecar Storage Design, Data Columns as a First-Class Citizen & Unit Testing (#15061)
* DB Filesystem: Move all data column related code to `data_columns.go` Only code move. * Implement data columns storage * Kasey comment: Fix typo * Kasey comment: Fix clutter * Kasey comment: `IsDataAvailable`: Remove `nodeID`. * Kasey comment: indice ==> index * Kasey comment: Move `CreateTestVerifiedRoDataColumnSidecars` in `beacon-chain/verification/fake`. * `Store` ==> `Save`. * Kasey comment: AAAA! * Kasey comment: Fix typo. * Kasey comment: Add comment. * Kasey commnet: Stop exporting errors for nothing. * Kasey comment: Read all metadata at once. * Kasey comment: Compute file size instead of reading it from stats. * Kasey comment: Lock mutexes before checking if the file exists. * Kasey comment: `limit` ==> `nonZeroOffset`. * Kasey comment: `DataColumnStorage.Get`: Set verified into the `verification package`. * Kasey comment: `prune` - Flatten the `==` case. * Kasey comment: Implement and use `storageIndices`. * `DataColumnsAlignWithBlock`: Move into its own file. * `DataColumnSidecar`: Rename variables to stick with https://github.com/ethereum/consensus-specs/blob/dev/specs/fulu/das-core.md#datacolumnsidecar * Kasey comment: Add `file.Sync`. * `DataColumnStorage.Get`: Remove useless cast. * (Internal) Kasey comment: Set automatically the count of saved data columns.
1 parent f304028 commit 4727125

File tree

102 files changed

+4958
-1715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+4958
-1715
lines changed

beacon-chain/blockchain/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ go_test(
144144
"//beacon-chain/core/feed/state:go_default_library",
145145
"//beacon-chain/core/helpers:go_default_library",
146146
"//beacon-chain/core/light-client:go_default_library",
147+
"//beacon-chain/core/peerdas:go_default_library",
147148
"//beacon-chain/core/signing:go_default_library",
148149
"//beacon-chain/core/transition:go_default_library",
149150
"//beacon-chain/das:go_default_library",
@@ -165,6 +166,7 @@ go_test(
165166
"//beacon-chain/state:go_default_library",
166167
"//beacon-chain/state/state-native:go_default_library",
167168
"//beacon-chain/state/stategen:go_default_library",
169+
"//beacon-chain/verification:go_default_library",
168170
"//config/features:go_default_library",
169171
"//config/fieldparams:go_default_library",
170172
"//config/params:go_default_library",

beacon-chain/blockchain/execution_engine.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,9 @@ func (s *Service) removeInvalidBlockAndState(ctx context.Context, blkRoots [][32
444444
// Blobs may not exist for some blocks, leading to deletion failures. Log such errors at debug level.
445445
log.WithError(err).Debug("Could not remove blob from blob storage")
446446
}
447+
if err := s.dataColumnStorage.Remove(root); err != nil {
448+
log.WithError(err).Debug("Could not remove data columns from data column storage")
449+
}
447450
}
448451
return nil
449452
}

beacon-chain/blockchain/kzg/kzg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func RecoverCellsAndKZGProofs(cellIndices []uint64, partialCells []Cell) (CellsA
9999

100100
ckzgCells, ckzgProofs, err := ckzg4844.RecoverCellsAndKZGProofs(cellIndices, ckzgPartialCells)
101101
if err != nil {
102-
return CellsAndProofs{}, err
102+
return CellsAndProofs{}, errors.Wrap(err, "recover cells and KZG proofs")
103103
}
104104

105105
return makeCellsAndProofs(ckzgCells[:], ckzgProofs[:])

beacon-chain/blockchain/options.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package blockchain
22

33
import (
4+
"time"
5+
46
"github.com/prysmaticlabs/prysm/v5/async/event"
57
"github.com/prysmaticlabs/prysm/v5/beacon-chain/cache"
68
statefeed "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed/state"
@@ -208,6 +210,14 @@ func WithBlobStorage(b *filesystem.BlobStorage) Option {
208210
}
209211
}
210212

213+
// WithDataColumnStorage sets the data column storage backend for the blockchain service.
214+
func WithDataColumnStorage(b *filesystem.DataColumnStorage) Option {
215+
return func(s *Service) error {
216+
s.dataColumnStorage = b
217+
return nil
218+
}
219+
}
220+
211221
func WithSyncChecker(checker Checker) Option {
212222
return func(s *Service) error {
213223
s.cfg.SyncChecker = checker
@@ -221,3 +231,10 @@ func WithCustodyInfo(custodyInfo *peerdas.CustodyInfo) Option {
221231
return nil
222232
}
223233
}
234+
235+
func WithGenesisTime(genesisTime time.Time) Option {
236+
return func(s *Service) error {
237+
s.genesisTime = genesisTime
238+
return nil
239+
}
240+
}

0 commit comments

Comments
 (0)