migrate methods to abstracted methods

Method numbers never change anyways. At worst, we'll deprecate old methods and
have to explicitly import them from the correct actors version to use them.
This commit is contained in:
Steven Allen 2020-10-08 13:32:54 -07:00
parent 4e730b5ec8
commit bcabe7b3b5
36 changed files with 160 additions and 136 deletions

View File

@ -24,6 +24,8 @@ func init() {
}) })
} }
var Methods = builtin2.MethodsAccount
func Load(store adt.Store, act *types.Actor) (State, error) { func Load(store adt.Store, act *types.Actor) (State, error) {
switch act.Code { switch act.Code {
case builtin0.AccountActorCodeID: case builtin0.AccountActorCodeID:

View File

@ -37,6 +37,11 @@ const (
SecondsInDay = builtin0.SecondsInDay SecondsInDay = builtin0.SecondsInDay
) )
const (
MethodSend = builtin2.MethodSend
MethodConstructor = builtin2.MethodConstructor
)
// TODO: Why does actors have 2 different versions of this? // TODO: Why does actors have 2 different versions of this?
type SectorInfo = proof0.SectorInfo type SectorInfo = proof0.SectorInfo
type PoStProof = proof0.PoStProof type PoStProof = proof0.PoStProof

View File

@ -0,0 +1,10 @@
package cron
import (
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
var (
Address = builtin2.CronActorAddr
Methods = builtin2.MethodsCron
)

View File

@ -26,7 +26,10 @@ func init() {
}) })
} }
var Address = builtin0.InitActorAddr var (
Address = builtin2.InitActorAddr
Methods = builtin2.MethodsInit
)
func Load(store adt.Store, act *types.Actor) (State, error) { func Load(store adt.Store, act *types.Actor) (State, error) {
switch act.Code { switch act.Code {

View File

@ -27,7 +27,10 @@ func init() {
}) })
} }
var Address = builtin0.StorageMarketActorAddr var (
Address = builtin2.StorageMarketActorAddr
Methods = builtin2.MethodsMarket
)
func Load(store adt.Store, act *types.Actor) (st State, err error) { func Load(store adt.Store, act *types.Actor) (st State, err error) {
switch act.Code { switch act.Code {

View File

@ -31,6 +31,8 @@ func init() {
}) })
} }
var Methods = builtin2.MethodsMiner
// Unchanged between v0 and v2 actors // Unchanged between v0 and v2 actors
var WPoStProvingPeriod = miner0.WPoStProvingPeriod var WPoStProvingPeriod = miner0.WPoStProvingPeriod
var WPoStPeriodDeadlines = miner0.WPoStPeriodDeadlines var WPoStPeriodDeadlines = miner0.WPoStPeriodDeadlines

View File

@ -9,12 +9,15 @@ 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"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig" multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
) )
var Methods = builtin2.MethodsMultisig
func Message(version actors.Version, from address.Address) MessageBuilder { func Message(version actors.Version, from address.Address) MessageBuilder {
switch version { switch version {
case actors.Version0: case actors.Version0:

View File

@ -7,8 +7,12 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
) )
var Methods = builtin2.MethodsPaych
func Message(version actors.Version, from address.Address) MessageBuilder { func Message(version actors.Version, from address.Address) MessageBuilder {
switch version { switch version {
case actors.Version0: case actors.Version0:

View File

@ -25,7 +25,10 @@ func init() {
}) })
} }
var Address = builtin0.StoragePowerActorAddr var (
Address = builtin2.StoragePowerActorAddr
Methods = builtin2.MethodsPower
)
func Load(store adt.Store, act *types.Actor) (st State, err error) { func Load(store adt.Store, act *types.Actor) (st State, err error) {
switch act.Code { switch act.Code {

View File

@ -24,7 +24,10 @@ func init() {
}) })
} }
var Address = builtin0.RewardActorAddr var (
Address = builtin2.RewardActorAddr
Methods = builtin2.MethodsReward
)
func Load(store adt.Store, act *types.Actor) (st State, err error) { func Load(store adt.Store, act *types.Actor) (st State, err error) {
switch act.Code { switch act.Code {

View File

@ -24,7 +24,10 @@ func init() {
}) })
} }
var Address = builtin0.VerifiedRegistryActorAddr var (
Address = builtin2.VerifiedRegistryActorAddr
Methods = builtin2.MethodsVerifiedRegistry
)
func Load(store adt.Store, act *types.Actor) (State, error) { func Load(store adt.Store, act *types.Actor) (State, error) {
switch act.Code { switch act.Code {

View File

@ -4,15 +4,13 @@ import (
"context" "context"
"sync" "sync"
"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/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"go.uber.org/fx"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
"go.uber.org/fx"
"github.com/filecoin-project/go-address"
"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"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
@ -156,7 +154,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Add
To: market.Address, To: market.Address,
From: wallet, From: wallet,
Value: toAdd, Value: toAdd,
Method: builtin2.MethodsMarket.AddBalance, Method: market.Methods.AddBalance,
Params: params, Params: params,
}, nil) }, nil)
if err != nil { if err != nil {

View File

@ -12,7 +12,7 @@ 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/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
tutils "github.com/filecoin-project/specs-actors/v2/support/testing" tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
@ -51,7 +51,7 @@ func addFundsMsg(toAdd abi.TokenAmount, addr address.Address, wallet address.Add
To: market.Address, To: market.Address,
From: wallet, From: wallet,
Value: toAdd, Value: toAdd,
Method: builtin2.MethodsMarket.AddBalance, Method: market.Methods.AddBalance,
Params: params, Params: params,
} }
} }

View File

@ -6,6 +6,7 @@ import (
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
@ -68,7 +69,7 @@ func failedGuess(msg *types.SignedMessage) int64 {
func GuessGasUsed(ctx context.Context, tsk types.TipSetKey, msg *types.SignedMessage, al ActorLookup) (int64, error) { func GuessGasUsed(ctx context.Context, tsk types.TipSetKey, msg *types.SignedMessage, al ActorLookup) (int64, error) {
// MethodSend is the same in all versions. // MethodSend is the same in all versions.
if msg.Message.Method == builtin0.MethodSend { if msg.Message.Method == builtin.MethodSend {
switch msg.Message.From.Protocol() { switch msg.Message.From.Protocol() {
case address.BLS: case address.BLS:
return 1298450, nil return 1298450, nil

View File

@ -24,7 +24,7 @@ import (
"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"
"github.com/filecoin-project/lotus/chain/actors/aerrors" "github.com/filecoin-project/lotus/chain/actors/aerrors"
lotusinit "github.com/filecoin-project/lotus/chain/actors/builtin/init" _init "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/gen"
. "github.com/filecoin-project/lotus/chain/stmgr" . "github.com/filecoin-project/lotus/chain/stmgr"
@ -183,8 +183,8 @@ func TestForkHeightTriggers(t *testing.T) {
m := &types.Message{ m := &types.Message{
From: cg.Banker(), From: cg.Banker(),
To: lotusinit.Address, To: _init.Address,
Method: builtin2.MethodsInit.Exec, Method: _init.Methods.Exec,
Params: enc, Params: enc,
GasLimit: types.TestGasLimit, GasLimit: types.TestGasLimit,
} }
@ -281,8 +281,8 @@ func TestForkRefuseCall(t *testing.T) {
m := &types.Message{ m := &types.Message{
From: cg.Banker(), From: cg.Banker(),
To: lotusinit.Address, To: _init.Address,
Method: builtin2.MethodsInit.Exec, Method: _init.Methods.Exec,
Params: enc, Params: enc,
GasLimit: types.TestGasLimit, GasLimit: types.TestGasLimit,
Value: types.NewInt(0), Value: types.NewInt(0),

View File

@ -18,8 +18,6 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
// Used for genesis. // Used for genesis.
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig" msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
@ -28,6 +26,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/cron"
_init "github.com/filecoin-project/lotus/chain/actors/builtin/init" _init "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
@ -253,14 +252,14 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
runCron := func(epoch abi.ChainEpoch) error { runCron := func(epoch abi.ChainEpoch) error {
cronMsg := &types.Message{ cronMsg := &types.Message{
To: builtin2.CronActorAddr, To: cron.Address,
From: builtin2.SystemActorAddr, From: builtin.SystemActorAddr,
Nonce: uint64(epoch), Nonce: uint64(epoch),
Value: types.NewInt(0), Value: types.NewInt(0),
GasFeeCap: types.NewInt(0), GasFeeCap: types.NewInt(0),
GasPremium: types.NewInt(0), GasPremium: types.NewInt(0),
GasLimit: build.BlockGasLimit * 10000, // Make super sure this is never too little GasLimit: build.BlockGasLimit * 10000, // Make super sure this is never too little
Method: builtin2.MethodsCron.EpochTick, Method: cron.Methods.EpochTick,
Params: nil, Params: nil,
} }
ret, err := vmi.ApplyImplicitMessage(ctx, cronMsg) ret, err := vmi.ApplyImplicitMessage(ctx, cronMsg)
@ -349,14 +348,14 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
} }
rwMsg := &types.Message{ rwMsg := &types.Message{
From: builtin2.SystemActorAddr, From: builtin.SystemActorAddr,
To: reward.Address, To: reward.Address,
Nonce: uint64(epoch), Nonce: uint64(epoch),
Value: types.NewInt(0), Value: types.NewInt(0),
GasFeeCap: types.NewInt(0), GasFeeCap: types.NewInt(0),
GasPremium: types.NewInt(0), GasPremium: types.NewInt(0),
GasLimit: 1 << 30, GasLimit: 1 << 30,
Method: builtin2.MethodsReward.AwardBlockReward, Method: reward.Methods.AwardBlockReward,
Params: params, Params: params,
} }
ret, actErr := vmi.ApplyImplicitMessage(ctx, rwMsg) ret, actErr := vmi.ApplyImplicitMessage(ctx, rwMsg)
@ -973,7 +972,7 @@ func (sm *StateManager) setupGenesisActors(ctx context.Context) error {
} else if builtin.IsAccountActor(act.Code) { } else if builtin.IsAccountActor(act.Code) {
// should exclude burnt funds actor and "remainder account actor" // should exclude burnt funds actor and "remainder account actor"
// should only ever be "faucet" accounts in testnets // should only ever be "faucet" accounts in testnets
if kaddr == builtin2.BurntFundsActorAddr { if kaddr == builtin.BurntFundsActorAddr {
return nil return nil
} }
@ -1051,24 +1050,24 @@ func (sm *StateManager) setupPreIgnitionGenesisActorsTestnet(ctx context.Context
totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount) totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount)
// 6 months // 6 months
sixMonths := abi.ChainEpoch(183 * builtin2.EpochsInDay) sixMonths := abi.ChainEpoch(183 * builtin.EpochsInDay)
totalsByEpoch[sixMonths] = big.NewInt(49_929_341) totalsByEpoch[sixMonths] = big.NewInt(49_929_341)
totalsByEpoch[sixMonths] = big.Add(totalsByEpoch[sixMonths], big.NewInt(32_787_700)) totalsByEpoch[sixMonths] = big.Add(totalsByEpoch[sixMonths], big.NewInt(32_787_700))
// 1 year // 1 year
oneYear := abi.ChainEpoch(365 * builtin2.EpochsInDay) oneYear := abi.ChainEpoch(365 * builtin.EpochsInDay)
totalsByEpoch[oneYear] = big.NewInt(22_421_712) totalsByEpoch[oneYear] = big.NewInt(22_421_712)
// 2 years // 2 years
twoYears := abi.ChainEpoch(2 * 365 * builtin2.EpochsInDay) twoYears := abi.ChainEpoch(2 * 365 * builtin.EpochsInDay)
totalsByEpoch[twoYears] = big.NewInt(7_223_364) totalsByEpoch[twoYears] = big.NewInt(7_223_364)
// 3 years // 3 years
threeYears := abi.ChainEpoch(3 * 365 * builtin2.EpochsInDay) threeYears := abi.ChainEpoch(3 * 365 * builtin.EpochsInDay)
totalsByEpoch[threeYears] = big.NewInt(87_637_883) totalsByEpoch[threeYears] = big.NewInt(87_637_883)
// 6 years // 6 years
sixYears := abi.ChainEpoch(6 * 365 * builtin2.EpochsInDay) sixYears := abi.ChainEpoch(6 * 365 * builtin.EpochsInDay)
totalsByEpoch[sixYears] = big.NewInt(100_000_000) totalsByEpoch[sixYears] = big.NewInt(100_000_000)
totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000)) totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000))
@ -1128,24 +1127,24 @@ func (sm *StateManager) setupPostIgnitionGenesisActors(ctx context.Context) erro
totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount) totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount)
// 6 months // 6 months
sixMonths := abi.ChainEpoch(183 * builtin2.EpochsInDay) sixMonths := abi.ChainEpoch(183 * builtin.EpochsInDay)
totalsByEpoch[sixMonths] = big.NewInt(49_929_341) totalsByEpoch[sixMonths] = big.NewInt(49_929_341)
totalsByEpoch[sixMonths] = big.Add(totalsByEpoch[sixMonths], big.NewInt(32_787_700)) totalsByEpoch[sixMonths] = big.Add(totalsByEpoch[sixMonths], big.NewInt(32_787_700))
// 1 year // 1 year
oneYear := abi.ChainEpoch(365 * builtin2.EpochsInDay) oneYear := abi.ChainEpoch(365 * builtin.EpochsInDay)
totalsByEpoch[oneYear] = big.NewInt(22_421_712) totalsByEpoch[oneYear] = big.NewInt(22_421_712)
// 2 years // 2 years
twoYears := abi.ChainEpoch(2 * 365 * builtin2.EpochsInDay) twoYears := abi.ChainEpoch(2 * 365 * builtin.EpochsInDay)
totalsByEpoch[twoYears] = big.NewInt(7_223_364) totalsByEpoch[twoYears] = big.NewInt(7_223_364)
// 3 years // 3 years
threeYears := abi.ChainEpoch(3 * 365 * builtin2.EpochsInDay) threeYears := abi.ChainEpoch(3 * 365 * builtin.EpochsInDay)
totalsByEpoch[threeYears] = big.NewInt(87_637_883) totalsByEpoch[threeYears] = big.NewInt(87_637_883)
// 6 years // 6 years
sixYears := abi.ChainEpoch(6 * 365 * builtin2.EpochsInDay) sixYears := abi.ChainEpoch(6 * 365 * builtin.EpochsInDay)
totalsByEpoch[sixYears] = big.NewInt(100_000_000) totalsByEpoch[sixYears] = big.NewInt(100_000_000)
totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000)) totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000))
@ -1279,7 +1278,7 @@ func (sm *StateManager) GetFilLocked(ctx context.Context, st *state.StateTree) (
} }
func GetFilBurnt(ctx context.Context, st *state.StateTree) (abi.TokenAmount, error) { func GetFilBurnt(ctx context.Context, st *state.StateTree) (abi.TokenAmount, error) {
burnt, err := st.GetActor(builtin2.BurntFundsActorAddr) burnt, err := st.GetActor(builtin.BurntFundsActorAddr)
if err != nil { if err != nil {
return big.Zero(), xerrors.Errorf("failed to load burnt actor: %w", err) return big.Zero(), xerrors.Errorf("failed to load burnt actor: %w", err)
} }

View File

@ -12,8 +12,6 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy"
cid "github.com/ipfs/go-cid" cid "github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen" cbg "github.com/whyrusleeping/cbor-gen"
@ -25,15 +23,16 @@ import (
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/rt" "github.com/filecoin-project/go-state-types/rt"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
exported0 "github.com/filecoin-project/specs-actors/actors/builtin/exported" exported0 "github.com/filecoin-project/specs-actors/actors/builtin/exported"
exported2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/exported" exported2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/exported"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors/builtin"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/builtin/power" "github.com/filecoin-project/lotus/chain/actors/builtin/power"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/beacon" "github.com/filecoin-project/lotus/chain/beacon"
"github.com/filecoin-project/lotus/chain/state" "github.com/filecoin-project/lotus/chain/state"
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
@ -548,8 +547,7 @@ func init() {
methods := make(map[abi.MethodNum]MethodMeta, len(exports)) methods := make(map[abi.MethodNum]MethodMeta, len(exports))
// Explicitly add send, it's special. // Explicitly add send, it's special.
// Note that builtin2.MethodSend = builtin0.MethodSend = 0. methods[builtin.MethodSend] = MethodMeta{
methods[builtin0.MethodSend] = MethodMeta{
Name: "Send", Name: "Send",
Params: reflect.TypeOf(new(abi.EmptyValue)), Params: reflect.TypeOf(new(abi.EmptyValue)),
Ret: reflect.TypeOf(new(abi.EmptyValue)), Ret: reflect.TypeOf(new(abi.EmptyValue)),
@ -573,11 +571,9 @@ func init() {
fnName = strings.TrimSuffix(fnName[strings.LastIndexByte(fnName, '.')+1:], "-fm") fnName = strings.TrimSuffix(fnName[strings.LastIndexByte(fnName, '.')+1:], "-fm")
switch abi.MethodNum(number) { switch abi.MethodNum(number) {
case builtin0.MethodSend: case builtin.MethodSend:
// Note that builtin2.MethodSend = builtin0.MethodSend = 0.
panic("method 0 is reserved for Send") panic("method 0 is reserved for Send")
case builtin0.MethodConstructor: case builtin.MethodConstructor:
// Note that builtin2.MethodConstructor = builtin0.MethodConstructor = 1.
if fnName != "Constructor" { if fnName != "Constructor" {
panic("method 1 is reserved for Constructor") panic("method 1 is reserved for Constructor")
} }

View File

@ -3,12 +3,13 @@ package vm
import ( import (
"fmt" "fmt"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"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/lotus/chain/actors/builtin"
) )
type scalingCost struct { type scalingCost struct {
@ -112,14 +113,14 @@ func (pl *pricelistV0) OnMethodInvocation(value abi.TokenAmount, methodNum abi.M
if big.Cmp(value, abi.NewTokenAmount(0)) != 0 { if big.Cmp(value, abi.NewTokenAmount(0)) != 0 {
ret += pl.sendTransferFunds ret += pl.sendTransferFunds
if methodNum == builtin2.MethodSend { if methodNum == builtin.MethodSend {
// transfer only // transfer only
ret += pl.sendTransferOnlyPremium ret += pl.sendTransferOnlyPremium
} }
extra += "t" extra += "t"
} }
if methodNum != builtin2.MethodSend { if methodNum != builtin.MethodSend {
extra += "i" extra += "i"
// running actors is cheaper becase we hand over to actors // running actors is cheaper becase we hand over to actors
ret += pl.sendInvokeMethod ret += pl.sendInvokeMethod

View File

@ -16,6 +16,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/actors/aerrors" "github.com/filecoin-project/lotus/chain/actors/aerrors"
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/account"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
) )
@ -57,7 +58,7 @@ func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, add
} }
// call constructor on account // call constructor on account
_, aerr = rt.internalSend(builtin.SystemActorAddr, addrID, builtin2.MethodsAccount.Constructor, big.Zero(), p) _, aerr = rt.internalSend(builtin.SystemActorAddr, addrID, account.Methods.Constructor, big.Zero(), p)
if aerr != nil { if aerr != nil {
return nil, address.Undef, aerrors.Wrap(aerr, "failed to invoke account constructor") return nil, address.Undef, aerrors.Wrap(aerr, "failed to invoke account constructor")
} }

View File

@ -10,8 +10,6 @@ import (
"strconv" "strconv"
"text/tabwriter" "text/tabwriter"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
@ -1170,7 +1168,7 @@ var msigLockProposeCmd = &cli.Command{
return actErr return actErr
} }
msgCid, err := api.MsigPropose(ctx, msig, msig, big.Zero(), from, uint64(builtin2.MethodsMultisig.LockBalance), params) msgCid, err := api.MsigPropose(ctx, msig, msig, big.Zero(), from, uint64(multisig.Methods.LockBalance), params)
if err != nil { if err != nil {
return err return err
} }
@ -1267,7 +1265,7 @@ var msigLockApproveCmd = &cli.Command{
return actErr return actErr
} }
msgCid, err := api.MsigApproveTxnHash(ctx, msig, txid, prop, msig, big.Zero(), from, uint64(builtin2.MethodsMultisig.LockBalance), params) msgCid, err := api.MsigApproveTxnHash(ctx, msig, txid, prop, msig, big.Zero(), from, uint64(multisig.Methods.LockBalance), params)
if err != nil { if err != nil {
return err return err
} }
@ -1359,7 +1357,7 @@ var msigLockCancelCmd = &cli.Command{
return actErr return actErr
} }
msgCid, err := api.MsigCancel(ctx, msig, txid, msig, big.Zero(), from, uint64(builtin2.MethodsMultisig.LockBalance), params) msgCid, err := api.MsigCancel(ctx, msig, txid, msig, big.Zero(), from, uint64(multisig.Methods.LockBalance), params)
if err != nil { if err != nil {
return err return err
} }
@ -1496,7 +1494,7 @@ var msigProposeThresholdCmd = &cli.Command{
return actErr return actErr
} }
msgCid, err := api.MsigPropose(ctx, msig, msig, types.NewInt(0), from, uint64(builtin2.MethodsMultisig.ChangeNumApprovalsThreshold), params) msgCid, err := api.MsigPropose(ctx, msig, msig, types.NewInt(0), from, uint64(multisig.Methods.ChangeNumApprovalsThreshold), params)
if err != nil { if err != nil {
return fmt.Errorf("failed to propose change of threshold: %w", err) return fmt.Errorf("failed to propose change of threshold: %w", err)
} }

View File

@ -16,7 +16,6 @@ import (
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
@ -870,7 +869,7 @@ func (r *refunder) processTipsetStorageMarketActor(ctx context.Context, tipset *
var messageMethod string var messageMethod string
switch m.Method { switch m.Method {
case builtin2.MethodsMarket.PublishStorageDeals: case market.Methods.PublishStorageDeals:
if !r.publishStorageDealsEnabled { if !r.publishStorageDealsEnabled {
return false, messageMethod, types.NewInt(0), nil return false, messageMethod, types.NewInt(0), nil
} }
@ -897,7 +896,7 @@ func (r *refunder) processTipsetStorageMinerActor(ctx context.Context, tipset *t
var messageMethod string var messageMethod string
switch m.Method { switch m.Method {
case builtin2.MethodsMiner.SubmitWindowedPoSt: case miner.Methods.SubmitWindowedPoSt:
if !r.windowedPoStEnabled { if !r.windowedPoStEnabled {
return false, messageMethod, types.NewInt(0), nil return false, messageMethod, types.NewInt(0), nil
} }
@ -910,7 +909,7 @@ func (r *refunder) processTipsetStorageMinerActor(ctx context.Context, tipset *t
} }
refundValue = types.BigMul(types.NewInt(uint64(recp.GasUsed)), tipset.Blocks()[0].ParentBaseFee) refundValue = types.BigMul(types.NewInt(uint64(recp.GasUsed)), tipset.Blocks()[0].ParentBaseFee)
case builtin2.MethodsMiner.ProveCommitSector: case miner.Methods.ProveCommitSector:
if !r.proveCommitEnabled { if !r.proveCommitEnabled {
return false, messageMethod, types.NewInt(0), nil return false, messageMethod, types.NewInt(0), nil
} }
@ -966,7 +965,7 @@ func (r *refunder) processTipsetStorageMinerActor(ctx context.Context, tipset *t
if r.refundPercent > 0 { if r.refundPercent > 0 {
refundValue = types.BigMul(types.BigDiv(refundValue, types.NewInt(100)), types.NewInt(uint64(r.refundPercent))) refundValue = types.BigMul(types.BigDiv(refundValue, types.NewInt(100)), types.NewInt(uint64(r.refundPercent)))
} }
case builtin2.MethodsMiner.PreCommitSector: case miner.Methods.PreCommitSector:
if !r.preCommitEnabled { if !r.preCommitEnabled {
return false, messageMethod, types.NewInt(0), nil return false, messageMethod, types.NewInt(0), nil
} }

View File

@ -14,11 +14,10 @@ import (
"go.opencensus.io/stats/view" "go.opencensus.io/stats/view"
"go.opencensus.io/tag" "go.opencensus.io/tag"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
lapi "github.com/filecoin-project/lotus/api" lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
) )
@ -145,7 +144,7 @@ var mpoolStatsCmd = &cli.Command{
seen: time.Now(), seen: time.Now(),
} }
if u.Message.Message.Method == builtin2.MethodsMiner.SubmitWindowedPoSt { if u.Message.Message.Method == miner.Methods.SubmitWindowedPoSt {
miner, err := isMiner(u.Message.Message.To) miner, err := isMiner(u.Message.Message.To)
if err != nil { if err != nil {

View File

@ -4,17 +4,19 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield" "github.com/filecoin-project/go-bitfield"
"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/chain/actors" "github.com/urfave/cli/v2"
"golang.org/x/xerrors"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
"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/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
"github.com/urfave/cli/v2"
) )
var sectorsCmd = &cli.Command{ var sectorsCmd = &cli.Command{
@ -69,7 +71,7 @@ var terminateSectorCmd = &cli.Command{
return err return err
} }
terminationDeclarationParams := []miner0.TerminationDeclaration{} terminationDeclarationParams := []miner2.TerminationDeclaration{}
for _, sn := range cctx.Args().Slice() { for _, sn := range cctx.Args().Slice() {
sectorNum, err := strconv.ParseUint(sn, 10, 64) sectorNum, err := strconv.ParseUint(sn, 10, 64)
@ -85,7 +87,7 @@ var terminateSectorCmd = &cli.Command{
return fmt.Errorf("get state sector partition %s", err) return fmt.Errorf("get state sector partition %s", err)
} }
para := miner0.TerminationDeclaration{ para := miner2.TerminationDeclaration{
Deadline: loca.Deadline, Deadline: loca.Deadline,
Partition: loca.Partition, Partition: loca.Partition,
Sectors: sectorbit, Sectors: sectorbit,
@ -94,7 +96,7 @@ var terminateSectorCmd = &cli.Command{
terminationDeclarationParams = append(terminationDeclarationParams, para) terminationDeclarationParams = append(terminationDeclarationParams, para)
} }
terminateSectorParams := &miner0.TerminateSectorsParams{ terminateSectorParams := &miner2.TerminateSectorsParams{
Terminations: terminationDeclarationParams, Terminations: terminationDeclarationParams,
} }
@ -106,7 +108,7 @@ var terminateSectorCmd = &cli.Command{
smsg, err := nodeApi.MpoolPushMessage(ctx, &types.Message{ smsg, err := nodeApi.MpoolPushMessage(ctx, &types.Message{
From: mi.Owner, From: mi.Owner,
To: maddr, To: maddr,
Method: builtin2.MethodsMiner.TerminateSectors, Method: miner.Methods.TerminateSectors,
Value: big.Zero(), Value: big.Zero(),
Params: sp, Params: sp,

View File

@ -11,7 +11,6 @@ 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"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg" verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
"github.com/filecoin-project/lotus/api/apibstore" "github.com/filecoin-project/lotus/api/apibstore"
@ -80,7 +79,7 @@ var verifRegAddVerifierCmd = &cli.Command{
return err return err
} }
smsg, err := api.MsigPropose(ctx, vrk, verifreg.Address, big.Zero(), sender, uint64(builtin2.MethodsVerifiedRegistry.AddVerifier), params) smsg, err := api.MsigPropose(ctx, vrk, verifreg.Address, big.Zero(), sender, uint64(verifreg.Methods.AddVerifier), params)
if err != nil { if err != nil {
return err return err
} }
@ -151,7 +150,7 @@ var verifRegVerifyClientCmd = &cli.Command{
msg := &types.Message{ msg := &types.Message{
To: verifreg.Address, To: verifreg.Address,
From: fromk, From: fromk,
Method: builtin2.MethodsVerifiedRegistry.AddVerifiedClient, Method: verifreg.Methods.AddVerifiedClient,
Params: params, Params: params,
} }

View File

@ -5,13 +5,8 @@ import (
"os" "os"
"strings" "strings"
"github.com/filecoin-project/lotus/api/apibstore"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
"github.com/filecoin-project/lotus/build"
"github.com/fatih/color" "github.com/fatih/color"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
@ -22,10 +17,13 @@ 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"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
"github.com/filecoin-project/lotus/api/apibstore"
"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/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/lib/tablewriter" "github.com/filecoin-project/lotus/lib/tablewriter"
@ -109,7 +107,7 @@ var actorSetAddrsCmd = &cli.Command{
From: minfo.Worker, From: minfo.Worker,
Value: types.NewInt(0), Value: types.NewInt(0),
GasLimit: gasLimit, GasLimit: gasLimit,
Method: builtin2.MethodsMiner.ChangeMultiaddrs, Method: miner.Methods.ChangeMultiaddrs,
Params: params, Params: params,
}, nil) }, nil)
if err != nil { if err != nil {
@ -174,7 +172,7 @@ var actorSetPeeridCmd = &cli.Command{
From: minfo.Worker, From: minfo.Worker,
Value: types.NewInt(0), Value: types.NewInt(0),
GasLimit: gasLimit, GasLimit: gasLimit,
Method: builtin2.MethodsMiner.ChangePeerID, Method: miner.Methods.ChangePeerID,
Params: params, Params: params,
}, nil) }, nil)
if err != nil { if err != nil {
@ -246,7 +244,7 @@ var actorWithdrawCmd = &cli.Command{
To: maddr, To: maddr,
From: mi.Owner, From: mi.Owner,
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin2.MethodsMiner.WithdrawBalance, Method: miner.Methods.WithdrawBalance,
Params: params, Params: params,
}, nil) }, nil)
if err != nil { if err != nil {
@ -345,7 +343,7 @@ var actorRepayDebtCmd = &cli.Command{
To: maddr, To: maddr,
From: fromId, From: fromId,
Value: amount, Value: amount,
Method: builtin2.MethodsMiner.RepayDebt, Method: miner.Methods.RepayDebt,
Params: nil, Params: nil,
}, nil) }, nil)
if err != nil { if err != nil {
@ -572,7 +570,7 @@ var actorControlSet = &cli.Command{
smsg, err := api.MpoolPushMessage(ctx, &types.Message{ smsg, err := api.MpoolPushMessage(ctx, &types.Message{
From: mi.Owner, From: mi.Owner,
To: maddr, To: maddr,
Method: builtin2.MethodsMiner.ChangeWorkerAddress, Method: miner.Methods.ChangeWorkerAddress,
Value: big.Zero(), Value: big.Zero(),
Params: sp, Params: sp,
@ -650,7 +648,7 @@ var actorSetOwnerCmd = &cli.Command{
smsg, err := api.MpoolPushMessage(ctx, &types.Message{ smsg, err := api.MpoolPushMessage(ctx, &types.Message{
From: mi.Owner, From: mi.Owner,
To: maddr, To: maddr,
Method: builtin2.MethodsMiner.ChangeOwnerAddress, Method: miner.Methods.ChangeOwnerAddress,
Value: big.Zero(), Value: big.Zero(),
Params: sp, Params: sp,
}, nil) }, nil)
@ -675,7 +673,7 @@ var actorSetOwnerCmd = &cli.Command{
smsg, err = api.MpoolPushMessage(ctx, &types.Message{ smsg, err = api.MpoolPushMessage(ctx, &types.Message{
From: newAddr, From: newAddr,
To: maddr, To: maddr,
Method: builtin2.MethodsMiner.ChangeOwnerAddress, Method: miner.Methods.ChangeOwnerAddress,
Value: big.Zero(), Value: big.Zero(),
Params: sp, Params: sp,
}, nil) }, nil)

View File

@ -31,7 +31,6 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
"github.com/filecoin-project/lotus/extern/sector-storage/stores" "github.com/filecoin-project/lotus/extern/sector-storage/stores"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power" power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
@ -39,6 +38,7 @@ import (
lapi "github.com/filecoin-project/lotus/api" lapi "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/power" "github.com/filecoin-project/lotus/chain/actors/builtin/power"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/gen/slashfilter" "github.com/filecoin-project/lotus/chain/gen/slashfilter"
@ -47,7 +47,7 @@ import (
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/genesis" "github.com/filecoin-project/lotus/genesis"
"github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/journal"
"github.com/filecoin-project/lotus/miner" storageminer "github.com/filecoin-project/lotus/miner"
"github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
@ -470,7 +470,7 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api lapi.FullNode,
return fmt.Errorf("failed to open filesystem journal: %w", err) return fmt.Errorf("failed to open filesystem journal: %w", err)
} }
m := miner.NewMiner(api, epp, a, slashfilter.New(mds), j) m := storageminer.NewMiner(api, epp, a, slashfilter.New(mds), j)
{ {
if err := m.Start(ctx); err != nil { if err := m.Start(ctx); err != nil {
return xerrors.Errorf("failed to start up genesis miner: %w", err) return xerrors.Errorf("failed to start up genesis miner: %w", err)
@ -578,7 +578,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
msg := &types.Message{ msg := &types.Message{
To: addr, To: addr,
From: mi.Worker, From: mi.Worker,
Method: builtin2.MethodsMiner.ChangePeerID, Method: miner.Methods.ChangePeerID,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPremium: gasPrice, GasPremium: gasPrice,
@ -661,7 +661,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
From: sender, From: sender,
Value: big.Zero(), Value: big.Zero(),
Method: builtin2.MethodsPower.CreateMiner, Method: power.Methods.CreateMiner,
Params: params, Params: params,
GasLimit: 0, GasLimit: 0,

View File

@ -6,6 +6,7 @@ import (
"github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/go-state-types/rt" "github.com/filecoin-project/go-state-types/rt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
@ -56,7 +57,7 @@ const (
const ( const (
_ = 0 // skip zero iota value; first usage of iota gets 1. _ = 0 // skip zero iota value; first usage of iota gets 1.
MethodCallerValidation = builtin2.MethodConstructor + iota MethodCallerValidation = builtin.MethodConstructor + iota
MethodCreateActor MethodCreateActor
MethodResolveAddress MethodResolveAddress
// MethodDeleteActor is the identifier for the method that deletes this actor. // MethodDeleteActor is the identifier for the method that deletes this actor.
@ -77,7 +78,7 @@ const (
// Exports defines the methods this actor exposes publicly. // Exports defines the methods this actor exposes publicly.
func (a Actor) Exports() []interface{} { func (a Actor) Exports() []interface{} {
return []interface{}{ return []interface{}{
builtin2.MethodConstructor: a.Constructor, builtin.MethodConstructor: a.Constructor,
MethodCallerValidation: a.CallerValidation, MethodCallerValidation: a.CallerValidation,
MethodCreateActor: a.CreateActor, MethodCreateActor: a.CreateActor,
MethodResolveAddress: a.ResolveAddress, MethodResolveAddress: a.ResolveAddress,

View File

@ -16,8 +16,6 @@ import (
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/go-statemachine"
"github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/specs-storage/storage"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
) )
var DealSectorPriority = 1024 var DealSectorPriority = 1024
@ -221,7 +219,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
deposit := big.Max(depositMinimum, collateral) deposit := big.Max(depositMinimum, collateral)
log.Infof("submitting precommit for sector %d (deposit: %s): ", sector.SectorNumber, deposit) log.Infof("submitting precommit for sector %d (deposit: %s): ", sector.SectorNumber, deposit)
mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin2.MethodsMiner.PreCommitSector, deposit, m.feeCfg.MaxPreCommitGasFee, enc.Bytes()) mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, miner.Methods.PreCommitSector, deposit, m.feeCfg.MaxPreCommitGasFee, enc.Bytes())
if err != nil { if err != nil {
if params.ReplaceCapacity { if params.ReplaceCapacity {
m.remarkForUpgrade(params.ReplaceSectorNumber) m.remarkForUpgrade(params.ReplaceSectorNumber)
@ -402,7 +400,7 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
} }
// TODO: check seed / ticket / deals are up to date // TODO: check seed / ticket / deals are up to date
mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin2.MethodsMiner.ProveCommitSector, collateral, m.feeCfg.MaxCommitGasFee, enc.Bytes()) mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, miner.Methods.ProveCommitSector, collateral, m.feeCfg.MaxCommitGasFee, enc.Bytes())
if err != nil { if err != nil {
return ctx.Send(SectorCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)}) return ctx.Send(SectorCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)})
} }

View File

@ -12,7 +12,6 @@ import (
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
@ -92,7 +91,7 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
To: market.Address, To: market.Address,
From: mi.Worker, From: mi.Worker,
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin2.MethodsMarket.PublishStorageDeals, Method: market.Methods.PublishStorageDeals,
Params: params, Params: params,
}, n.publishSpec) }, n.publishSpec)
if err != nil { if err != nil {
@ -192,7 +191,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address
To: market.Address, To: market.Address,
From: addr, From: addr,
Value: amount, Value: amount,
Method: builtin2.MethodsMarket.AddBalance, Method: market.Methods.AddBalance,
}, n.addBalanceSpec) }, n.addBalanceSpec)
if err != nil { if err != nil {
return cid.Undef, err return cid.Undef, err
@ -314,7 +313,7 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
} }
switch msg.Method { switch msg.Method {
case builtin2.MethodsMiner.PreCommitSector: case miner.Methods.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)
@ -329,7 +328,7 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
} }
return true, false, nil return true, false, nil
case builtin2.MethodsMiner.ProveCommitSector: case miner.Methods.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

@ -7,6 +7,7 @@ import (
"sort" "sort"
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
"go.uber.org/fx" "go.uber.org/fx"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -16,8 +17,6 @@ import (
"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"
builtin2 "github.com/filecoin-project/specs-actors/v2/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"
"github.com/filecoin-project/lotus/chain/messagepool" "github.com/filecoin-project/lotus/chain/messagepool"
@ -259,7 +258,7 @@ func gasEstimateGasLimit(
if !builtin.IsPaymentChannelActor(act.Code) { if !builtin.IsPaymentChannelActor(act.Code) {
return res.MsgRct.GasUsed, nil return res.MsgRct.GasUsed, nil
} }
if msgIn.Method != builtin2.MethodsPaych.Collect { if msgIn.Method != paych.Methods.Collect {
return res.MsgRct.GasUsed, nil return res.MsgRct.GasUsed, nil
} }

View File

@ -12,7 +12,6 @@ import (
"github.com/filecoin-project/lotus/chain/actors/builtin/multisig" "github.com/filecoin-project/lotus/chain/actors/builtin/multisig"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig" multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
@ -85,7 +84,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(builtin2.MethodsMultisig.AddSigner), enc) return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(multisig.Methods.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) {
@ -94,7 +93,7 @@ func (a *MsigAPI) MsigAddApprove(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigApproveTxnHash(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin2.MethodsMultisig.AddSigner), enc) return a.MsigApproveTxnHash(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(multisig.Methods.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) {
@ -103,7 +102,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(builtin2.MethodsMultisig.AddSigner), enc) return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(multisig.Methods.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) {
@ -112,7 +111,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(builtin2.MethodsMultisig.SwapSigner), enc) return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(multisig.Methods.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) {
@ -121,7 +120,7 @@ func (a *MsigAPI) MsigSwapApprove(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigApproveTxnHash(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin2.MethodsMultisig.SwapSigner), enc) return a.MsigApproveTxnHash(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(multisig.Methods.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) {
@ -130,7 +129,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(builtin2.MethodsMultisig.SwapSigner), enc) return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(multisig.Methods.SwapSigner), enc)
} }
func (a *MsigAPI) MsigApprove(ctx context.Context, msig address.Address, txID uint64, src address.Address) (cid.Cid, error) { func (a *MsigAPI) MsigApprove(ctx context.Context, msig address.Address, txID uint64, src address.Address) (cid.Cid, error) {
@ -151,7 +150,7 @@ func (a *MsigAPI) MsigRemoveSigner(ctx context.Context, msig address.Address, pr
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigPropose(ctx, msig, msig, types.NewInt(0), proposer, uint64(builtin2.MethodsMultisig.RemoveSigner), enc) return a.MsigPropose(ctx, msig, msig, types.NewInt(0), proposer, uint64(multisig.Methods.RemoveSigner), enc)
} }
func (a *MsigAPI) msigApproveOrCancelSimple(ctx context.Context, operation api.MsigProposeResponse, msig address.Address, txID uint64, src address.Address) (cid.Cid, error) { func (a *MsigAPI) msigApproveOrCancelSimple(ctx context.Context, operation api.MsigProposeResponse, msig address.Address, txID uint64, src address.Address) (cid.Cid, error) {

View File

@ -24,6 +24,7 @@ import (
"github.com/filecoin-project/lotus/api/test" "github.com/filecoin-project/lotus/api/test"
"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/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/gen"
genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis" genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis"
@ -40,7 +41,6 @@ import (
testing2 "github.com/filecoin-project/lotus/node/modules/testing" testing2 "github.com/filecoin-project/lotus/node/modules/testing"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage/mockstorage" "github.com/filecoin-project/lotus/storage/mockstorage"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
"github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/crypto"
@ -93,7 +93,7 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
msg := &types.Message{ msg := &types.Message{
To: act, To: act,
From: waddr, From: waddr,
Method: builtin2.MethodsMiner.ChangePeerID, Method: miner.Methods.ChangePeerID,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
} }

View File

@ -14,8 +14,6 @@ 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"
builtin2 "github.com/filecoin-project/specs-actors/v2/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"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych" "github.com/filecoin-project/lotus/chain/actors/builtin/paych"
@ -107,7 +105,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 != builtin2.MethodsPaych.Settle { if msg.Method != paych.Methods.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

@ -15,7 +15,6 @@ 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"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
@ -150,7 +149,7 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
To: market.Address, To: market.Address,
From: maddr, From: maddr,
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin2.MethodsMarket.ComputeDataCommitment, Method: market.Methods.ComputeDataCommitment,
Params: ccparams, Params: ccparams,
} }
r, err := s.delegate.StateCall(ctx, ccmt, tsk) r, err := s.delegate.StateCall(ctx, ccmt, tsk)

View File

@ -17,7 +17,6 @@ import (
"go.opencensus.io/trace" "go.opencensus.io/trace"
"golang.org/x/xerrors" "golang.org/x/xerrors"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
@ -290,7 +289,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: builtin2.MethodsMiner.DeclareFaultsRecovered, Method: miner.Methods.DeclareFaultsRecovered,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
} }
@ -374,7 +373,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: builtin2.MethodsMiner.DeclareFaults, Method: miner.Methods.DeclareFaults,
Params: enc, Params: enc,
Value: types.NewInt(0), // TODO: Is there a fee? Value: types.NewInt(0), // TODO: Is there a fee?
} }
@ -714,7 +713,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: builtin2.MethodsMiner.SubmitWindowedPoSt, Method: miner.Methods.SubmitWindowedPoSt,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
} }

View File

@ -188,7 +188,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, builtin2.MethodsMiner.SubmitWindowedPoSt, msg.Method) require.Equal(t, miner.Methods.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)