more renames

This commit is contained in:
Steven Allen 2020-09-21 16:01:29 -07:00
parent 63f026f7c3
commit d33dd4f7bc
9 changed files with 77 additions and 65 deletions

View File

@ -29,3 +29,7 @@ func (a *Actor) IsStorageMinerActor() bool {
func (a *Actor) IsMultisigActor() bool { func (a *Actor) IsMultisigActor() bool {
return a.Code == builtin0.MultisigActorCodeID return a.Code == builtin0.MultisigActorCodeID
} }
func (a *Actor) IsPaymentChannelActor() bool {
return a.Code == builtin0.PaymentChannelActorCodeID
}

View File

@ -8,25 +8,27 @@ import (
"io" "io"
"time" "time"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-fil-markets/shared" "github.com/filecoin-project/go-fil-markets/shared"
"github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/market"
"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/events" "github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/events/state" "github.com/filecoin-project/lotus/chain/events/state"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
@ -67,8 +69,8 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
return cid.Undef, err return cid.Undef, err
} }
params, err := actors.SerializeParams(&market.PublishStorageDealsParams{ params, err := actors.SerializeParams(&market0.PublishStorageDealsParams{
Deals: []market.ClientDealProposal{deal.ClientDealProposal}, Deals: []market0.ClientDealProposal{deal.ClientDealProposal},
}) })
if err != nil { if err != nil {
@ -77,10 +79,10 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
// TODO: We may want this to happen after fetching data // TODO: We may want this to happen after fetching data
smsg, err := n.MpoolPushMessage(ctx, &types.Message{ smsg, err := n.MpoolPushMessage(ctx, &types.Message{
To: builtin.StorageMarketActorAddr, To: market.Address,
From: mi.Worker, From: mi.Worker,
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin.MethodsMarket.PublishStorageDeals, Method: builtin0.MethodsMarket.PublishStorageDeals,
Params: params, Params: params,
}, nil) }, nil)
if err != nil { if err != nil {
@ -177,10 +179,10 @@ func (n *ProviderNodeAdapter) EnsureFunds(ctx context.Context, addr, wallet addr
func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) (cid.Cid, error) { func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) (cid.Cid, error) {
// (Provider Node API) // (Provider Node API)
smsg, err := n.MpoolPushMessage(ctx, &types.Message{ smsg, err := n.MpoolPushMessage(ctx, &types.Message{
To: builtin.StorageMarketActorAddr, To: market.Address,
From: addr, From: addr,
Value: amount, Value: amount,
Method: builtin.MethodsMarket.AddBalance, Method: builtin0.MethodsMarket.AddBalance,
}, nil) }, nil)
if err != nil { if err != nil {
return cid.Undef, err return cid.Undef, err
@ -302,7 +304,7 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
} }
switch msg.Method { switch msg.Method {
case builtin.MethodsMiner.PreCommitSector: case builtin0.MethodsMiner.PreCommitSector:
var params miner.SectorPreCommitInfo var params miner.SectorPreCommitInfo
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
return true, false, xerrors.Errorf("unmarshal pre commit: %w", err) return true, false, xerrors.Errorf("unmarshal pre commit: %w", err)
@ -317,7 +319,7 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
} }
return true, false, nil return true, false, nil
case builtin.MethodsMiner.ProveCommitSector: case builtin0.MethodsMiner.ProveCommitSector:
var params miner.ProveCommitSectorParams var params miner.ProveCommitSectorParams
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
return true, false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err) return true, false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err)

View File

@ -9,7 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/filecoin-project/lotus/chain/gen/slashfilter" "github.com/filecoin-project/lotus/chain/gen/slashfilter"
@ -489,7 +489,7 @@ func (m *Miner) computeTicket(ctx context.Context, brand *types.BeaconEntry, bas
} }
func (m *Miner) createBlock(base *MiningBase, addr address.Address, ticket *types.Ticket, func (m *Miner) createBlock(base *MiningBase, addr address.Address, ticket *types.Ticket,
eproof *types.ElectionProof, bvals []types.BeaconEntry, wpostProof []proof.PoStProof, msgs []*types.SignedMessage) (*types.BlockMsg, error) { eproof *types.ElectionProof, bvals []types.BeaconEntry, wpostProof []proof0.PoStProof, msgs []*types.SignedMessage) (*types.BlockMsg, error) {
uts := base.TipSet.MinTimestamp() + build.BlockDelaySecs*(uint64(base.NullRounds)+1) uts := base.TipSet.MinTimestamp() + build.BlockDelaySecs*(uint64(base.NullRounds)+1)
nheight := base.TipSet.Height() + base.NullRounds + 1 nheight := base.TipSet.Height() + base.NullRounds + 1

View File

@ -13,7 +13,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/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/specs-actors/actors/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -181,10 +182,10 @@ func (a *GasAPI) GasEstimateGasLimit(ctx context.Context, msgIn *types.Message,
return res.MsgRct.GasUsed, nil return res.MsgRct.GasUsed, nil
} }
if !act.Code.Equals(builtin.PaymentChannelActorCodeID) { if !act.IsPaymentChannelActor() {
return res.MsgRct.GasUsed, nil return res.MsgRct.GasUsed, nil
} }
if msgIn.Method != builtin.MethodsPaych.Collect { if msgIn.Method != builtin0.MethodsPaych.Collect {
return res.MsgRct.GasUsed, nil return res.MsgRct.GasUsed, nil
} }

View File

@ -9,10 +9,12 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/specs-actors/actors/builtin"
init_ "github.com/filecoin-project/specs-actors/actors/builtin/init" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
samsig "github.com/filecoin-project/specs-actors/actors/builtin/multisig" init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
multisig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/minio/blake2b-simd" "github.com/minio/blake2b-simd"
@ -46,7 +48,7 @@ func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Ad
} }
// Set up constructor parameters for multisig // Set up constructor parameters for multisig
msigParams := &samsig.ConstructorParams{ msigParams := &multisig0.ConstructorParams{
Signers: addrs, Signers: addrs,
NumApprovalsThreshold: req, NumApprovalsThreshold: req,
UnlockDuration: duration, UnlockDuration: duration,
@ -58,8 +60,9 @@ func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Ad
} }
// new actors are created by invoking 'exec' on the init actor with the constructor params // new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init_.ExecParams{ // TODO: network upgrade?
CodeCID: builtin.MultisigActorCodeID, execParams := &init0.ExecParams{
CodeCID: builtin0.MultisigActorCodeID,
ConstructorParams: enc, ConstructorParams: enc,
} }
@ -70,9 +73,9 @@ func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Ad
// now we create the message to send this with // now we create the message to send this with
msg := types.Message{ msg := types.Message{
To: builtin.InitActorAddr, To: init_.Address,
From: src, From: src,
Method: builtin.MethodsInit.Exec, Method: builtin0.MethodsInit.Exec,
Params: enc, Params: enc,
Value: val, Value: val,
} }
@ -104,7 +107,7 @@ func (a *MsigAPI) MsigPropose(ctx context.Context, msig address.Address, to addr
return cid.Undef, xerrors.Errorf("must provide source address") return cid.Undef, xerrors.Errorf("must provide source address")
} }
enc, actErr := actors.SerializeParams(&samsig.ProposeParams{ enc, actErr := actors.SerializeParams(&multisig0.ProposeParams{
To: to, To: to,
Value: amt, Value: amt,
Method: abi.MethodNum(method), Method: abi.MethodNum(method),
@ -118,7 +121,7 @@ func (a *MsigAPI) MsigPropose(ctx context.Context, msig address.Address, to addr
To: msig, To: msig,
From: src, From: src,
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin.MethodsMultisig.Propose, Method: builtin0.MethodsMultisig.Propose,
Params: enc, Params: enc,
} }
@ -136,7 +139,7 @@ func (a *MsigAPI) MsigAddPropose(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(builtin.MethodsMultisig.AddSigner), enc) return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.AddSigner), enc)
} }
func (a *MsigAPI) MsigAddApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, newAdd address.Address, inc bool) (cid.Cid, error) { func (a *MsigAPI) MsigAddApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, newAdd address.Address, inc bool) (cid.Cid, error) {
@ -145,7 +148,7 @@ func (a *MsigAPI) MsigAddApprove(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigApprove(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin.MethodsMultisig.AddSigner), enc) return a.MsigApprove(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.AddSigner), enc)
} }
func (a *MsigAPI) MsigAddCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, newAdd address.Address, inc bool) (cid.Cid, error) { func (a *MsigAPI) MsigAddCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, newAdd address.Address, inc bool) (cid.Cid, error) {
@ -154,7 +157,7 @@ func (a *MsigAPI) MsigAddCancel(ctx context.Context, msig address.Address, src a
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(builtin.MethodsMultisig.AddSigner), enc) return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.AddSigner), enc)
} }
func (a *MsigAPI) MsigSwapPropose(ctx context.Context, msig address.Address, src address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) { func (a *MsigAPI) MsigSwapPropose(ctx context.Context, msig address.Address, src address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) {
@ -163,7 +166,7 @@ func (a *MsigAPI) MsigSwapPropose(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(builtin.MethodsMultisig.SwapSigner), enc) return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.SwapSigner), enc)
} }
func (a *MsigAPI) MsigSwapApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) { func (a *MsigAPI) MsigSwapApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) {
@ -172,7 +175,7 @@ func (a *MsigAPI) MsigSwapApprove(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigApprove(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin.MethodsMultisig.SwapSigner), enc) return a.MsigApprove(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.SwapSigner), enc)
} }
func (a *MsigAPI) MsigSwapCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) { func (a *MsigAPI) MsigSwapCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) {
@ -181,7 +184,7 @@ func (a *MsigAPI) MsigSwapCancel(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(builtin.MethodsMultisig.SwapSigner), enc) return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.SwapSigner), enc)
} }
func (a *MsigAPI) MsigApprove(ctx context.Context, msig address.Address, txID uint64, proposer address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (cid.Cid, error) { func (a *MsigAPI) MsigApprove(ctx context.Context, msig address.Address, txID uint64, proposer address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (cid.Cid, error) {
@ -217,7 +220,7 @@ func (a *MsigAPI) msigApproveOrCancel(ctx context.Context, operation api.MsigPro
proposer = proposerID proposer = proposerID
} }
p := samsig.ProposalHashData{ p := multisig0.ProposalHashData{
Requester: proposer, Requester: proposer,
To: to, To: to,
Value: amt, Value: amt,
@ -231,8 +234,8 @@ func (a *MsigAPI) msigApproveOrCancel(ctx context.Context, operation api.MsigPro
} }
phash := blake2b.Sum256(pser) phash := blake2b.Sum256(pser)
enc, err := actors.SerializeParams(&samsig.TxnIDParams{ enc, err := actors.SerializeParams(&multisig0.TxnIDParams{
ID: samsig.TxnID(txID), ID: multisig0.TxnID(txID),
ProposalHash: phash[:], ProposalHash: phash[:],
}) })
@ -248,9 +251,9 @@ func (a *MsigAPI) msigApproveOrCancel(ctx context.Context, operation api.MsigPro
*/ */
switch operation { switch operation {
case api.MsigApprove: case api.MsigApprove:
msigResponseMethod = builtin.MethodsMultisig.Approve msigResponseMethod = builtin0.MethodsMultisig.Approve
case api.MsigCancel: case api.MsigCancel:
msigResponseMethod = builtin.MethodsMultisig.Cancel msigResponseMethod = builtin0.MethodsMultisig.Cancel
default: default:
return cid.Undef, xerrors.Errorf("Invalid operation for msigApproveOrCancel") return cid.Undef, xerrors.Errorf("Invalid operation for msigApproveOrCancel")
} }
@ -272,7 +275,7 @@ func (a *MsigAPI) msigApproveOrCancel(ctx context.Context, operation api.MsigPro
} }
func serializeAddParams(new address.Address, inc bool) ([]byte, error) { func serializeAddParams(new address.Address, inc bool) ([]byte, error) {
enc, actErr := actors.SerializeParams(&samsig.AddSignerParams{ enc, actErr := actors.SerializeParams(&multisig0.AddSignerParams{
Signer: new, Signer: new,
Increase: inc, Increase: inc,
}) })
@ -284,7 +287,7 @@ func serializeAddParams(new address.Address, inc bool) ([]byte, error) {
} }
func serializeSwapParams(old address.Address, new address.Address) ([]byte, error) { func serializeSwapParams(old address.Address, new address.Address) ([]byte, error) {
enc, actErr := actors.SerializeParams(&samsig.SwapSignerParams{ enc, actErr := actors.SerializeParams(&multisig0.SwapSignerParams{
From: old, From: old,
To: new, To: new,
}) })

View File

@ -7,7 +7,9 @@ import (
builtin2 "github.com/filecoin-project/lotus/chain/actors/builtin" builtin2 "github.com/filecoin-project/lotus/chain/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"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg" "github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
@ -24,8 +26,6 @@ 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/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
@ -1025,7 +1025,7 @@ func (a *StateAPI) StateMinerAvailableBalance(ctx context.Context, maddr address
// Returns zero if there is no entry in the data cap table for the // Returns zero if there is no entry in the data cap table for the
// address. // address.
func (a *StateAPI) StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) { func (a *StateAPI) StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) {
act, err := a.StateGetActor(ctx, builtin.VerifiedRegistryActorAddr, tsk) act, err := a.StateGetActor(ctx, builtin0.VerifiedRegistryActorAddr, tsk)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1063,12 +1063,12 @@ func (a *StateAPI) StateDealProviderCollateralBounds(ctx context.Context, size a
return api.DealCollateralBounds{}, xerrors.Errorf("loading tipset %s: %w", tsk, err) return api.DealCollateralBounds{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
} }
pact, err := a.StateGetActor(ctx, builtin.StoragePowerActorAddr, tsk) pact, err := a.StateGetActor(ctx, builtin0.StoragePowerActorAddr, tsk)
if err != nil { if err != nil {
return api.DealCollateralBounds{}, xerrors.Errorf("failed to load power actor: %w", err) return api.DealCollateralBounds{}, xerrors.Errorf("failed to load power actor: %w", err)
} }
ract, err := a.StateGetActor(ctx, builtin.RewardActorAddr, tsk) ract, err := a.StateGetActor(ctx, builtin0.RewardActorAddr, tsk)
if err != nil { if err != nil {
return api.DealCollateralBounds{}, xerrors.Errorf("failed to load reward actor: %w", err) return api.DealCollateralBounds{}, xerrors.Errorf("failed to load reward actor: %w", err)
} }

View File

@ -9,7 +9,8 @@ import (
"go.uber.org/fx" "go.uber.org/fx"
"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"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -70,10 +71,10 @@ func (a *PaychAPI) PaychNewPayment(ctx context.Context, from, to address.Address
return nil, err return nil, err
} }
svs := make([]*paych.SignedVoucher, len(vouchers)) svs := make([]*paych0.SignedVoucher, len(vouchers))
for i, v := range vouchers { for i, v := range vouchers {
sv, err := a.PaychMgr.CreateVoucher(ctx, ch.Channel, paych.SignedVoucher{ sv, err := a.PaychMgr.CreateVoucher(ctx, ch.Channel, paych0.SignedVoucher{
Amount: v.Amount, Amount: v.Amount,
Lane: lane, Lane: lane,
@ -122,15 +123,15 @@ func (a *PaychAPI) PaychCollect(ctx context.Context, addr address.Address) (cid.
return a.PaychMgr.Collect(ctx, addr) return a.PaychMgr.Collect(ctx, addr)
} }
func (a *PaychAPI) PaychVoucherCheckValid(ctx context.Context, ch address.Address, sv *paych.SignedVoucher) error { func (a *PaychAPI) PaychVoucherCheckValid(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher) error {
return a.PaychMgr.CheckVoucherValid(ctx, ch, sv) return a.PaychMgr.CheckVoucherValid(ctx, ch, sv)
} }
func (a *PaychAPI) PaychVoucherCheckSpendable(ctx context.Context, ch address.Address, sv *paych.SignedVoucher, secret []byte, proof []byte) (bool, error) { func (a *PaychAPI) PaychVoucherCheckSpendable(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, secret []byte, proof []byte) (bool, error) {
return a.PaychMgr.CheckVoucherSpendable(ctx, ch, sv, secret, proof) return a.PaychMgr.CheckVoucherSpendable(ctx, ch, sv, secret, proof)
} }
func (a *PaychAPI) PaychVoucherAdd(ctx context.Context, ch address.Address, sv *paych.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) { func (a *PaychAPI) PaychVoucherAdd(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
return a.PaychMgr.AddVoucherInbound(ctx, ch, sv, proof, minDelta) return a.PaychMgr.AddVoucherInbound(ctx, ch, sv, proof, minDelta)
} }
@ -142,16 +143,16 @@ func (a *PaychAPI) PaychVoucherAdd(ctx context.Context, ch address.Address, sv *
// If there are insufficient funds in the channel to create the voucher, // If there are insufficient funds in the channel to create the voucher,
// returns a nil voucher and the shortfall. // returns a nil voucher and the shortfall.
func (a *PaychAPI) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*api.VoucherCreateResult, error) { func (a *PaychAPI) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*api.VoucherCreateResult, error) {
return a.PaychMgr.CreateVoucher(ctx, pch, paych.SignedVoucher{Amount: amt, Lane: lane}) return a.PaychMgr.CreateVoucher(ctx, pch, paych0.SignedVoucher{Amount: amt, Lane: lane})
} }
func (a *PaychAPI) PaychVoucherList(ctx context.Context, pch address.Address) ([]*paych.SignedVoucher, error) { func (a *PaychAPI) PaychVoucherList(ctx context.Context, pch address.Address) ([]*paych0.SignedVoucher, error) {
vi, err := a.PaychMgr.ListVouchers(ctx, pch) vi, err := a.PaychMgr.ListVouchers(ctx, pch)
if err != nil { if err != nil {
return nil, err return nil, err
} }
out := make([]*paych.SignedVoucher, len(vi)) out := make([]*paych0.SignedVoucher, len(vi))
for k, v := range vi { for k, v := range vi {
out[k] = v.Voucher out[k] = v.Voucher
} }
@ -159,6 +160,6 @@ func (a *PaychAPI) PaychVoucherList(ctx context.Context, pch address.Address) ([
return out, nil return out, nil
} }
func (a *PaychAPI) PaychVoucherSubmit(ctx context.Context, ch address.Address, sv *paych.SignedVoucher, secret []byte, proof []byte) (cid.Cid, error) { func (a *PaychAPI) PaychVoucherSubmit(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, secret []byte, proof []byte) (cid.Cid, error) {
return a.PaychMgr.SubmitVoucher(ctx, ch, sv, secret, proof) return a.PaychMgr.SubmitVoucher(ctx, ch, sv, secret, proof)
} }

View File

@ -13,8 +13,9 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/paych" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -38,9 +39,9 @@ type API struct {
type settlerAPI interface { type settlerAPI interface {
PaychList(context.Context) ([]address.Address, error) PaychList(context.Context) ([]address.Address, error)
PaychStatus(context.Context, address.Address) (*api.PaychStatus, error) PaychStatus(context.Context, address.Address) (*api.PaychStatus, error)
PaychVoucherCheckSpendable(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error) PaychVoucherCheckSpendable(context.Context, address.Address, *paych0.SignedVoucher, []byte, []byte) (bool, error)
PaychVoucherList(context.Context, address.Address) ([]*paych.SignedVoucher, error) PaychVoucherList(context.Context, address.Address) ([]*paych0.SignedVoucher, error)
PaychVoucherSubmit(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (cid.Cid, error) PaychVoucherSubmit(context.Context, address.Address, *paych0.SignedVoucher, []byte, []byte) (cid.Cid, error)
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64) (*api.MsgLookup, error) StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64) (*api.MsgLookup, error)
} }
@ -85,7 +86,7 @@ func (pcs *paymentChannelSettler) messageHandler(msg *types.Message, rec *types.
if err != nil { if err != nil {
return true, err return true, err
} }
go func(voucher *paych.SignedVoucher, submitMessageCID cid.Cid) { go func(voucher *paych0.SignedVoucher, submitMessageCID cid.Cid) {
defer wg.Done() defer wg.Done()
msgLookup, err := pcs.api.StateWaitMsg(pcs.ctx, submitMessageCID, build.MessageConfidence) msgLookup, err := pcs.api.StateWaitMsg(pcs.ctx, submitMessageCID, build.MessageConfidence)
if err != nil { if err != nil {
@ -106,7 +107,7 @@ func (pcs *paymentChannelSettler) revertHandler(ctx context.Context, ts *types.T
func (pcs *paymentChannelSettler) matcher(msg *types.Message) (matchOnce bool, matched bool, err error) { func (pcs *paymentChannelSettler) matcher(msg *types.Message) (matchOnce bool, matched bool, err error) {
// Check if this is a settle payment channel message // Check if this is a settle payment channel message
if msg.Method != builtin.MethodsPaych.Settle { if msg.Method != builtin0.MethodsPaych.Settle {
return false, false, nil return false, false, nil
} }
// Check if this payment channel is of concern to this node (i.e. tracked in payment channel store), // Check if this payment channel is of concern to this node (i.e. tracked in payment channel store),

View File

@ -13,7 +13,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/actors/builtin"
init_ "github.com/filecoin-project/specs-actors/actors/builtin/init" init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych" paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
@ -387,7 +387,7 @@ func (ca *channelAccessor) createPaych(ctx context.Context, amt types.BigInt) (c
return cid.Undef, aerr return cid.Undef, aerr
} }
enc, aerr := actors.SerializeParams(&init_.ExecParams{ enc, aerr := actors.SerializeParams(&init0.ExecParams{
CodeCID: builtin.PaymentChannelActorCodeID, CodeCID: builtin.PaymentChannelActorCodeID,
ConstructorParams: params, ConstructorParams: params,
}) })
@ -452,7 +452,7 @@ func (ca *channelAccessor) waitPaychCreateMsg(channelID string, mcid cid.Cid) er
return err return err
} }
var decodedReturn init_.ExecReturn var decodedReturn init0.ExecReturn
err = decodedReturn.UnmarshalCBOR(bytes.NewReader(mwait.Receipt.Return)) err = decodedReturn.UnmarshalCBOR(bytes.NewReader(mwait.Receipt.Return))
if err != nil { if err != nil {
log.Error(err) log.Error(err)