Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new FEVM actors to the registry #9958

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions chain/actors/builtin/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
account10 "github.com/filecoin-project/go-state-types/builtin/v10/account"
cron10 "github.com/filecoin-project/go-state-types/builtin/v10/cron"
datacap10 "github.com/filecoin-project/go-state-types/builtin/v10/datacap"
eam10 "github.com/filecoin-project/go-state-types/builtin/v10/eam"
embryo10 "github.com/filecoin-project/go-state-types/builtin/v10/embryo"
ethaccount10 "github.com/filecoin-project/go-state-types/builtin/v10/ethaccount"
evm10 "github.com/filecoin-project/go-state-types/builtin/v10/evm"
_init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
market10 "github.com/filecoin-project/go-state-types/builtin/v10/market"
miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner"
Expand Down Expand Up @@ -265,6 +269,7 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry {
methods: datacap9.Methods,
state: new(datacap9.State),
})

}
}

Expand Down Expand Up @@ -343,6 +348,32 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry {
methods: datacap10.Methods,
state: new(datacap10.State),
})

case manifest.EvmKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: evm10.Methods,
state: new(evm10.State),
})
case manifest.EamKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: eam10.Methods,
state: nil,
geoff-vball marked this conversation as resolved.
Show resolved Hide resolved
})
case manifest.EmbryoKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: embryo10.Methods,
state: nil,
})
case manifest.EthAccountKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: ethaccount10.Methods,
state: nil,
})

}
}

Expand Down
32 changes: 32 additions & 0 deletions chain/actors/builtin/registry.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ import (
{{if (ge . 9)}}
datacap{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/datacap"
{{end}}
{{if (ge . 10)}}
evm{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/evm"
eam{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/eam"
embryo{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/embryo"
ethaccount{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/ethaccount"
{{end}}
{{end}}
"github.com/filecoin-project/go-state-types/cbor"
rtt "github.com/filecoin-project/go-state-types/rt"
Expand Down Expand Up @@ -174,6 +180,32 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry {
methods: datacap{{.}}.Methods,
state: new(datacap{{.}}.State),
}){{end}}
{{if (ge . 10)}}
case manifest.EvmKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: evm{{.}}.Methods,
state: new(evm{{.}}.State),
})
case manifest.EamKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: eam{{.}}.Methods,
state: nil,
})
case manifest.EmbryoKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: embryo{{.}}.Methods,
state: nil,
})
case manifest.EthAccountKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: ethaccount{{.}}.Methods,
state: nil,
})
{{end}}
}
}
{{end}}
Expand Down
9 changes: 4 additions & 5 deletions chain/vm/invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,16 @@ func DecodeParams(b []byte, out interface{}) error {
}

func DumpActorState(i *ActorRegistry, act *types.Actor, b []byte) (interface{}, error) {
// Account & Embryo code special case
if builtin.IsAccountActor(act.Code) || builtin.IsEmbryoActor(act.Code) {
return nil, nil
}

actInfo, ok := i.actors[act.Code]
if !ok {
return nil, xerrors.Errorf("state type for actor %s not found", act.Code)
}

um := actInfo.vmActor.State()
if um == nil {
// TODO: I would like to assert that we have the empty object here
return nil, nil
}
Comment on lines +293 to +296
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the embryo actors actually not have state? What does the state cid in actor entry point to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embryo actors (soon to be renamed to "placeholders"), EthAccounts, and the EAM do not have state. Their heads are the empty object CID.

This CID will get put into the blockstore as part of the migration (if it isn't already).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I guess, if we’re not using nil state anywhere to mean “actor not found”, this seems fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question -- I don't know of any place where we do that, but I'll take a look before assuming.

if err := um.UnmarshalCBOR(bytes.NewReader(b)); err != nil {
return nil, xerrors.Errorf("unmarshaling actor state: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
github.com/filecoin-project/go-legs v0.4.4
github.com/filecoin-project/go-padreader v0.0.1
github.com/filecoin-project/go-paramfetch v0.0.4
github.com/filecoin-project/go-state-types v0.10.0-alpha.7
github.com/filecoin-project/go-state-types v0.10.0-alpha-8
github.com/filecoin-project/go-statemachine v1.0.2
github.com/filecoin-project/go-statestore v0.2.0
github.com/filecoin-project/go-storedcounter v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.10.0-alpha.7 h1:CnHwzDJpeixx1FLHtlp3iDv2j346qFDYa0w99mSt9A4=
github.com/filecoin-project/go-state-types v0.10.0-alpha.7/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI=
github.com/filecoin-project/go-state-types v0.10.0-alpha-8 h1:BPUEnjs4eBjhX+WCeG/Mfpoc7umYVgXENur73PJ1cNc=
github.com/filecoin-project/go-state-types v0.10.0-alpha-8/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI=
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
Expand Down