-
Notifications
You must be signed in to change notification settings - Fork 96
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: dao based governance NTRN-206 #53
feat: dao based governance NTRN-206 #53
Conversation
f51ac8b
to
b633408
Compare
928d8ef
to
bd94cd7
Compare
94a2228
to
2da5a15
Compare
proto/adminmodule/genesis.proto
Outdated
|
||
import "gogoproto/gogo.proto"; | ||
|
||
// this line is used by starport scaffolding # genesis/proto/import |
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.
pls remove
proto/adminmodule/query.proto
Outdated
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// this line is used by starport scaffolding # 2 |
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.
all these likes should be removed i think
wasmbinding/bindings/msg.go
Outdated
@@ -17,6 +19,8 @@ type NeutronMsg struct { | |||
RegisterInterchainQuery *RegisterInterchainQuery `json:"register_interchain_query,omitempty"` | |||
UpdateInterchainQuery *UpdateInterchainQuery `json:"update_interchain_query,omitempty"` | |||
RemoveInterchainQuery *RemoveInterchainQuery `json:"remove_interchain_query,omitempty"` | |||
AddAdmin *AddAdmin `json:"add_admin,omitempty"` |
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.
why exactly do we need an add admin message available for the contracts? aren't we going to add a single admin to genesis?
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.
That was a very first method i implemented, so i have not removed AddAdmin
exactly to leave a space to discussion - "are we need this one?".
cont, err := proto.Marshal(&prop) | ||
if err != nil { | ||
return nil, sdkerrors.Wrap(err, "failed to marshall incoming SubmitProposal message") | ||
} |
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.
here and everywhere: please add newlines after error checks
wasmbinding/message_plugin.go
Outdated
msg := admintypes.MsgSubmitProposal{Proposer: contractAddr.String()} | ||
|
||
if submitProposal.Proposals.TextProposal != 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.
redundant newline
wasmbinding/message_plugin.go
Outdated
func (m *CustomMessenger) addAmin(ctx sdk.Context, contractAddr sdk.AccAddress, addAdmin *bindings.AddAdmin) ([]sdk.Event, [][]byte, error) { | ||
response, err := m.PerformAddAmin(ctx, contractAddr, addAdmin) | ||
if err != nil { | ||
ctx.Logger().Debug("PerformSubmitTx: failed to addAdmin", |
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.
PerformSubmitTx
is a copy-and-paste
wasmQueryPlugin := NewQueryPlugin(ictxKeeper, icqKeeper) | ||
|
||
queryPluginOpt := wasmkeeper.WithQueryPlugins(&wasmkeeper.QueryPlugins{ | ||
Custom: CustomQuerier(wasmQueryPlugin), | ||
}) | ||
messagePluginOpt := wasmkeeper.WithMessageHandlerDecorator( | ||
CustomMessageDecorator(ictxKeeper, icqKeeper), | ||
CustomMessageDecorator(ictxKeeper, icqKeeper, admKeeper), |
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.
maybe give this variable a full name? adminKeeper
? not sure we gain anything from losing a couple of characters. also in other places it has a full name
"result", logMsg, | ||
) | ||
|
||
// TODO event? |
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.
add the event?
x/adminmodule/client/cli/query.go
Outdated
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
// "github.com/cosmos/cosmos-sdk/client/flags" |
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.
commented code
return m, nil | ||
} | ||
|
||
//func (m *MsgSubmitProposal) GetContent() govtypes.Content { // TODO m.Content.GetCachedValue() returns 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.
commented code
x/adminmodule/module.go
Outdated
} | ||
|
||
func (am AppModule) DefaultGenesis(jsonCodec codec.JSONCodec) json.RawMessage { | ||
//TODO implement me |
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.
implement?
x/adminmodule/module.go
Outdated
} | ||
|
||
func (am AppModule) ValidateGenesis(jsonCodec codec.JSONCodec, config client.TxEncodingConfig, message json.RawMessage) error { | ||
//TODO implement me |
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.
implement?
) | ||
|
||
// NewQuerier creates a new adminmodule Querier instance | ||
func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { |
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.
i don't think this is the way to go in sdk 0.45; please check the query implementations in our modules
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.
Please add tests for the new msg bindings
wasmbinding/message_plugin.go
Outdated
Title: submitProposal.Proposals.TextProposal.Title, | ||
Description: submitProposal.Proposals.TextProposal.Description, | ||
} | ||
var parameterChanges []paramChange.ParamChange |
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.
parameterChanges := make([]paramChange.ParamChange, 0, len(proposal.Changes))
wasmbinding/message_plugin.go
Outdated
Description: submitProposal.Proposals.TextProposal.Description, | ||
} | ||
var parameterChanges []paramChange.ParamChange | ||
for _, parameterChange := range proposal.Changes { |
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.
What about making proposal.Changes
in bindings.SubmitProposal
as paramChange.ParamChange
type?
You don't need this loop then.
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.
NOTE FOR EVERYONE: WE DO NOT NEED TO FIX MODULE FORMATTING, ETC.; WE'LL USE INFORMAL ADMIN MODULE LATER ON. |
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.
Please rebase on upstream audit fixes branch since you lag a lot behind it.
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.
utACK
4309d30
to
83a1772
Compare
Task 1
Task 2
This PR implements a neutron's vision of governance. It uses admin module in bound with smart contract bindings, provided w this pr.
testing:
make init
./test_proposal.sh