port to v2 imports
This commit is contained in:
@@ -15,8 +15,8 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/apibstore"
|
||||
@@ -138,7 +138,7 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
ccparams, err := actors.SerializeParams(&market0.ComputeDataCommitmentParams{
|
||||
ccparams, err := actors.SerializeParams(&market2.ComputeDataCommitmentParams{
|
||||
DealIDs: deals,
|
||||
SectorType: sectorType,
|
||||
})
|
||||
@@ -150,7 +150,7 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
|
||||
To: market.Address,
|
||||
From: maddr,
|
||||
Value: types.NewInt(0),
|
||||
Method: builtin0.MethodsMarket.ComputeDataCommitment,
|
||||
Method: builtin2.MethodsMarket.ComputeDataCommitment,
|
||||
Params: ccparams,
|
||||
}
|
||||
r, err := s.delegate.StateCall(ctx, ccmt, tsk)
|
||||
|
||||
+5
-6
@@ -5,9 +5,6 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
@@ -29,7 +26,9 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/events"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@@ -150,7 +149,7 @@ func (m *Miner) Run(ctx context.Context) error {
|
||||
evts := events.NewEvents(ctx, m.api)
|
||||
adaptedAPI := NewSealingAPIAdapter(m.api)
|
||||
// TODO: Maybe we update this policy after actor upgrades?
|
||||
pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, miner0.MaxSectorExpirationExtension-(miner0.WPoStProvingPeriod*2), md.PeriodStart%miner0.WPoStProvingPeriod)
|
||||
pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, policy.GetMaxSectorExpirationExtension()-(md.WPoStProvingPeriod*2), md.PeriodStart%md.WPoStProvingPeriod)
|
||||
m.sealing = sealing.New(adaptedAPI, fc, NewEventsAdapter(evts), m.maddr, m.ds, m.sealer, m.sc, m.verif, &pcp, sealing.GetSealingConfigFunc(m.getSealConfig), m.handleSealingNotifications)
|
||||
|
||||
go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function
|
||||
@@ -238,9 +237,9 @@ func (wpp *StorageWpp) GenerateCandidates(ctx context.Context, randomness abi.Po
|
||||
return cds, nil
|
||||
}
|
||||
|
||||
func (wpp *StorageWpp) ComputeProof(ctx context.Context, ssi []proof0.SectorInfo, rand abi.PoStRandomness) ([]proof0.PoStProof, error) {
|
||||
func (wpp *StorageWpp) ComputeProof(ctx context.Context, ssi []builtin.SectorInfo, rand abi.PoStRandomness) ([]builtin.PoStProof, error) {
|
||||
if build.InsecurePoStValidation {
|
||||
return []proof0.PoStProof{{ProofBytes: []byte("valid proof")}}, nil
|
||||
return []builtin.PoStProof{{ProofBytes: []byte("valid proof")}}, nil
|
||||
}
|
||||
|
||||
log.Infof("Computing WinningPoSt ;%+v; %v", ssi, rand)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/mock"
|
||||
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
@@ -48,7 +48,7 @@ func PreSeal(ssize abi.SectorSize, maddr address.Address, sectors int) (*genesis
|
||||
r := mock.CommDR(d)
|
||||
preseal.CommR, _ = commcid.ReplicaCommitmentV1ToCID(r[:])
|
||||
preseal.SectorID = abi.SectorNumber(i + 1)
|
||||
preseal.Deal = market0.DealProposal{
|
||||
preseal.Deal = market2.DealProposal{
|
||||
PieceCID: preseal.CommD,
|
||||
PieceSize: abi.PaddedPieceSize(ssize),
|
||||
Client: k.Address,
|
||||
|
||||
+17
-22
@@ -17,14 +17,14 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
@@ -290,7 +290,7 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uin
|
||||
msg := &types.Message{
|
||||
To: s.actor,
|
||||
From: s.worker,
|
||||
Method: builtin0.MethodsMiner.DeclareFaultsRecovered,
|
||||
Method: builtin2.MethodsMiner.DeclareFaultsRecovered,
|
||||
Params: enc,
|
||||
Value: types.NewInt(0),
|
||||
}
|
||||
@@ -374,7 +374,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64,
|
||||
msg := &types.Message{
|
||||
To: s.actor,
|
||||
From: s.worker,
|
||||
Method: builtin0.MethodsMiner.DeclareFaults,
|
||||
Method: builtin2.MethodsMiner.DeclareFaults,
|
||||
Params: enc,
|
||||
Value: types.NewInt(0), // TODO: Is there a fee?
|
||||
}
|
||||
@@ -505,12 +505,12 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
|
||||
|
||||
skipCount := uint64(0)
|
||||
postSkipped := bitfield.New()
|
||||
var postOut []proof.PoStProof
|
||||
var postOut []proof2.PoStProof
|
||||
somethingToProve := true
|
||||
|
||||
for retries := 0; retries < 5; retries++ {
|
||||
var partitions []miner.PoStPartition
|
||||
var sinfos []proof.SectorInfo
|
||||
var sinfos []proof2.SectorInfo
|
||||
for partIdx, partition := range batch {
|
||||
// TODO: Can do this in parallel
|
||||
toProve, err := bitfield.SubtractBitField(partition.LiveSectors, partition.FaultySectors)
|
||||
@@ -625,12 +625,6 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
|
||||
}
|
||||
|
||||
func (s *WindowPoStScheduler) batchPartitions(partitions []api.Partition) ([][]api.Partition, error) {
|
||||
// Get the number of sectors allowed in a partition, for this proof size
|
||||
sectorsPerPartition, err := builtin0.PoStProofWindowPoStPartitionSectors(s.proofType)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("getting sectors per partition: %w", err)
|
||||
}
|
||||
|
||||
// We don't want to exceed the number of sectors allowed in a message.
|
||||
// So given the number of sectors in a partition, work out the number of
|
||||
// partitions that can be in a message without exceeding sectors per
|
||||
@@ -641,9 +635,10 @@ func (s *WindowPoStScheduler) batchPartitions(partitions []api.Partition) ([][]a
|
||||
// sectors per partition 3: ooo
|
||||
// partitions per message 2: oooOOO
|
||||
// <1><2> (3rd doesn't fit)
|
||||
// TODO(NETUPGRADE): we're going to need some form of policy abstraction
|
||||
// where we can get policy from the future. Unfortunately, we can't just get this from the state.
|
||||
partitionsPerMsg := int(miner0.AddressedSectorsMax / sectorsPerPartition)
|
||||
partitionsPerMsg, err := policy.GetMaxPoStPartitions(s.proofType)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("getting sectors per partition: %w", err)
|
||||
}
|
||||
|
||||
// The number of messages will be:
|
||||
// ceiling(number of partitions / partitions per message)
|
||||
@@ -665,7 +660,7 @@ func (s *WindowPoStScheduler) batchPartitions(partitions []api.Partition) ([][]a
|
||||
return batches, nil
|
||||
}
|
||||
|
||||
func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors, allSectors bitfield.BitField, ts *types.TipSet) ([]proof.SectorInfo, error) {
|
||||
func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors, allSectors bitfield.BitField, ts *types.TipSet) ([]proof2.SectorInfo, error) {
|
||||
sset, err := s.api.StateMinerSectors(ctx, s.actor, &goodSectors, ts.Key())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -675,22 +670,22 @@ func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors,
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
substitute := proof.SectorInfo{
|
||||
substitute := proof2.SectorInfo{
|
||||
SectorNumber: sset[0].SectorNumber,
|
||||
SealedCID: sset[0].SealedCID,
|
||||
SealProof: sset[0].SealProof,
|
||||
}
|
||||
|
||||
sectorByID := make(map[uint64]proof.SectorInfo, len(sset))
|
||||
sectorByID := make(map[uint64]proof2.SectorInfo, len(sset))
|
||||
for _, sector := range sset {
|
||||
sectorByID[uint64(sector.SectorNumber)] = proof.SectorInfo{
|
||||
sectorByID[uint64(sector.SectorNumber)] = proof2.SectorInfo{
|
||||
SectorNumber: sector.SectorNumber,
|
||||
SealedCID: sector.SealedCID,
|
||||
SealProof: sector.SealProof,
|
||||
}
|
||||
}
|
||||
|
||||
proofSectors := make([]proof.SectorInfo, 0, len(sset))
|
||||
proofSectors := make([]proof2.SectorInfo, 0, len(sset))
|
||||
if err := allSectors.ForEach(func(sectorNo uint64) error {
|
||||
if info, found := sectorByID[sectorNo]; found {
|
||||
proofSectors = append(proofSectors, info)
|
||||
@@ -719,7 +714,7 @@ func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.Submi
|
||||
msg := &types.Message{
|
||||
To: s.actor,
|
||||
From: s.worker,
|
||||
Method: builtin0.MethodsMiner.SubmitWindowedPoSt,
|
||||
Method: builtin2.MethodsMiner.SubmitWindowedPoSt,
|
||||
Params: enc,
|
||||
Value: types.NewInt(0),
|
||||
}
|
||||
|
||||
+21
-21
@@ -17,10 +17,10 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
||||
tutils "github.com/filecoin-project/specs-actors/support/testing"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
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"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
@@ -98,12 +98,12 @@ func (m *mockStorageMinerAPI) StateWaitMsg(ctx context.Context, cid cid.Cid, con
|
||||
type mockProver struct {
|
||||
}
|
||||
|
||||
func (m *mockProver) GenerateWinningPoSt(context.Context, abi.ActorID, []proof0.SectorInfo, abi.PoStRandomness) ([]proof0.PoStProof, error) {
|
||||
func (m *mockProver) GenerateWinningPoSt(context.Context, abi.ActorID, []proof2.SectorInfo, abi.PoStRandomness) ([]proof2.PoStProof, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []proof0.SectorInfo, pr abi.PoStRandomness) ([]proof0.PoStProof, []abi.SectorID, error) {
|
||||
return []proof0.PoStProof{
|
||||
func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []proof2.SectorInfo, pr abi.PoStRandomness) ([]proof2.PoStProof, []abi.SectorID, error) {
|
||||
return []proof2.PoStProof{
|
||||
{
|
||||
PoStProof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1,
|
||||
ProofBytes: []byte("post-proof"),
|
||||
@@ -132,13 +132,13 @@ func TestWDPostDoPost(t *testing.T) {
|
||||
mockStgMinerAPI := newMockStorageMinerAPI()
|
||||
|
||||
// Get the number of sectors allowed in a partition for this proof type
|
||||
sectorsPerPartition, err := builtin0.PoStProofWindowPoStPartitionSectors(proofType)
|
||||
sectorsPerPartition, err := builtin2.PoStProofWindowPoStPartitionSectors(proofType)
|
||||
require.NoError(t, err)
|
||||
// Work out the number of partitions that can be included in a message
|
||||
// without exceeding the message sector limit
|
||||
|
||||
require.NoError(t, err)
|
||||
partitionsPerMsg := int(miner0.AddressedSectorsMax / sectorsPerPartition)
|
||||
partitionsPerMsg := int(miner2.AddressedSectorsMax / sectorsPerPartition)
|
||||
|
||||
// Enough partitions to fill expectedMsgCount-1 messages
|
||||
partitionCount := (expectedMsgCount - 1) * partitionsPerMsg
|
||||
@@ -173,11 +173,11 @@ func TestWDPostDoPost(t *testing.T) {
|
||||
}
|
||||
|
||||
di := &dline.Info{
|
||||
WPoStPeriodDeadlines: miner0.WPoStPeriodDeadlines,
|
||||
WPoStProvingPeriod: miner0.WPoStProvingPeriod,
|
||||
WPoStChallengeWindow: miner0.WPoStChallengeWindow,
|
||||
WPoStChallengeLookback: miner0.WPoStChallengeLookback,
|
||||
FaultDeclarationCutoff: miner0.FaultDeclarationCutoff,
|
||||
WPoStPeriodDeadlines: miner2.WPoStPeriodDeadlines,
|
||||
WPoStProvingPeriod: miner2.WPoStProvingPeriod,
|
||||
WPoStChallengeWindow: miner2.WPoStChallengeWindow,
|
||||
WPoStChallengeLookback: miner2.WPoStChallengeLookback,
|
||||
FaultDeclarationCutoff: miner2.FaultDeclarationCutoff,
|
||||
}
|
||||
ts := mockTipSet(t)
|
||||
|
||||
@@ -188,7 +188,7 @@ func TestWDPostDoPost(t *testing.T) {
|
||||
// Read the window PoST messages
|
||||
for i := 0; i < expectedMsgCount; i++ {
|
||||
msg := <-mockStgMinerAPI.pushedMessages
|
||||
require.Equal(t, builtin0.MethodsMiner.SubmitWindowedPoSt, msg.Method)
|
||||
require.Equal(t, builtin2.MethodsMiner.SubmitWindowedPoSt, msg.Method)
|
||||
var params miner.SubmitWindowedPoStParams
|
||||
err := params.UnmarshalCBOR(bytes.NewReader(msg.Params))
|
||||
require.NoError(t, err)
|
||||
@@ -254,11 +254,11 @@ func (m *mockStorageMinerAPI) StateMinerProvingDeadline(ctx context.Context, add
|
||||
Close: 0,
|
||||
Challenge: 0,
|
||||
FaultCutoff: 0,
|
||||
WPoStPeriodDeadlines: miner0.WPoStPeriodDeadlines,
|
||||
WPoStProvingPeriod: miner0.WPoStProvingPeriod,
|
||||
WPoStChallengeWindow: miner0.WPoStChallengeWindow,
|
||||
WPoStChallengeLookback: miner0.WPoStChallengeLookback,
|
||||
FaultDeclarationCutoff: miner0.FaultDeclarationCutoff,
|
||||
WPoStPeriodDeadlines: miner2.WPoStPeriodDeadlines,
|
||||
WPoStProvingPeriod: miner2.WPoStProvingPeriod,
|
||||
WPoStChallengeWindow: miner2.WPoStChallengeWindow,
|
||||
WPoStChallengeLookback: miner2.WPoStChallengeLookback,
|
||||
FaultDeclarationCutoff: miner2.FaultDeclarationCutoff,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ func (m *mockStorageMinerAPI) StateSearchMsg(ctx context.Context, cid cid.Cid) (
|
||||
|
||||
func (m *mockStorageMinerAPI) StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error) {
|
||||
return &types.Actor{
|
||||
Code: builtin0.StorageMinerActorCodeID,
|
||||
Code: builtin2.StorageMinerActorCodeID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user