From dd393b470faf1eea850946b1a3b42faefac4e689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 18 May 2021 20:34:23 +0200 Subject: [PATCH] Fix aggregation inputs --- api/test/window_post.go | 2 +- extern/sector-storage/mock/mock.go | 2 +- extern/storage-sealing/commit_batch.go | 10 +++++++--- extern/storage-sealing/states_sealing.go | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/api/test/window_post.go b/api/test/window_post.go index e508fb5c5..df520c63d 100644 --- a/api/test/window_post.go +++ b/api/test/window_post.go @@ -121,7 +121,7 @@ func TestPledgeBatching(t *testing.T, b APIBuilder, blocktime time.Duration, nSe ctx, cancel := context.WithCancel(context.Background()) defer cancel() - n, sn := b(t, []FullNodeOpts{FullNodeWithLatestActorsAt(-1)}, OneMiner) + n, sn := b(t, []FullNodeOpts{FullNodeWithLatestActorsAt(-1)}, OneMiner) client := n[0].FullNode.(*impl.FullNodeAPI) miner := sn[0] diff --git a/extern/sector-storage/mock/mock.go b/extern/sector-storage/mock/mock.go index c7844befd..bb968b474 100644 --- a/extern/sector-storage/mock/mock.go +++ b/extern/sector-storage/mock/mock.go @@ -517,7 +517,7 @@ func (m mockVerif) VerifyAggregateSeals(aggregate proof5.AggregateSealVerifyProo for i := 0; i < 32; i++ { b := svi.UnsealedCID.Bytes()[i] + svi.SealedCID.Bytes()[31-i] - svi.InteractiveRandomness[i]*svi.Randomness[i] // raw proof byte - b *= uint8(pi) // with aggregate index + b *= uint8(pi) // with aggregate index out[i] += b } } diff --git a/extern/storage-sealing/commit_batch.go b/extern/storage-sealing/commit_batch.go index 060a92fff..f086c2ad6 100644 --- a/extern/storage-sealing/commit_batch.go +++ b/extern/storage-sealing/commit_batch.go @@ -181,7 +181,6 @@ func (b *CommitBatcher) processBatch(notif, after bool) (*cid.Cid, error) { return nil, nil } - spt := b.todo[0].spt proofs := make([][]byte, 0, total) infos := make([]proof5.AggregateSealVerifyInfo, 0, total) @@ -198,9 +197,14 @@ func (b *CommitBatcher) processBatch(notif, after bool) (*cid.Cid, error) { proofs = append(proofs, b.todo[info.Number].proof) } + mid, err := address.IDFromAddress(b.maddr) + if err != nil { + return nil, xerrors.Errorf("getting miner id: %w", err) + } + params.AggregateProof, err = b.verif.AggregateSealProofs(proof5.AggregateSealVerifyProofAndInfos{ - Miner: 0, - SealProof: spt, + Miner: abi.ActorID(mid), + SealProof: b.todo[infos[0].Number].spt, AggregateProof: arp, Infos: infos, }, proofs) diff --git a/extern/storage-sealing/states_sealing.go b/extern/storage-sealing/states_sealing.go index 19eb31e64..bec9ad51b 100644 --- a/extern/storage-sealing/states_sealing.go +++ b/extern/storage-sealing/states_sealing.go @@ -3,7 +3,6 @@ package sealing import ( "bytes" "context" - "github.com/ipfs/go-cid" "golang.org/x/xerrors" @@ -590,6 +589,7 @@ func (m *Sealing) handleSubmitCommitAggregate(ctx statemachine.Context, sector S UnsealedCID: *sector.CommD, }, proof: sector.Proof, // todo: this correct?? + spt: sector.SectorType, }) if err != nil { return ctx.Send(SectorCommitFailed{xerrors.Errorf("queuing commit for aggregation failed: %w", err)})