move actor key to a const array

This commit is contained in:
Jennifer Wang 2022-05-30 14:51:59 -04:00
parent 2c1cf42aa0
commit 970aa299a2
2 changed files with 20 additions and 26 deletions

View File

@ -32,6 +32,22 @@ const (
VerifregKey = "verifiedregistry"
)
func GetBuiltinActorsKeys() []string {
return []string{
AccountKey,
CronKey,
InitKey,
MarketKey,
MinerKey,
MultisigKey,
PaychKey,
PowerKey,
RewardKey,
SystemKey,
VerifregKey,
}
}
var (
manifestMx sync.RWMutex
)
@ -85,19 +101,8 @@ func loadManifests(ctx context.Context, store cbor.IpldStore) error {
manifests[av] = mf
for _, name := range []string{
AccountKey,
CronKey,
InitKey,
MarketKey,
MinerKey,
MultisigKey,
PaychKey,
PowerKey,
RewardKey,
SystemKey,
VerifregKey,
} {
var actorKeys = GetBuiltinActorsKeys()
for _, name := range actorKeys {
c, ok := mf.Get(name)
if ok {
actorMeta[c] = actorEntry{name: name, version: av}

View File

@ -1933,19 +1933,8 @@ var StateSysActorCIDsCmd = &cli.Command{
tw := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
_, _ = fmt.Fprintln(tw, "\nActor\tCID\t")
for _, name := range []string{
actors.AccountKey,
actors.CronKey,
actors.InitKey,
actors.MarketKey,
actors.MinerKey,
actors.MultisigKey,
actors.PaychKey,
actors.PowerKey,
actors.RewardKey,
actors.SystemKey,
actors.VerifregKey,
} {
var actorKeys = actors.GetBuiltinActorsKeys()
for _, name := range actorKeys {
sysActorCID, ok := actors.GetActorCodeID(actorVersion, name)
if !ok {
return xerrors.Errorf("error getting actor %v code id for actor version %d", name,