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

Rework governance/ update admin-module NTRN-70 #303

Merged
merged 27 commits into from
Sep 7, 2023

Conversation

quasisamurai
Copy link
Contributor

@quasisamurai quasisamurai commented Aug 15, 2023

@quasisamurai quasisamurai force-pushed the feat/admin-module-sdk47 branch from f400a7f to b86ff05 Compare August 15, 2023 10:55
@quasisamurai quasisamurai changed the title Feat/admin module sdk47 admin module & governance sdk47 update NTRN-70 Aug 17, 2023
@quasisamurai quasisamurai marked this pull request as ready for review August 17, 2023 08:28
app/app.go Outdated
Comment on lines 702 to 705
// TODO: enabled proposals?
//if len(enabledProposals) != 0 {
// app.AdminmoduleKeeper.Router().AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, enabledProposals))
//}
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO?

app/app.go Outdated Show resolved Hide resolved
wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
@quasisamurai quasisamurai changed the title admin module & governance sdk47 update NTRN-70 Rework governance/ update admin-module NTRN-70 Aug 25, 2023
wasmOpts...,
)
wasmHooks.ContractKeeper = &app.WasmKeeper

app.CronKeeper.WasmMsgServer = wasmkeeper.NewMsgServerImpl(&app.WasmKeeper)
cronModule := cron.NewAppModule(appCodec, &app.CronKeeper)

if len(enabledProposals) != 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

enabledProposals variable is not used anymore, remove it please

@@ -41,6 +36,20 @@ func isConsumerParamChangeWhitelisted(paramChanges []proposal.ParamChange) bool
return true
}

func isSdkMessageWhitelisted(msg sdk.Msg) bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add a comment what is the purpose of this method.

@@ -41,6 +36,20 @@ func isConsumerParamChangeWhitelisted(paramChanges []proposal.ParamChange) bool
return true
}

func isSdkMessageWhitelisted(msg sdk.Msg) bool {
switch msg.(type) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We definitely need to whitelist more messages here, but it's out of scope of this PR, will do it later

@@ -295,6 +294,34 @@ func (m *CustomMessenger) submitTx(ctx sdk.Context, contractAddr sdk.AccAddress,
}

func (m *CustomMessenger) submitAdminProposal(ctx sdk.Context, contractAddr sdk.AccAddress, submitAdminProposal *bindings.SubmitAdminProposal) ([]sdk.Event, [][]byte, error) {
var data []byte
if submitAdminProposal.AdminProposal.ParamChangeProposal != nil || submitAdminProposal.AdminProposal.UpgradeProposal != nil || submitAdminProposal.AdminProposal.ClientUpdateProposal != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a comment there why exactly we need that condition.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also i think it's cleaner to create a method isLegacyProposal() which does this check inside of it

Copy link
Collaborator

Choose a reason for hiding this comment

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

These two conditions differ only in the method that should called (m.performSubmitAdminProposalLegacy() or m.performSubmitAdminProposal()).

Logging and unmarshalling logic is the same for both conditions. Let's refactor to make it easier to read?

wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
quasisamurai and others added 4 commits August 29, 2023 15:17
Co-authored-by: Mike Mozhaev <programmer10110@gmail.com>
Co-authored-by: Mike Mozhaev <programmer10110@gmail.com>
Co-authored-by: Mike Mozhaev <programmer10110@gmail.com>
@quasisamurai quasisamurai force-pushed the feat/admin-module-sdk47 branch from 845b949 to 552a67f Compare August 29, 2023 12:02
wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
wasmbinding/message_plugin.go Show resolved Hide resolved
@@ -170,23 +169,6 @@ var (
EnableSpecificProposals = ""
)

// GetEnabledProposals parses the ProposalsEnabled / EnableSpecificProposals values to
// produce a list of enabled proposals to pass into wasmd app.
func GetEnabledProposals() []wasm.ProposalType {
Copy link
Contributor

Choose a reason for hiding this comment

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

do you think its safe to remove EnableSpecificProposals and ProposalsEnabled variables. and also remove all mentions in Makefile

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why it might be unsafe? wasm.ProposalType is basically deprecated

wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
wasmbinding/message_plugin.go Show resolved Hide resolved
wasmbinding/message_plugin.go Show resolved Hide resolved
wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
wasmbinding/message_plugin.go Outdated Show resolved Hide resolved
app/app.go Outdated Show resolved Hide resolved
app/app.go Outdated Show resolved Hide resolved
Copy link
Contributor

@NeverHappened NeverHappened left a comment

Choose a reason for hiding this comment

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

There are lots of app.GetEnabledProposals(), in testing code that needs to be fixed

app/app.go Outdated Show resolved Hide resolved
@pr0n00gler pr0n00gler merged commit 743fc8f into update-sdk47 Sep 7, 2023
2 of 5 checks passed
@pr0n00gler pr0n00gler deleted the feat/admin-module-sdk47 branch May 9, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants