Order proofs before aggregation

This commit is contained in:
Łukasz Magiera 2021-05-18 18:58:41 +02:00
parent 9690bc882c
commit e400bdf87a
2 changed files with 22 additions and 1 deletions

View File

@ -516,11 +516,18 @@ func (m mockVerif) VerifyAggregateSeals(aggregate proof5.AggregateSealVerifyProo
for pi, svi := range aggregate.Infos {
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
out[i] += b
}
}
var sis []abi.SectorNumber
for _, info := range aggregate.Infos {
sis = append(sis, info.Number)
}
fmt.Printf("VERSIS %+v\n", sis)
return bytes.Equal(aggregate.Proof, out), nil
}
@ -531,6 +538,13 @@ func (m mockVerif) AggregateSealProofs(aggregateInfo proof5.AggregateSealVerifyP
out[i] += proof[i] * uint8(pi)
}
}
var sis []abi.SectorNumber
for _, info := range aggregateInfo.Infos {
sis = append(sis, info.Number)
}
fmt.Printf("AGGSIS %+v\n", sis)
return out, nil
}

View File

@ -186,10 +186,17 @@ func (b *CommitBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
for id, p := range b.todo {
params.SectorNumbers.Set(uint64(id))
proofs = append(proofs, p.proof)
infos = append(infos, p.info)
}
sort.Slice(infos, func(i, j int) bool {
return infos[i].Number < infos[j].Number
})
for _, info := range infos {
proofs = append(proofs, b.todo[info.Number].proof)
}
params.AggregateProof, err = b.verif.AggregateSealProofs(proof5.AggregateSealVerifyProofAndInfos{
Miner: 0,
SealProof: spt,