Skip to content

Commit

Permalink
migrate some more imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Sep 21, 2020
1 parent 3f0106c commit 63f026f
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 36 deletions.
15 changes: 8 additions & 7 deletions paychmgr/store.go
Expand Up @@ -12,12 +12,13 @@ import (
"github.com/filecoin-project/lotus/chain/types"

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-datastore"
"github.com/ipfs/go-datastore/namespace"
dsq "github.com/ipfs/go-datastore/query"

paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"

"github.com/filecoin-project/go-address"
cborrpc "github.com/filecoin-project/go-cbor-util"

Expand Down Expand Up @@ -48,7 +49,7 @@ const (
)

type VoucherInfo struct {
Voucher *paych.SignedVoucher
Voucher *paych0.SignedVoucher
Proof []byte
Submitted bool
}
Expand Down Expand Up @@ -102,7 +103,7 @@ func (ci *ChannelInfo) to() address.Address {

// infoForVoucher gets the VoucherInfo for the given 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 {
eq, err := cborutil.Equals(sv, v.Voucher)
if err != nil {
Expand All @@ -115,15 +116,15 @@ func (ci *ChannelInfo) infoForVoucher(sv *paych.SignedVoucher) (*VoucherInfo, er
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)
return vi != nil, err
}

// markVoucherSubmitted marks the voucher, and any vouchers of lower nonce
// in the same lane, as being submitted.
// 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)
if err != nil {
return err
Expand All @@ -147,7 +148,7 @@ func (ci *ChannelInfo) markVoucherSubmitted(sv *paych.SignedVoucher) error {
}

// 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)
if err != nil {
return false, err
Expand Down Expand Up @@ -276,7 +277,7 @@ func (ps *Store) VouchersForPaych(ch address.Address) ([]*VoucherInfo, error) {
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)
if err != nil {
return err
Expand Down
11 changes: 6 additions & 5 deletions paychmgr/util.go
Expand Up @@ -4,21 +4,22 @@ import (
"context"

"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 {
PaychVoucherList(context.Context, address.Address) ([]*paych.SignedVoucher, error)
PaychVoucherCheckSpendable(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error)
PaychVoucherList(context.Context, address.Address) ([]*paych0.SignedVoucher, 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)
if err != nil {
return nil, err
}

bestByLane := make(map[uint64]*paych.SignedVoucher)
bestByLane := make(map[uint64]*paych0.SignedVoucher)
for _, voucher := range vouchers {
spendable, err := api.PaychVoucherCheckSpendable(ctx, ch, voucher, nil, nil)
if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions storage/adapter_storage_miner.go
Expand Up @@ -14,7 +14,8 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"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"

"github.com/filecoin-project/lotus/api"
Expand Down Expand Up @@ -146,10 +147,10 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
}

ccmt := &types.Message{
To: builtin.StorageMarketActorAddr,
To: market.Address,
From: maddr,
Value: types.NewInt(0),
Method: builtin.MethodsMarket.ComputeDataCommitment,
Method: builtin0.MethodsMarket.ComputeDataCommitment,
Params: ccparams,
}
r, err := s.delegate.StateCall(ctx, ccmt, tsk)
Expand Down
6 changes: 3 additions & 3 deletions storage/miner.go
Expand Up @@ -6,13 +6,13 @@ import (
"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"

"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/specs-actors/actors/runtime/proof"

"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
Expand Down Expand Up @@ -235,9 +235,9 @@ func (wpp *StorageWpp) GenerateCandidates(ctx context.Context, randomness abi.Po
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 {
return []proof.PoStProof{{ProofBytes: []byte("valid proof")}}, nil
return []proof0.PoStProof{{ProofBytes: []byte("valid proof")}}, nil
}

log.Infof("Computing WinningPoSt ;%+v; %v", ssi, rand)
Expand Down
5 changes: 3 additions & 2 deletions storage/mockstorage/preseal.go
Expand Up @@ -9,7 +9,8 @@ import (
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto"
"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/wallet"
Expand Down Expand Up @@ -48,7 +49,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 = market.DealProposal{
preseal.Deal = market0.DealProposal{
PieceCID: preseal.CommD,
PieceSize: abi.PaddedPieceSize(ssize),
Client: k.Address,
Expand Down
17 changes: 8 additions & 9 deletions storage/wdpost_run.go
Expand Up @@ -5,29 +5,28 @@ import (
"context"
"time"

"github.com/filecoin-project/specs-actors/actors/runtime/proof"

"github.com/filecoin-project/go-bitfield"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/ipfs/go-cid"

"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"

"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/types"
"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) {
Expand Down Expand Up @@ -219,7 +218,7 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uin
msg := &types.Message{
To: s.actor,
From: s.worker,
Method: builtin.MethodsMiner.DeclareFaultsRecovered,
Method: builtin0.MethodsMiner.DeclareFaultsRecovered,
Params: enc,
Value: types.NewInt(0),
}
Expand Down Expand Up @@ -298,7 +297,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64,
msg := &types.Message{
To: s.actor,
From: s.worker,
Method: builtin.MethodsMiner.DeclareFaults,
Method: builtin0.MethodsMiner.DeclareFaults,
Params: enc,
Value: types.NewInt(0), // TODO: Is there a fee?
}
Expand Down Expand Up @@ -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) {
// 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 {
return nil, xerrors.Errorf("getting sectors per partition: %w", err)
}
Expand Down Expand Up @@ -647,7 +646,7 @@ func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.Submi
msg := &types.Message{
To: s.actor,
From: s.worker,
Method: builtin.MethodsMiner.SubmitWindowedPoSt,
Method: builtin0.MethodsMiner.SubmitWindowedPoSt,
Params: enc,
Value: types.NewInt(0),
}
Expand Down
13 changes: 6 additions & 7 deletions storage/wdpost_run_test.go
Expand Up @@ -16,10 +16,9 @@ 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"
"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"
"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"

"github.com/filecoin-project/lotus/api"
Expand Down Expand Up @@ -97,12 +96,12 @@ func (m *mockStorageMinerAPI) StateWaitMsg(ctx context.Context, cid cid.Cid, con
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")
}

func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []proof.SectorInfo, pr abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) {
return []proof.PoStProof{
func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []proof0.SectorInfo, pr abi.PoStRandomness) ([]proof0.PoStProof, []abi.SectorID, error) {
return []proof0.PoStProof{
{
PoStProof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1,
ProofBytes: []byte("post-proof"),
Expand Down Expand Up @@ -131,7 +130,7 @@ func TestWDPostDoPost(t *testing.T) {
mockStgMinerAPI := newMockStorageMinerAPI()

// 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)
// Work out the number of partitions that can be included in a message
// without exceeding the message sector limit
Expand Down Expand Up @@ -183,7 +182,7 @@ func TestWDPostDoPost(t *testing.T) {
// Read the window PoST messages
for i := 0; i < expectedMsgCount; i++ {
msg := <-mockStgMinerAPI.pushedMessages
require.Equal(t, builtin.MethodsMiner.SubmitWindowedPoSt, msg.Method)
require.Equal(t, builtin0.MethodsMiner.SubmitWindowedPoSt, msg.Method)
var params miner.SubmitWindowedPoStParams
err := params.UnmarshalCBOR(bytes.NewReader(msg.Params))
require.NoError(t, err)
Expand Down

0 comments on commit 63f026f

Please sign in to comment.