This commit is contained in:
vyzo 2022-04-04 14:25:03 +03:00
parent 770608aef1
commit cdd5420e0c
116 changed files with 2389 additions and 1337 deletions

View File

@ -27,6 +27,7 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
func init() {
@ -35,38 +36,122 @@ func init() {
return load0(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version0, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
builtin.RegisterActorState(builtin2.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version2, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
builtin.RegisterActorState(builtin3.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version3, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
builtin.RegisterActorState(builtin4.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version4, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
builtin.RegisterActorState(builtin5.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version5, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
builtin.RegisterActorState(builtin6.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version6, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
builtin.RegisterActorState(builtin7.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version7, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
builtin.RegisterActorState(builtin8.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version8, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
}
var Methods = builtin4.MethodsAccount
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != "account" {
return nil, xerrors.Errorf("actor code is not account: %s", name)
}
switch av {
case actors.Version0:
return load0(store, act.Head)
case actors.Version2:
return load2(store, act.Head)
case actors.Version3:
return load3(store, act.Head)
case actors.Version4:
return load4(store, act.Head)
case actors.Version5:
return load5(store, act.Head)
case actors.Version6:
return load6(store, act.Head)
case actors.Version7:
return load7(store, act.Head)
case actors.Version8:
return load8(store, act.Head)
default:
return nil, xerrors.Errorf("unknown actor version: %d", av)
}
}
switch act.Code {
case builtin0.AccountActorCodeID:
@ -124,11 +209,15 @@ func MakeState(store adt.Store, av actors.Version, addr address.Address) (State,
case actors.Version8:
return make8(store, addr)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "account"); ok {
return c, nil
}
switch av {
case actors.Version0:

View File

@ -22,7 +22,7 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
func make0(store adt.Store, addr address.Address) (State, error) {
out := state0{store: store}
out.State = account0.State{Address: addr}
out.State = account0.State{Address:addr}
return &out, nil
}

View File

@ -22,7 +22,7 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
func make2(store adt.Store, addr address.Address) (State, error) {
out := state2{store: store}
out.State = account2.State{Address: addr}
out.State = account2.State{Address:addr}
return &out, nil
}

View File

@ -22,7 +22,7 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
func make3(store adt.Store, addr address.Address) (State, error) {
out := state3{store: store}
out.State = account3.State{Address: addr}
out.State = account3.State{Address:addr}
return &out, nil
}

View File

@ -22,7 +22,7 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
func make4(store adt.Store, addr address.Address) (State, error) {
out := state4{store: store}
out.State = account4.State{Address: addr}
out.State = account4.State{Address:addr}
return &out, nil
}

View File

@ -22,7 +22,7 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
func make5(store adt.Store, addr address.Address) (State, error) {
out := state5{store: store}
out.State = account5.State{Address: addr}
out.State = account5.State{Address:addr}
return &out, nil
}

View File

@ -22,7 +22,7 @@ func load6(store adt.Store, root cid.Cid) (State, error) {
func make6(store adt.Store, addr address.Address) (State, error) {
out := state6{store: store}
out.State = account6.State{Address: addr}
out.State = account6.State{Address:addr}
return &out, nil
}

View File

@ -22,7 +22,7 @@ func load7(store adt.Store, root cid.Cid) (State, error) {
func make7(store adt.Store, addr address.Address) (State, error) {
out := state7{store: store}
out.State = account7.State{Address: addr}
out.State = account7.State{Address:addr}
return &out, nil
}

View File

@ -22,7 +22,7 @@ func load8(store adt.Store, root cid.Cid) (State, error) {
func make8(store adt.Store, addr address.Address) (State, error) {
out := state8{store: store}
out.State = account8.State{Address: addr}
out.State = account8.State{Address:addr}
return &out, nil
}

View File

@ -5,6 +5,7 @@ import (
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing"
@ -29,9 +30,11 @@ import (
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
smoothing8 "github.com/filecoin-project/specs-actors/v8/actors/util/smoothing"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
@ -72,53 +75,55 @@ func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight,
return miner8.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
}
func FromV0FilterEstimate(v0 smoothing0.FilterEstimate) FilterEstimate {
func FromV0FilterEstimate(v0 smoothing0.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v0) //nolint:unconvert
}
}
func FromV2FilterEstimate(v2 smoothing2.FilterEstimate) FilterEstimate {
func FromV2FilterEstimate(v2 smoothing2.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v2)
}
}
func FromV3FilterEstimate(v3 smoothing3.FilterEstimate) FilterEstimate {
func FromV3FilterEstimate(v3 smoothing3.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v3)
}
}
func FromV4FilterEstimate(v4 smoothing4.FilterEstimate) FilterEstimate {
func FromV4FilterEstimate(v4 smoothing4.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v4)
}
}
func FromV5FilterEstimate(v5 smoothing5.FilterEstimate) FilterEstimate {
func FromV5FilterEstimate(v5 smoothing5.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v5)
}
}
func FromV6FilterEstimate(v6 smoothing6.FilterEstimate) FilterEstimate {
func FromV6FilterEstimate(v6 smoothing6.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v6)
}
}
func FromV7FilterEstimate(v7 smoothing7.FilterEstimate) FilterEstimate {
func FromV7FilterEstimate(v7 smoothing7.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v7)
}
}
func FromV8FilterEstimate(v8 smoothing8.FilterEstimate) FilterEstimate {
func FromV8FilterEstimate(v8 smoothing8.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v8)
}
}
type ActorStateLoader func(store adt.Store, root cid.Cid) (cbor.Marshaler, error)
@ -137,6 +142,11 @@ func Load(store adt.Store, act *types.Actor) (cbor.Marshaler, error) {
}
func ActorNameByCode(c cid.Cid) string {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name
}
switch {
case builtin0.IsBuiltinActor(c):
@ -169,6 +179,11 @@ func ActorNameByCode(c cid.Cid) string {
}
func IsBuiltinActor(c cid.Cid) bool {
_, _, ok := actors.GetActorMetaByCode(c)
if ok {
return true
}
if builtin0.IsBuiltinActor(c) {
return true
@ -206,6 +221,11 @@ func IsBuiltinActor(c cid.Cid) bool {
}
func IsAccountActor(c cid.Cid) bool {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name == "account"
}
if c == builtin0.AccountActorCodeID {
return true
@ -243,6 +263,11 @@ func IsAccountActor(c cid.Cid) bool {
}
func IsStorageMinerActor(c cid.Cid) bool {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name == "storageminer"
}
if c == builtin0.StorageMinerActorCodeID {
return true
@ -280,6 +305,11 @@ func IsStorageMinerActor(c cid.Cid) bool {
}
func IsMultisigActor(c cid.Cid) bool {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name == "multisig"
}
if c == builtin0.MultisigActorCodeID {
return true
@ -317,6 +347,11 @@ func IsMultisigActor(c cid.Cid) bool {
}
func IsPaymentChannelActor(c cid.Cid) bool {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name == "paymentchannel"
}
if c == builtin0.PaymentChannelActorCodeID {
return true

View File

@ -3,8 +3,8 @@ package cron
import (
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
"github.com/ipfs/go-cid"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
@ -21,6 +21,7 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
func MakeState(store adt.Store, av actors.Version) (State, error) {
@ -50,11 +51,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
case actors.Version8:
return make8(store)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "cron"); ok {
return c, nil
}
switch av {
case actors.Version0:
@ -91,6 +96,7 @@ var (
Methods = builtin8.MethodsCron
)
type State interface {
GetState() interface{}
}

View File

@ -29,6 +29,7 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
func init() {
@ -37,33 +38,81 @@ func init() {
return load0(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version0, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
builtin.RegisterActorState(builtin2.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version2, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
builtin.RegisterActorState(builtin3.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version3, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
builtin.RegisterActorState(builtin4.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version4, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
builtin.RegisterActorState(builtin5.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version5, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
builtin.RegisterActorState(builtin6.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version6, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
builtin.RegisterActorState(builtin7.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version7, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
builtin.RegisterActorState(builtin8.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version8, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
}
var (
@ -72,6 +121,42 @@ var (
)
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != "init" {
return nil, xerrors.Errorf("actor code is not init: %s", name)
}
switch av {
case actors.Version0:
return load0(store, act.Head)
case actors.Version2:
return load2(store, act.Head)
case actors.Version3:
return load3(store, act.Head)
case actors.Version4:
return load4(store, act.Head)
case actors.Version5:
return load5(store, act.Head)
case actors.Version6:
return load6(store, act.Head)
case actors.Version7:
return load7(store, act.Head)
case actors.Version8:
return load8(store, act.Head)
default:
return nil, xerrors.Errorf("unknown actor version: %d", av)
}
}
switch act.Code {
case builtin0.InitActorCodeID:
@ -129,11 +214,15 @@ func MakeState(store adt.Store, av actors.Version, networkName string) (State, e
case actors.Version8:
return make8(store, networkName)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "init"); ok {
return c, nil
}
switch av {
case actors.Version0:

View File

@ -10,6 +10,8 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)

View File

@ -10,6 +10,8 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)

View File

@ -10,8 +10,10 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
)

View File

@ -10,8 +10,10 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
)

View File

@ -10,8 +10,10 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
)

View File

@ -10,8 +10,10 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
)

View File

@ -10,8 +10,10 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
)

View File

@ -10,8 +10,10 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
init8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/init"
adt8 "github.com/filecoin-project/specs-actors/v8/actors/util/adt"
)

View File

@ -29,8 +29,9 @@ import (
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
)
@ -41,33 +42,81 @@ func init() {
return load0(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version0, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
builtin.RegisterActorState(builtin2.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version2, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
builtin.RegisterActorState(builtin3.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version3, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
builtin.RegisterActorState(builtin4.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version4, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
builtin.RegisterActorState(builtin5.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version5, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
builtin.RegisterActorState(builtin6.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version6, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
builtin.RegisterActorState(builtin7.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version7, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
builtin.RegisterActorState(builtin8.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version8, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
}
var (
@ -76,6 +125,42 @@ var (
)
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != "storagemarket" {
return nil, xerrors.Errorf("actor code is not storagemarket: %s", name)
}
switch av {
case actors.Version0:
return load0(store, act.Head)
case actors.Version2:
return load2(store, act.Head)
case actors.Version3:
return load3(store, act.Head)
case actors.Version4:
return load4(store, act.Head)
case actors.Version5:
return load5(store, act.Head)
case actors.Version6:
return load6(store, act.Head)
case actors.Version7:
return load7(store, act.Head)
case actors.Version8:
return load8(store, act.Head)
default:
return nil, xerrors.Errorf("unknown actor version: %d", av)
}
}
switch act.Code {
case builtin0.StorageMarketActorCodeID:
@ -133,11 +218,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
case actors.Version8:
return make8(store)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "storagemarket"); ok {
return c, nil
}
switch av {
case actors.Version0:
@ -247,7 +336,7 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
case actors.Version8:
return decodePublishStorageDealsReturn8(b)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}

View File

@ -40,6 +40,7 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
func init() {
@ -48,34 +49,82 @@ func init() {
return load0(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version0, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
builtin.RegisterActorState(builtin2.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version2, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
builtin.RegisterActorState(builtin3.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version3, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
builtin.RegisterActorState(builtin4.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version4, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
builtin.RegisterActorState(builtin5.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version5, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
builtin.RegisterActorState(builtin6.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version6, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
builtin.RegisterActorState(builtin7.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version7, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
builtin.RegisterActorState(builtin8.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version8, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
}
var Methods = builtin8.MethodsMiner
@ -95,6 +144,42 @@ var DeclarationsMax = miner2.DeclarationsMax
var AddressedSectorsMax = miner2.AddressedSectorsMax
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != "storageminer" {
return nil, xerrors.Errorf("actor code is not storageminer: %s", name)
}
switch av {
case actors.Version0:
return load0(store, act.Head)
case actors.Version2:
return load2(store, act.Head)
case actors.Version3:
return load3(store, act.Head)
case actors.Version4:
return load4(store, act.Head)
case actors.Version5:
return load5(store, act.Head)
case actors.Version6:
return load6(store, act.Head)
case actors.Version7:
return load7(store, act.Head)
case actors.Version8:
return load8(store, act.Head)
default:
return nil, xerrors.Errorf("unknown actor version: %d", av)
}
}
switch act.Code {
case builtin0.StorageMinerActorCodeID:
@ -121,7 +206,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case builtin8.StorageMinerActorCodeID:
return load8(store, act.Head)
}
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
@ -152,11 +237,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
case actors.Version8:
return make8(store)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "storageminer"); ok {
return c, nil
}
switch av {
case actors.Version0:

View File

@ -18,6 +18,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)
@ -135,10 +136,10 @@ func (s *state0) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will either expire on-time (can be
// 1. If the sector is non-faulty, it will either expire on-time (can be
// learned from the sector info), or in the next quantized expiration
// epoch (i.e., the first element in the partition's expiration queue.
// 2. If it's faulty, it will expire early within the first 14 entries
// 2. If it's faulty, it will expire early within the first 14 entries
// of the expiration queue.
stopErr := errors.New("stop")
@ -209,7 +210,7 @@ func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
}
func (s *state0) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt0.AsMap(s.store, s.State.PreCommittedSectors)
precommitted, err := adt0.AsMap(s.store, s.State.PreCommittedSectors)
if err != nil {
return err
}
@ -288,7 +289,7 @@ func (s *state0) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
allocatedRuns,
)
if err != nil {
@ -518,6 +519,7 @@ func fromV0SectorOnChainInfo(v0 miner0.SectorOnChainInfo) SectorOnChainInfo {
InitialPledge: v0.InitialPledge,
ExpectedDayReward: v0.ExpectedDayReward,
ExpectedStoragePledge: v0.ExpectedStoragePledge,
}
return info
}

View File

@ -16,6 +16,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
@ -133,10 +134,10 @@ func (s *state2) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will either expire on-time (can be
// 1. If the sector is non-faulty, it will either expire on-time (can be
// learned from the sector info), or in the next quantized expiration
// epoch (i.e., the first element in the partition's expiration queue.
// 2. If it's faulty, it will expire early within the first 14 entries
// 2. If it's faulty, it will expire early within the first 14 entries
// of the expiration queue.
stopErr := errors.New("stop")
@ -207,7 +208,7 @@ func (s *state2) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
}
func (s *state2) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt2.AsMap(s.store, s.State.PreCommittedSectors)
precommitted, err := adt2.AsMap(s.store, s.State.PreCommittedSectors)
if err != nil {
return err
}
@ -286,7 +287,7 @@ func (s *state2) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
allocatedRuns,
)
if err != nil {
@ -548,6 +549,7 @@ func fromV2SectorOnChainInfo(v2 miner2.SectorOnChainInfo) SectorOnChainInfo {
InitialPledge: v2.InitialPledge,
ExpectedDayReward: v2.ExpectedDayReward,
ExpectedStoragePledge: v2.ExpectedStoragePledge,
}
return info
}

View File

@ -16,6 +16,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
@ -135,10 +136,10 @@ func (s *state3) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will either expire on-time (can be
// 1. If the sector is non-faulty, it will either expire on-time (can be
// learned from the sector info), or in the next quantized expiration
// epoch (i.e., the first element in the partition's expiration queue.
// 2. If it's faulty, it will expire early within the first 14 entries
// 2. If it's faulty, it will expire early within the first 14 entries
// of the expiration queue.
stopErr := errors.New("stop")
@ -209,7 +210,7 @@ func (s *state3) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
}
func (s *state3) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt3.AsMap(s.store, s.State.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
precommitted, err := adt3.AsMap(s.store, s.State.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
if err != nil {
return err
}
@ -288,7 +289,7 @@ func (s *state3) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
allocatedRuns,
)
if err != nil {
@ -549,6 +550,7 @@ func fromV3SectorOnChainInfo(v3 miner3.SectorOnChainInfo) SectorOnChainInfo {
InitialPledge: v3.InitialPledge,
ExpectedDayReward: v3.ExpectedDayReward,
ExpectedStoragePledge: v3.ExpectedStoragePledge,
}
return info
}

View File

@ -16,6 +16,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
@ -135,10 +136,10 @@ func (s *state4) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will either expire on-time (can be
// 1. If the sector is non-faulty, it will either expire on-time (can be
// learned from the sector info), or in the next quantized expiration
// epoch (i.e., the first element in the partition's expiration queue.
// 2. If it's faulty, it will expire early within the first 14 entries
// 2. If it's faulty, it will expire early within the first 14 entries
// of the expiration queue.
stopErr := errors.New("stop")
@ -209,7 +210,7 @@ func (s *state4) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
}
func (s *state4) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt4.AsMap(s.store, s.State.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
precommitted, err := adt4.AsMap(s.store, s.State.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
if err != nil {
return err
}
@ -288,7 +289,7 @@ func (s *state4) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
allocatedRuns,
)
if err != nil {
@ -549,6 +550,7 @@ func fromV4SectorOnChainInfo(v4 miner4.SectorOnChainInfo) SectorOnChainInfo {
InitialPledge: v4.InitialPledge,
ExpectedDayReward: v4.ExpectedDayReward,
ExpectedStoragePledge: v4.ExpectedStoragePledge,
}
return info
}

View File

@ -16,6 +16,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
@ -135,10 +136,10 @@ func (s *state5) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will either expire on-time (can be
// 1. If the sector is non-faulty, it will either expire on-time (can be
// learned from the sector info), or in the next quantized expiration
// epoch (i.e., the first element in the partition's expiration queue.
// 2. If it's faulty, it will expire early within the first 14 entries
// 2. If it's faulty, it will expire early within the first 14 entries
// of the expiration queue.
stopErr := errors.New("stop")
@ -209,7 +210,7 @@ func (s *state5) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
}
func (s *state5) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt5.AsMap(s.store, s.State.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
precommitted, err := adt5.AsMap(s.store, s.State.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
if err != nil {
return err
}
@ -288,7 +289,7 @@ func (s *state5) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
allocatedRuns,
)
if err != nil {
@ -549,6 +550,7 @@ func fromV5SectorOnChainInfo(v5 miner5.SectorOnChainInfo) SectorOnChainInfo {
InitialPledge: v5.InitialPledge,
ExpectedDayReward: v5.ExpectedDayReward,
ExpectedStoragePledge: v5.ExpectedStoragePledge,
}
return info
}

View File

@ -16,6 +16,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
@ -135,10 +136,10 @@ func (s *state6) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will either expire on-time (can be
// 1. If the sector is non-faulty, it will either expire on-time (can be
// learned from the sector info), or in the next quantized expiration
// epoch (i.e., the first element in the partition's expiration queue.
// 2. If it's faulty, it will expire early within the first 42 entries
// 2. If it's faulty, it will expire early within the first 42 entries
// of the expiration queue.
stopErr := errors.New("stop")
@ -209,7 +210,7 @@ func (s *state6) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
}
func (s *state6) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt6.AsMap(s.store, s.State.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
precommitted, err := adt6.AsMap(s.store, s.State.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
if err != nil {
return err
}
@ -288,7 +289,7 @@ func (s *state6) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
allocatedRuns,
)
if err != nil {
@ -549,6 +550,7 @@ func fromV6SectorOnChainInfo(v6 miner6.SectorOnChainInfo) SectorOnChainInfo {
InitialPledge: v6.InitialPledge,
ExpectedDayReward: v6.ExpectedDayReward,
ExpectedStoragePledge: v6.ExpectedStoragePledge,
}
return info
}

View File

@ -16,6 +16,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
@ -135,9 +136,9 @@ func (s *state7) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will expire on-time (can be
// 1. If the sector is non-faulty, it will expire on-time (can be
// learned from the sector info).
// 2. If it's faulty, it will expire early within the first 42 entries
// 2. If it's faulty, it will expire early within the first 42 entries
// of the expiration queue.
stopErr := errors.New("stop")
@ -208,7 +209,7 @@ func (s *state7) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
}
func (s *state7) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt7.AsMap(s.store, s.State.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
precommitted, err := adt7.AsMap(s.store, s.State.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
if err != nil {
return err
}
@ -287,7 +288,7 @@ func (s *state7) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
allocatedRuns,
)
if err != nil {
@ -550,6 +551,7 @@ func fromV7SectorOnChainInfo(v7 miner7.SectorOnChainInfo) SectorOnChainInfo {
ExpectedStoragePledge: v7.ExpectedStoragePledge,
SectorKeyCID: v7.SectorKeyCID,
}
return info
}

View File

@ -16,6 +16,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
miner8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/miner"
@ -135,9 +136,9 @@ func (s *state8) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will expire on-time (can be
// 1. If the sector is non-faulty, it will expire on-time (can be
// learned from the sector info).
// 2. If it's faulty, it will expire early within the first 42 entries
// 2. If it's faulty, it will expire early within the first 42 entries
// of the expiration queue.
stopErr := errors.New("stop")
@ -208,7 +209,7 @@ func (s *state8) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
}
func (s *state8) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt8.AsMap(s.store, s.State.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
precommitted, err := adt8.AsMap(s.store, s.State.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
if err != nil {
return err
}
@ -287,7 +288,7 @@ func (s *state8) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
allocatedRuns,
)
if err != nil {
@ -550,6 +551,7 @@ func fromV8SectorOnChainInfo(v8 miner8.SectorOnChainInfo) SectorOnChainInfo {
ExpectedStoragePledge: v8.ExpectedStoragePledge,
SectorKeyCID: v8.SectorKeyCID,
}
return info
}

View File

@ -73,6 +73,8 @@ func (m message0) Create(
}, nil
}
func (m message0) Propose(msig, to address.Address, amt abi.TokenAmount,
method abi.MethodNum, params []byte) (*types.Message, error) {
@ -140,3 +142,4 @@ func (m message0) Cancel(msig address.Address, txID uint64, hashData *ProposalHa
Params: enc,
}, nil
}

View File

@ -69,3 +69,5 @@ func (m message2) Create(
Value: initialAmount,
}, nil
}

View File

@ -69,3 +69,5 @@ func (m message3) Create(
Value: initialAmount,
}, nil
}

View File

@ -69,3 +69,5 @@ func (m message4) Create(
Value: initialAmount,
}, nil
}

View File

@ -69,3 +69,5 @@ func (m message5) Create(
Value: initialAmount,
}, nil
}

View File

@ -69,3 +69,5 @@ func (m message6) Create(
Value: initialAmount,
}, nil
}

View File

@ -69,3 +69,5 @@ func (m message7) Create(
Value: initialAmount,
}, nil
}

View File

@ -69,3 +69,5 @@ func (m message8) Create(
Value: initialAmount,
}, nil
}

View File

@ -31,6 +31,7 @@ import (
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
@ -43,36 +44,120 @@ func init() {
return load0(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version0, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
builtin.RegisterActorState(builtin2.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version2, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
builtin.RegisterActorState(builtin3.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version3, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
builtin.RegisterActorState(builtin4.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version4, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
builtin.RegisterActorState(builtin5.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version5, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
builtin.RegisterActorState(builtin6.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version6, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
builtin.RegisterActorState(builtin7.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version7, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
builtin.RegisterActorState(builtin8.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version8, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
}
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != "multisig" {
return nil, xerrors.Errorf("actor code is not multisig: %s", name)
}
switch av {
case actors.Version0:
return load0(store, act.Head)
case actors.Version2:
return load2(store, act.Head)
case actors.Version3:
return load3(store, act.Head)
case actors.Version4:
return load4(store, act.Head)
case actors.Version5:
return load5(store, act.Head)
case actors.Version6:
return load6(store, act.Head)
case actors.Version7:
return load7(store, act.Head)
case actors.Version8:
return load8(store, act.Head)
default:
return nil, xerrors.Errorf("unknown actor version: %d", av)
}
}
switch act.Code {
case builtin0.MultisigActorCodeID:
@ -130,11 +215,15 @@ func MakeState(store adt.Store, av actors.Version, signers []address.Address, th
case actors.Version8:
return make8(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "multisig"); ok {
return c, nil
}
switch av {
case actors.Version0:

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
)

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
)

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
msig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig"

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
msig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig"

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig"

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig"

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
msig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig"

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
msig8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/multisig"

View File

@ -31,6 +31,7 @@ import (
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
@ -43,37 +44,121 @@ func init() {
return load0(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version0, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
builtin.RegisterActorState(builtin2.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version2, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
builtin.RegisterActorState(builtin3.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version3, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
builtin.RegisterActorState(builtin4.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version4, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
builtin.RegisterActorState(builtin5.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version5, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
builtin.RegisterActorState(builtin6.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version6, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
builtin.RegisterActorState(builtin7.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version7, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
builtin.RegisterActorState(builtin8.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version8, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
}
// Load returns an abstract copy of payment channel state, irregardless of actor version
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != "paymentchannel" {
return nil, xerrors.Errorf("actor code is not paymentchannel: %s", name)
}
switch av {
case actors.Version0:
return load0(store, act.Head)
case actors.Version2:
return load2(store, act.Head)
case actors.Version3:
return load3(store, act.Head)
case actors.Version4:
return load4(store, act.Head)
case actors.Version5:
return load5(store, act.Head)
case actors.Version6:
return load6(store, act.Head)
case actors.Version7:
return load7(store, act.Head)
case actors.Version8:
return load8(store, act.Head)
default:
return nil, xerrors.Errorf("unknown actor version: %d", av)
}
}
switch act.Code {
case builtin0.PaymentChannelActorCodeID:
@ -131,11 +216,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
case actors.Version8:
return make8(store)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "paymentchannel"); ok {
return c, nil
}
switch av {
case actors.Version0:

View File

@ -112,3 +112,4 @@ func (ls *laneState0) Redeemed() (big.Int, error) {
func (ls *laneState0) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}

View File

@ -112,3 +112,4 @@ func (ls *laneState2) Redeemed() (big.Int, error) {
func (ls *laneState2) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}

View File

@ -112,3 +112,4 @@ func (ls *laneState3) Redeemed() (big.Int, error) {
func (ls *laneState3) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}

View File

@ -112,3 +112,4 @@ func (ls *laneState4) Redeemed() (big.Int, error) {
func (ls *laneState4) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}

View File

@ -112,3 +112,4 @@ func (ls *laneState5) Redeemed() (big.Int, error) {
func (ls *laneState5) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}

View File

@ -112,3 +112,4 @@ func (ls *laneState6) Redeemed() (big.Int, error) {
func (ls *laneState6) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}

View File

@ -113,6 +113,7 @@ func (ls *laneState7) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}
func toV7SignedVoucher(sv SignedVoucher) paych7.SignedVoucher {
return paych7.SignedVoucher{
ChannelAddr: sv.ChannelAddr,

View File

@ -113,6 +113,7 @@ func (ls *laneState8) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}
func toV8SignedVoucher(sv SignedVoucher) paych8.SignedVoucher {
return paych8.SignedVoucher{
ChannelAddr: sv.ChannelAddr,

View File

@ -30,6 +30,7 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
func init() {
@ -38,33 +39,81 @@ func init() {
return load0(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version0, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
builtin.RegisterActorState(builtin2.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version2, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
builtin.RegisterActorState(builtin3.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version3, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
builtin.RegisterActorState(builtin4.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version4, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
builtin.RegisterActorState(builtin5.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version5, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
builtin.RegisterActorState(builtin6.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version6, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
builtin.RegisterActorState(builtin7.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version7, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
builtin.RegisterActorState(builtin8.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version8, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
}
var (
@ -73,6 +122,42 @@ var (
)
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != "storagepower" {
return nil, xerrors.Errorf("actor code is not storagepower: %s", name)
}
switch av {
case actors.Version0:
return load0(store, act.Head)
case actors.Version2:
return load2(store, act.Head)
case actors.Version3:
return load3(store, act.Head)
case actors.Version4:
return load4(store, act.Head)
case actors.Version5:
return load5(store, act.Head)
case actors.Version6:
return load6(store, act.Head)
case actors.Version7:
return load7(store, act.Head)
case actors.Version8:
return load8(store, act.Head)
default:
return nil, xerrors.Errorf("unknown actor version: %d", av)
}
}
switch act.Code {
case builtin0.StoragePowerActorCodeID:
@ -130,11 +215,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
case actors.Version8:
return make8(store)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "storagepower"); ok {
return c, nil
}
switch av {
case actors.Version0:

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)
@ -41,6 +42,7 @@ func make0(store adt.Store) (State, error) {
out.State = *power0.ConstructState(em, emm)
return &out, nil
}

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
@ -41,6 +42,7 @@ func make2(store adt.Store) (State, error) {
out.State = *power2.ConstructState(em, emm)
return &out, nil
}

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
power3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/power"
@ -38,6 +39,7 @@ func make3(store adt.Store) (State, error) {
out.State = *s
return &out, nil
}

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
power4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/power"
@ -38,6 +39,7 @@ func make4(store adt.Store) (State, error) {
out.State = *s
return &out, nil
}

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
power5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/power"
@ -38,6 +39,7 @@ func make5(store adt.Store) (State, error) {
out.State = *s
return &out, nil
}

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
power6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/power"
@ -38,6 +39,7 @@ func make6(store adt.Store) (State, error) {
out.State = *s
return &out, nil
}

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power"
@ -38,6 +39,7 @@ func make7(store adt.Store) (State, error) {
out.State = *s
return &out, nil
}

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
power8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/power"
@ -38,6 +39,7 @@ func make8(store adt.Store) (State, error) {
out.State = *s
return &out, nil
}

View File

@ -2,9 +2,9 @@ package reward
import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors"
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/cbor"
@ -25,6 +25,7 @@ import (
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
@ -36,33 +37,81 @@ func init() {
return load0(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version0, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
builtin.RegisterActorState(builtin2.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version2, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
builtin.RegisterActorState(builtin3.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version3, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
builtin.RegisterActorState(builtin4.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version4, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
builtin.RegisterActorState(builtin5.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version5, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
builtin.RegisterActorState(builtin6.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version6, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
builtin.RegisterActorState(builtin7.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version7, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
builtin.RegisterActorState(builtin8.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version8, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
}
var (
@ -71,6 +120,42 @@ var (
)
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != "reward" {
return nil, xerrors.Errorf("actor code is not reward: %s", name)
}
switch av {
case actors.Version0:
return load0(store, act.Head)
case actors.Version2:
return load2(store, act.Head)
case actors.Version3:
return load3(store, act.Head)
case actors.Version4:
return load4(store, act.Head)
case actors.Version5:
return load5(store, act.Head)
case actors.Version6:
return load6(store, act.Head)
case actors.Version7:
return load7(store, act.Head)
case actors.Version8:
return load8(store, act.Head)
default:
return nil, xerrors.Errorf("unknown actor version: %d", av)
}
}
switch act.Code {
case builtin0.RewardActorCodeID:
@ -128,11 +213,15 @@ func MakeState(store adt.Store, av actors.Version, currRealizedPower abi.Storage
case actors.Version8:
return make8(store, currRealizedPower)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "reward"); ok {
return c, nil
}
switch av {
case actors.Version0:

View File

@ -1,10 +1,11 @@
package system
import (
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors"
"golang.org/x/xerrors"
"github.com/ipfs/go-cid"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
@ -21,6 +22,7 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
var (
@ -54,11 +56,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
case actors.Version8:
return make8(store)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "system"); ok {
return c, nil
}
switch av {
case actors.Version0:

View File

@ -25,9 +25,10 @@ import (
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
verifreg8 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
)
@ -38,34 +39,82 @@ func init() {
return load0(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version0, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
builtin.RegisterActorState(builtin2.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version2, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
builtin.RegisterActorState(builtin3.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version3, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
builtin.RegisterActorState(builtin4.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version4, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
builtin.RegisterActorState(builtin5.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version5, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
builtin.RegisterActorState(builtin6.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version6, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
builtin.RegisterActorState(builtin7.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version7, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
builtin.RegisterActorState(builtin8.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
if c, ok := actors.GetActorCodeID(actors.Version8, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
}
var (
@ -74,6 +123,42 @@ var (
)
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != "verifiedregistry" {
return nil, xerrors.Errorf("actor code is not verifiedregistry: %s", name)
}
switch av {
case actors.Version0:
return load0(store, act.Head)
case actors.Version2:
return load2(store, act.Head)
case actors.Version3:
return load3(store, act.Head)
case actors.Version4:
return load4(store, act.Head)
case actors.Version5:
return load5(store, act.Head)
case actors.Version6:
return load6(store, act.Head)
case actors.Version7:
return load7(store, act.Head)
case actors.Version8:
return load8(store, act.Head)
default:
return nil, xerrors.Errorf("unknown actor version: %d", av)
}
}
switch act.Code {
case builtin0.VerifiedRegistryActorCodeID:
@ -131,11 +216,15 @@ func MakeState(store adt.Store, av actors.Version, rootKeyAddress address.Addres
case actors.Version8:
return make8(store, rootKeyAddress)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
if c, ok := actors.GetActorCodeID(av, "verifiedregistry"); ok {
return c, nil
}
switch av {
case actors.Version0:
@ -171,7 +260,6 @@ type RemoveDataCapProposal = verifreg8.RemoveDataCapProposal
type RemoveDataCapRequest = verifreg8.RemoveDataCapRequest
type RemoveDataCapParams = verifreg8.RemoveDataCapParams
type RmDcProposalID = verifreg8.RmDcProposalID
const SignatureDomainSeparation_RemoveDataCap = verifreg8.SignatureDomainSeparation_RemoveDataCap
type State interface {

View File

@ -10,46 +10,56 @@ import (
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market"
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market"
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
verifreg4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/verifreg"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
verifreg5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/verifreg"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market"
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
verifreg6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/verifreg"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
verifreg7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
miner8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/miner"
verifreg8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/verifreg"
paych8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/paych"
)
@ -64,28 +74,45 @@ const (
// This should only be used for testing.
func SetSupportedProofTypes(types ...abi.RegisteredSealProof) {
miner0.SupportedProofTypes = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner2.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner2.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
miner2.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner3.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner3.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
miner3.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner4.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner4.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
miner4.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner5.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner6.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner7.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
miner8.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
AddSupportedProofTypes(types...)
}
@ -98,23 +125,33 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
}
// Set for all miner versions.
miner0.SupportedProofTypes[t] = struct{}{}
miner2.PreCommitSealProofTypesV0[t] = struct{}{}
miner2.PreCommitSealProofTypesV7[t] = struct{}{}
miner2.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
miner2.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
miner3.PreCommitSealProofTypesV0[t] = struct{}{}
miner3.PreCommitSealProofTypesV7[t] = struct{}{}
miner3.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
miner3.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
miner4.PreCommitSealProofTypesV0[t] = struct{}{}
miner4.PreCommitSealProofTypesV7[t] = struct{}{}
miner4.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
miner4.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
miner5.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
wpp, err := t.RegisteredWindowPoStProof()
if err != nil {
@ -124,6 +161,8 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
miner5.WindowPoStProofTypes[wpp] = struct{}{}
miner6.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
wpp, err = t.RegisteredWindowPoStProof()
if err != nil {
@ -133,6 +172,8 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
miner6.WindowPoStProofTypes[wpp] = struct{}{}
miner7.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
wpp, err = t.RegisteredWindowPoStProof()
if err != nil {
@ -142,6 +183,8 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
miner7.WindowPoStProofTypes[wpp] = struct{}{}
miner8.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
wpp, err = t.RegisteredWindowPoStProof()
if err != nil {
@ -151,6 +194,7 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
miner8.WindowPoStProofTypes[wpp] = struct{}{}
}
}
@ -187,36 +231,52 @@ func GetPreCommitChallengeDelay() abi.ChainEpoch {
// for testing.
func SetConsensusMinerMinPower(p abi.StoragePower) {
power0.ConsensusMinerMinPower = p
for _, policy := range builtin2.SealProofPolicies {
policy.ConsensusMinerMinPower = p
}
for _, policy := range builtin3.PoStProofPolicies {
policy.ConsensusMinerMinPower = p
}
for _, policy := range builtin4.PoStProofPolicies {
policy.ConsensusMinerMinPower = p
}
for _, policy := range builtin5.PoStProofPolicies {
policy.ConsensusMinerMinPower = p
}
for _, policy := range builtin6.PoStProofPolicies {
policy.ConsensusMinerMinPower = p
}
for _, policy := range builtin7.PoStProofPolicies {
policy.ConsensusMinerMinPower = p
}
for _, policy := range builtin8.PoStProofPolicies {
policy.ConsensusMinerMinPower = p
}
}
// SetMinVerifiedDealSize sets the minimum size of a verified deal. This should
@ -248,34 +308,42 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) (a
return miner0.MaxSealDuration[t], nil
case actors.Version2:
return miner2.MaxProveCommitDuration[t], nil
case actors.Version3:
return miner3.MaxProveCommitDuration[t], nil
case actors.Version4:
return miner4.MaxProveCommitDuration[t], nil
case actors.Version5:
return miner5.MaxProveCommitDuration[t], nil
case actors.Version6:
return miner6.MaxProveCommitDuration[t], nil
case actors.Version7:
return miner7.MaxProveCommitDuration[t], nil
case actors.Version8:
return miner8.MaxProveCommitDuration[t], nil
default:
return 0, xerrors.Errorf("unsupported actors version")
}
@ -286,41 +354,57 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) (a
// only be used for testing.
func SetProviderCollateralSupplyTarget(num, denom big.Int) {
market2.ProviderCollateralSupplyTarget = builtin2.BigFrac{
Numerator: num,
Denominator: denom,
}
market3.ProviderCollateralSupplyTarget = builtin3.BigFrac{
Numerator: num,
Denominator: denom,
}
market4.ProviderCollateralSupplyTarget = builtin4.BigFrac{
Numerator: num,
Denominator: denom,
}
market5.ProviderCollateralSupplyTarget = builtin5.BigFrac{
Numerator: num,
Denominator: denom,
}
market6.ProviderCollateralSupplyTarget = builtin6.BigFrac{
Numerator: num,
Denominator: denom,
}
market7.ProviderCollateralSupplyTarget = builtin7.BigFrac{
Numerator: num,
Denominator: denom,
}
market8.ProviderCollateralSupplyTarget = builtin8.BigFrac{
Numerator: num,
Denominator: denom,
}
}
func DealProviderCollateralBounds(
@ -339,41 +423,49 @@ func DealProviderCollateralBounds(
min, max := market0.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil, nwVer)
return min, max, nil
case actors.Version2:
min, max := market2.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
return min, max, nil
case actors.Version3:
min, max := market3.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
return min, max, nil
case actors.Version4:
min, max := market4.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
return min, max, nil
case actors.Version5:
min, max := market5.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
return min, max, nil
case actors.Version6:
min, max := market6.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
return min, max, nil
case actors.Version7:
min, max := market7.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
return min, max, nil
case actors.Version8:
min, max := market8.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
return min, max, nil
default:
return big.Zero(), big.Zero(), xerrors.Errorf("unsupported actors version")
}
@ -390,9 +482,11 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
miner0.WPoStChallengeWindow = period
miner0.WPoStProvingPeriod = period * abi.ChainEpoch(miner0.WPoStPeriodDeadlines)
miner2.WPoStChallengeWindow = period
miner2.WPoStProvingPeriod = period * abi.ChainEpoch(miner2.WPoStPeriodDeadlines)
miner3.WPoStChallengeWindow = period
miner3.WPoStProvingPeriod = period * abi.ChainEpoch(miner3.WPoStPeriodDeadlines)
@ -400,6 +494,7 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
// scale it if we're scaling the challenge period.
miner3.WPoStDisputeWindow = period * 30
miner4.WPoStChallengeWindow = period
miner4.WPoStProvingPeriod = period * abi.ChainEpoch(miner4.WPoStPeriodDeadlines)
@ -407,6 +502,7 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
// scale it if we're scaling the challenge period.
miner4.WPoStDisputeWindow = period * 30
miner5.WPoStChallengeWindow = period
miner5.WPoStProvingPeriod = period * abi.ChainEpoch(miner5.WPoStPeriodDeadlines)
@ -414,6 +510,7 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
// scale it if we're scaling the challenge period.
miner5.WPoStDisputeWindow = period * 30
miner6.WPoStChallengeWindow = period
miner6.WPoStProvingPeriod = period * abi.ChainEpoch(miner6.WPoStPeriodDeadlines)
@ -421,6 +518,7 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
// scale it if we're scaling the challenge period.
miner6.WPoStDisputeWindow = period * 30
miner7.WPoStChallengeWindow = period
miner7.WPoStProvingPeriod = period * abi.ChainEpoch(miner7.WPoStPeriodDeadlines)
@ -428,6 +526,7 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
// scale it if we're scaling the challenge period.
miner7.WPoStDisputeWindow = period * 30
miner8.WPoStChallengeWindow = period
miner8.WPoStProvingPeriod = period * abi.ChainEpoch(miner8.WPoStPeriodDeadlines)
@ -435,6 +534,7 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
// scale it if we're scaling the challenge period.
miner8.WPoStDisputeWindow = period * 30
}
func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
@ -545,34 +645,42 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
// TODO: Should we instead error here since the concept doesn't exist yet?
return miner0.AddressedPartitionsMax, nil
case actors.Version2:
return miner2.DeclarationsMax, nil
case actors.Version3:
return miner3.DeclarationsMax, nil
case actors.Version4:
return miner4.DeclarationsMax, nil
case actors.Version5:
return miner5.DeclarationsMax, nil
case actors.Version6:
return miner6.DeclarationsMax, nil
case actors.Version7:
return miner7.DeclarationsMax, nil
case actors.Version8:
return miner8.DeclarationsMax, nil
default:
return 0, xerrors.Errorf("unsupported network version")
}
@ -589,34 +697,42 @@ func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, ba
return big.Zero(), nil
case actors.Version2:
return big.Zero(), nil
case actors.Version3:
return big.Zero(), nil
case actors.Version4:
return big.Zero(), nil
case actors.Version5:
return miner5.AggregateNetworkFee(aggregateSize, baseFee), nil
case actors.Version6:
return miner6.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actors.Version7:
return miner7.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actors.Version8:
return miner8.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
default:
return big.Zero(), xerrors.Errorf("unsupported network version")
}
@ -633,34 +749,42 @@ func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, base
return big.Zero(), nil
case actors.Version2:
return big.Zero(), nil
case actors.Version3:
return big.Zero(), nil
case actors.Version4:
return big.Zero(), nil
case actors.Version5:
return big.Zero(), nil
case actors.Version6:
return miner6.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
case actors.Version7:
return miner7.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
case actors.Version8:
return miner8.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
default:
return big.Zero(), xerrors.Errorf("unsupported network version")
}