-
Notifications
You must be signed in to change notification settings - Fork 41
feat: preinstalls #226
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
base: main
Are you sure you want to change the base?
feat: preinstalls #226
Conversation
import "github.com/ethereum/go-ethereum/common" | ||
|
||
type Preinstall struct { | ||
Address common.Address |
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.
Could we add names here to keep track of what these are?
// Migrate9to10 migrates the x/vm module state from the consensus | ||
// version 9 to version 10. Specifically, it deploys a set of predefined | ||
// preinstall contracts with a fixed addresses and code. | ||
func (m Migrator) Migrate9to10(ctx sdk.Context) error { |
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.
We're gonna reset all module versions to 1, so let's remove this or move it to some example upgradehandler. I think we should keep the preinstalls keeper method though
@@ -127,6 +127,11 @@ func (AppModule) Name() string { | |||
func (am AppModule) RegisterServices(cfg module.Configurator) { | |||
types.RegisterMsgServer(cfg.MsgServer(), am.keeper) | |||
types.RegisterQueryServer(cfg.QueryServer(), am.keeper) | |||
|
|||
m := keeper.NewMigrator(am.keeper) | |||
if err := cfg.RegisterMigration(types.ModuleName, 9, m.Migrate9to10); err != nil { |
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.
Same as above - I want to avoid having migrations for modules before v1
@@ -57,6 +57,10 @@ func InitGenesis( | |||
} | |||
} | |||
|
|||
if err := k.AddPreinstalls(ctx, types.DefaultPreinstalls); err != nil { |
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.
Could we add this into the evmd instead? I'm thinking that we could pass in the default preinstalls as a default there, but allow anyone to specify their own precompiles upon genesis inside their app
I want to discuss how we add this, and if we want any temporary stuff or how we should do this.
In the current code I have the following:
The questions I have are:
a. Eric mentioned maybe wanting a cli command to add pre-installs. I could do that, but it seems like temporary code we might now want in the evm repo
b. If this is primarily to add them to the running testnet, I would suggest just changing the gaia binary being used to call the `keeper.Add