migrate some more imports

This commit is contained in:
Steven Allen 2020-09-21 15:24:45 -07:00
parent 3f0106cfe5
commit 63f026f7c3
7 changed files with 38 additions and 36 deletions

View File

@ -12,12 +12,13 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
cborutil "github.com/filecoin-project/go-cbor-util" cborutil "github.com/filecoin-project/go-cbor-util"
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace" "github.com/ipfs/go-datastore/namespace"
dsq "github.com/ipfs/go-datastore/query" dsq "github.com/ipfs/go-datastore/query"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
cborrpc "github.com/filecoin-project/go-cbor-util" cborrpc "github.com/filecoin-project/go-cbor-util"
@ -48,7 +49,7 @@ const (
) )
type VoucherInfo struct { type VoucherInfo struct {
Voucher *paych.SignedVoucher Voucher *paych0.SignedVoucher
Proof []byte Proof []byte
Submitted bool Submitted bool
} }
@ -102,7 +103,7 @@ func (ci *ChannelInfo) to() address.Address {
// infoForVoucher gets the VoucherInfo for the given voucher. // infoForVoucher gets the VoucherInfo for the given voucher.
// returns nil if the channel doesn't have the voucher. // returns nil if the channel doesn't have the voucher.
func (ci *ChannelInfo) infoForVoucher(sv *paych.SignedVoucher) (*VoucherInfo, error) { func (ci *ChannelInfo) infoForVoucher(sv *paych0.SignedVoucher) (*VoucherInfo, error) {
for _, v := range ci.Vouchers { for _, v := range ci.Vouchers {
eq, err := cborutil.Equals(sv, v.Voucher) eq, err := cborutil.Equals(sv, v.Voucher)
if err != nil { if err != nil {
@ -115,7 +116,7 @@ func (ci *ChannelInfo) infoForVoucher(sv *paych.SignedVoucher) (*VoucherInfo, er
return nil, nil return nil, nil
} }
func (ci *ChannelInfo) hasVoucher(sv *paych.SignedVoucher) (bool, error) { func (ci *ChannelInfo) hasVoucher(sv *paych0.SignedVoucher) (bool, error) {
vi, err := ci.infoForVoucher(sv) vi, err := ci.infoForVoucher(sv)
return vi != nil, err return vi != nil, err
} }
@ -123,7 +124,7 @@ func (ci *ChannelInfo) hasVoucher(sv *paych.SignedVoucher) (bool, error) {
// markVoucherSubmitted marks the voucher, and any vouchers of lower nonce // markVoucherSubmitted marks the voucher, and any vouchers of lower nonce
// in the same lane, as being submitted. // in the same lane, as being submitted.
// Note: This method doesn't write anything to the store. // Note: This method doesn't write anything to the store.
func (ci *ChannelInfo) markVoucherSubmitted(sv *paych.SignedVoucher) error { func (ci *ChannelInfo) markVoucherSubmitted(sv *paych0.SignedVoucher) error {
vi, err := ci.infoForVoucher(sv) vi, err := ci.infoForVoucher(sv)
if err != nil { if err != nil {
return err return err
@ -147,7 +148,7 @@ func (ci *ChannelInfo) markVoucherSubmitted(sv *paych.SignedVoucher) error {
} }
// wasVoucherSubmitted returns true if the voucher has been submitted // wasVoucherSubmitted returns true if the voucher has been submitted
func (ci *ChannelInfo) wasVoucherSubmitted(sv *paych.SignedVoucher) (bool, error) { func (ci *ChannelInfo) wasVoucherSubmitted(sv *paych0.SignedVoucher) (bool, error) {
vi, err := ci.infoForVoucher(sv) vi, err := ci.infoForVoucher(sv)
if err != nil { if err != nil {
return false, err return false, err
@ -276,7 +277,7 @@ func (ps *Store) VouchersForPaych(ch address.Address) ([]*VoucherInfo, error) {
return ci.Vouchers, nil return ci.Vouchers, nil
} }
func (ps *Store) MarkVoucherSubmitted(ci *ChannelInfo, sv *paych.SignedVoucher) error { func (ps *Store) MarkVoucherSubmitted(ci *ChannelInfo, sv *paych0.SignedVoucher) error {
err := ci.markVoucherSubmitted(sv) err := ci.markVoucherSubmitted(sv)
if err != nil { if err != nil {
return err return err

View File

@ -4,21 +4,22 @@ import (
"context" "context"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
) )
type BestSpendableAPI interface { type BestSpendableAPI interface {
PaychVoucherList(context.Context, address.Address) ([]*paych.SignedVoucher, error) PaychVoucherList(context.Context, address.Address) ([]*paych0.SignedVoucher, error)
PaychVoucherCheckSpendable(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error) PaychVoucherCheckSpendable(context.Context, address.Address, *paych0.SignedVoucher, []byte, []byte) (bool, error)
} }
func BestSpendableByLane(ctx context.Context, api BestSpendableAPI, ch address.Address) (map[uint64]*paych.SignedVoucher, error) { func BestSpendableByLane(ctx context.Context, api BestSpendableAPI, ch address.Address) (map[uint64]*paych0.SignedVoucher, error) {
vouchers, err := api.PaychVoucherList(ctx, ch) vouchers, err := api.PaychVoucherList(ctx, ch)
if err != nil { if err != nil {
return nil, err return nil, err
} }
bestByLane := make(map[uint64]*paych.SignedVoucher) bestByLane := make(map[uint64]*paych0.SignedVoucher)
for _, voucher := range vouchers { for _, voucher := range vouchers {
spendable, err := api.PaychVoucherCheckSpendable(ctx, ch, voucher, nil, nil) spendable, err := api.PaychVoucherCheckSpendable(ctx, ch, voucher, nil, nil)
if err != nil { if err != nil {

View File

@ -14,7 +14,8 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/specs-actors/actors/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market" market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
@ -146,10 +147,10 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
} }
ccmt := &types.Message{ ccmt := &types.Message{
To: builtin.StorageMarketActorAddr, To: market.Address,
From: maddr, From: maddr,
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin.MethodsMarket.ComputeDataCommitment, Method: builtin0.MethodsMarket.ComputeDataCommitment,
Params: ccparams, Params: ccparams,
} }
r, err := s.delegate.StateCall(ctx, ccmt, tsk) r, err := s.delegate.StateCall(ctx, ccmt, tsk)

View File

@ -6,13 +6,13 @@ import (
"time" "time"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" 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/network"
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-bitfield" "github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
@ -235,9 +235,9 @@ func (wpp *StorageWpp) GenerateCandidates(ctx context.Context, randomness abi.Po
return cds, nil return cds, nil
} }
func (wpp *StorageWpp) ComputeProof(ctx context.Context, ssi []proof.SectorInfo, rand abi.PoStRandomness) ([]proof.PoStProof, error) { func (wpp *StorageWpp) ComputeProof(ctx context.Context, ssi []proof0.SectorInfo, rand abi.PoStRandomness) ([]proof0.PoStProof, error) {
if build.InsecurePoStValidation { if build.InsecurePoStValidation {
return []proof.PoStProof{{ProofBytes: []byte("valid proof")}}, nil return []proof0.PoStProof{{ProofBytes: []byte("valid proof")}}, nil
} }
log.Infof("Computing WinningPoSt ;%+v; %v", ssi, rand) log.Infof("Computing WinningPoSt ;%+v; %v", ssi, rand)

View File

@ -9,7 +9,8 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/lotus/extern/sector-storage/mock" "github.com/filecoin-project/lotus/extern/sector-storage/mock"
"github.com/filecoin-project/specs-actors/actors/builtin/market"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/chain/wallet"
@ -48,7 +49,7 @@ func PreSeal(ssize abi.SectorSize, maddr address.Address, sectors int) (*genesis
r := mock.CommDR(d) r := mock.CommDR(d)
preseal.CommR, _ = commcid.ReplicaCommitmentV1ToCID(r[:]) preseal.CommR, _ = commcid.ReplicaCommitmentV1ToCID(r[:])
preseal.SectorID = abi.SectorNumber(i + 1) preseal.SectorID = abi.SectorNumber(i + 1)
preseal.Deal = market.DealProposal{ preseal.Deal = market0.DealProposal{
PieceCID: preseal.CommD, PieceCID: preseal.CommD,
PieceSize: abi.PaddedPieceSize(ssize), PieceSize: abi.PaddedPieceSize(ssize),
Client: k.Address, Client: k.Address,

View File

@ -5,8 +5,6 @@ import (
"context" "context"
"time" "time"
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/filecoin-project/go-bitfield" "github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
@ -14,20 +12,21 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"go.opencensus.io/trace" "go.opencensus.io/trace"
"golang.org/x/xerrors" "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"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/journal"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
) )
func (s *WindowPoStScheduler) failPost(err error, deadline *dline.Info) { func (s *WindowPoStScheduler) failPost(err error, deadline *dline.Info) {
@ -219,7 +218,7 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uin
msg := &types.Message{ msg := &types.Message{
To: s.actor, To: s.actor,
From: s.worker, From: s.worker,
Method: builtin.MethodsMiner.DeclareFaultsRecovered, Method: builtin0.MethodsMiner.DeclareFaultsRecovered,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
} }
@ -298,7 +297,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64,
msg := &types.Message{ msg := &types.Message{
To: s.actor, To: s.actor,
From: s.worker, From: s.worker,
Method: builtin.MethodsMiner.DeclareFaults, Method: builtin0.MethodsMiner.DeclareFaults,
Params: enc, Params: enc,
Value: types.NewInt(0), // TODO: Is there a fee? Value: types.NewInt(0), // TODO: Is there a fee?
} }
@ -555,7 +554,7 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
func (s *WindowPoStScheduler) batchPartitions(partitions []api.Partition) ([][]api.Partition, error) { func (s *WindowPoStScheduler) batchPartitions(partitions []api.Partition) ([][]api.Partition, error) {
// Get the number of sectors allowed in a partition, for this proof size // Get the number of sectors allowed in a partition, for this proof size
sectorsPerPartition, err := builtin.PoStProofWindowPoStPartitionSectors(s.proofType) sectorsPerPartition, err := builtin0.PoStProofWindowPoStPartitionSectors(s.proofType)
if err != nil { if err != nil {
return nil, xerrors.Errorf("getting sectors per partition: %w", err) return nil, xerrors.Errorf("getting sectors per partition: %w", err)
} }
@ -647,7 +646,7 @@ func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.Submi
msg := &types.Message{ msg := &types.Message{
To: s.actor, To: s.actor,
From: s.worker, From: s.worker,
Method: builtin.MethodsMiner.SubmitWindowedPoSt, Method: builtin0.MethodsMiner.SubmitWindowedPoSt,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
} }

View File

@ -16,10 +16,9 @@ import (
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/specs-actors/actors/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof"
tutils "github.com/filecoin-project/specs-actors/support/testing" tutils "github.com/filecoin-project/specs-actors/support/testing"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
@ -97,12 +96,12 @@ func (m *mockStorageMinerAPI) StateWaitMsg(ctx context.Context, cid cid.Cid, con
type mockProver struct { type mockProver struct {
} }
func (m *mockProver) GenerateWinningPoSt(context.Context, abi.ActorID, []proof.SectorInfo, abi.PoStRandomness) ([]proof.PoStProof, error) { func (m *mockProver) GenerateWinningPoSt(context.Context, abi.ActorID, []proof0.SectorInfo, abi.PoStRandomness) ([]proof0.PoStProof, error) {
panic("implement me") panic("implement me")
} }
func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []proof.SectorInfo, pr abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) { func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []proof0.SectorInfo, pr abi.PoStRandomness) ([]proof0.PoStProof, []abi.SectorID, error) {
return []proof.PoStProof{ return []proof0.PoStProof{
{ {
PoStProof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, PoStProof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1,
ProofBytes: []byte("post-proof"), ProofBytes: []byte("post-proof"),
@ -131,7 +130,7 @@ func TestWDPostDoPost(t *testing.T) {
mockStgMinerAPI := newMockStorageMinerAPI() mockStgMinerAPI := newMockStorageMinerAPI()
// Get the number of sectors allowed in a partition for this proof type // Get the number of sectors allowed in a partition for this proof type
sectorsPerPartition, err := builtin.PoStProofWindowPoStPartitionSectors(proofType) sectorsPerPartition, err := builtin0.PoStProofWindowPoStPartitionSectors(proofType)
require.NoError(t, err) require.NoError(t, err)
// Work out the number of partitions that can be included in a message // Work out the number of partitions that can be included in a message
// without exceeding the message sector limit // without exceeding the message sector limit
@ -183,7 +182,7 @@ func TestWDPostDoPost(t *testing.T) {
// Read the window PoST messages // Read the window PoST messages
for i := 0; i < expectedMsgCount; i++ { for i := 0; i < expectedMsgCount; i++ {
msg := <-mockStgMinerAPI.pushedMessages msg := <-mockStgMinerAPI.pushedMessages
require.Equal(t, builtin.MethodsMiner.SubmitWindowedPoSt, msg.Method) require.Equal(t, builtin0.MethodsMiner.SubmitWindowedPoSt, msg.Method)
var params miner.SubmitWindowedPoStParams var params miner.SubmitWindowedPoStParams
err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)) err := params.UnmarshalCBOR(bytes.NewReader(msg.Params))
require.NoError(t, err) require.NoError(t, err)