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

Initialize precompiles in UpdateParams #58

Closed
wants to merge 2 commits into from

Conversation

evgeniy-scherbina
Copy link

No description provided.

x/evm/keeper/msg_server.go Fixed Show fixed Hide fixed
@evgeniy-scherbina evgeniy-scherbina force-pushed the yevhenii/boilerplate-precompile-v3 branch 2 times, most recently from 62432f9 to b38c516 Compare May 7, 2024 19:37
@evgeniy-scherbina evgeniy-scherbina changed the title Added TestInitPrecompiles unit-test Initialize precompiles in UpdateParams May 7, 2024
@evgeniy-scherbina evgeniy-scherbina force-pushed the yevhenii/boilerplate-precompile-v3 branch 4 times, most recently from 357e30a to 208eaa5 Compare May 8, 2024 13:42
@evgeniy-scherbina evgeniy-scherbina marked this pull request as ready for review May 8, 2024 13:43
x/evm/keeper/msg_server.go Outdated Show resolved Hide resolved
if err := k.SetParams(ctx, req.Params); err != nil {
return nil, err
}

return &types.MsgUpdateParamsResponse{}, nil
}

func (k *Keeper) updatePrecompiles(ctx sdk.Context, newEnabledPrecompiles []string) error {
Copy link
Member

Choose a reason for hiding this comment

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

Should we return an error if the precompile contract isn't registered in the geth precompile modules (RegisteredModules())?

Also small optional thing: I think this could be moved to a separate file, just feels it could be separate from the msg_server

Comment on lines +167 to 173
if err := k.updatePrecompiles(ctx, req.Params.EnabledPrecompiles); err != nil {
return nil, err
}

if err := k.SetParams(ctx, req.Params); err != nil {
return nil, err
}
Copy link
Member

Choose a reason for hiding this comment

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

updatePrecompiles() naming a bit vague in usage here since it's also set in state in SetParams() - could optionally rename to something more specific / different from just updating/setting like initializePreocmpiles

@evgeniy-scherbina evgeniy-scherbina force-pushed the yevhenii/boilerplate-precompile-v3 branch from a0d627e to b64b3fd Compare May 29, 2024 18:38
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days-before-close if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants