From 75c7ddea501a5c96e4588cd1c23bc14d7926b10e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 29 Jun 2022 12:54:14 -0400 Subject: [PATCH] Remove old functions for getting actors cids --- chain/actors/builtin/multisig/message.go.template | 5 ++--- chain/actors/builtin/multisig/message8.go | 5 ++--- chain/gen/genesis/f00_system.go | 8 +++----- chain/gen/genesis/f02_reward.go | 8 ++++---- chain/gen/genesis/f03_cron.go | 8 ++++---- chain/gen/genesis/f04_power.go | 8 ++++---- chain/gen/genesis/f05_market.go | 8 ++++---- chain/gen/genesis/f06_vreg.go | 8 ++++---- chain/gen/genesis/genesis.go | 12 ++++++------ storage/wdpost_run_test.go | 7 +++---- 10 files changed, 36 insertions(+), 41 deletions(-) diff --git a/chain/actors/builtin/multisig/message.go.template b/chain/actors/builtin/multisig/message.go.template index 4db88826ad3..5542f4eecd9 100644 --- a/chain/actors/builtin/multisig/message.go.template +++ b/chain/actors/builtin/multisig/message.go.template @@ -14,7 +14,6 @@ import ( builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin" multisig{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/multisig" init{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/init" - "github.com/filecoin-project/lotus/chain/actors/builtin" {{end}} @@ -69,8 +68,8 @@ func (m message{{.v}}) Create( ConstructorParams: enc, } {{else}} - code, err := builtin.GetMultisigActorCodeID(actors.Version{{.v}}) - if err != nil { + code, ok := actors.GetActorCodeID(actors.Version{{.v}}, actors.MultisigKey) + if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/actors/builtin/multisig/message8.go b/chain/actors/builtin/multisig/message8.go index bc560f50dab..18429fb5bb5 100644 --- a/chain/actors/builtin/multisig/message8.go +++ b/chain/actors/builtin/multisig/message8.go @@ -9,7 +9,6 @@ import ( builtin8 "github.com/filecoin-project/go-state-types/builtin" init8 "github.com/filecoin-project/go-state-types/builtin/v8/init" multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig" - "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -51,8 +50,8 @@ func (m message8) Create( return nil, actErr } - code, err := builtin.GetMultisigActorCodeID(actors.Version8) - if err != nil { + code, ok := actors.GetActorCodeID(actors.Version8, actors.MultisigKey) + if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/gen/genesis/f00_system.go b/chain/gen/genesis/f00_system.go index 527701f1718..6a1a9cbd1e5 100644 --- a/chain/gen/genesis/f00_system.go +++ b/chain/gen/genesis/f00_system.go @@ -9,8 +9,6 @@ import ( "github.com/filecoin-project/go-state-types/manifest" - "github.com/filecoin-project/lotus/chain/actors/builtin" - "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/big" @@ -53,9 +51,9 @@ func SetupSystemActor(ctx context.Context, bs bstore.Blockstore, av actors.Versi return nil, err } - actcid, err := builtin.GetSystemActorCodeID(av) - if err != nil { - return nil, err + actcid, ok := actors.GetActorCodeID(av, actors.SystemKey) + if !ok { + return nil, xerrors.Errorf("failed to get system actor code ID for actors version %d", av) } act := &types.Actor{ diff --git a/chain/gen/genesis/f02_reward.go b/chain/gen/genesis/f02_reward.go index e4d6aa32a2e..ec0f68c2fc7 100644 --- a/chain/gen/genesis/f02_reward.go +++ b/chain/gen/genesis/f02_reward.go @@ -3,7 +3,7 @@ package genesis import ( "context" - "github.com/filecoin-project/lotus/chain/actors/builtin" + "golang.org/x/xerrors" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -30,9 +30,9 @@ func SetupRewardActor(ctx context.Context, bs bstore.Blockstore, qaPower big.Int return nil, err } - actcid, err := builtin.GetRewardActorCodeID(av) - if err != nil { - return nil, err + actcid, ok := actors.GetActorCodeID(av, actors.RewardKey) + if !ok { + return nil, xerrors.Errorf("failed to get reward actor code ID for actors version %d", av) } act := &types.Actor{ diff --git a/chain/gen/genesis/f03_cron.go b/chain/gen/genesis/f03_cron.go index fad5e6fa639..b88f94e8c46 100644 --- a/chain/gen/genesis/f03_cron.go +++ b/chain/gen/genesis/f03_cron.go @@ -3,7 +3,7 @@ package genesis import ( "context" - "github.com/filecoin-project/lotus/chain/actors/builtin" + "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/chain/actors" @@ -28,9 +28,9 @@ func SetupCronActor(ctx context.Context, bs bstore.Blockstore, av actors.Version return nil, err } - actcid, err := builtin.GetCronActorCodeID(av) - if err != nil { - return nil, err + actcid, ok := actors.GetActorCodeID(av, actors.CronKey) + if !ok { + return nil, xerrors.Errorf("failed to get cron actor code ID for actors version %d", av) } act := &types.Actor{ diff --git a/chain/gen/genesis/f04_power.go b/chain/gen/genesis/f04_power.go index 35cd5f87bcb..1afcaa01221 100644 --- a/chain/gen/genesis/f04_power.go +++ b/chain/gen/genesis/f04_power.go @@ -3,7 +3,7 @@ package genesis import ( "context" - "github.com/filecoin-project/lotus/chain/actors/builtin" + "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/chain/actors/builtin/power" @@ -30,9 +30,9 @@ func SetupStoragePowerActor(ctx context.Context, bs bstore.Blockstore, av actors return nil, err } - actcid, err := builtin.GetPowerActorCodeID(av) - if err != nil { - return nil, err + actcid, ok := actors.GetActorCodeID(av, actors.PowerKey) + if !ok { + return nil, xerrors.Errorf("failed to get power actor code ID for actors version %d", av) } act := &types.Actor{ diff --git a/chain/gen/genesis/f05_market.go b/chain/gen/genesis/f05_market.go index 045842cdecd..dff8218aa62 100644 --- a/chain/gen/genesis/f05_market.go +++ b/chain/gen/genesis/f05_market.go @@ -3,7 +3,7 @@ package genesis import ( "context" - "github.com/filecoin-project/lotus/chain/actors/builtin" + "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/chain/actors" @@ -28,9 +28,9 @@ func SetupStorageMarketActor(ctx context.Context, bs bstore.Blockstore, av actor return nil, err } - actcid, err := builtin.GetMarketActorCodeID(av) - if err != nil { - return nil, err + actcid, ok := actors.GetActorCodeID(av, actors.MarketKey) + if !ok { + return nil, xerrors.Errorf("failed to get market actor code ID for actors version %d", av) } act := &types.Actor{ diff --git a/chain/gen/genesis/f06_vreg.go b/chain/gen/genesis/f06_vreg.go index d93b01a4fab..b60a9a59956 100644 --- a/chain/gen/genesis/f06_vreg.go +++ b/chain/gen/genesis/f06_vreg.go @@ -3,7 +3,7 @@ package genesis import ( "context" - "github.com/filecoin-project/lotus/chain/actors/builtin" + "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/chain/actors/builtin/verifreg" @@ -43,9 +43,9 @@ func SetupVerifiedRegistryActor(ctx context.Context, bs bstore.Blockstore, av ac return nil, err } - actcid, err := builtin.GetVerifregActorCodeID(av) - if err != nil { - return nil, err + actcid, ok := actors.GetActorCodeID(av, actors.VerifregKey) + if !ok { + return nil, xerrors.Errorf("failed to get verifreg actor code ID for actors version %d", av) } act := &types.Actor{ diff --git a/chain/gen/genesis/genesis.go b/chain/gen/genesis/genesis.go index 138437b78aa..a513fcff329 100644 --- a/chain/gen/genesis/genesis.go +++ b/chain/gen/genesis/genesis.go @@ -381,9 +381,9 @@ func MakeAccountActor(ctx context.Context, cst cbor.IpldStore, av actors.Version return nil, err } - actcid, err := builtin.GetAccountActorCodeID(av) - if err != nil { - return nil, err + actcid, ok := actors.GetActorCodeID(av, actors.AccountKey) + if !ok { + return nil, xerrors.Errorf("failed to get account actor code ID for actors version %d", av) } act := &types.Actor{ @@ -463,9 +463,9 @@ func CreateMultisigAccount(ctx context.Context, cst cbor.IpldStore, state *state return err } - actcid, err := builtin.GetMultisigActorCodeID(av) - if err != nil { - return err + actcid, ok := actors.GetActorCodeID(av, actors.MultisigKey) + if !ok { + return xerrors.Errorf("failed to get multisig code ID for actors version %d", av) } err = state.SetActor(ida, &types.Actor{ diff --git a/storage/wdpost_run_test.go b/storage/wdpost_run_test.go index 6efb3e54769..e173b65435b 100644 --- a/storage/wdpost_run_test.go +++ b/storage/wdpost_run_test.go @@ -9,7 +9,6 @@ import ( prooftypes "github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/lotus/chain/actors" - lbuiltin "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/stretchr/testify/require" @@ -347,9 +346,9 @@ func (m *mockStorageMinerAPI) StateSearchMsg(ctx context.Context, from types.Tip } func (m *mockStorageMinerAPI) StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error) { - code, err := lbuiltin.GetMinerActorCodeID(actors.Version7) - if err != nil { - return nil, err + code, ok := actors.GetActorCodeID(actors.Version7, actors.MinerKey) + if !ok { + return nil, xerrors.Errorf("failed to get miner actor code ID for actors version %d", actors.Version7) } return &types.Actor{ Code: code,