-
Notifications
You must be signed in to change notification settings - Fork 101
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
feat(core, runtime): Builtin actors framework #3624
Conversation
129c4df
to
1cf07ad
Compare
a0ca2d0
to
e3eca71
Compare
2728c21
to
6f271fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pallets/gear-builtin
is still under review and will be submitted asap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pallets/gear-builtin/src/tests/*
to be reviewed after suggested changes applied/discussed
5aeef2b
to
3a73022
Compare
12f9252
to
9cba655
Compare
Awesome and huge work done! |
Following the discussion on reworking the original approach to builtin actors (#3504), a new extensible framework for Runtime builtin actors is proposed.
A set of
BuiltinActor
's is defined as thepallet_gear_builtin_actor::Config
trait associated type - a tuple consisting of custom types each of which must implement thepallet_gear_builtin_actor::BuiltinActor
trait (similar to how migrations or signed extras are defined in the Runtime). Those can be pallets (if access to on-chain storage is required) or any other custom types.To enable messages routing to a specific builtin actor, the latter must be registered with the
pallet_gear::Config::<T>::BuiltinRouter
associated type that implements thepallet_gear::builtin::BuiltinRouter
trait and provides thelookup()
function to derive the respectiveBuiltinId
based on the message destination address (ProgramId
).This functionality is provided by the
gear_builtin_actor
pallet.The
BuiltinId
must be unique across all actors: it is claimed by a builtin actor itself as the actor's type's associated constant. Thegear-builtin-actor
pallet provides theregister_actor()
function that would check if there are conflictingBuiltinId
's. This should be the preferred way to register an actor during Runtime upgrades.This PR includes:
Gear
pallet and theGearBuiltinActor
palletProgramId
'scalculate_gas_info()
for the case of a builtin actor.Examples of actual "production" builtin actor (like
staking-proxy
one) are beyond the scope of this PR and will be added subsequently.