From ba2032c642b212747eef8afa63d1778033e3f899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 17 May 2021 22:51:29 +0200 Subject: [PATCH] Fix some aggregation bugs --- api/test/window_post.go | 6 ++++++ extern/storage-sealing/commit_batch.go | 4 ++-- extern/storage-sealing/states_sealing.go | 11 ++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/api/test/window_post.go b/api/test/window_post.go index c987fa1f9..b6804c401 100644 --- a/api/test/window_post.go +++ b/api/test/window_post.go @@ -188,6 +188,12 @@ func pledgeSectors(t *testing.T, ctx context.Context, miner TestStorageNode, n, } for len(toCheck) > 0 { + cb, err := miner.SectorCommitFlush(ctx) + require.NoError(t, err) + if cb != nil { + fmt.Printf("BATCH: %s\n", *cb) + } + for n := range toCheck { st, err := miner.SectorsStatus(ctx, n, false) require.NoError(t, err) diff --git a/extern/storage-sealing/commit_batch.go b/extern/storage-sealing/commit_batch.go index 8b5d9b543..ad0b00e88 100644 --- a/extern/storage-sealing/commit_batch.go +++ b/extern/storage-sealing/commit_batch.go @@ -141,11 +141,11 @@ func (b *CommitBatcher) processBatch(notif, after bool) (*cid.Cid, error) { } spt := b.todo[0].spt - proofs := make([][]byte, total) + proofs := make([][]byte, 0, total) for id, p := range b.todo { params.SectorNumbers.Set(uint64(id)) - proofs[id] = p.proof + proofs = append(proofs, p.proof) } params.AggregateProof, err = b.verif.AggregateSealProofs(spt, arp, proofs) diff --git a/extern/storage-sealing/states_sealing.go b/extern/storage-sealing/states_sealing.go index 9975b1a37..739e8c946 100644 --- a/extern/storage-sealing/states_sealing.go +++ b/extern/storage-sealing/states_sealing.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/exitcode" + "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/specs-actors/v5/actors/runtime/proof" "github.com/filecoin-project/specs-storage/storage" @@ -457,8 +458,16 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo if err != nil { return xerrors.Errorf("getting config: %w", err) } + if cfg.AggregateCommits { - return ctx.Send(SectorSubmitCommitAggregate{}) + nv, err := m.api.StateNetworkVersion(ctx.Context(), nil) + if err != nil { + return xerrors.Errorf("getting network version: %w", err) + } + + if nv >= network.Version13 { + return ctx.Send(SectorSubmitCommitAggregate{}) + } } tok, _, err := m.api.ChainHead(ctx.Context())