Skip to content

Commit

Permalink
Fix Bugs in PeerDAS Testing (#14396)
Browse files Browse the repository at this point in the history
* Fix Various Bugs in PeerDAS

* Remove Log

* Remove useless copy var.

---------

Co-authored-by: Manu NALEPA <[email protected]>
  • Loading branch information
nisdas and nalepae authored Aug 29, 2024
1 parent bd7ec3f commit 8cd37ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
23 changes: 16 additions & 7 deletions beacon-chain/core/peerdas/helpers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package peerdas

import (
"context"
"encoding/binary"
"fmt"
"math"
Expand Down Expand Up @@ -145,16 +146,24 @@ func DataColumnSidecars(signedBlock interfaces.ReadOnlySignedBeaconBlock, blobs
}

// Compute cells and proofs.
cellsAndProofs := make([]kzg.CellsAndProofs, 0, blobsCount)
cellsAndProofs := make([]kzg.CellsAndProofs, blobsCount)

eg, _ := errgroup.WithContext(context.Background())
for i := range blobs {
blob := &blobs[i]
blobCellsAndProofs, err := kzg.ComputeCellsAndKZGProofs(blob)
if err != nil {
return nil, errors.Wrap(err, "compute cells and KZG proofs")
}
blobIndex := i
eg.Go(func() error {
blob := &blobs[blobIndex]
blobCellsAndProofs, err := kzg.ComputeCellsAndKZGProofs(blob)
if err != nil {
return errors.Wrap(err, "compute cells and KZG proofs")
}

cellsAndProofs = append(cellsAndProofs, blobCellsAndProofs)
cellsAndProofs[blobIndex] = blobCellsAndProofs
return nil
})
}
if err := eg.Wait(); err != nil {
return nil, err
}

// Get the column sidecars.
Expand Down
4 changes: 4 additions & 0 deletions beacon-chain/sync/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,10 @@ func (s *Service) subscribeDynamicWithColumnSubnets(
genesis := s.cfg.clock.GenesisTime()
ticker := slots.NewSlotTicker(genesis, params.BeaconConfig().SecondsPerSlot)

wantedSubs := s.retrieveActiveColumnSubnets()
for _, idx := range wantedSubs {
s.subscribeWithBase(s.addDigestAndIndexToTopic(topicFormat, digest, idx), validate, handle)
}
go func() {
for {
select {
Expand Down

0 comments on commit 8cd37ab

Please sign in to comment.