Make things build
This commit is contained in:
parent
8f42f375cf
commit
6278bdc69a
@ -302,6 +302,10 @@ func GetDefaultSectorSize() abi.SectorSize {
|
|||||||
return szs[0]
|
return szs[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetDefaultAggregationProof() abi.RegisteredAggregationProof {
|
||||||
|
return abi.RegisteredAggregationProof_SnarkPackV1
|
||||||
|
}
|
||||||
|
|
||||||
func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version) abi.ChainEpoch {
|
func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version) abi.ChainEpoch {
|
||||||
if nwVer <= network.Version10 {
|
if nwVer <= network.Version10 {
|
||||||
return builtin5.SealProofPoliciesV0[proof].SectorMaxLifetime
|
return builtin5.SealProofPoliciesV0[proof].SectorMaxLifetime
|
||||||
|
@ -693,7 +693,7 @@ func (m genFakeVerifier) VerifyAggregateSeals(aggregate proof5.AggregateSealVeri
|
|||||||
panic("not supported")
|
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")
|
panic("not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
|
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/ipfs/go-datastore"
|
||||||
"github.com/minio/blake2b-simd"
|
"github.com/minio/blake2b-simd"
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
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)
|
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)
|
var _ ffiwrapper.Verifier = (*cachingVerifier)(nil)
|
||||||
|
@ -32,6 +32,7 @@ import (
|
|||||||
|
|
||||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
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/ffiwrapper/basicfs"
|
||||||
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
"github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader"
|
"github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader"
|
||||||
@ -538,12 +539,12 @@ func TestSealAndVerifyAggregate(t *testing.T) {
|
|||||||
|
|
||||||
aggStart := time.Now()
|
aggStart := time.Now()
|
||||||
|
|
||||||
avi.Proof, err = ProofVerifier.AggregateSealProofs(sealProofType, toAggregate)
|
avi.Proof, err = ProofVerifier.AggregateSealProofs(sealProofType, policy.GetDefaultAggregationProof(), toAggregate)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
aggDone := time.Now()
|
aggDone := time.Now()
|
||||||
|
|
||||||
_, err = ProofVerifier.AggregateSealProofs(sealProofType, toAggregate)
|
_, err = ProofVerifier.AggregateSealProofs(sealProofType, policy.GetDefaultAggregationProof(), toAggregate)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
aggHot := time.Now()
|
aggHot := time.Now()
|
||||||
|
2
extern/sector-storage/ffiwrapper/types.go
vendored
2
extern/sector-storage/ffiwrapper/types.go
vendored
@ -42,7 +42,7 @@ type Verifier interface {
|
|||||||
GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredPoStProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error)
|
GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredPoStProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error)
|
||||||
|
|
||||||
// cheap, makes no sense to put this on the storage interface
|
// 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 {
|
type SectorProvider interface {
|
||||||
|
@ -140,6 +140,6 @@ func (proofVerifier) GenerateWinningPoStSectorChallenge(ctx context.Context, pro
|
|||||||
return ffi.GenerateWinningPoStSectorChallenge(proofType, minerID, randomness, eligibleSectorCount)
|
return ffi.GenerateWinningPoStSectorChallenge(proofType, minerID, randomness, eligibleSectorCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v proofVerifier) AggregateSealProofs(proofType abi.RegisteredSealProof, proofs [][]byte) ([]byte, error) {
|
func (v proofVerifier) AggregateSealProofs(proofType abi.RegisteredSealProof, rap abi.RegisteredAggregationProof, proofs [][]byte) ([]byte, error) {
|
||||||
return ffi.AggregateSealProofs(proofType, proofs)
|
return ffi.AggregateSealProofs(proofType, rap, proofs)
|
||||||
}
|
}
|
||||||
|
2
extern/sector-storage/mock/mock.go
vendored
2
extern/sector-storage/mock/mock.go
vendored
@ -524,7 +524,7 @@ func (m mockVerif) VerifyAggregateSeals(aggregate proof5.AggregateSealVerifyProo
|
|||||||
return bytes.Equal(aggregate.Proof, out), nil
|
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
|
out := make([]byte, 200) // todo: figure out more real length
|
||||||
for pi, proof := range proofs {
|
for pi, proof := range proofs {
|
||||||
for i := range proof[:32] {
|
for i := range proof[:32] {
|
||||||
|
14
extern/storage-sealing/commit_batch.go
vendored
14
extern/storage-sealing/commit_batch.go
vendored
@ -28,13 +28,16 @@ var (
|
|||||||
CommitBatchWait = 5 * time.Minute
|
CommitBatchWait = 5 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const arp = abi.RegisteredAggregationProof_SnarkPackV1
|
||||||
|
|
||||||
type CommitBatcherApi interface {
|
type CommitBatcherApi interface {
|
||||||
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error)
|
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)
|
StateMinerInfo(context.Context, address.Address, TipSetToken) (miner.MinerInfo, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type AggregateInput struct {
|
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
|
info proof5.AggregateSealVerifyInfo
|
||||||
proof []byte
|
proof []byte
|
||||||
}
|
}
|
||||||
@ -137,20 +140,15 @@ func (b *CommitBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
spt := b.todo[0].info.SealProof
|
spt := b.todo[0].spt
|
||||||
proofs := make([][]byte, total)
|
proofs := make([][]byte, total)
|
||||||
|
|
||||||
for id, p := range b.todo {
|
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))
|
params.SectorNumbers.Set(uint64(id))
|
||||||
proofs[id] = p.proof
|
proofs[id] = p.proof
|
||||||
}
|
}
|
||||||
|
|
||||||
params.AggregateProof, err = b.verif.AggregateSealProofs(spt, proofs)
|
params.AggregateProof, err = b.verif.AggregateSealProofs(spt, arp, proofs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("aggregating proofs: %w", err)
|
return nil, xerrors.Errorf("aggregating proofs: %w", err)
|
||||||
}
|
}
|
||||||
|
1
extern/storage-sealing/states_sealing.go
vendored
1
extern/storage-sealing/states_sealing.go
vendored
@ -531,7 +531,6 @@ func (m *Sealing) handleSubmitCommitAggregate(ctx statemachine.Context, sector S
|
|||||||
mcid, err := m.commiter.AddCommit(ctx.Context(), sector.SectorNumber, AggregateInput{
|
mcid, err := m.commiter.AddCommit(ctx.Context(), sector.SectorNumber, AggregateInput{
|
||||||
info: proof.AggregateSealVerifyInfo{
|
info: proof.AggregateSealVerifyInfo{
|
||||||
Number: sector.SectorNumber,
|
Number: sector.SectorNumber,
|
||||||
DealIDs: sector.dealIDs(),
|
|
||||||
Randomness: sector.TicketValue,
|
Randomness: sector.TicketValue,
|
||||||
InteractiveRandomness: sector.SeedValue,
|
InteractiveRandomness: sector.SeedValue,
|
||||||
SealedCID: *sector.CommR,
|
SealedCID: *sector.CommR,
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
||||||
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
|
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
|
||||||
tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
|
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/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
@ -144,6 +145,14 @@ func (m mockVerif) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStV
|
|||||||
return true, nil
|
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) {
|
func (m mockVerif) VerifySeal(proof2.SealVerifyInfo) (bool, error) {
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user