Skip to content

Commit

Permalink
add expedited
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Nov 28, 2023
1 parent 7165e41 commit 4b9b61f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 39 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ require (

replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0

github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.47.6-0.20231124185741-15259ccd2249
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
// See: https://github.com/cosmos/cosmos-sdk/issues/13134
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,6 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8=
github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0=
github.com/cosmos/cosmos-sdk v0.47.5 h1:n1+WjP/VM/gAEOx3TqU2/Ny734rj/MX1kpUnn7zVJP8=
github.com/cosmos/cosmos-sdk v0.47.5/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
Expand Down Expand Up @@ -801,6 +799,8 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA=
github.com/osmosis-labs/cosmos-sdk v0.47.6-0.20231124185741-15259ccd2249 h1:WXgQVDkydvC/5a2F/QJ7tTcsb1AsULqsX8e9BdgGROE=
github.com/osmosis-labs/cosmos-sdk v0.47.6-0.20231124185741-15259ccd2249/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c=
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func TestGovVoteByContract(t *testing.T) {
"",
"my proposal",
"testing",
false,
)
require.NoError(t, err)
rsp, gotErr := chain.SendMsgs(msg)
Expand Down
80 changes: 43 additions & 37 deletions x/wasm/client/cli/gov_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func ProposalStoreCodeCmd() *cobra.Command {
Short: "Submit a wasm binary proposal",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -80,7 +80,7 @@ func ProposalStoreCodeCmd() *cobra.Command {
return err
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand Down Expand Up @@ -154,7 +154,7 @@ func ProposalInstantiateContractCmd() *cobra.Command {
Short: "Submit an instantiate wasm contract proposal",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -173,7 +173,7 @@ func ProposalInstantiateContractCmd() *cobra.Command {
return err
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand Down Expand Up @@ -201,7 +201,7 @@ func ProposalInstantiateContract2Cmd() *cobra.Command {
Short: "Submit an instantiate wasm contract proposal with predictable address",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -220,7 +220,7 @@ func ProposalInstantiateContract2Cmd() *cobra.Command {
return err
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command {
Short: "Submit a store and instantiate wasm contract proposal",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -342,7 +342,7 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command {
Funds: amount,
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand Down Expand Up @@ -375,7 +375,7 @@ func ProposalMigrateContractCmd() *cobra.Command {
Short: "Submit a migrate wasm contract to a new code version proposal",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -394,7 +394,7 @@ func ProposalMigrateContractCmd() *cobra.Command {
return err
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand All @@ -417,7 +417,7 @@ func ProposalExecuteContractCmd() *cobra.Command {
Short: "Submit a execute wasm contract proposal (run by any address)",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -449,7 +449,7 @@ func ProposalExecuteContractCmd() *cobra.Command {
Funds: funds,
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand All @@ -474,7 +474,7 @@ func ProposalSudoContractCmd() *cobra.Command {
Short: "Submit a sudo wasm contract proposal (to call privileged commands)",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -494,7 +494,7 @@ func ProposalSudoContractCmd() *cobra.Command {
Msg: []byte(args[1]),
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand All @@ -517,7 +517,7 @@ func ProposalUpdateContractAdminCmd() *cobra.Command {
Short: "Submit a new admin for a contract proposal",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -533,7 +533,7 @@ func ProposalUpdateContractAdminCmd() *cobra.Command {

src := parseUpdateContractAdminArgs(args, authority)

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand All @@ -556,7 +556,7 @@ func ProposalClearContractAdminCmd() *cobra.Command {
Short: "Submit a clear admin for a contract to prevent further migrations proposal",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -575,7 +575,7 @@ func ProposalClearContractAdminCmd() *cobra.Command {
Contract: args[0],
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand All @@ -598,7 +598,7 @@ func ProposalPinCodesCmd() *cobra.Command {
Short: "Submit a pin code proposal for pinning a code to cache",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -622,7 +622,7 @@ func ProposalPinCodesCmd() *cobra.Command {
CodeIDs: codeIds,
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand Down Expand Up @@ -657,7 +657,7 @@ func ProposalUnpinCodesCmd() *cobra.Command {
Short: "Submit a unpin code proposal for unpinning a code to cache",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -680,7 +680,7 @@ func ProposalUnpinCodesCmd() *cobra.Command {
CodeIDs: codeIds,
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand Down Expand Up @@ -763,7 +763,7 @@ Example:
$ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm,%s1vx8knpllrj7n963p9ttd80w47kpacrhuts497x
`, version.AppName, bech32Prefix, bech32Prefix)),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -792,7 +792,7 @@ $ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1
}
}

proposalMsg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand All @@ -815,7 +815,7 @@ func ProposalAddCodeUploadParamsAddresses() *cobra.Command {
Short: "Submit an add code upload params addresses proposal to add addresses to code upload config params",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -834,7 +834,7 @@ func ProposalAddCodeUploadParamsAddresses() *cobra.Command {
Addresses: args,
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand All @@ -857,7 +857,7 @@ func ProposalRemoveCodeUploadParamsAddresses() *cobra.Command {
Short: "Submit a remove code upload params addresses proposal to remove addresses from code upload config params",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -876,7 +876,7 @@ func ProposalRemoveCodeUploadParamsAddresses() *cobra.Command {
Addresses: args,
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand All @@ -899,35 +899,41 @@ func addCommonProposalFlags(cmd *cobra.Command) {
cmd.Flags().String(cli.FlagSummary, "", "Summary of proposal")
cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
cmd.Flags().String(flagAuthority, DefaultGovAuthority.String(), "The address of the governance account. Default is the sdk gov module account")
cmd.Flags().Bool(flagExpedite, false, "Expedite proposals have shorter voting period but require higher voting threshold")
}

func getProposalInfo(cmd *cobra.Command) (client.Context, string, string, sdk.Coins, error) {
func getProposalInfo(cmd *cobra.Command) (client.Context, string, string, sdk.Coins, bool, error) {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return client.Context{}, "", "", nil, err
return client.Context{}, "", "", nil, false, err
}

proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle)
if err != nil {
return clientCtx, proposalTitle, "", nil, err
return clientCtx, proposalTitle, "", nil, false, err
}

summary, err := cmd.Flags().GetString(cli.FlagSummary)
if err != nil {
return client.Context{}, proposalTitle, summary, nil, err
return client.Context{}, proposalTitle, summary, nil, false, err
}

depositArg, err := cmd.Flags().GetString(cli.FlagDeposit)
if err != nil {
return client.Context{}, proposalTitle, summary, nil, err
return client.Context{}, proposalTitle, summary, nil, false, err
}

deposit, err := sdk.ParseCoinsNormalized(depositArg)
if err != nil {
return client.Context{}, proposalTitle, summary, deposit, err
return client.Context{}, proposalTitle, summary, deposit, false, err
}

return clientCtx, proposalTitle, summary, deposit, nil
expedite, err := cmd.Flags().GetBool(flagExpedite)
if err != nil {
return client.Context{}, proposalTitle, summary, deposit, false, err
}

return clientCtx, proposalTitle, summary, deposit, expedite, nil
}

func ProposalStoreAndMigrateContractCmd() *cobra.Command {
Expand All @@ -936,7 +942,7 @@ func ProposalStoreAndMigrateContractCmd() *cobra.Command {
Short: "Submit a store and migrate wasm contract proposal",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd)
clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd)
if err != nil {
return err
}
Expand All @@ -963,7 +969,7 @@ func ProposalStoreAndMigrateContractCmd() *cobra.Command {
Contract: args[1],
}

proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary)
proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions x/wasm/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
flagAllowAllMsgs = "allow-all-messages"
flagNoTokenTransfer = "no-token-transfer"
flagAuthority = "authority"
flagExpedite = "expedite"
)

// GetTxCmd returns the transaction commands for this module
Expand Down
1 change: 1 addition & 0 deletions x/wasm/keeper/proposal_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ func submitLegacyProposal(t *testing.T, ctx sdk.Context, content v1beta1.Content
"",
content.GetTitle(),
content.GetDescription(),
false,
)
require.NoError(t, err)

Expand Down

0 comments on commit 4b9b61f

Please sign in to comment.