Skip to content

Commit

Permalink
Drop actor keys from chain/actors/manifest.go
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-vball committed Dec 13, 2022
1 parent f3830b6 commit ae4010f
Show file tree
Hide file tree
Showing 176 changed files with 410 additions and 281 deletions.
3 changes: 2 additions & 1 deletion build/builtin_actors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/require"

actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/manifest"

"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors"
Expand All @@ -26,7 +27,7 @@ func TestRegistration(t *testing.T) {
require.True(t, found)
require.True(t, manifestCid.Defined())

for _, key := range actors.GetBuiltinActorsKeys(av) {
for _, key := range manifest.GetBuiltinActorsKeys(av) {
actorCid, found := actors.GetActorCodeID(av, key)
require.True(t, found)
name, version, found := actors.GetActorMetaByCode(actorCid)
Expand Down
25 changes: 13 additions & 12 deletions chain/actors/actor_cids.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"golang.org/x/xerrors"

actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/manifest"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
Expand All @@ -28,7 +29,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
// Actors V7 and lower
switch name {

case AccountKey:
case manifest.AccountKey:
switch av {

case actorstypes.Version0:
Expand All @@ -53,7 +54,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.AccountActorCodeID, true
}

case CronKey:
case manifest.CronKey:
switch av {

case actorstypes.Version0:
Expand All @@ -78,7 +79,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.CronActorCodeID, true
}

case InitKey:
case manifest.InitKey:
switch av {

case actorstypes.Version0:
Expand All @@ -103,7 +104,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.InitActorCodeID, true
}

case MarketKey:
case manifest.MarketKey:
switch av {

case actorstypes.Version0:
Expand All @@ -128,7 +129,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.StorageMarketActorCodeID, true
}

case MinerKey:
case manifest.MinerKey:
switch av {

case actorstypes.Version0:
Expand All @@ -153,7 +154,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.StorageMinerActorCodeID, true
}

case MultisigKey:
case manifest.MultisigKey:
switch av {

case actorstypes.Version0:
Expand All @@ -178,7 +179,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.MultisigActorCodeID, true
}

case PaychKey:
case manifest.PaychKey:
switch av {

case actorstypes.Version0:
Expand All @@ -203,7 +204,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.PaymentChannelActorCodeID, true
}

case PowerKey:
case manifest.PowerKey:
switch av {

case actorstypes.Version0:
Expand All @@ -228,7 +229,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.StoragePowerActorCodeID, true
}

case RewardKey:
case manifest.RewardKey:
switch av {

case actorstypes.Version0:
Expand All @@ -253,7 +254,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.RewardActorCodeID, true
}

case SystemKey:
case manifest.SystemKey:
switch av {

case actorstypes.Version0:
Expand All @@ -278,7 +279,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
return builtin7.SystemActorCodeID, true
}

case VerifregKey:
case manifest.VerifregKey:
switch av {

case actorstypes.Version0:
Expand Down Expand Up @@ -314,7 +315,7 @@ func GetActorCodeIDs(av actorstypes.Version) (map[string]cid.Cid, error) {
return cids, nil
}

actorsKeys := GetBuiltinActorsKeys(av)
actorsKeys := manifest.GetBuiltinActorsKeys(av)
synthCids := make(map[string]cid.Cid)

for _, key := range actorsKeys {
Expand Down
3 changes: 2 additions & 1 deletion chain/actors/builtin/account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/manifest"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
Expand All @@ -25,7 +26,7 @@ var Methods = builtin10.MethodsAccount

func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != actors.AccountKey {
if name != manifest.AccountKey {
return nil, xerrors.Errorf("actor code is not account: %s", name)
}

Expand Down
3 changes: 2 additions & 1 deletion chain/actors/builtin/account/actor.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/go-state-types/manifest"

{{range .versions}}
{{if (le . 7)}}
Expand All @@ -24,7 +25,7 @@ var Methods = builtin{{.latestVersion}}.MethodsAccount

func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != actors.AccountKey {
if name != manifest.AccountKey {
return nil, xerrors.Errorf("actor code is not account: %s", name)
}

Expand Down
3 changes: 2 additions & 1 deletion chain/actors/builtin/account/state.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/go-state-types/manifest"

{{if (le .v 7)}}
account{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/account"
Expand Down Expand Up @@ -48,7 +49,7 @@ func (s *state{{.v}}) GetState() interface{} {
}

func (s *state{{.v}}) ActorKey() string {
return actors.AccountKey
return manifest.AccountKey
}

func (s *state{{.v}}) ActorVersion() actorstypes.Version {
Expand Down
3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v0.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v10.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v3.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v4.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v5.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v6.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v7.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v8.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/actors/builtin/account/v9.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions chain/actors/builtin/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/filecoin-project/go-state-types/builtin"
smoothingtypes "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/manifest"
"github.com/filecoin-project/go-state-types/proof"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
Expand Down Expand Up @@ -165,7 +166,7 @@ func IsAccountActor(c cid.Cid) bool {
func IsStorageMinerActor(c cid.Cid) bool {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name == actors.MinerKey
return name == manifest.MinerKey
}

if c == builtin0.StorageMinerActorCodeID {
Expand Down Expand Up @@ -202,7 +203,7 @@ func IsStorageMinerActor(c cid.Cid) bool {
func IsMultisigActor(c cid.Cid) bool {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name == actors.MultisigKey
return name == manifest.MultisigKey
}

if c == builtin0.MultisigActorCodeID {
Expand Down
Loading

0 comments on commit ae4010f

Please sign in to comment.