Skip to content

Commit

Permalink
Remove old functions for getting actors cids
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-vball committed Jun 29, 2022
1 parent 8637964 commit 75c7dde
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 41 deletions.
5 changes: 2 additions & 3 deletions chain/actors/builtin/multisig/message.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -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}}


Expand Down Expand Up @@ -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")
}

Expand Down
5 changes: 2 additions & 3 deletions chain/actors/builtin/multisig/message8.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
}

Expand Down
8 changes: 3 additions & 5 deletions chain/gen/genesis/f00_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{
Expand Down
8 changes: 4 additions & 4 deletions chain/gen/genesis/f02_reward.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{
Expand Down
8 changes: 4 additions & 4 deletions chain/gen/genesis/f03_cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{
Expand Down
8 changes: 4 additions & 4 deletions chain/gen/genesis/f04_power.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{
Expand Down
8 changes: 4 additions & 4 deletions chain/gen/genesis/f05_market.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{
Expand Down
8 changes: 4 additions & 4 deletions chain/gen/genesis/f06_vreg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{
Expand Down
12 changes: 6 additions & 6 deletions chain/gen/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down
7 changes: 3 additions & 4 deletions storage/wdpost_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 75c7dde

Please sign in to comment.