diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7c019fab64..932685b43ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,12 +20,13 @@
- Go 1.17 provides a much clearer go.mod file [\#679](https://github.com/CosmWasm/wasmd/pull/679) ([faddat](https://github.com/faddat))
- Autopin wasm code uploaded by gov proposal [\#726](https://github.com/CosmWasm/wasmd/pull/726) ([ethanfrey](https://github.com/ethanfrey))
- You must explicitly declare --no-admin on cli instantiate if that is what you want [\#727](https://github.com/CosmWasm/wasmd/pull/727) ([ethanfrey](https://github.com/ethanfrey))
-
+- Add governance proposals for Wasm Execute and Sudo [\#730](https://github.com/CosmWasm/wasmd/pull/730) ([ethanfrey](https://github.com/ethanfrey))
+- Remove unused run-as flag from Wasm Migrate proposals [\#730](https://github.com/CosmWasm/wasmd/pull/730) ([ethanfrey](https://github.com/ethanfrey))
+- Expose wasm/Keeper.SetParams [\#732](https://github.com/CosmWasm/wasmd/pull/732) ([ethanfrey](https://github.com/ethanfrey))
[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.22.0...v0.21.0)
-
## [v0.21.0](https://github.com/CosmWasm/wasmd/tree/v0.21.0) (2021-11-17)
[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.21.0...v0.20.0)
diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md
index e9ea878143d..dd8dc7f203b 100644
--- a/docs/proto/proto-docs.md
+++ b/docs/proto/proto-docs.md
@@ -46,10 +46,12 @@
- [cosmwasm/wasm/v1/proposal.proto](#cosmwasm/wasm/v1/proposal.proto)
- [ClearAdminProposal](#cosmwasm.wasm.v1.ClearAdminProposal)
+ - [ExecuteContractProposal](#cosmwasm.wasm.v1.ExecuteContractProposal)
- [InstantiateContractProposal](#cosmwasm.wasm.v1.InstantiateContractProposal)
- [MigrateContractProposal](#cosmwasm.wasm.v1.MigrateContractProposal)
- [PinCodesProposal](#cosmwasm.wasm.v1.PinCodesProposal)
- [StoreCodeProposal](#cosmwasm.wasm.v1.StoreCodeProposal)
+ - [SudoContractProposal](#cosmwasm.wasm.v1.SudoContractProposal)
- [UnpinCodesProposal](#cosmwasm.wasm.v1.UnpinCodesProposal)
- [UpdateAdminProposal](#cosmwasm.wasm.v1.UpdateAdminProposal)
@@ -658,6 +660,27 @@ contract.
+
+
+### ExecuteContractProposal
+ExecuteContractProposal gov proposal content type to call execute on a
+contract.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `title` | [string](#string) | | Title is a short summary |
+| `description` | [string](#string) | | Description is a human readable text |
+| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender |
+| `contract` | [string](#string) | | Contract is the address of the smart contract |
+| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract as execute |
+| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation |
+
+
+
+
+
+
### InstantiateContractProposal
@@ -690,10 +713,11 @@ MigrateContractProposal gov proposal content type to migrate a contract.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | Title is a short summary |
-| `description` | [string](#string) | | Description is a human readable text |
-| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender |
+| `description` | [string](#string) | | Description is a human readable text
+
+Note: skipping 3 as this was previously used for unneeded run_as |
| `contract` | [string](#string) | | Contract is the address of the smart contract |
-| `code_id` | [uint64](#uint64) | | CodeID references the new WASM code |
+| `code_id` | [uint64](#uint64) | | CodeID references the new WASM codesudo |
| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on migration |
@@ -738,6 +762,24 @@ StoreCodeProposal gov proposal content type to submit WASM code to the system
+
+
+### SudoContractProposal
+SudoContractProposal gov proposal content type to call sudo on a contract.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `title` | [string](#string) | | Title is a short summary |
+| `description` | [string](#string) | | Description is a human readable text |
+| `contract` | [string](#string) | | Contract is the address of the smart contract |
+| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract as sudo |
+
+
+
+
+
+
### UnpinCodesProposal
diff --git a/proto/cosmwasm/wasm/v1/proposal.proto b/proto/cosmwasm/wasm/v1/proposal.proto
index 759124c0f86..2f36f87f945 100644
--- a/proto/cosmwasm/wasm/v1/proposal.proto
+++ b/proto/cosmwasm/wasm/v1/proposal.proto
@@ -56,16 +56,48 @@ message MigrateContractProposal {
string title = 1;
// Description is a human readable text
string description = 2;
- // RunAs is the address that is passed to the contract's environment as sender
- string run_as = 3;
+ // Note: skipping 3 as this was previously used for unneeded run_as
+
// Contract is the address of the smart contract
string contract = 4;
- // CodeID references the new WASM code
+ // CodeID references the new WASM codesudo
uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ];
// Msg json encoded message to be passed to the contract on migration
bytes msg = 6 [ (gogoproto.casttype) = "RawContractMessage" ];
}
+// SudoContractProposal gov proposal content type to call sudo on a contract.
+message SudoContractProposal {
+ // Title is a short summary
+ string title = 1;
+ // Description is a human readable text
+ string description = 2;
+ // Contract is the address of the smart contract
+ string contract = 3;
+ // Msg json encoded message to be passed to the contract as sudo
+ bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ];
+}
+
+// ExecuteContractProposal gov proposal content type to call execute on a
+// contract.
+message ExecuteContractProposal {
+ // Title is a short summary
+ string title = 1;
+ // Description is a human readable text
+ string description = 2;
+ // RunAs is the address that is passed to the contract's environment as sender
+ string run_as = 3;
+ // Contract is the address of the smart contract
+ string contract = 4;
+ // Msg json encoded message to be passed to the contract as execute
+ bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ];
+ // Funds coins that are transferred to the contract on instantiation
+ repeated cosmos.base.v1beta1.Coin funds = 6 [
+ (gogoproto.nullable) = false,
+ (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
+ ];
+}
+
// UpdateAdminProposal gov proposal content type to set an admin for a contract.
message UpdateAdminProposal {
// Title is a short summary
diff --git a/x/wasm/Governance.md b/x/wasm/Governance.md
index 39295a0d7b8..f26c0c5a5a7 100644
--- a/x/wasm/Governance.md
+++ b/x/wasm/Governance.md
@@ -6,19 +6,20 @@ a high-level, technical introduction meant to provide context before
looking into the code, or constructing proposals.
## Proposal Types
-We have added 5 new wasm specific proposal types that cover the contract's live cycle and authorization:
+We have added 9 new wasm specific proposal types that cover the contract's live cycle and authorization:
* `StoreCodeProposal` - upload a wasm binary
* `InstantiateContractProposal` - instantiate a wasm contract
* `MigrateContractProposal` - migrate a wasm contract to a new code version
+* `SudoContractProposal` - call into the protected `sudo` entry point of a contract
+* `ExecuteContractProposal` - execute a wasm contract as an arbitrary user
* `UpdateAdminProposal` - set a new admin for a contract
* `ClearAdminProposal` - clear admin for a contract to prevent further migrations
+* `PinCodes` - pin the given code ids in cache. This trades memory for reduced startup time and lowers gas cost
+* `UnpinCodes` - unpin the given code ids from the cache. This frees up memory and returns to standard speed and gas cost
For details see the proposal type [implementation](https://github.com/CosmWasm/wasmd/blob/master/x/wasm/types/proposal.go)
-A wasm message but no proposal type:
-* `ExecuteContract` - execute a command on a wasm contract
-
### Unit tests
[Proposal type validations](https://github.com/CosmWasm/wasmd/blob/master/x/wasm/types/proposal_test.go)
diff --git a/x/wasm/client/cli/gov_tx.go b/x/wasm/client/cli/gov_tx.go
index 267342f714a..28f892ed1a0 100644
--- a/x/wasm/client/cli/gov_tx.go
+++ b/x/wasm/client/cli/gov_tx.go
@@ -181,10 +181,79 @@ func ProposalMigrateContractCmd() *cobra.Command {
return err
}
+ proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle)
+ if err != nil {
+ return fmt.Errorf("proposal title: %s", err)
+ }
+ proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription)
+ if err != nil {
+ return fmt.Errorf("proposal description: %s", err)
+ }
+ depositArg, err := cmd.Flags().GetString(cli.FlagDeposit)
+ if err != nil {
+ return err
+ }
+ deposit, err := sdk.ParseCoinsNormalized(depositArg)
+ if err != nil {
+ return err
+ }
+
+ content := types.MigrateContractProposal{
+ Title: proposalTitle,
+ Description: proposalDescr,
+ Contract: src.Contract,
+ CodeID: src.CodeID,
+ Msg: src.Msg,
+ }
+
+ msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ if err != nil {
+ return err
+ }
+ if err = msg.ValidateBasic(); err != nil {
+ return err
+ }
+
+ return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
+ },
+ }
+
+ // proposal flags
+ cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
+ cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
+ cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)")
+ // type values must match the "ProposalHandler" "routes" in cli
+ cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade")
+ return cmd
+}
+
+func ProposalExecuteContractCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "execute-contract [contract_addr_bech32] [json_encoded_migration_args]",
+ Short: "Submit a execute wasm contract proposal (run by any address)",
+ Args: cobra.ExactArgs(2),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientTxContext(cmd)
+ if err != nil {
+ return err
+ }
+
+ contract := args[0]
+ execMsg := []byte(args[1])
+ amountStr, err := cmd.Flags().GetString(flagAmount)
+ if err != nil {
+ return fmt.Errorf("amount: %s", err)
+ }
+ funds, err := sdk.ParseCoinsNormalized(amountStr)
+ if err != nil {
+ return fmt.Errorf("amount: %s", err)
+ }
runAs, err := cmd.Flags().GetString(flagRunAs)
if err != nil {
return fmt.Errorf("run-as: %s", err)
}
+
if len(runAs) == 0 {
return errors.New("run-as address is required")
}
@@ -205,13 +274,13 @@ func ProposalMigrateContractCmd() *cobra.Command {
return err
}
- content := types.MigrateContractProposal{
+ content := types.ExecuteContractProposal{
Title: proposalTitle,
Description: proposalDescr,
- Contract: src.Contract,
- CodeID: src.CodeID,
- Msg: src.Msg,
+ Contract: contract,
+ Msg: execMsg,
RunAs: runAs,
+ Funds: funds,
}
msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
@@ -226,6 +295,7 @@ func ProposalMigrateContractCmd() *cobra.Command {
},
}
cmd.Flags().String(flagRunAs, "", "The address that is passed as sender to the contract on proposal execution")
+ cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation")
// proposal flags
cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
@@ -237,6 +307,66 @@ func ProposalMigrateContractCmd() *cobra.Command {
return cmd
}
+func ProposalSudoContractCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "sudo-contract [contract_addr_bech32] [json_encoded_migration_args]",
+ Short: "Submit a sudo wasm contract proposal (to call privileged commands)",
+ Args: cobra.ExactArgs(2),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientTxContext(cmd)
+ if err != nil {
+ return err
+ }
+
+ contract := args[0]
+ sudoMsg := []byte(args[1])
+
+ proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle)
+ if err != nil {
+ return fmt.Errorf("proposal title: %s", err)
+ }
+ proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription)
+ if err != nil {
+ return fmt.Errorf("proposal description: %s", err)
+ }
+ depositArg, err := cmd.Flags().GetString(cli.FlagDeposit)
+ if err != nil {
+ return err
+ }
+ deposit, err := sdk.ParseCoinsNormalized(depositArg)
+ if err != nil {
+ return err
+ }
+
+ content := types.SudoContractProposal{
+ Title: proposalTitle,
+ Description: proposalDescr,
+ Contract: contract,
+ Msg: sudoMsg,
+ }
+
+ msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ if err != nil {
+ return err
+ }
+ if err = msg.ValidateBasic(); err != nil {
+ return err
+ }
+
+ return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
+ },
+ }
+
+ // proposal flagsExecute
+ cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
+ cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
+ cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)")
+ // type values must match the "ProposalHandler" "routes" in cli
+ cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade")
+ return cmd
+}
+
func ProposalUpdateContractAdminCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "set-contract-admin [contract_addr_bech32] [new_admin_addr_bech32]",
diff --git a/x/wasm/client/proposal_handler.go b/x/wasm/client/proposal_handler.go
index 02007a4edfd..ad3363ac7a1 100644
--- a/x/wasm/client/proposal_handler.go
+++ b/x/wasm/client/proposal_handler.go
@@ -12,6 +12,8 @@ var ProposalHandlers = []govclient.ProposalHandler{
govclient.NewProposalHandler(cli.ProposalStoreCodeCmd, rest.StoreCodeProposalHandler),
govclient.NewProposalHandler(cli.ProposalInstantiateContractCmd, rest.InstantiateProposalHandler),
govclient.NewProposalHandler(cli.ProposalMigrateContractCmd, rest.MigrateProposalHandler),
+ govclient.NewProposalHandler(cli.ProposalExecuteContractCmd, rest.ExecuteProposalHandler),
+ govclient.NewProposalHandler(cli.ProposalSudoContractCmd, rest.SudoProposalHandler),
govclient.NewProposalHandler(cli.ProposalUpdateContractAdminCmd, rest.UpdateContractAdminProposalHandler),
govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd, rest.ClearContractAdminProposalHandler),
govclient.NewProposalHandler(cli.ProposalPinCodesCmd, rest.PinCodeProposalHandler),
diff --git a/x/wasm/client/proposal_handler_test.go b/x/wasm/client/proposal_handler_test.go
index f433122dc8b..3e82c62e077 100644
--- a/x/wasm/client/proposal_handler_test.go
+++ b/x/wasm/client/proposal_handler_test.go
@@ -183,6 +183,76 @@ func TestGovRestHandlers(t *testing.T) {
},
expCode: http.StatusOK,
},
+ "execute contract": {
+ srcPath: "/gov/proposals/wasm_execute",
+ srcBody: dict{
+ "title": "Test Proposal",
+ "description": "My proposal",
+ "type": "migrate",
+ "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
+ "msg": dict{"foo": "bar"},
+ "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
+ "deposit": []dict{{"denom": "ustake", "amount": "10"}},
+ "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
+ "base_req": aBaseReq,
+ },
+ expCode: http.StatusOK,
+ },
+ "execute contract fails with no run_as": {
+ srcPath: "/gov/proposals/wasm_execute",
+ srcBody: dict{
+ "title": "Test Proposal",
+ "description": "My proposal",
+ "type": "migrate",
+ "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
+ "msg": dict{"foo": "bar"},
+ "deposit": []dict{{"denom": "ustake", "amount": "10"}},
+ "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
+ "base_req": aBaseReq,
+ },
+ expCode: http.StatusBadRequest,
+ },
+ "execute contract fails with no message": {
+ srcPath: "/gov/proposals/wasm_execute",
+ srcBody: dict{
+ "title": "Test Proposal",
+ "description": "My proposal",
+ "type": "migrate",
+ "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
+ "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
+ "deposit": []dict{{"denom": "ustake", "amount": "10"}},
+ "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
+ "base_req": aBaseReq,
+ },
+ expCode: http.StatusBadRequest,
+ },
+ "sudo contract": {
+ srcPath: "/gov/proposals/wasm_sudo",
+ srcBody: dict{
+ "title": "Test Proposal",
+ "description": "My proposal",
+ "type": "migrate",
+ "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
+ "msg": dict{"foo": "bar"},
+ "deposit": []dict{{"denom": "ustake", "amount": "10"}},
+ "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
+ "base_req": aBaseReq,
+ },
+ expCode: http.StatusOK,
+ },
+ "sudo contract fails with no message": {
+ srcPath: "/gov/proposals/wasm_sudo",
+ srcBody: dict{
+ "title": "Test Proposal",
+ "description": "My proposal",
+ "type": "migrate",
+ "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
+ "deposit": []dict{{"denom": "ustake", "amount": "10"}},
+ "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
+ "base_req": aBaseReq,
+ },
+ expCode: http.StatusBadRequest,
+ },
"update contract admin": {
srcPath: "/gov/proposals/wasm_update_admin",
srcBody: dict{
diff --git a/x/wasm/client/rest/gov.go b/x/wasm/client/rest/gov.go
index 05b22d4554d..5178b29852d 100644
--- a/x/wasm/client/rest/gov.go
+++ b/x/wasm/client/rest/gov.go
@@ -126,8 +126,6 @@ type MigrateProposalJSONReq struct {
Contract string `json:"contract" yaml:"contract"`
Code uint64 `json:"code_id" yaml:"code_id"`
Msg json.RawMessage `json:"msg" yaml:"msg"`
- // RunAs is the role that is passed to the contract's environment
- RunAs string `json:"run_as" yaml:"run_as"`
}
func (s MigrateProposalJSONReq) Content() govtypes.Content {
@@ -137,7 +135,6 @@ func (s MigrateProposalJSONReq) Content() govtypes.Content {
Contract: s.Contract,
CodeID: s.Code,
Msg: types.RawContractMessage(s.Msg),
- RunAs: s.RunAs,
}
}
func (s MigrateProposalJSONReq) GetProposer() string {
@@ -162,6 +159,97 @@ func MigrateProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
}
}
+type ExecuteProposalJSONReq struct {
+ BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
+
+ Title string `json:"title" yaml:"title"`
+ Description string `json:"description" yaml:"description"`
+
+ Proposer string `json:"proposer" yaml:"proposer"`
+ Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
+
+ Contract string `json:"contract" yaml:"contract"`
+ Msg json.RawMessage `json:"msg" yaml:"msg"`
+ // RunAs is the role that is passed to the contract's environment
+ RunAs string `json:"run_as" yaml:"run_as"`
+ Funds sdk.Coins `json:"funds" yaml:"funds"`
+}
+
+func (s ExecuteProposalJSONReq) Content() govtypes.Content {
+ return &types.ExecuteContractProposal{
+ Title: s.Title,
+ Description: s.Description,
+ Contract: s.Contract,
+ Msg: types.RawContractMessage(s.Msg),
+ RunAs: s.RunAs,
+ Funds: s.Funds,
+ }
+}
+func (s ExecuteProposalJSONReq) GetProposer() string {
+ return s.Proposer
+}
+func (s ExecuteProposalJSONReq) GetDeposit() sdk.Coins {
+ return s.Deposit
+}
+func (s ExecuteProposalJSONReq) GetBaseReq() rest.BaseReq {
+ return s.BaseReq
+}
+func ExecuteProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
+ return govrest.ProposalRESTHandler{
+ SubRoute: "wasm_execute",
+ Handler: func(w http.ResponseWriter, r *http.Request) {
+ var req ExecuteProposalJSONReq
+ if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
+ return
+ }
+ toStdTxResponse(cliCtx, w, req)
+ },
+ }
+}
+
+type SudoProposalJSONReq struct {
+ BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
+
+ Title string `json:"title" yaml:"title"`
+ Description string `json:"description" yaml:"description"`
+
+ Proposer string `json:"proposer" yaml:"proposer"`
+ Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
+
+ Contract string `json:"contract" yaml:"contract"`
+ Msg json.RawMessage `json:"msg" yaml:"msg"`
+}
+
+func (s SudoProposalJSONReq) Content() govtypes.Content {
+ return &types.SudoContractProposal{
+ Title: s.Title,
+ Description: s.Description,
+ Contract: s.Contract,
+ Msg: types.RawContractMessage(s.Msg),
+ }
+}
+func (s SudoProposalJSONReq) GetProposer() string {
+ return s.Proposer
+}
+func (s SudoProposalJSONReq) GetDeposit() sdk.Coins {
+ return s.Deposit
+}
+func (s SudoProposalJSONReq) GetBaseReq() rest.BaseReq {
+ return s.BaseReq
+}
+func SudoProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
+ return govrest.ProposalRESTHandler{
+ SubRoute: "wasm_sudo",
+ Handler: func(w http.ResponseWriter, r *http.Request) {
+ var req SudoProposalJSONReq
+ if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
+ return
+ }
+ toStdTxResponse(cliCtx, w, req)
+ },
+ }
+}
+
type UpdateAdminJSONReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
diff --git a/x/wasm/keeper/contract_keeper.go b/x/wasm/keeper/contract_keeper.go
index cd84c97da2d..ffdcc918950 100644
--- a/x/wasm/keeper/contract_keeper.go
+++ b/x/wasm/keeper/contract_keeper.go
@@ -17,6 +17,7 @@ type decoratedKeeper interface {
pinCode(ctx sdk.Context, codeID uint64) error
unpinCode(ctx sdk.Context, codeID uint64) error
execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error)
+ Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
setContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra types.ContractInfoExtension) error
}
@@ -53,6 +54,10 @@ func (p PermissionedKeeper) Migrate(ctx sdk.Context, contractAddress sdk.AccAddr
return p.nested.migrate(ctx, contractAddress, caller, newCodeID, msg, p.authZPolicy)
}
+func (p PermissionedKeeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) {
+ return p.nested.Sudo(ctx, contractAddress, msg)
+}
+
func (p PermissionedKeeper) UpdateContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newAdmin sdk.AccAddress) error {
return p.nested.setContractAdmin(ctx, contractAddress, caller, newAdmin, p.authZPolicy)
}
diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go
index 5980782eeca..b56faa16380 100644
--- a/x/wasm/keeper/keeper.go
+++ b/x/wasm/keeper/keeper.go
@@ -438,9 +438,9 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller
return data, nil
}
-// Sudo allows priviledged access to a contract. This can never be called by governance or external tx, but only by
-// another native Go module directly. Thus, the keeper doesn't place any access controls on it, that is the
-// responsibility or the app developer (who passes the wasm.Keeper in app.go)
+// Sudo allows priviledged access to a contract. This can never be called by an external tx, but only by
+// another native Go module directly, or on-chain governance (if sudo proposals are enabled). Thus, the keeper doesn't
+// place any access controls on it, that is the responsibility or the app developer (who passes the wasm.Keeper in app.go)
func (k Keeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) {
defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "sudo")
contractInfo, codeInfo, prefixStore, err := k.contractInstance(ctx, contractAddress)
diff --git a/x/wasm/keeper/proposal_handler.go b/x/wasm/keeper/proposal_handler.go
index 4076540fa17..79f6a9fc30b 100644
--- a/x/wasm/keeper/proposal_handler.go
+++ b/x/wasm/keeper/proposal_handler.go
@@ -35,6 +35,10 @@ func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []t
return handleInstantiateProposal(ctx, k, *c)
case *types.MigrateContractProposal:
return handleMigrateProposal(ctx, k, *c)
+ case *types.SudoContractProposal:
+ return handleSudoProposal(ctx, k, *c)
+ case *types.ExecuteContractProposal:
+ return handleExecuteProposal(ctx, k, *c)
case *types.UpdateAdminProposal:
return handleUpdateAdminProposal(ctx, k, *c)
case *types.ClearAdminProposal:
@@ -95,6 +99,52 @@ func handleMigrateProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.M
return err
}
+ contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
+ if err != nil {
+ return sdkerrors.Wrap(err, "contract")
+ }
+ if err != nil {
+ return sdkerrors.Wrap(err, "run as address")
+ }
+ // runAs is not used if this is permissioned, so just put any valid address there (second contractAddr)
+ data, err := k.Migrate(ctx, contractAddr, contractAddr, p.CodeID, p.Msg)
+ if err != nil {
+ return err
+ }
+
+ ctx.EventManager().EmitEvent(sdk.NewEvent(
+ types.EventTypeGovContractResult,
+ sdk.NewAttribute(types.AttributeKeyResultDataHex, hex.EncodeToString(data)),
+ ))
+ return nil
+}
+
+func handleSudoProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.SudoContractProposal) error {
+ if err := p.ValidateBasic(); err != nil {
+ return err
+ }
+
+ contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
+ if err != nil {
+ return sdkerrors.Wrap(err, "contract")
+ }
+ data, err := k.Sudo(ctx, contractAddr, p.Msg)
+ if err != nil {
+ return err
+ }
+
+ ctx.EventManager().EmitEvent(sdk.NewEvent(
+ types.EventTypeGovContractResult,
+ sdk.NewAttribute(types.AttributeKeyResultDataHex, hex.EncodeToString(data)),
+ ))
+ return nil
+}
+
+func handleExecuteProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.ExecuteContractProposal) error {
+ if err := p.ValidateBasic(); err != nil {
+ return err
+ }
+
contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
if err != nil {
return sdkerrors.Wrap(err, "contract")
@@ -103,7 +153,7 @@ func handleMigrateProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.M
if err != nil {
return sdkerrors.Wrap(err, "run as address")
}
- data, err := k.Migrate(ctx, contractAddr, runAsAddr, p.CodeID, p.Msg)
+ data, err := k.Execute(ctx, contractAddr, runAsAddr, p.Msg, p.Funds)
if err != nil {
return err
}
diff --git a/x/wasm/keeper/proposal_integration_test.go b/x/wasm/keeper/proposal_integration_test.go
index 9338c1dc80c..a943003e551 100644
--- a/x/wasm/keeper/proposal_integration_test.go
+++ b/x/wasm/keeper/proposal_integration_test.go
@@ -166,7 +166,6 @@ func TestMigrateProposal(t *testing.T) {
CodeID: 2,
Contract: contractAddr.String(),
Msg: migMsgBz,
- RunAs: otherAddress.String(),
}
em := sdk.NewEventManager()
@@ -206,6 +205,119 @@ func TestMigrateProposal(t *testing.T) {
assert.Equal(t, types.AttributeKeyResultDataHex, string(em.Events()[1].Attributes[0].Key))
}
+func TestExecuteProposal(t *testing.T) {
+ ctx, keepers := CreateTestInput(t, false, "staking")
+ govKeeper, bankKeeper := keepers.GovKeeper, keepers.BankKeeper
+
+ exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers)
+ contractAddr := exampleContract.Contract
+
+ // check balance
+ bal := bankKeeper.GetBalance(ctx, contractAddr, "denom")
+ require.Equal(t, bal.Amount, sdk.NewInt(100))
+
+ releaseMsg := struct {
+ Release struct{} `json:"release"`
+ }{}
+ releaseMsgBz, err := json.Marshal(releaseMsg)
+ require.NoError(t, err)
+
+ // try with runAs that doesn't have pemission
+ badSrc := types.ExecuteContractProposal{
+ Title: "First",
+ Description: "Beneficiary has no permission to run",
+ Contract: contractAddr.String(),
+ Msg: releaseMsgBz,
+ RunAs: exampleContract.BeneficiaryAddr.String(),
+ }
+
+ em := sdk.NewEventManager()
+
+ // fails on store - this doesn't have permission
+ storedProposal, err := govKeeper.SubmitProposal(ctx, &badSrc)
+ require.Error(t, err)
+ // balance should not change
+ bal = bankKeeper.GetBalance(ctx, contractAddr, "denom")
+ require.Equal(t, bal.Amount, sdk.NewInt(100))
+
+ // try again with the proper run-as
+ src := types.ExecuteContractProposal{
+ Title: "Second",
+ Description: "Verifier can execute",
+ Contract: contractAddr.String(),
+ Msg: releaseMsgBz,
+ RunAs: exampleContract.VerifierAddr.String(),
+ }
+
+ em = sdk.NewEventManager()
+
+ // when stored
+ storedProposal, err = govKeeper.SubmitProposal(ctx, &src)
+ require.NoError(t, err)
+
+ // and proposal execute
+ handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
+ err = handler(ctx.WithEventManager(em), storedProposal.GetContent())
+ require.NoError(t, err)
+
+ // balance should be empty (proper release)
+ bal = bankKeeper.GetBalance(ctx, contractAddr, "denom")
+ require.Equal(t, bal.Amount, sdk.NewInt(0))
+}
+
+func TestSudoProposal(t *testing.T) {
+ ctx, keepers := CreateTestInput(t, false, "staking")
+ govKeeper, bankKeeper := keepers.GovKeeper, keepers.BankKeeper
+
+ exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers)
+ contractAddr := exampleContract.Contract
+ _, _, anyAddr := keyPubAddr()
+
+ // check balance
+ bal := bankKeeper.GetBalance(ctx, contractAddr, "denom")
+ require.Equal(t, bal.Amount, sdk.NewInt(100))
+ bal = bankKeeper.GetBalance(ctx, anyAddr, "denom")
+ require.Equal(t, bal.Amount, sdk.NewInt(0))
+
+ type StealMsg struct {
+ Recipient string `json:"recipient"`
+ Amount []sdk.Coin `json:"amount"`
+ }
+ stealMsg := struct {
+ Steal StealMsg `json:"steal_funds"`
+ }{Steal: StealMsg{
+ Recipient: anyAddr.String(),
+ Amount: []sdk.Coin{sdk.NewInt64Coin("denom", 75)},
+ }}
+ stealMsgBz, err := json.Marshal(stealMsg)
+ require.NoError(t, err)
+
+ // sudo can do anything
+ src := types.SudoContractProposal{
+ Title: "Sudo",
+ Description: "Steal funds for the verifier",
+ Contract: contractAddr.String(),
+ Msg: stealMsgBz,
+ }
+
+ em := sdk.NewEventManager()
+
+ // when stored
+ storedProposal, err := govKeeper.SubmitProposal(ctx, &src)
+ require.NoError(t, err)
+
+ // and proposal execute
+ handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
+ err = handler(ctx.WithEventManager(em), storedProposal.GetContent())
+ require.NoError(t, err)
+
+ // balance should be empty (and verifier richer)
+ bal = bankKeeper.GetBalance(ctx, contractAddr, "denom")
+ require.Equal(t, bal.Amount, sdk.NewInt(25))
+ bal = bankKeeper.GetBalance(ctx, anyAddr, "denom")
+ require.Equal(t, bal.Amount, sdk.NewInt(75))
+}
+
func TestAdminProposals(t *testing.T) {
var (
otherAddress sdk.AccAddress = bytes.Repeat([]byte{0x2}, types.ContractAddrLen)
diff --git a/x/wasm/types/exported_keepers.go b/x/wasm/types/exported_keepers.go
index 02f227648b3..525d2194048 100644
--- a/x/wasm/types/exported_keepers.go
+++ b/x/wasm/types/exported_keepers.go
@@ -36,6 +36,9 @@ type ContractOpsKeeper interface {
// Migrate allows to upgrade a contract to a new code with data migration.
Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte) ([]byte, error)
+ // Sudo allows to call privileged entry point of a contract.
+ Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
+
// UpdateContractAdmin sets the admin value on the ContractInfo. It must be a valid address (use ClearContractAdmin to remove it)
UpdateContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newAdmin sdk.AccAddress) error
diff --git a/x/wasm/types/genesis.pb.go b/x/wasm/types/genesis.pb.go
index 14fb3e7fd03..0c5096e4211 100644
--- a/x/wasm/types/genesis.pb.go
+++ b/x/wasm/types/genesis.pb.go
@@ -5,12 +5,11 @@ package types
import (
fmt "fmt"
+ _ "github.com/gogo/protobuf/gogoproto"
+ proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
-
- _ "github.com/gogo/protobuf/gogoproto"
- proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/x/wasm/types/ibc.pb.go b/x/wasm/types/ibc.pb.go
index d9f4a3809a8..ac6c9f0060d 100644
--- a/x/wasm/types/ibc.pb.go
+++ b/x/wasm/types/ibc.pb.go
@@ -5,12 +5,11 @@ package types
import (
fmt "fmt"
+ _ "github.com/gogo/protobuf/gogoproto"
+ proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
-
- _ "github.com/gogo/protobuf/gogoproto"
- proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/x/wasm/types/proposal.go b/x/wasm/types/proposal.go
index c3fc543ed90..710193753b3 100644
--- a/x/wasm/types/proposal.go
+++ b/x/wasm/types/proposal.go
@@ -16,6 +16,8 @@ const (
ProposalTypeStoreCode ProposalType = "StoreCode"
ProposalTypeInstantiateContract ProposalType = "InstantiateContract"
ProposalTypeMigrateContract ProposalType = "MigrateContract"
+ ProposalTypeSudoContract ProposalType = "SudoContract"
+ ProposalTypeExecuteContract ProposalType = "ExecuteContract"
ProposalTypeUpdateAdmin ProposalType = "UpdateAdmin"
ProposalTypeClearAdmin ProposalType = "ClearAdmin"
ProposalTypePinCodes ProposalType = "PinCodes"
@@ -30,6 +32,8 @@ var EnableAllProposals = []ProposalType{
ProposalTypeStoreCode,
ProposalTypeInstantiateContract,
ProposalTypeMigrateContract,
+ ProposalTypeSudoContract,
+ ProposalTypeExecuteContract,
ProposalTypeUpdateAdmin,
ProposalTypeClearAdmin,
ProposalTypePinCodes,
@@ -58,6 +62,8 @@ func init() { // register new content types with the sdk
govtypes.RegisterProposalType(string(ProposalTypeStoreCode))
govtypes.RegisterProposalType(string(ProposalTypeInstantiateContract))
govtypes.RegisterProposalType(string(ProposalTypeMigrateContract))
+ govtypes.RegisterProposalType(string(ProposalTypeSudoContract))
+ govtypes.RegisterProposalType(string(ProposalTypeExecuteContract))
govtypes.RegisterProposalType(string(ProposalTypeUpdateAdmin))
govtypes.RegisterProposalType(string(ProposalTypeClearAdmin))
govtypes.RegisterProposalType(string(ProposalTypePinCodes))
@@ -65,6 +71,8 @@ func init() { // register new content types with the sdk
govtypes.RegisterProposalTypeCodec(&StoreCodeProposal{}, "wasm/StoreCodeProposal")
govtypes.RegisterProposalTypeCodec(&InstantiateContractProposal{}, "wasm/InstantiateContractProposal")
govtypes.RegisterProposalTypeCodec(&MigrateContractProposal{}, "wasm/MigrateContractProposal")
+ govtypes.RegisterProposalTypeCodec(&SudoContractProposal{}, "wasm/SudoContractProposal")
+ govtypes.RegisterProposalTypeCodec(&ExecuteContractProposal{}, "wasm/ExecuteContractProposal")
govtypes.RegisterProposalTypeCodec(&UpdateAdminProposal{}, "wasm/UpdateAdminProposal")
govtypes.RegisterProposalTypeCodec(&ClearAdminProposal{}, "wasm/ClearAdminProposal")
govtypes.RegisterProposalTypeCodec(&PinCodesProposal{}, "wasm/PinCodesProposal")
@@ -237,9 +245,6 @@ func (p MigrateContractProposal) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
return sdkerrors.Wrap(err, "contract")
}
- if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
- return sdkerrors.Wrap(err, "run as")
- }
if err := p.Msg.ValidateBasic(); err != nil {
return sdkerrors.Wrap(err, "payload msg")
}
@@ -253,9 +258,8 @@ func (p MigrateContractProposal) String() string {
Description: %s
Contract: %s
Code id: %d
- Run as: %s
Msg %q
-`, p.Title, p.Description, p.Contract, p.CodeID, p.RunAs, p.Msg)
+`, p.Title, p.Description, p.Contract, p.CodeID, p.Msg)
}
// MarshalYAML pretty prints the migrate message
@@ -266,14 +270,126 @@ func (p MigrateContractProposal) MarshalYAML() (interface{}, error) {
Contract string `yaml:"contract"`
CodeID uint64 `yaml:"code_id"`
Msg string `yaml:"msg"`
- RunAs string `yaml:"run_as"`
}{
Title: p.Title,
Description: p.Description,
Contract: p.Contract,
CodeID: p.CodeID,
Msg: string(p.Msg),
+ }, nil
+}
+
+// ProposalRoute returns the routing key of a parameter change proposal.
+func (p SudoContractProposal) ProposalRoute() string { return RouterKey }
+
+// GetTitle returns the title of the proposal
+func (p *SudoContractProposal) GetTitle() string { return p.Title }
+
+// GetDescription returns the human readable description of the proposal
+func (p SudoContractProposal) GetDescription() string { return p.Description }
+
+// ProposalType returns the type
+func (p SudoContractProposal) ProposalType() string { return string(ProposalTypeSudoContract) }
+
+// ValidateBasic validates the proposal
+func (p SudoContractProposal) ValidateBasic() error {
+ if err := validateProposalCommons(p.Title, p.Description); err != nil {
+ return err
+ }
+ if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
+ return sdkerrors.Wrap(err, "contract")
+ }
+ if err := p.Msg.ValidateBasic(); err != nil {
+ return sdkerrors.Wrap(err, "payload msg")
+ }
+ return nil
+}
+
+// String implements the Stringer interface.
+func (p SudoContractProposal) String() string {
+ return fmt.Sprintf(`Migrate Contract Proposal:
+ Title: %s
+ Description: %s
+ Contract: %s
+ Msg %q
+`, p.Title, p.Description, p.Contract, p.Msg)
+}
+
+// MarshalYAML pretty prints the migrate message
+func (p SudoContractProposal) MarshalYAML() (interface{}, error) {
+ return struct {
+ Title string `yaml:"title"`
+ Description string `yaml:"description"`
+ Contract string `yaml:"contract"`
+ Msg string `yaml:"msg"`
+ }{
+ Title: p.Title,
+ Description: p.Description,
+ Contract: p.Contract,
+ Msg: string(p.Msg),
+ }, nil
+}
+
+// ProposalRoute returns the routing key of a parameter change proposal.
+func (p ExecuteContractProposal) ProposalRoute() string { return RouterKey }
+
+// GetTitle returns the title of the proposal
+func (p *ExecuteContractProposal) GetTitle() string { return p.Title }
+
+// GetDescription returns the human readable description of the proposal
+func (p ExecuteContractProposal) GetDescription() string { return p.Description }
+
+// ProposalType returns the type
+func (p ExecuteContractProposal) ProposalType() string { return string(ProposalTypeExecuteContract) }
+
+// ValidateBasic validates the proposal
+func (p ExecuteContractProposal) ValidateBasic() error {
+ if err := validateProposalCommons(p.Title, p.Description); err != nil {
+ return err
+ }
+ if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
+ return sdkerrors.Wrap(err, "contract")
+ }
+ if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
+ return sdkerrors.Wrap(err, "run as")
+ }
+ if !p.Funds.IsValid() {
+ return sdkerrors.ErrInvalidCoins
+ }
+ if err := p.Msg.ValidateBasic(); err != nil {
+ return sdkerrors.Wrap(err, "payload msg")
+ }
+ return nil
+}
+
+// String implements the Stringer interface.
+func (p ExecuteContractProposal) String() string {
+ return fmt.Sprintf(`Migrate Contract Proposal:
+ Title: %s
+ Description: %s
+ Contract: %s
+ Run as: %s
+ Msg: %q
+ Funds: %s
+`, p.Title, p.Description, p.Contract, p.RunAs, p.Msg, p.Funds)
+}
+
+// MarshalYAML pretty prints the migrate message
+func (p ExecuteContractProposal) MarshalYAML() (interface{}, error) {
+ return struct {
+ Title string `yaml:"title"`
+ Description string `yaml:"description"`
+ Contract string `yaml:"contract"`
+ Msg string `yaml:"msg"`
+ RunAs string `yaml:"run_as"`
+ Funds sdk.Coins `yaml:"funds"`
+ }{
+ Title: p.Title,
+ Description: p.Description,
+ Contract: p.Contract,
+ Msg: string(p.Msg),
RunAs: p.RunAs,
+ Funds: p.Funds,
}, nil
}
diff --git a/x/wasm/types/proposal.pb.go b/x/wasm/types/proposal.pb.go
index 53dd2c1fdf7..2f075be4c6c 100644
--- a/x/wasm/types/proposal.pb.go
+++ b/x/wasm/types/proposal.pb.go
@@ -6,14 +6,13 @@ package types
import (
bytes "bytes"
fmt "fmt"
- io "io"
- math "math"
- math_bits "math/bits"
-
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
+ io "io"
+ math "math"
+ math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -132,11 +131,9 @@ type MigrateContractProposal struct {
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
// Description is a human readable text
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
- // RunAs is the address that is passed to the contract's environment as sender
- RunAs string `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3" json:"run_as,omitempty"`
// Contract is the address of the smart contract
Contract string `protobuf:"bytes,4,opt,name=contract,proto3" json:"contract,omitempty"`
- // CodeID references the new WASM code
+ // CodeID references the new WASM codesudo
CodeID uint64 `protobuf:"varint,5,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
// Msg json encoded message to be passed to the contract on migration
Msg RawContractMessage `protobuf:"bytes,6,opt,name=msg,proto3,casttype=RawContractMessage" json:"msg,omitempty"`
@@ -174,6 +171,99 @@ func (m *MigrateContractProposal) XXX_DiscardUnknown() {
var xxx_messageInfo_MigrateContractProposal proto.InternalMessageInfo
+// SudoContractProposal gov proposal content type to call sudo on a contract.
+type SudoContractProposal struct {
+ // Title is a short summary
+ Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
+ // Description is a human readable text
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ // Contract is the address of the smart contract
+ Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"`
+ // Msg json encoded message to be passed to the contract as sudo
+ Msg RawContractMessage `protobuf:"bytes,4,opt,name=msg,proto3,casttype=RawContractMessage" json:"msg,omitempty"`
+}
+
+func (m *SudoContractProposal) Reset() { *m = SudoContractProposal{} }
+func (*SudoContractProposal) ProtoMessage() {}
+func (*SudoContractProposal) Descriptor() ([]byte, []int) {
+ return fileDescriptor_be6422d717c730cb, []int{3}
+}
+func (m *SudoContractProposal) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *SudoContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_SudoContractProposal.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *SudoContractProposal) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_SudoContractProposal.Merge(m, src)
+}
+func (m *SudoContractProposal) XXX_Size() int {
+ return m.Size()
+}
+func (m *SudoContractProposal) XXX_DiscardUnknown() {
+ xxx_messageInfo_SudoContractProposal.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SudoContractProposal proto.InternalMessageInfo
+
+// ExecuteContractProposal gov proposal content type to call execute on a
+// contract.
+type ExecuteContractProposal struct {
+ // Title is a short summary
+ Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
+ // Description is a human readable text
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ // RunAs is the address that is passed to the contract's environment as sender
+ RunAs string `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3" json:"run_as,omitempty"`
+ // Contract is the address of the smart contract
+ Contract string `protobuf:"bytes,4,opt,name=contract,proto3" json:"contract,omitempty"`
+ // Msg json encoded message to be passed to the contract as execute
+ Msg RawContractMessage `protobuf:"bytes,5,opt,name=msg,proto3,casttype=RawContractMessage" json:"msg,omitempty"`
+ // Funds coins that are transferred to the contract on instantiation
+ Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"`
+}
+
+func (m *ExecuteContractProposal) Reset() { *m = ExecuteContractProposal{} }
+func (*ExecuteContractProposal) ProtoMessage() {}
+func (*ExecuteContractProposal) Descriptor() ([]byte, []int) {
+ return fileDescriptor_be6422d717c730cb, []int{4}
+}
+func (m *ExecuteContractProposal) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *ExecuteContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_ExecuteContractProposal.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *ExecuteContractProposal) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ExecuteContractProposal.Merge(m, src)
+}
+func (m *ExecuteContractProposal) XXX_Size() int {
+ return m.Size()
+}
+func (m *ExecuteContractProposal) XXX_DiscardUnknown() {
+ xxx_messageInfo_ExecuteContractProposal.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ExecuteContractProposal proto.InternalMessageInfo
+
// UpdateAdminProposal gov proposal content type to set an admin for a contract.
type UpdateAdminProposal struct {
// Title is a short summary
@@ -189,7 +279,7 @@ type UpdateAdminProposal struct {
func (m *UpdateAdminProposal) Reset() { *m = UpdateAdminProposal{} }
func (*UpdateAdminProposal) ProtoMessage() {}
func (*UpdateAdminProposal) Descriptor() ([]byte, []int) {
- return fileDescriptor_be6422d717c730cb, []int{3}
+ return fileDescriptor_be6422d717c730cb, []int{5}
}
func (m *UpdateAdminProposal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -232,7 +322,7 @@ type ClearAdminProposal struct {
func (m *ClearAdminProposal) Reset() { *m = ClearAdminProposal{} }
func (*ClearAdminProposal) ProtoMessage() {}
func (*ClearAdminProposal) Descriptor() ([]byte, []int) {
- return fileDescriptor_be6422d717c730cb, []int{4}
+ return fileDescriptor_be6422d717c730cb, []int{6}
}
func (m *ClearAdminProposal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -275,7 +365,7 @@ type PinCodesProposal struct {
func (m *PinCodesProposal) Reset() { *m = PinCodesProposal{} }
func (*PinCodesProposal) ProtoMessage() {}
func (*PinCodesProposal) Descriptor() ([]byte, []int) {
- return fileDescriptor_be6422d717c730cb, []int{5}
+ return fileDescriptor_be6422d717c730cb, []int{7}
}
func (m *PinCodesProposal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -318,7 +408,7 @@ type UnpinCodesProposal struct {
func (m *UnpinCodesProposal) Reset() { *m = UnpinCodesProposal{} }
func (*UnpinCodesProposal) ProtoMessage() {}
func (*UnpinCodesProposal) Descriptor() ([]byte, []int) {
- return fileDescriptor_be6422d717c730cb, []int{6}
+ return fileDescriptor_be6422d717c730cb, []int{8}
}
func (m *UnpinCodesProposal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -351,6 +441,8 @@ func init() {
proto.RegisterType((*StoreCodeProposal)(nil), "cosmwasm.wasm.v1.StoreCodeProposal")
proto.RegisterType((*InstantiateContractProposal)(nil), "cosmwasm.wasm.v1.InstantiateContractProposal")
proto.RegisterType((*MigrateContractProposal)(nil), "cosmwasm.wasm.v1.MigrateContractProposal")
+ proto.RegisterType((*SudoContractProposal)(nil), "cosmwasm.wasm.v1.SudoContractProposal")
+ proto.RegisterType((*ExecuteContractProposal)(nil), "cosmwasm.wasm.v1.ExecuteContractProposal")
proto.RegisterType((*UpdateAdminProposal)(nil), "cosmwasm.wasm.v1.UpdateAdminProposal")
proto.RegisterType((*ClearAdminProposal)(nil), "cosmwasm.wasm.v1.ClearAdminProposal")
proto.RegisterType((*PinCodesProposal)(nil), "cosmwasm.wasm.v1.PinCodesProposal")
@@ -360,51 +452,54 @@ func init() {
func init() { proto.RegisterFile("cosmwasm/wasm/v1/proposal.proto", fileDescriptor_be6422d717c730cb) }
var fileDescriptor_be6422d717c730cb = []byte{
- // 698 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcd, 0x6e, 0xd3, 0x4a,
- 0x14, 0x8e, 0x9b, 0xc4, 0x49, 0xa7, 0xd1, 0xbd, 0xb9, 0xbe, 0x69, 0x6f, 0x6e, 0x41, 0x76, 0x64,
- 0xa4, 0xca, 0x1b, 0x6c, 0x52, 0x24, 0x04, 0xec, 0xe2, 0xb0, 0x69, 0x45, 0xa5, 0xca, 0x55, 0x55,
- 0x89, 0x4d, 0x34, 0xb1, 0xa7, 0xa9, 0x45, 0x3c, 0x63, 0x79, 0x26, 0x0d, 0x79, 0x0b, 0x1e, 0x80,
- 0x07, 0x40, 0x6c, 0x10, 0x6f, 0x51, 0xb1, 0xaa, 0xc4, 0xa6, 0x2b, 0x43, 0xdd, 0x37, 0xc8, 0x12,
- 0x09, 0x09, 0xcd, 0x8c, 0x13, 0xd2, 0x82, 0x00, 0x89, 0x1f, 0x89, 0xcd, 0xd8, 0x67,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5d, 0x39,
- 0xc9, 0x74, 0xe5, 0x34, 0xd3, 0x95, 0x77, 0x99, 0xae, 0x3c, 0xbd, 0xd0, 0x0b, 0xa7, 0x17, 0x7a,
- 0xe1, 0xec, 0x42, 0x2f, 0x3c, 0xda, 0x58, 0xb8, 0x9b, 0x5d, 0x42, 0xa3, 0x83, 0xd9, 0x03, 0x1f,
- 0x38, 0x4f, 0xe4, 0x43, 0x2f, 0xee, 0x67, 0x5f, 0x15, 0xcf, 0xfc, 0xed, 0x8f, 0x01, 0x00, 0x00,
- 0xff, 0xff, 0x9a, 0x01, 0xce, 0x1b, 0x6f, 0x06, 0x00, 0x00,
+ // 737 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xc1, 0x6e, 0xd3, 0x4a,
+ 0x14, 0x8d, 0x9b, 0xc4, 0x49, 0xa7, 0xd1, 0x7b, 0x79, 0x7e, 0x69, 0x1b, 0x0a, 0xb2, 0x23, 0x23,
+ 0x55, 0xde, 0x60, 0x93, 0x22, 0x21, 0x60, 0x17, 0x07, 0x16, 0xad, 0xa8, 0x54, 0xb9, 0xaa, 0x2a,
+ 0xb1, 0x89, 0x26, 0xf6, 0x34, 0xb5, 0x88, 0x67, 0x2c, 0xcf, 0xa4, 0x69, 0xfe, 0x02, 0x24, 0x96,
+ 0x7c, 0x00, 0x62, 0x83, 0xd8, 0xf3, 0x01, 0x15, 0xab, 0x2e, 0xbb, 0x32, 0x34, 0xfd, 0x83, 0x2c,
+ 0x91, 0x90, 0xd0, 0x78, 0x9c, 0x90, 0x16, 0xd4, 0x82, 0x68, 0x16, 0x6c, 0x9c, 0x5c, 0xdf, 0x73,
+ 0xe7, 0x1c, 0x1f, 0x9d, 0xab, 0x01, 0x9a, 0x4b, 0x68, 0xd0, 0x87, 0x34, 0xb0, 0x92, 0xc7, 0x41,
+ 0xdd, 0x0a, 0x23, 0x12, 0x12, 0x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
+ 0xa4, 0xfa, 0x7b, 0x09, 0x28, 0x3b, 0x38, 0xfc, 0x9b, 0x34, 0xdb, 0x4f, 0x8f, 0x4e, 0xd5, 0xcc,
+ 0xc9, 0xa9, 0x9a, 0x79, 0x33, 0x54, 0xa5, 0xa3, 0xa1, 0x2a, 0x1d, 0x0f, 0x55, 0xe9, 0xf3, 0x50,
+ 0x95, 0x5e, 0x9c, 0xa9, 0x99, 0xe3, 0x33, 0x35, 0x73, 0x72, 0xa6, 0x66, 0x9e, 0xad, 0x4e, 0xa5,
+ 0xb8, 0x49, 0x68, 0xb0, 0x3b, 0xbe, 0x74, 0x3d, 0xeb, 0x50, 0x5c, 0xbe, 0x49, 0x92, 0xdb, 0x72,
+ 0x72, 0xf5, 0xde, 0xfb, 0x16, 0x00, 0x00, 0xff, 0xff, 0x51, 0xe8, 0xe8, 0x8c, 0x03, 0x08, 0x00,
+ 0x00,
}
func (this *StoreCodeProposal) Equal(that interface{}) bool {
@@ -518,18 +613,92 @@ func (this *MigrateContractProposal) Equal(that interface{}) bool {
if this.Description != that1.Description {
return false
}
- if this.RunAs != that1.RunAs {
+ if this.Contract != that1.Contract {
+ return false
+ }
+ if this.CodeID != that1.CodeID {
+ return false
+ }
+ if !bytes.Equal(this.Msg, that1.Msg) {
+ return false
+ }
+ return true
+}
+func (this *SudoContractProposal) Equal(that interface{}) bool {
+ if that == nil {
+ return this == nil
+ }
+
+ that1, ok := that.(*SudoContractProposal)
+ if !ok {
+ that2, ok := that.(SudoContractProposal)
+ if ok {
+ that1 = &that2
+ } else {
+ return false
+ }
+ }
+ if that1 == nil {
+ return this == nil
+ } else if this == nil {
+ return false
+ }
+ if this.Title != that1.Title {
+ return false
+ }
+ if this.Description != that1.Description {
return false
}
if this.Contract != that1.Contract {
return false
}
- if this.CodeID != that1.CodeID {
+ if !bytes.Equal(this.Msg, that1.Msg) {
+ return false
+ }
+ return true
+}
+func (this *ExecuteContractProposal) Equal(that interface{}) bool {
+ if that == nil {
+ return this == nil
+ }
+
+ that1, ok := that.(*ExecuteContractProposal)
+ if !ok {
+ that2, ok := that.(ExecuteContractProposal)
+ if ok {
+ that1 = &that2
+ } else {
+ return false
+ }
+ }
+ if that1 == nil {
+ return this == nil
+ } else if this == nil {
+ return false
+ }
+ if this.Title != that1.Title {
+ return false
+ }
+ if this.Description != that1.Description {
+ return false
+ }
+ if this.RunAs != that1.RunAs {
+ return false
+ }
+ if this.Contract != that1.Contract {
return false
}
if !bytes.Equal(this.Msg, that1.Msg) {
return false
}
+ if len(this.Funds) != len(that1.Funds) {
+ return false
+ }
+ for i := range this.Funds {
+ if !this.Funds[i].Equal(&that1.Funds[i]) {
+ return false
+ }
+ }
return true
}
func (this *UpdateAdminProposal) Equal(that interface{}) bool {
@@ -851,6 +1020,122 @@ func (m *MigrateContractProposal) MarshalToSizedBuffer(dAtA []byte) (int, error)
i--
dAtA[i] = 0x22
}
+ if len(m.Description) > 0 {
+ i -= len(m.Description)
+ copy(dAtA[i:], m.Description)
+ i = encodeVarintProposal(dAtA, i, uint64(len(m.Description)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if len(m.Title) > 0 {
+ i -= len(m.Title)
+ copy(dAtA[i:], m.Title)
+ i = encodeVarintProposal(dAtA, i, uint64(len(m.Title)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *SudoContractProposal) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *SudoContractProposal) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *SudoContractProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Msg) > 0 {
+ i -= len(m.Msg)
+ copy(dAtA[i:], m.Msg)
+ i = encodeVarintProposal(dAtA, i, uint64(len(m.Msg)))
+ i--
+ dAtA[i] = 0x22
+ }
+ if len(m.Contract) > 0 {
+ i -= len(m.Contract)
+ copy(dAtA[i:], m.Contract)
+ i = encodeVarintProposal(dAtA, i, uint64(len(m.Contract)))
+ i--
+ dAtA[i] = 0x1a
+ }
+ if len(m.Description) > 0 {
+ i -= len(m.Description)
+ copy(dAtA[i:], m.Description)
+ i = encodeVarintProposal(dAtA, i, uint64(len(m.Description)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if len(m.Title) > 0 {
+ i -= len(m.Title)
+ copy(dAtA[i:], m.Title)
+ i = encodeVarintProposal(dAtA, i, uint64(len(m.Title)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *ExecuteContractProposal) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *ExecuteContractProposal) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *ExecuteContractProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Funds) > 0 {
+ for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- {
+ {
+ size, err := m.Funds[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintProposal(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x32
+ }
+ }
+ if len(m.Msg) > 0 {
+ i -= len(m.Msg)
+ copy(dAtA[i:], m.Msg)
+ i = encodeVarintProposal(dAtA, i, uint64(len(m.Msg)))
+ i--
+ dAtA[i] = 0x2a
+ }
+ if len(m.Contract) > 0 {
+ i -= len(m.Contract)
+ copy(dAtA[i:], m.Contract)
+ i = encodeVarintProposal(dAtA, i, uint64(len(m.Contract)))
+ i--
+ dAtA[i] = 0x22
+ }
if len(m.RunAs) > 0 {
i -= len(m.RunAs)
copy(dAtA[i:], m.RunAs)
@@ -1176,7 +1461,31 @@ func (m *MigrateContractProposal) Size() (n int) {
if l > 0 {
n += 1 + l + sovProposal(uint64(l))
}
- l = len(m.RunAs)
+ l = len(m.Contract)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ if m.CodeID != 0 {
+ n += 1 + sovProposal(uint64(m.CodeID))
+ }
+ l = len(m.Msg)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ return n
+}
+
+func (m *SudoContractProposal) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Title)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ l = len(m.Description)
if l > 0 {
n += 1 + l + sovProposal(uint64(l))
}
@@ -1184,13 +1493,45 @@ func (m *MigrateContractProposal) Size() (n int) {
if l > 0 {
n += 1 + l + sovProposal(uint64(l))
}
- if m.CodeID != 0 {
- n += 1 + sovProposal(uint64(m.CodeID))
+ l = len(m.Msg)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ return n
+}
+
+func (m *ExecuteContractProposal) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Title)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ l = len(m.Description)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ l = len(m.RunAs)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ l = len(m.Contract)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
}
l = len(m.Msg)
if l > 0 {
n += 1 + l + sovProposal(uint64(l))
}
+ if len(m.Funds) > 0 {
+ for _, e := range m.Funds {
+ l = e.Size()
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ }
return n
}
@@ -1900,9 +2241,9 @@ func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error {
}
m.Description = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
- case 3:
+ case 4:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RunAs", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -1930,9 +2271,176 @@ func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.RunAs = string(dAtA[iNdEx:postIndex])
+ m.Contract = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
- case 4:
+ case 5:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType)
+ }
+ m.CodeID = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.CodeID |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 6:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType)
+ }
+ var byteLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ byteLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if byteLen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...)
+ if m.Msg == nil {
+ m.Msg = []byte{}
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipProposal(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *SudoContractProposal) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: SudoContractProposal: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: SudoContractProposal: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Title = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Description = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
}
@@ -1964,11 +2472,11 @@ func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error {
}
m.Contract = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
- case 5:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType)
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType)
}
- m.CodeID = 0
+ var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowProposal
@@ -1978,12 +2486,205 @@ func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- m.CodeID |= uint64(b&0x7F) << shift
+ byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
- case 6:
+ if byteLen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...)
+ if m.Msg == nil {
+ m.Msg = []byte{}
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipProposal(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *ExecuteContractProposal) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: ExecuteContractProposal: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: ExecuteContractProposal: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Title = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Description = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field RunAs", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.RunAs = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Contract = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType)
}
@@ -2017,6 +2718,40 @@ func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error {
m.Msg = []byte{}
}
iNdEx = postIndex
+ case 6:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Funds", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Funds = append(m.Funds, types.Coin{})
+ if err := m.Funds[len(m.Funds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipProposal(dAtA[iNdEx:])
diff --git a/x/wasm/types/proposal_test.go b/x/wasm/types/proposal_test.go
index aac9c73d023..70f6bc76a06 100644
--- a/x/wasm/types/proposal_test.go
+++ b/x/wasm/types/proposal_test.go
@@ -304,18 +304,6 @@ func TestValidateMigrateContractProposal(t *testing.T) {
}),
expErr: true,
},
- "run_as missing": {
- src: MigrateContractProposalFixture(func(p *MigrateContractProposal) {
- p.RunAs = ""
- }),
- expErr: true,
- },
- "run_as invalid": {
- src: MigrateContractProposalFixture(func(p *MigrateContractProposal) {
- p.RunAs = invalidAddress
- }),
- expErr: true,
- },
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
@@ -491,7 +479,6 @@ func TestProposalStrings(t *testing.T) {
Description: Bar
Contract: cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr
Code id: 1
- Run as: cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4
Msg "{\"verifier\":\"cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4\"}"
`,
},
@@ -609,7 +596,6 @@ description: Bar
contract: cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr
code_id: 1
msg: '{"verifier":"cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4"}'
-run_as: cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4
`,
},
"update admin": {
@@ -733,7 +719,6 @@ func TestUnmarshalContentFromJson(t *testing.T) {
exp: &MigrateContractProposal{
Title: "foo",
Description: "bar",
- RunAs: "myRunAsAddress",
Contract: "myContractAddr",
CodeID: 1,
Msg: []byte("{}"),
diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go
index d5e3828e27f..a6f0f8e710d 100644
--- a/x/wasm/types/query.pb.go
+++ b/x/wasm/types/query.pb.go
@@ -7,10 +7,6 @@ import (
bytes "bytes"
context "context"
fmt "fmt"
- io "io"
- math "math"
- math_bits "math/bits"
-
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/gogo/protobuf/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
@@ -20,6 +16,9 @@ import (
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
+ io "io"
+ math "math"
+ math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/x/wasm/types/test_fixtures.go b/x/wasm/types/test_fixtures.go
index 1c74771f319..568c4f7c911 100644
--- a/x/wasm/types/test_fixtures.go
+++ b/x/wasm/types/test_fixtures.go
@@ -249,7 +249,6 @@ func MigrateContractProposalFixture(mutators ...func(p *MigrateContractProposal)
Contract: contractAddr,
CodeID: 1,
Msg: migMsgBz,
- RunAs: anyAddress,
}
for _, m := range mutators {
diff --git a/x/wasm/types/tx.pb.go b/x/wasm/types/tx.pb.go
index 4113f370b5d..dd82a4ae1bc 100644
--- a/x/wasm/types/tx.pb.go
+++ b/x/wasm/types/tx.pb.go
@@ -6,10 +6,6 @@ package types
import (
context "context"
fmt "fmt"
- io "io"
- math "math"
- math_bits "math/bits"
-
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto"
@@ -18,6 +14,9 @@ import (
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
+ io "io"
+ math "math"
+ math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/x/wasm/types/types.pb.go b/x/wasm/types/types.pb.go
index 4adacd95e9a..93f1a612f12 100644
--- a/x/wasm/types/types.pb.go
+++ b/x/wasm/types/types.pb.go
@@ -6,15 +6,14 @@ package types
import (
bytes "bytes"
fmt "fmt"
- io "io"
- math "math"
- math_bits "math/bits"
-
types "github.com/cosmos/cosmos-sdk/codec/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
_ "github.com/regen-network/cosmos-proto"
github_com_tendermint_tendermint_libs_bytes "github.com/tendermint/tendermint/libs/bytes"
+ io "io"
+ math "math"
+ math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.