Make things build

This commit is contained in:
Łukasz Magiera 2021-05-17 20:47:41 +02:00
parent 8f42f375cf
commit 6278bdc69a
10 changed files with 36 additions and 16 deletions

View File

@ -302,6 +302,10 @@ func GetDefaultSectorSize() abi.SectorSize {
return szs[0]
}
func GetDefaultAggregationProof() abi.RegisteredAggregationProof {
return abi.RegisteredAggregationProof_SnarkPackV1
}
func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version) abi.ChainEpoch {
if nwVer <= network.Version10 {
return builtin5.SealProofPoliciesV0[proof].SectorMaxLifetime

View File

@ -693,7 +693,7 @@ func (m genFakeVerifier) VerifyAggregateSeals(aggregate proof5.AggregateSealVeri
panic("not supported")
}
func (m genFakeVerifier) AggregateSealProofs(proofType abi.RegisteredSealProof, proofs [][]byte) ([]byte, error) {
func (m genFakeVerifier) AggregateSealProofs(proofType abi.RegisteredSealProof, rap abi.RegisteredAggregationProof, proofs [][]byte) ([]byte, error) {
panic("not supported")
}

View File

@ -8,6 +8,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
proof5 "github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"
"github.com/ipfs/go-datastore"
"github.com/minio/blake2b-simd"
cbg "github.com/whyrusleeping/cbor-gen"
@ -96,4 +97,12 @@ func (cv *cachingVerifier) GenerateWinningPoStSectorChallenge(ctx context.Contex
return cv.backend.GenerateWinningPoStSectorChallenge(ctx, proofType, a, rnd, u)
}
func (cv cachingVerifier) VerifyAggregateSeals(aggregate proof5.AggregateSealVerifyProofAndInfos) (bool, error) {
return cv.backend.VerifyAggregateSeals(aggregate)
}
func (cv cachingVerifier) AggregateSealProofs(proofType abi.RegisteredSealProof, rap abi.RegisteredAggregationProof, proofs [][]byte) ([]byte, error) {
return cv.backend.AggregateSealProofs(proofType, rap, proofs)
}
var _ ffiwrapper.Verifier = (*cachingVerifier)(nil)

View File

@ -32,6 +32,7 @@ import (
ffi "github.com/filecoin-project/filecoin-ffi"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper/basicfs"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader"
@ -538,12 +539,12 @@ func TestSealAndVerifyAggregate(t *testing.T) {
aggStart := time.Now()
avi.Proof, err = ProofVerifier.AggregateSealProofs(sealProofType, toAggregate)
avi.Proof, err = ProofVerifier.AggregateSealProofs(sealProofType, policy.GetDefaultAggregationProof(), toAggregate)
require.NoError(t, err)
aggDone := time.Now()
_, err = ProofVerifier.AggregateSealProofs(sealProofType, toAggregate)
_, err = ProofVerifier.AggregateSealProofs(sealProofType, policy.GetDefaultAggregationProof(), toAggregate)
require.NoError(t, err)
aggHot := time.Now()

View File

@ -42,7 +42,7 @@ type Verifier interface {
GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredPoStProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error)
// cheap, makes no sense to put this on the storage interface
AggregateSealProofs(proofType abi.RegisteredSealProof, proofs [][]byte) ([]byte, error)
AggregateSealProofs(proofType abi.RegisteredSealProof, rap abi.RegisteredAggregationProof, proofs [][]byte) ([]byte, error)
}
type SectorProvider interface {

View File

@ -140,6 +140,6 @@ func (proofVerifier) GenerateWinningPoStSectorChallenge(ctx context.Context, pro
return ffi.GenerateWinningPoStSectorChallenge(proofType, minerID, randomness, eligibleSectorCount)
}
func (v proofVerifier) AggregateSealProofs(proofType abi.RegisteredSealProof, proofs [][]byte) ([]byte, error) {
return ffi.AggregateSealProofs(proofType, proofs)
func (v proofVerifier) AggregateSealProofs(proofType abi.RegisteredSealProof, rap abi.RegisteredAggregationProof, proofs [][]byte) ([]byte, error) {
return ffi.AggregateSealProofs(proofType, rap, proofs)
}

View File

@ -524,7 +524,7 @@ func (m mockVerif) VerifyAggregateSeals(aggregate proof5.AggregateSealVerifyProo
return bytes.Equal(aggregate.Proof, out), nil
}
func (m mockVerif) AggregateSealProofs(proofType abi.RegisteredSealProof, proofs [][]byte) ([]byte, error) {
func (m mockVerif) AggregateSealProofs(proofType abi.RegisteredSealProof, rap abi.RegisteredAggregationProof, proofs [][]byte) ([]byte, error) {
out := make([]byte, 200) // todo: figure out more real length
for pi, proof := range proofs {
for i := range proof[:32] {

View File

@ -28,13 +28,16 @@ var (
CommitBatchWait = 5 * time.Minute
)
const arp = abi.RegisteredAggregationProof_SnarkPackV1
type CommitBatcherApi interface {
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error)
StateMinerInfo(context.Context, address.Address, TipSetToken) (miner.MinerInfo, error)
}
type AggregateInput struct {
// TODO: Something changed in actors, I think this now needs to be AggregateSealVerifyProofAndInfos
spt abi.RegisteredSealProof
// TODO: Something changed in actors, I think this now needs to be AggregateSealVerifyProofAndInfos todo ??
info proof5.AggregateSealVerifyInfo
proof []byte
}
@ -137,20 +140,15 @@ func (b *CommitBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
return nil, nil
}
spt := b.todo[0].info.SealProof
spt := b.todo[0].spt
proofs := make([][]byte, total)
for id, p := range b.todo {
if p.info.SealProof != spt {
// todo: handle when we'll have proof upgrade
return nil, xerrors.Errorf("different seal proof types in commit batch: %w", err)
}
params.SectorNumbers.Set(uint64(id))
proofs[id] = p.proof
}
params.AggregateProof, err = b.verif.AggregateSealProofs(spt, proofs)
params.AggregateProof, err = b.verif.AggregateSealProofs(spt, arp, proofs)
if err != nil {
return nil, xerrors.Errorf("aggregating proofs: %w", err)
}

View File

@ -531,7 +531,6 @@ func (m *Sealing) handleSubmitCommitAggregate(ctx statemachine.Context, sector S
mcid, err := m.commiter.AddCommit(ctx.Context(), sector.SectorNumber, AggregateInput{
info: proof.AggregateSealVerifyInfo{
Number: sector.SectorNumber,
DealIDs: sector.dealIDs(),
Randomness: sector.TicketValue,
InteractiveRandomness: sector.SeedValue,
SealedCID: *sector.CommR,

View File

@ -23,6 +23,7 @@ import (
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
proof5 "github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
@ -144,6 +145,14 @@ func (m mockVerif) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStV
return true, nil
}
func (m mockVerif) AggregateSealProofs(proofType abi.RegisteredSealProof, rap abi.RegisteredAggregationProof, proofs [][]byte) ([]byte, error) {
panic("implement me")
}
func (m mockVerif) VerifyAggregateSeals(aggregate proof5.AggregateSealVerifyProofAndInfos) (bool, error) {
panic("implement me")
}
func (m mockVerif) VerifySeal(proof2.SealVerifyInfo) (bool, error) {
panic("implement me")
}