rerun agen to gofmt

This commit is contained in:
vyzo 2022-04-04 14:30:42 +03:00
parent efa57bbd1f
commit 7712fc044e
11 changed files with 443 additions and 455 deletions

View File

@ -27,7 +27,6 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
func init() {
@ -37,7 +36,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version0, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
@ -47,7 +46,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version2, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
@ -57,7 +56,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version3, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
@ -67,7 +66,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version4, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
@ -77,7 +76,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version5, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
@ -87,7 +86,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version6, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
@ -97,7 +96,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version7, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
@ -107,7 +106,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version8, "account"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
@ -117,39 +116,39 @@ 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)
}
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 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 {
@ -209,14 +208,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "account"); ok {
return c, nil
}
switch av {

View File

@ -3,8 +3,8 @@ package cron
import (
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"golang.org/x/xerrors"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
@ -21,7 +21,6 @@ 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) {
@ -51,14 +50,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "cron"); ok {
return c, nil
}
switch av {
@ -96,7 +95,6 @@ var (
Methods = builtin8.MethodsCron
)
type State interface {
GetState() interface{}
}

View File

@ -29,7 +29,6 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
func init() {
@ -39,7 +38,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version0, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
@ -49,7 +48,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version2, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
@ -59,7 +58,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version3, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
@ -69,7 +68,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version4, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
@ -79,7 +78,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version5, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
@ -89,7 +88,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version6, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
@ -99,7 +98,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version7, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
@ -109,7 +108,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version8, "init"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
@ -122,39 +121,39 @@ 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)
}
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 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 {
@ -214,14 +213,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "init"); ok {
return c, nil
}
switch av {

View File

@ -29,9 +29,8 @@ 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"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
)
@ -43,7 +42,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version0, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
@ -53,7 +52,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version2, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
@ -63,7 +62,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version3, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
@ -73,7 +72,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version4, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
@ -83,7 +82,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version5, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
@ -93,7 +92,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version6, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
@ -103,7 +102,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version7, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
@ -113,7 +112,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version8, "storagemarket"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
@ -126,39 +125,39 @@ 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)
}
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 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 {
@ -218,14 +217,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "storagemarket"); ok {
return c, nil
}
switch av {
@ -299,7 +298,7 @@ type DealProposals interface {
type PublishStorageDealsParams = market0.PublishStorageDealsParams
type PublishStorageDealsReturn interface {
DealIDs() ([]abi.DealID, error)
DealIDs() ([]abi.DealID, error)
// Note that this index is based on the batch of deals that were published, NOT the DealID
IsDealValid(index uint64) (bool, error)
}
@ -336,7 +335,7 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
case actors.Version8:
return decodePublishStorageDealsReturn8(b)
}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -352,67 +351,67 @@ type DealState struct {
}
type DealProposal struct {
PieceCID cid.Cid
PieceSize abi.PaddedPieceSize
VerifiedDeal bool
Client address.Address
Provider address.Address
Label string
StartEpoch abi.ChainEpoch
EndEpoch abi.ChainEpoch
PieceCID cid.Cid
PieceSize abi.PaddedPieceSize
VerifiedDeal bool
Client address.Address
Provider address.Address
Label string
StartEpoch abi.ChainEpoch
EndEpoch abi.ChainEpoch
StoragePricePerEpoch abi.TokenAmount
ProviderCollateral abi.TokenAmount
ClientCollateral abi.TokenAmount
ProviderCollateral abi.TokenAmount
ClientCollateral abi.TokenAmount
}
type DealStateChanges struct {
Added []DealIDState
Added []DealIDState
Modified []DealStateChange
Removed []DealIDState
Removed []DealIDState
}
type DealIDState struct {
ID abi.DealID
ID abi.DealID
Deal DealState
}
// DealStateChange is a change in deal state from -> to
type DealStateChange struct {
ID abi.DealID
ID abi.DealID
From *DealState
To *DealState
To *DealState
}
type DealProposalChanges struct {
Added []ProposalIDState
Added []ProposalIDState
Removed []ProposalIDState
}
type ProposalIDState struct {
ID abi.DealID
ID abi.DealID
Proposal DealProposal
}
func EmptyDealState() *DealState {
return &DealState{
SectorStartEpoch: -1,
SlashEpoch: -1,
SlashEpoch: -1,
LastUpdatedEpoch: -1,
}
}
// returns the earned fees and pending fees for a given deal
func (deal DealProposal) GetDealFees(height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
if ef.LessThan(big.Zero()) {
ef = big.Zero()
}
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
if ef.LessThan(big.Zero()) {
ef = big.Zero()
}
if ef.GreaterThan(tf) {
ef = tf
}
if ef.GreaterThan(tf) {
ef = tf
}
return ef, big.Sub(tf, ef)
return ef, big.Sub(tf, ef)
}

View File

@ -40,7 +40,6 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
func init() {
@ -50,7 +49,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version0, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
@ -60,7 +59,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version2, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
@ -70,7 +69,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version3, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
@ -80,7 +79,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version4, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
@ -90,7 +89,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version5, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
@ -100,7 +99,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version6, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
@ -110,7 +109,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version7, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
@ -120,7 +119,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version8, "storageminer"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
@ -145,39 +144,39 @@ 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)
}
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 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 {
@ -206,7 +205,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)
}
@ -237,14 +236,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "storageminer"); ok {
return c, nil
}
switch av {
@ -296,8 +295,8 @@ type State interface {
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
NumLiveSectors() (uint64, error)
IsAllocated(abi.SectorNumber) (bool, error)
// UnallocatedSectorNumbers returns up to count unallocated sector numbers (or less than
// count if there aren't enough).
// UnallocatedSectorNumbers returns up to count unallocated sector numbers (or less than
// count if there aren't enough).
UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
GetAllocatedSectors() (*bitfield.BitField, error)

View File

@ -31,7 +31,6 @@ 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"
@ -45,7 +44,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version0, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
@ -55,7 +54,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version2, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
@ -65,7 +64,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version3, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
@ -75,7 +74,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version4, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
@ -85,7 +84,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version5, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
@ -95,7 +94,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version6, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
@ -105,7 +104,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version7, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
@ -115,7 +114,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version8, "multisig"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
@ -123,39 +122,39 @@ func init() {
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)
}
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 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 {
@ -215,14 +214,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "multisig"); ok {
return c, nil
}
switch av {

View File

@ -31,7 +31,6 @@ 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"
@ -45,7 +44,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version0, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
@ -55,7 +54,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version2, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
@ -65,7 +64,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version3, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
@ -75,7 +74,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version4, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
@ -85,7 +84,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version5, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
@ -95,7 +94,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version6, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
@ -105,7 +104,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version7, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
@ -115,7 +114,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version8, "paymentchannel"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
@ -124,39 +123,39 @@ func init() {
// 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)
}
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 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 {
@ -216,14 +215,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "paymentchannel"); ok {
return c, nil
}
switch av {

View File

@ -30,7 +30,6 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
func init() {
@ -40,7 +39,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version0, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
@ -50,7 +49,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version2, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
@ -60,7 +59,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version3, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
@ -70,7 +69,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version4, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
@ -80,7 +79,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version5, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
@ -90,7 +89,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version6, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
@ -100,7 +99,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version7, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
@ -110,7 +109,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version8, "storagepower"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
@ -123,39 +122,39 @@ 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)
}
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 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 {
@ -215,14 +214,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "storagepower"); ok {
return c, nil
}
switch av {

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,7 +25,6 @@ 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"
@ -38,7 +37,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version0, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
@ -48,7 +47,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version2, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
@ -58,7 +57,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version3, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
@ -68,7 +67,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version4, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
@ -78,7 +77,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version5, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
@ -88,7 +87,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version6, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
@ -98,7 +97,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version7, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
@ -108,7 +107,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version8, "reward"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
@ -121,39 +120,39 @@ 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)
}
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 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 {
@ -213,14 +212,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "reward"); ok {
return c, nil
}
switch av {

View File

@ -1,11 +1,10 @@
package system
import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
@ -22,7 +21,6 @@ import (
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
)
var (
@ -56,14 +54,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "system"); ok {
return c, nil
}
switch av {

View File

@ -25,10 +25,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/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"
)
@ -40,7 +39,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version0, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
}
@ -50,7 +49,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version2, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
@ -60,7 +59,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version3, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load3(store, root)
})
}
@ -70,7 +69,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version4, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})
}
@ -80,7 +79,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version5, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}
@ -90,7 +89,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version6, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load6(store, root)
})
}
@ -100,7 +99,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version7, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load7(store, root)
})
}
@ -110,7 +109,7 @@ func init() {
})
if c, ok := actors.GetActorCodeID(actors.Version8, "verifiedregistry"); ok {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load8(store, root)
})
}
@ -124,39 +123,39 @@ 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)
}
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 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 {
@ -216,14 +215,14 @@ 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
}
if c, ok := actors.GetActorCodeID(av, "verifiedregistry"); ok {
return c, nil
}
switch av {
@ -260,6 +259,7 @@ 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 {