From 6849c9146a839c91b0349feba4af5a2e76da1fac Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Thu, 16 Mar 2023 20:24:03 +0100 Subject: [PATCH 01/13] Deprecate proposal types --- docs/proto/proto-docs.md | 218 +- proto/cosmwasm/wasm/v1/proposal.proto | 80 +- proto/cosmwasm/wasm/v1/tx.proto | 119 +- x/wasm/simulation/proposals.go | 207 +- x/wasm/types/proposal.pb.go | 220 +- x/wasm/types/tx.pb.go | 3976 +++++++++++++++++++------ 6 files changed, 3675 insertions(+), 1145 deletions(-) diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index b0ad0b0445..f7b3fd5a06 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -92,8 +92,16 @@ - [MsgInstantiateContractResponse](#cosmwasm.wasm.v1.MsgInstantiateContractResponse) - [MsgMigrateContract](#cosmwasm.wasm.v1.MsgMigrateContract) - [MsgMigrateContractResponse](#cosmwasm.wasm.v1.MsgMigrateContractResponse) + - [MsgPinCodes](#cosmwasm.wasm.v1.MsgPinCodes) + - [MsgPinCodesResponse](#cosmwasm.wasm.v1.MsgPinCodesResponse) + - [MsgStoreAndInstantiateContract](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContract) + - [MsgStoreAndInstantiateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse) - [MsgStoreCode](#cosmwasm.wasm.v1.MsgStoreCode) - [MsgStoreCodeResponse](#cosmwasm.wasm.v1.MsgStoreCodeResponse) + - [MsgSudoContract](#cosmwasm.wasm.v1.MsgSudoContract) + - [MsgSudoContractResponse](#cosmwasm.wasm.v1.MsgSudoContractResponse) + - [MsgUnpinCodes](#cosmwasm.wasm.v1.MsgUnpinCodes) + - [MsgUnpinCodesResponse](#cosmwasm.wasm.v1.MsgUnpinCodesResponse) - [MsgUpdateAdmin](#cosmwasm.wasm.v1.MsgUpdateAdmin) - [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse) - [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig) @@ -628,8 +636,10 @@ applied. ### ClearAdminProposal -ClearAdminProposal gov proposal content type to clear the admin of a -contract. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit ClearAdminProposal. To clear the admin of a contract, +a simple MsgClearAdmin can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -646,8 +656,10 @@ contract. ### ExecuteContractProposal -ExecuteContractProposal gov proposal content type to call execute on a -contract. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit ExecuteContractProposal. To call execute on a contract, +a simple MsgExecuteContract can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -667,8 +679,10 @@ contract. ### InstantiateContract2Proposal -InstantiateContract2Proposal gov proposal content type to instantiate -contract 2 +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit InstantiateContract2Proposal. To instantiate contract 2, +a simple MsgInstantiateContract2 can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -692,8 +706,10 @@ contract 2 ### InstantiateContractProposal -InstantiateContractProposal gov proposal content type to instantiate a -contract. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit InstantiateContractProposal. To instantiate a contract, +a simple MsgInstantiateContract can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -715,7 +731,10 @@ contract. ### MigrateContractProposal -MigrateContractProposal gov proposal content type to migrate a contract. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit MigrateContractProposal. To migrate a contract, +a simple MsgMigrateContract can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -736,8 +755,10 @@ Note: skipping 3 as this was previously used for unneeded run_as | ### PinCodesProposal -PinCodesProposal gov proposal content type to pin a set of code ids in the -wasmvm cache. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit PinCodesProposal. To pin a set of code ids in the wasmvm +cache, a simple MsgPinCodes can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -754,8 +775,10 @@ wasmvm cache. ### StoreAndInstantiateContractProposal -StoreAndInstantiateContractProposal gov proposal content type to store -and instantiate the contract. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit StoreAndInstantiateContractProposal. To store and instantiate +the contract, a simple MsgStoreAndInstantiateContract can be invoked from +the x/gov module via a v1 governance proposal. | Field | Type | Label | Description | @@ -782,7 +805,10 @@ and instantiate the contract. ### StoreCodeProposal -StoreCodeProposal gov proposal content type to submit WASM code to the system +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit StoreCodeProposal. To submit WASM code to the system, +a simple MsgStoreCode can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -805,7 +831,10 @@ StoreCodeProposal gov proposal content type to submit WASM code to the system ### SudoContractProposal -SudoContractProposal gov proposal content type to call sudo on a contract. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit SudoContractProposal. To call sudo on a contract, +a simple MsgSudoContract can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -823,8 +852,10 @@ SudoContractProposal gov proposal content type to call sudo on a contract. ### UnpinCodesProposal -UnpinCodesProposal gov proposal content type to unpin a set of code ids in -the wasmvm cache. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm +cache, a simple MsgUnpinCodes can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -841,7 +872,10 @@ the wasmvm cache. ### UpdateAdminProposal -UpdateAdminProposal gov proposal content type to set an admin for a contract. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit UpdateAdminProposal. To set an admin for a contract, +a simple MsgUpdateAdmin can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | @@ -859,8 +893,10 @@ UpdateAdminProposal gov proposal content type to set an admin for a contract. ### UpdateInstantiateConfigProposal -UpdateInstantiateConfigProposal gov proposal content type to update -instantiate config to a set of code ids. +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit UpdateInstantiateConfigProposal. To update instantiate config +to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from +the x/gov module via a v1 governance proposal. | Field | Type | Label | Description | @@ -1467,6 +1503,79 @@ MsgMigrateContractResponse returns contract migration result data. + + +### MsgPinCodes +MsgPinCodes is the MsgPinCodes request type. + +Since: 0.40 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the governance account. | +| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the new WASM codes | + + + + + + + + +### MsgPinCodesResponse +MsgPinCodesResponse defines the response structure for executing a +MsgPinCodes message. + +Since: 0.40 + + + + + + + + +### MsgStoreAndInstantiateContract +MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract +request type. + +Since: 0.40 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the governance account. | +| `run_as` | [string](#string) | | | +| `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | +| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | +| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional | +| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | +| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | +| `source` | [string](#string) | | Source is the URL where the code is hosted | +| `builder` | [string](#string) | | Builder is the docker image used to build the code deterministically, used for smart contract verification | +| `code_hash` | [bytes](#bytes) | | CodeHash is the SHA256 sum of the code outputted by builder, used for smart contract verification | + + + + + + + + +### MsgStoreAndInstantiateContractResponse +MsgStoreAndInstantiateContractResponse defines the response structure +for executing a MsgStoreAndInstantiateContract message. + +Since: 0.40 + + + + + + ### MsgStoreCode @@ -1500,6 +1609,69 @@ MsgStoreCodeResponse returns store result data. + + +### MsgSudoContract +MsgSudoContract is the MsgSudoContract request type. + +Since: 0.40 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the governance account. | +| `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 | + + + + + + + + +### MsgSudoContractResponse +MsgSudoContractResponse defines the response structure for executing a +MsgSudoContract message. + +Since: 0.40 + + + + + + + + +### MsgUnpinCodes +MsgUnpinCodes is the MsgUnpinCodes request type. + +Since: 0.40 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the governance account. | +| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the WASM codes | + + + + + + + + +### MsgUnpinCodesResponse +MsgUnpinCodesResponse defines the response structure for executing a +MsgUnpinCodes message. + +Since: 0.40 + + + + + + ### MsgUpdateAdmin @@ -1557,7 +1729,7 @@ MsgUpdateInstantiateConfigResponse returns empty data ### MsgUpdateParams -MsgUpdateParams is the Msg/UpdateParams request type. +MsgUpdateParams is the MsgUpdateParams request type. Since: 0.40 @@ -1611,6 +1783,10 @@ Msg defines the wasm Msg service. | `UpdateParams` | [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams) | [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse) | UpdateParams defines a governance operation for updating the x/wasm module parameters. The authority is defined in the keeper. Since: 0.40 | | +| `SudoContract` | [MsgSudoContract](#cosmwasm.wasm.v1.MsgSudoContract) | [MsgSudoContractResponse](#cosmwasm.wasm.v1.MsgSudoContractResponse) | SudoContract calls sudo on a contract. | | +| `PinCodes` | [MsgPinCodes](#cosmwasm.wasm.v1.MsgPinCodes) | [MsgPinCodesResponse](#cosmwasm.wasm.v1.MsgPinCodesResponse) | PinCodes pins a set of code ids in the wasmvm cache. | | +| `UnpinCodes` | [MsgUnpinCodes](#cosmwasm.wasm.v1.MsgUnpinCodes) | [MsgUnpinCodesResponse](#cosmwasm.wasm.v1.MsgUnpinCodesResponse) | UnpinCodes unpins a set of code ids in the wasmvm cache. | | +| `StoreAndInstantiateContract` | [MsgStoreAndInstantiateContract](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContract) | [MsgStoreAndInstantiateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse) | StoreAndInstantiateContract stores and instantiates the contract. | | diff --git a/proto/cosmwasm/wasm/v1/proposal.proto b/proto/cosmwasm/wasm/v1/proposal.proto index b1c484bc9c..c171feb4af 100644 --- a/proto/cosmwasm/wasm/v1/proposal.proto +++ b/proto/cosmwasm/wasm/v1/proposal.proto @@ -11,8 +11,12 @@ option (gogoproto.goproto_stringer_all) = false; option (gogoproto.goproto_getters_all) = false; option (gogoproto.equal_all) = true; -// StoreCodeProposal gov proposal content type to submit WASM code to the system +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit StoreCodeProposal. To submit WASM code to the system, +// a simple MsgStoreCode can be invoked from the x/gov module via +// a v1 governance proposal. message StoreCodeProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -39,9 +43,12 @@ message StoreCodeProposal { bytes code_hash = 11; } -// InstantiateContractProposal gov proposal content type to instantiate a -// contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit InstantiateContractProposal. To instantiate a contract, +// a simple MsgInstantiateContract can be invoked from the x/gov module via +// a v1 governance proposal. message InstantiateContractProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -65,9 +72,12 @@ message InstantiateContractProposal { ]; } -// InstantiateContract2Proposal gov proposal content type to instantiate -// contract 2 +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit InstantiateContract2Proposal. To instantiate contract 2, +// a simple MsgInstantiateContract2 can be invoked from the x/gov module via +// a v1 governance proposal. message InstantiateContract2Proposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -96,8 +106,12 @@ message InstantiateContract2Proposal { bool fix_msg = 10; } -// MigrateContractProposal gov proposal content type to migrate a contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit MigrateContractProposal. To migrate a contract, +// a simple MsgMigrateContract can be invoked from the x/gov module via +// a v1 governance proposal. message MigrateContractProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -114,8 +128,12 @@ message MigrateContractProposal { bytes msg = 6 [ (gogoproto.casttype) = "RawContractMessage" ]; } -// SudoContractProposal gov proposal content type to call sudo on a contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit SudoContractProposal. To call sudo on a contract, +// a simple MsgSudoContract can be invoked from the x/gov module via +// a v1 governance proposal. message SudoContractProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -128,9 +146,12 @@ message SudoContractProposal { bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ]; } -// ExecuteContractProposal gov proposal content type to call execute on a -// contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit ExecuteContractProposal. To call execute on a contract, +// a simple MsgExecuteContract can be invoked from the x/gov module via +// a v1 governance proposal. message ExecuteContractProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -150,8 +171,12 @@ message ExecuteContractProposal { ]; } -// UpdateAdminProposal gov proposal content type to set an admin for a contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit UpdateAdminProposal. To set an admin for a contract, +// a simple MsgUpdateAdmin can be invoked from the x/gov module via +// a v1 governance proposal. message UpdateAdminProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -164,9 +189,12 @@ message UpdateAdminProposal { string contract = 4; } -// ClearAdminProposal gov proposal content type to clear the admin of a -// contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit ClearAdminProposal. To clear the admin of a contract, +// a simple MsgClearAdmin can be invoked from the x/gov module via +// a v1 governance proposal. message ClearAdminProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -177,9 +205,12 @@ message ClearAdminProposal { string contract = 3; } -// PinCodesProposal gov proposal content type to pin a set of code ids in the -// wasmvm cache. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit PinCodesProposal. To pin a set of code ids in the wasmvm +// cache, a simple MsgPinCodes can be invoked from the x/gov module via +// a v1 governance proposal. message PinCodesProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -193,9 +224,12 @@ message PinCodesProposal { ]; } -// UnpinCodesProposal gov proposal content type to unpin a set of code ids in -// the wasmvm cache. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm +// cache, a simple MsgUnpinCodes can be invoked from the x/gov module via +// a v1 governance proposal. message UnpinCodesProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -218,9 +252,12 @@ message AccessConfigUpdate { AccessConfig instantiate_permission = 2 [ (gogoproto.nullable) = false ]; } -// UpdateInstantiateConfigProposal gov proposal content type to update -// instantiate config to a set of code ids. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit UpdateInstantiateConfigProposal. To update instantiate config +// to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from +// the x/gov module via a v1 governance proposal. message UpdateInstantiateConfigProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary @@ -233,9 +270,12 @@ message UpdateInstantiateConfigProposal { [ (gogoproto.nullable) = false ]; } -// StoreAndInstantiateContractProposal gov proposal content type to store -// and instantiate the contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit StoreAndInstantiateContractProposal. To store and instantiate +// the contract, a simple MsgStoreAndInstantiateContract can be invoked from +// the x/gov module via a v1 governance proposal. message StoreAndInstantiateContractProposal { + option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary diff --git a/proto/cosmwasm/wasm/v1/tx.proto b/proto/cosmwasm/wasm/v1/tx.proto index 5b86535a21..bf0f2e284e 100644 --- a/proto/cosmwasm/wasm/v1/tx.proto +++ b/proto/cosmwasm/wasm/v1/tx.proto @@ -38,6 +38,15 @@ service Msg { // // Since: 0.40 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // SudoContract calls sudo on a contract. + rpc SudoContract(MsgSudoContract) returns (MsgSudoContractResponse); + // PinCodes pins a set of code ids in the wasmvm cache. + rpc PinCodes(MsgPinCodes) returns (MsgPinCodesResponse); + // UnpinCodes unpins a set of code ids in the wasmvm cache. + rpc UnpinCodes(MsgUnpinCodes) returns (MsgUnpinCodesResponse); + // StoreAndInstantiateContract stores and instantiates the contract. + rpc StoreAndInstantiateContract(MsgStoreAndInstantiateContract) + returns (MsgStoreAndInstantiateContractResponse); } // MsgStoreCode submit Wasm code to the system @@ -214,7 +223,7 @@ message MsgUpdateInstantiateConfig { // MsgUpdateInstantiateConfigResponse returns empty data message MsgUpdateInstantiateConfigResponse {} -// MsgUpdateParams is the Msg/UpdateParams request type. +// MsgUpdateParams is the MsgUpdateParams request type. // // Since: 0.40 message MsgUpdateParams { @@ -233,4 +242,110 @@ message MsgUpdateParams { // MsgUpdateParams message. // // Since: 0.40 -message MsgUpdateParamsResponse {} \ No newline at end of file +message MsgUpdateParamsResponse {} + +// MsgSudoContract is the MsgSudoContract request type. +// +// Since: 0.40 +message MsgSudoContract { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Contract is the address of the smart contract + string contract = 2; + // Msg json encoded message to be passed to the contract as sudo + bytes msg = 3 [ (gogoproto.casttype) = "RawContractMessage" ]; +} + +// MsgSudoContractResponse defines the response structure for executing a +// MsgSudoContract message. +// +// Since: 0.40 +message MsgSudoContractResponse {} + +// MsgPinCodes is the MsgPinCodes request type. +// +// Since: 0.40 +message MsgPinCodes { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // CodeIDs references the new WASM codes + repeated uint64 code_ids = 2 [ + (gogoproto.customname) = "CodeIDs", + (gogoproto.moretags) = "yaml:\"code_ids\"" + ]; +} + +// MsgPinCodesResponse defines the response structure for executing a +// MsgPinCodes message. +// +// Since: 0.40 +message MsgPinCodesResponse {} + +// MsgUnpinCodes is the MsgUnpinCodes request type. +// +// Since: 0.40 +message MsgUnpinCodes { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // CodeIDs references the WASM codes + repeated uint64 code_ids = 2 [ + (gogoproto.customname) = "CodeIDs", + (gogoproto.moretags) = "yaml:\"code_ids\"" + ]; +} + +// MsgUnpinCodesResponse defines the response structure for executing a +// MsgUnpinCodes message. +// +// Since: 0.40 +message MsgUnpinCodesResponse {} + +// MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract +// request type. +// +// Since: 0.40 +message MsgStoreAndInstantiateContract { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string run_as = 2; + // WASMByteCode can be raw or gzip compressed + bytes wasm_byte_code = 3 [ (gogoproto.customname) = "WASMByteCode" ]; + // InstantiatePermission to apply on contract creation, optional + AccessConfig instantiate_permission = 4; + // UnpinCode code on upload, optional + bool unpin_code = 5; + // Admin is an optional address that can execute migrations + string admin = 6; + // Label is optional metadata to be stored with a constract instance. + string label = 7; + // Msg json encoded message to be passed to the contract on instantiation + bytes msg = 8 [ (gogoproto.casttype) = "RawContractMessage" ]; + // Funds coins that are transferred to the contract on instantiation + repeated cosmos.base.v1beta1.Coin funds = 9 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // Source is the URL where the code is hosted + string source = 10; + // Builder is the docker image used to build the code deterministically, used + // for smart contract verification + string builder = 11; + // CodeHash is the SHA256 sum of the code outputted by builder, used for smart + // contract verification + bytes code_hash = 12; +} + +// MsgStoreAndInstantiateContractResponse defines the response structure +// for executing a MsgStoreAndInstantiateContract message. +// +// Since: 0.40 +message MsgStoreAndInstantiateContractResponse {} \ No newline at end of file diff --git a/x/wasm/simulation/proposals.go b/x/wasm/simulation/proposals.go index 880e6cf371..ebb78680f7 100644 --- a/x/wasm/simulation/proposals.go +++ b/x/wasm/simulation/proposals.go @@ -4,6 +4,7 @@ import ( "math/rand" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" @@ -26,14 +27,9 @@ const ( WeightStoreAndInstantiateContractProposal = "weight_store_and_instantiate_contract_proposal" ) -func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedProposalContent { - return []simtypes.WeightedProposalContent{ - // simulation.NewWeightedProposalContent( - // WeightStoreCodeProposal, - // params.DefaultWeightStoreCodeProposal, - // SimulateStoreCodeProposal(wasmKeeper), - // ), - simulation.NewWeightedProposalContent( +func ProposalMsgs(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( WeightInstantiateContractProposal, params.DefaultWeightInstantiateContractProposal, SimulateInstantiateContractProposal( @@ -42,7 +38,7 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP DefaultSimulationCodeIDSelector, ), ), - simulation.NewWeightedProposalContent( + simulation.NewWeightedProposalMsg( WeightUpdateAdminProposal, params.DefaultWeightUpdateAdminProposal, SimulateUpdateAdminProposal( @@ -50,7 +46,7 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP DefaultSimulateUpdateAdminProposalContractSelector, ), ), - simulation.NewWeightedProposalContent( + simulation.NewWeightedProposalMsg( WeightExeContractProposal, params.DefaultWeightExecuteContractProposal, SimulateExecuteContractProposal( @@ -61,7 +57,7 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP DefaultSimulationExecutePayloader, ), ), - simulation.NewWeightedProposalContent( + simulation.NewWeightedProposalMsg( WeightClearAdminProposal, params.DefaultWeightClearAdminProposal, SimulateClearAdminProposal( @@ -69,7 +65,7 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP DefaultSimulateContractSelector, ), ), - simulation.NewWeightedProposalContent( + simulation.NewWeightedProposalMsg( WeightMigrateContractProposal, params.DefaultWeightMigrateContractProposal, SimulateMigrateContractProposal( @@ -78,15 +74,7 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP DefaultSimulationCodeIDSelector, ), ), - // simulation.NewWeightedProposalContent( - // WeightSudoContractProposal, - // params.DefaultWeightSudoContractProposal, - // SimulateSudoContractProposal( - // wasmKeeper, - // DefaultSimulateContractSelector, - // ), - // ), - simulation.NewWeightedProposalContent( + simulation.NewWeightedProposalMsg( WeightPinCodesProposal, params.DefaultWeightPinCodesProposal, SimulatePinContractProposal( @@ -94,7 +82,7 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP DefaultSimulationCodeIDSelector, ), ), - simulation.NewWeightedProposalContent( + simulation.NewWeightedProposalMsg( WeightUnpinCodesProposal, params.DefaultWeightUnpinCodesProposal, SimulateUnpinContractProposal( @@ -102,7 +90,7 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP DefaultSimulationCodeIDSelector, ), ), - simulation.NewWeightedProposalContent( + simulation.NewWeightedProposalMsg( WeightUpdateInstantiateConfigProposal, params.DefaultWeightUpdateInstantiateConfigProposal, SimulateUpdateInstantiateConfigProposal( @@ -110,47 +98,39 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP DefaultSimulationCodeIDSelector, ), ), - // simulation.NewWeightedProposalContent( - // WeightStoreAndInstantiateContractProposal, - // params.DefaultWeightStoreAndInstantiateContractProposal, - // SimulateStoreAndInstantiateContractProposal( - // wasmKeeper, - // ), - // ), } } // simulate store code proposal (unused now) // Current problem: out of gas (defaul gaswanted config of gov SimulateMsgSubmitProposal is 10_000_000) // but this proposal may need more than it -// +func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") -func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { simAccount, _ := simtypes.RandomAcc(r, accs) wasmBz := testdata.ReflectContractWasm() permission := wasmKeeper.GetParams(ctx).InstantiateDefaultPermission.With(simAccount.Address) - return types.NewStoreCodeProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - simAccount.Address.String(), - wasmBz, - &permission, - false, - "", - "", - []byte{}, - ) + return &types.MsgStoreCode{ + Sender: authority.String(), + WASMByteCode: wasmBz, + InstantiatePermission: &permission, + } } } // Simulate instantiate contract proposal -func SimulateInstantiateContractProposal(_ BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { - simAccount, _ := simtypes.RandomAcc(r, accs) +// + +func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") + // admin adminAccount, _ := simtypes.RandomAcc(r, accs) // get codeID @@ -159,16 +139,14 @@ func SimulateInstantiateContractProposal(_ BankKeeper, wasmKeeper WasmKeeper, co return nil } - return types.NewInstantiateContractProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - simAccount.Address.String(), - adminAccount.Address.String(), - codeID, - simtypes.RandStringOfLength(r, 10), - []byte(`{}`), - sdk.Coins{}, - ) + return &types.MsgInstantiateContract{ + Sender: authority.String(), + Admin: string(adminAccount.Address), + CodeID: codeID, + Label: simtypes.RandStringOfLength(r, 10), + Msg: []byte(`{}`), + Funds: sdk.Coins{}, + } } } @@ -181,36 +159,21 @@ func SimulateExecuteContractProposal( contractSelector MsgExecuteContractSelector, senderSelector MsgExecuteSenderSelector, payloader MsgExecutePayloader, -) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { +) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") + ctAddress := contractSelector(ctx, wasmKeeper) if ctAddress == nil { return nil } - simAccount, err := senderSelector(wasmKeeper, ctx, ctAddress, accs) - if err != nil { - return nil - } - - msg := types.MsgExecuteContract{ - Sender: simAccount.Address.String(), + return &types.MsgExecuteContract{ + Sender: authority.String(), Contract: ctAddress.String(), Funds: sdk.Coins{}, } - - if err := payloader(&msg); err != nil { - return nil - } - - return types.NewExecuteContractProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - simAccount.Address.String(), - ctAddress.String(), - msg.Msg, - sdk.Coins{}, - ) } } @@ -237,20 +200,19 @@ func DefaultSimulateUpdateAdminProposalContractSelector( // Simulate update admin contract proposal // -func SimulateUpdateAdminProposal(wasmKeeper WasmKeeper, contractSelector UpdateAdminContractSelector) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { +func SimulateUpdateAdminProposal(wasmKeeper WasmKeeper, contractSelector UpdateAdminContractSelector) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { simAccount, _ := simtypes.RandomAcc(r, accs) ctAddress, _ := contractSelector(ctx, wasmKeeper, simAccount.Address.String()) if ctAddress == nil { return nil } - return types.NewUpdateAdminProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - simtypes.RandomAccounts(r, 1)[0].Address.String(), - ctAddress.String(), - ) + return &types.MsgUpdateAdmin{ + Sender: "", + NewAdmin: simtypes.RandomAccounts(r, 1)[0].Address.String(), + Contract: ctAddress.String(), + } } } @@ -271,18 +233,16 @@ func DefaultSimulateContractSelector( // Simulate clear admin proposal // -func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdminContractSelector) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { +func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdminContractSelector) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { ctAddress := contractSelector(ctx, wasmKeeper) if ctAddress == nil { return nil } - - return types.NewClearAdminProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - ctAddress.String(), - ) + return &types.MsgClearAdmin{ + Sender: "", + Contract: ctAddress.String(), + } } } @@ -291,8 +251,8 @@ type MigrateContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.A // Simulate migrate contract proposal // -func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector MigrateContractProposalContractSelector, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { +func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector MigrateContractProposalContractSelector, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { ctAddress := contractSelector(ctx, wasmKeeper) if ctAddress == nil { return nil @@ -303,13 +263,12 @@ func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector Mig return nil } - return types.NewMigrateContractProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - ctAddress.String(), - codeID, - []byte(`{}`), - ) + return &types.MsgMigrateContract{ + Sender: "", + Contract: ctAddress.String(), + CodeID: codeID, + Msg: []byte(`{}`), + } } } @@ -318,45 +277,43 @@ type SudoContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.AccA // Simulate sudo contract proposal // -func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoContractProposalContractSelector) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { +func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoContractProposalContractSelector) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { ctAddress := contractSelector(ctx, wasmKeeper) if ctAddress == nil { return nil } - return types.NewSudoContractProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - ctAddress.String(), - []byte(`{}`), - ) + return types.MsgSudoContract{ + Authority: "", + Contract: ctAddress.String(), + Msg: []byte(`{}`), + } } } // Simulate pin contract proposal // -func SimulatePinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { +func SimulatePinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { codeID := codeSelector(ctx, wasmKeeper) if codeID == 0 { return nil } - return types.NewPinCodesProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - []uint64{codeID}, - ) + return &types.MsgPinCodes{ + Authority: "", + CodeIDs: []uint64{codeID}, + } } } // Simulate unpin contract proposal // -func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { +func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { codeID := codeSelector(ctx, wasmKeeper) if codeID == 0 { return nil @@ -373,8 +330,8 @@ func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSel // Simulate update instantiate config proposal // -func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { +func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { codeID := codeSelector(ctx, wasmKeeper) if codeID == 0 { return nil @@ -397,8 +354,8 @@ func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector } } -func SimulateStoreAndInstantiateContractProposal(wasmKeeper WasmKeeper) simtypes.ContentSimulatorFn { - return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { +func SimulateStoreAndInstantiateContractProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn { + return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { simAccount, _ := simtypes.RandomAcc(r, accs) adminAccount, _ := simtypes.RandomAcc(r, accs) diff --git a/x/wasm/types/proposal.pb.go b/x/wasm/types/proposal.pb.go index 349a1535b6..ca74cc5ae0 100644 --- a/x/wasm/types/proposal.pb.go +++ b/x/wasm/types/proposal.pb.go @@ -30,7 +30,12 @@ var ( // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// StoreCodeProposal gov proposal content type to submit WASM code to the system +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit StoreCodeProposal. To submit WASM code to the system, +// a simple MsgStoreCode can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type StoreCodeProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -91,8 +96,12 @@ func (m *StoreCodeProposal) XXX_DiscardUnknown() { var xxx_messageInfo_StoreCodeProposal proto.InternalMessageInfo -// InstantiateContractProposal gov proposal content type to instantiate a -// contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit InstantiateContractProposal. To instantiate a contract, +// a simple MsgInstantiateContract can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type InstantiateContractProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -149,8 +158,12 @@ func (m *InstantiateContractProposal) XXX_DiscardUnknown() { var xxx_messageInfo_InstantiateContractProposal proto.InternalMessageInfo -// InstantiateContract2Proposal gov proposal content type to instantiate -// contract 2 +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit InstantiateContract2Proposal. To instantiate contract 2, +// a simple MsgInstantiateContract2 can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type InstantiateContract2Proposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -212,7 +225,12 @@ func (m *InstantiateContract2Proposal) XXX_DiscardUnknown() { var xxx_messageInfo_InstantiateContract2Proposal proto.InternalMessageInfo -// MigrateContractProposal gov proposal content type to migrate a contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit MigrateContractProposal. To migrate a contract, +// a simple MsgMigrateContract can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type MigrateContractProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -263,7 +281,12 @@ func (m *MigrateContractProposal) XXX_DiscardUnknown() { var xxx_messageInfo_MigrateContractProposal proto.InternalMessageInfo -// SudoContractProposal gov proposal content type to call sudo on a contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit SudoContractProposal. To call sudo on a contract, +// a simple MsgSudoContract can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type SudoContractProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -312,8 +335,12 @@ func (m *SudoContractProposal) XXX_DiscardUnknown() { var xxx_messageInfo_SudoContractProposal proto.InternalMessageInfo -// ExecuteContractProposal gov proposal content type to call execute on a -// contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit ExecuteContractProposal. To call execute on a contract, +// a simple MsgExecuteContract can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type ExecuteContractProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -366,7 +393,12 @@ func (m *ExecuteContractProposal) XXX_DiscardUnknown() { var xxx_messageInfo_ExecuteContractProposal proto.InternalMessageInfo -// UpdateAdminProposal gov proposal content type to set an admin for a contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit UpdateAdminProposal. To set an admin for a contract, +// a simple MsgUpdateAdmin can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type UpdateAdminProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -415,8 +447,12 @@ func (m *UpdateAdminProposal) XXX_DiscardUnknown() { var xxx_messageInfo_UpdateAdminProposal proto.InternalMessageInfo -// ClearAdminProposal gov proposal content type to clear the admin of a -// contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit ClearAdminProposal. To clear the admin of a contract, +// a simple MsgClearAdmin can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type ClearAdminProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -463,8 +499,12 @@ func (m *ClearAdminProposal) XXX_DiscardUnknown() { var xxx_messageInfo_ClearAdminProposal proto.InternalMessageInfo -// PinCodesProposal gov proposal content type to pin a set of code ids in the -// wasmvm cache. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit PinCodesProposal. To pin a set of code ids in the wasmvm +// cache, a simple MsgPinCodes can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type PinCodesProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"` @@ -511,8 +551,12 @@ func (m *PinCodesProposal) XXX_DiscardUnknown() { var xxx_messageInfo_PinCodesProposal proto.InternalMessageInfo -// UnpinCodesProposal gov proposal content type to unpin a set of code ids in -// the wasmvm cache. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm +// cache, a simple MsgUnpinCodes can be invoked from the x/gov module via +// a v1 governance proposal. +// +// Deprecated: Do not use. type UnpinCodesProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"` @@ -605,8 +649,12 @@ func (m *AccessConfigUpdate) XXX_DiscardUnknown() { var xxx_messageInfo_AccessConfigUpdate proto.InternalMessageInfo -// UpdateInstantiateConfigProposal gov proposal content type to update -// instantiate config to a set of code ids. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit UpdateInstantiateConfigProposal. To update instantiate config +// to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from +// the x/gov module via a v1 governance proposal. +// +// Deprecated: Do not use. type UpdateInstantiateConfigProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"` @@ -654,8 +702,12 @@ func (m *UpdateInstantiateConfigProposal) XXX_DiscardUnknown() { var xxx_messageInfo_UpdateInstantiateConfigProposal proto.InternalMessageInfo -// StoreAndInstantiateContractProposal gov proposal content type to store -// and instantiate the contract. +// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +// an explicit StoreAndInstantiateContractProposal. To store and instantiate +// the contract, a simple MsgStoreAndInstantiateContract can be invoked from +// the x/gov module via a v1 governance proposal. +// +// Deprecated: Do not use. type StoreAndInstantiateContractProposal struct { // Title is a short summary Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -743,72 +795,72 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/proposal.proto", fileDescriptor_be6422d717c730cb) } var fileDescriptor_be6422d717c730cb = []byte{ - // 1025 bytes of a gzipped FileDescriptorProto + // 1028 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0x4f, 0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, 0x00, 0x00, } func (this *StoreCodeProposal) Equal(that interface{}) bool { diff --git a/x/wasm/types/tx.pb.go b/x/wasm/types/tx.pb.go index a97615f13c..ed97d19f8a 100644 --- a/x/wasm/types/tx.pb.go +++ b/x/wasm/types/tx.pb.go @@ -791,7 +791,7 @@ func (m *MsgUpdateInstantiateConfigResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateInstantiateConfigResponse proto.InternalMessageInfo -// MsgUpdateParams is the Msg/UpdateParams request type. +// MsgUpdateParams is the MsgUpdateParams request type. // // Since: 0.40 type MsgUpdateParams struct { @@ -885,6 +885,400 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgSudoContract is the MsgSudoContract request type. +// +// Since: 0.40 +type MsgSudoContract struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // Contract is the address of the smart contract + Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"` + // Msg json encoded message to be passed to the contract as sudo + Msg RawContractMessage `protobuf:"bytes,3,opt,name=msg,proto3,casttype=RawContractMessage" json:"msg,omitempty"` +} + +func (m *MsgSudoContract) Reset() { *m = MsgSudoContract{} } +func (m *MsgSudoContract) String() string { return proto.CompactTextString(m) } +func (*MsgSudoContract) ProtoMessage() {} +func (*MsgSudoContract) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{18} +} + +func (m *MsgSudoContract) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *MsgSudoContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSudoContract.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 *MsgSudoContract) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSudoContract.Merge(m, src) +} + +func (m *MsgSudoContract) XXX_Size() int { + return m.Size() +} + +func (m *MsgSudoContract) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSudoContract.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSudoContract proto.InternalMessageInfo + +// MsgSudoContractResponse defines the response structure for executing a +// MsgSudoContract message. +// +// Since: 0.40 +type MsgSudoContractResponse struct{} + +func (m *MsgSudoContractResponse) Reset() { *m = MsgSudoContractResponse{} } +func (m *MsgSudoContractResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSudoContractResponse) ProtoMessage() {} +func (*MsgSudoContractResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{19} +} + +func (m *MsgSudoContractResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *MsgSudoContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSudoContractResponse.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 *MsgSudoContractResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSudoContractResponse.Merge(m, src) +} + +func (m *MsgSudoContractResponse) XXX_Size() int { + return m.Size() +} + +func (m *MsgSudoContractResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSudoContractResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSudoContractResponse proto.InternalMessageInfo + +// MsgPinCodes is the MsgPinCodes request type. +// +// Since: 0.40 +type MsgPinCodes struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // CodeIDs references the new WASM codes + CodeIDs []uint64 `protobuf:"varint,2,rep,packed,name=code_ids,json=codeIds,proto3" json:"code_ids,omitempty" yaml:"code_ids"` +} + +func (m *MsgPinCodes) Reset() { *m = MsgPinCodes{} } +func (m *MsgPinCodes) String() string { return proto.CompactTextString(m) } +func (*MsgPinCodes) ProtoMessage() {} +func (*MsgPinCodes) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{20} +} + +func (m *MsgPinCodes) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *MsgPinCodes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPinCodes.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 *MsgPinCodes) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPinCodes.Merge(m, src) +} + +func (m *MsgPinCodes) XXX_Size() int { + return m.Size() +} + +func (m *MsgPinCodes) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPinCodes.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPinCodes proto.InternalMessageInfo + +// MsgPinCodesResponse defines the response structure for executing a +// MsgPinCodes message. +// +// Since: 0.40 +type MsgPinCodesResponse struct{} + +func (m *MsgPinCodesResponse) Reset() { *m = MsgPinCodesResponse{} } +func (m *MsgPinCodesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPinCodesResponse) ProtoMessage() {} +func (*MsgPinCodesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{21} +} + +func (m *MsgPinCodesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *MsgPinCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPinCodesResponse.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 *MsgPinCodesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPinCodesResponse.Merge(m, src) +} + +func (m *MsgPinCodesResponse) XXX_Size() int { + return m.Size() +} + +func (m *MsgPinCodesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPinCodesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPinCodesResponse proto.InternalMessageInfo + +// MsgUnpinCodes is the MsgUnpinCodes request type. +// +// Since: 0.40 +type MsgUnpinCodes struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // CodeIDs references the WASM codes + CodeIDs []uint64 `protobuf:"varint,2,rep,packed,name=code_ids,json=codeIds,proto3" json:"code_ids,omitempty" yaml:"code_ids"` +} + +func (m *MsgUnpinCodes) Reset() { *m = MsgUnpinCodes{} } +func (m *MsgUnpinCodes) String() string { return proto.CompactTextString(m) } +func (*MsgUnpinCodes) ProtoMessage() {} +func (*MsgUnpinCodes) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{22} +} + +func (m *MsgUnpinCodes) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *MsgUnpinCodes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnpinCodes.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 *MsgUnpinCodes) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnpinCodes.Merge(m, src) +} + +func (m *MsgUnpinCodes) XXX_Size() int { + return m.Size() +} + +func (m *MsgUnpinCodes) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnpinCodes.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnpinCodes proto.InternalMessageInfo + +// MsgUnpinCodesResponse defines the response structure for executing a +// MsgUnpinCodes message. +// +// Since: 0.40 +type MsgUnpinCodesResponse struct{} + +func (m *MsgUnpinCodesResponse) Reset() { *m = MsgUnpinCodesResponse{} } +func (m *MsgUnpinCodesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUnpinCodesResponse) ProtoMessage() {} +func (*MsgUnpinCodesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{23} +} + +func (m *MsgUnpinCodesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *MsgUnpinCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnpinCodesResponse.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 *MsgUnpinCodesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnpinCodesResponse.Merge(m, src) +} + +func (m *MsgUnpinCodesResponse) XXX_Size() int { + return m.Size() +} + +func (m *MsgUnpinCodesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnpinCodesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnpinCodesResponse proto.InternalMessageInfo + +// MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract +// request type. +// +// Since: 0.40 +type MsgStoreAndInstantiateContract struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + RunAs string `protobuf:"bytes,2,opt,name=run_as,json=runAs,proto3" json:"run_as,omitempty"` + // WASMByteCode can be raw or gzip compressed + WASMByteCode []byte `protobuf:"bytes,3,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"` + // InstantiatePermission to apply on contract creation, optional + InstantiatePermission *AccessConfig `protobuf:"bytes,4,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission,omitempty"` + // UnpinCode code on upload, optional + UnpinCode bool `protobuf:"varint,5,opt,name=unpin_code,json=unpinCode,proto3" json:"unpin_code,omitempty"` + // Admin is an optional address that can execute migrations + Admin string `protobuf:"bytes,6,opt,name=admin,proto3" json:"admin,omitempty"` + // Label is optional metadata to be stored with a constract instance. + Label string `protobuf:"bytes,7,opt,name=label,proto3" json:"label,omitempty"` + // Msg json encoded message to be passed to the contract on instantiation + Msg RawContractMessage `protobuf:"bytes,8,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,9,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` + // Source is the URL where the code is hosted + Source string `protobuf:"bytes,10,opt,name=source,proto3" json:"source,omitempty"` + // Builder is the docker image used to build the code deterministically, used + // for smart contract verification + Builder string `protobuf:"bytes,11,opt,name=builder,proto3" json:"builder,omitempty"` + // CodeHash is the SHA256 sum of the code outputted by builder, used for smart + // contract verification + CodeHash []byte `protobuf:"bytes,12,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` +} + +func (m *MsgStoreAndInstantiateContract) Reset() { *m = MsgStoreAndInstantiateContract{} } +func (m *MsgStoreAndInstantiateContract) String() string { return proto.CompactTextString(m) } +func (*MsgStoreAndInstantiateContract) ProtoMessage() {} +func (*MsgStoreAndInstantiateContract) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{24} +} + +func (m *MsgStoreAndInstantiateContract) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *MsgStoreAndInstantiateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStoreAndInstantiateContract.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 *MsgStoreAndInstantiateContract) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStoreAndInstantiateContract.Merge(m, src) +} + +func (m *MsgStoreAndInstantiateContract) XXX_Size() int { + return m.Size() +} + +func (m *MsgStoreAndInstantiateContract) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStoreAndInstantiateContract.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStoreAndInstantiateContract proto.InternalMessageInfo + +// MsgStoreAndInstantiateContractResponse defines the response structure +// for executing a MsgStoreAndInstantiateContract message. +// +// Since: 0.40 +type MsgStoreAndInstantiateContractResponse struct{} + +func (m *MsgStoreAndInstantiateContractResponse) Reset() { + *m = MsgStoreAndInstantiateContractResponse{} +} +func (m *MsgStoreAndInstantiateContractResponse) String() string { return proto.CompactTextString(m) } +func (*MsgStoreAndInstantiateContractResponse) ProtoMessage() {} +func (*MsgStoreAndInstantiateContractResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{25} +} + +func (m *MsgStoreAndInstantiateContractResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *MsgStoreAndInstantiateContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStoreAndInstantiateContractResponse.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 *MsgStoreAndInstantiateContractResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStoreAndInstantiateContractResponse.Merge(m, src) +} + +func (m *MsgStoreAndInstantiateContractResponse) XXX_Size() int { + return m.Size() +} + +func (m *MsgStoreAndInstantiateContractResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStoreAndInstantiateContractResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStoreAndInstantiateContractResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgStoreCode)(nil), "cosmwasm.wasm.v1.MsgStoreCode") proto.RegisterType((*MsgStoreCodeResponse)(nil), "cosmwasm.wasm.v1.MsgStoreCodeResponse") @@ -904,78 +1298,103 @@ func init() { proto.RegisterType((*MsgUpdateInstantiateConfigResponse)(nil), "cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse") proto.RegisterType((*MsgUpdateParams)(nil), "cosmwasm.wasm.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmwasm.wasm.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgSudoContract)(nil), "cosmwasm.wasm.v1.MsgSudoContract") + proto.RegisterType((*MsgSudoContractResponse)(nil), "cosmwasm.wasm.v1.MsgSudoContractResponse") + proto.RegisterType((*MsgPinCodes)(nil), "cosmwasm.wasm.v1.MsgPinCodes") + proto.RegisterType((*MsgPinCodesResponse)(nil), "cosmwasm.wasm.v1.MsgPinCodesResponse") + proto.RegisterType((*MsgUnpinCodes)(nil), "cosmwasm.wasm.v1.MsgUnpinCodes") + proto.RegisterType((*MsgUnpinCodesResponse)(nil), "cosmwasm.wasm.v1.MsgUnpinCodesResponse") + proto.RegisterType((*MsgStoreAndInstantiateContract)(nil), "cosmwasm.wasm.v1.MsgStoreAndInstantiateContract") + proto.RegisterType((*MsgStoreAndInstantiateContractResponse)(nil), "cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse") } func init() { proto.RegisterFile("cosmwasm/wasm/v1/tx.proto", fileDescriptor_4f74d82755520264) } var fileDescriptor_4f74d82755520264 = []byte{ - // 1043 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x57, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0xae, 0x9b, 0x1f, 0x4d, 0x5e, 0x42, 0xb7, 0x32, 0xd9, 0xc6, 0x35, 0xc8, 0x09, 0x61, 0xb5, - 0x64, 0xd1, 0x6e, 0xd2, 0x04, 0xd4, 0xc3, 0xde, 0x9a, 0x2c, 0x87, 0xae, 0x64, 0xa8, 0x5c, 0x2d, - 0x15, 0x68, 0xa5, 0x68, 0x62, 0x4f, 0x5c, 0x6b, 0x6b, 0x3b, 0x78, 0x26, 0x4d, 0x7a, 0xe0, 0xc2, - 0x5f, 0x00, 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 0xd2, 0x95, 0x19, 0x94, 0x3f, 0x80, 0xec, 0x90, 0x31, - 0x30, 0x03, 0x0a, 0x6d, 0xe1, 0x76, 0x21, 0x5e, 0x86, 0x4e, 0xda, 0x6d, 0x54, 0xc5, 0x47, 0x3f, - 0xde, 0x76, 0x65, 0xcf, 0x78, 0x6a, 0x7b, 0xec, 0x46, 0x89, 0x4a, 0x0a, 0xe4, 0xb6, 0xbf, 0xd9, - 0x82, 0x94, 0x4c, 0x74, 0xfe, 0x04, 0xf2, 0xb3, 0x7f, 0x2e, 0x31, 0x86, 0x45, 0xff, 0x09, 0x88, - 0xf7, 0x97, 0xcf, 0x87, 0x1d, 0xf0, 0x19, 0xbc, 0x1e, 0x77, 0xc9, 0xd7, 0x63, 0xc3, 0x63, 0x90, - 0xe2, 0xfe, 0xba, 0xc8, 0x30, 0x25, 0x85, 0x52, 0xec, 0xcd, 0xf9, 0x60, 0x5d, 0xa6, 0xb6, 0xd8, - 0x5a, 0x1b, 0x1a, 0x66, 0xc5, 0x70, 0x67, 0xf1, 0x08, 0xbf, 0x17, 0xcb, 0xb2, 0x80, 0x12, 0x1f, - 0xae, 0x83, 0x8a, 0xa6, 0x59, 0x3c, 0x12, 0xe3, 0xd3, 0x2c, 0xa0, 0x12, 0xd2, 0x24, 0x1d, 0x5c, - 0x9f, 0x40, 0x21, 0x7a, 0x42, 0x55, 0x63, 0x83, 0x23, 0x08, 0xb1, 0xbe, 0x0a, 0x11, 0x52, 0x7f, - 0x0c, 0x10, 0x39, 0x72, 0x2a, 0xb1, 0x71, 0x33, 0x80, 0xf8, 0xce, 0x0a, 0x40, 0xc8, 0xfb, 0x39, - 0x94, 0x93, 0x8e, 0x97, 0x87, 0x4b, 0xc4, 0xdd, 0x42, 0x8b, 0xef, 0xbf, 0x0a, 0x3a, 0x4c, 0xff, - 0x1c, 0x8a, 0x73, 0x0d, 0xff, 0xd6, 0x12, 0x16, 0x0f, 0x22, 0x3e, 0x58, 0x09, 0x09, 0xd8, 0x3b, - 0x4f, 0xae, 0xfe, 0x90, 0x36, 0xae, 0xa6, 0x12, 0xf7, 0x72, 0x2a, 0x71, 0xbf, 0x4f, 0x25, 0xee, - 0xcb, 0x1b, 0x69, 0xe3, 0xe5, 0x8d, 0xb4, 0xf1, 0xeb, 0x8d, 0xb4, 0xf1, 0xe9, 0xfd, 0xc8, 0xdd, - 0xdc, 0xb5, 0x89, 0x79, 0x1a, 0xbc, 0xbb, 0x68, 0xcd, 0x89, 0xf7, 0x0e, 0xc3, 0xee, 0xe7, 0x7e, - 0x96, 0xbd, 0xa6, 0xbc, 0xf7, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x7b, 0x0a, 0x47, 0x5d, - 0x0d, 0x00, 0x00, + // 1328 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x8f, 0xdb, 0x44, + 0x1b, 0x5f, 0x6f, 0x9c, 0xaf, 0x27, 0x79, 0xdb, 0x95, 0xbb, 0x1f, 0x5e, 0xf7, 0x6d, 0x12, 0x42, + 0x29, 0x29, 0x6a, 0x93, 0xdd, 0x80, 0x2a, 0xe8, 0x2d, 0x49, 0x91, 0xd8, 0x4a, 0x81, 0x95, 0x57, + 0xa5, 0x02, 0x55, 0x8a, 0x26, 0xf1, 0xac, 0x63, 0x35, 0xb6, 0x83, 0xc7, 0xee, 0xee, 0x1e, 0xb8, + 0x70, 0xe3, 0x56, 0xb8, 0x72, 0xe0, 0xc2, 0x89, 0x13, 0x07, 0xfa, 0x1f, 0x70, 0x28, 0x17, 0x54, + 0x71, 0xe2, 0x14, 0x20, 0x3d, 0x70, 0xe7, 0xc8, 0x09, 0xcd, 0xf8, 0x23, 0x4e, 0x62, 0x67, 0xb3, + 0x5b, 0x40, 0x48, 0x5c, 0x12, 0x4f, 0xe6, 0xf9, 0xf8, 0x3d, 0x1f, 0x33, 0xcf, 0x2f, 0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 0xb1, 0x1e, 0x35, 0xbb, 0x85, 0x7d, 0xc8, 0x04, 0x73, + 0xfb, 0x4a, 0xa4, 0x9a, 0xbf, 0x2d, 0xbd, 0xb2, 0x70, 0x3b, 0x5c, 0xe4, 0xd0, 0x7c, 0x8d, 0x2e, + 0xf2, 0x44, 0x20, 0xa6, 0xc8, 0xf3, 0xd3, 0x50, 0xf8, 0x94, 0x83, 0xcb, 0x8b, 0x46, 0xe1, 0x4e, + 0xfc, 0xb5, 0x14, 0xad, 0x21, 0xbd, 0x79, 0x56, 0x0d, 0x1f, 0x4b, 0xf3, 0xce, 0xd3, 0x5f, 0x0b, + 0x2b, 0x4f, 0xc7, 0x05, 0xee, 0xd9, 0xb8, 0xc0, 0xfd, 0x32, 0x2e, 0x70, 0x8f, 0x9f, 0x17, 0x56, + 0x9e, 0x3d, 0x2f, 0xac, 0xfc, 0xf4, 0xbc, 0xb0, 0xf2, 0xe1, 0xb5, 0xd0, 0x3c, 0x68, 0x99, 0x44, + 0xbf, 0xef, 0xbf, 0xc6, 0x52, 0x6a, 0xc7, 0xee, 0xeb, 0x2c, 0x36, 0x13, 0xba, 0x29, 0xf6, 0xc6, + 0xea, 0xf5, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x53, 0xb7, 0x4c, 0x68, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1015,6 +1434,14 @@ type MsgClient interface { // // Since: 0.40 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // SudoContract calls sudo on a contract. + SudoContract(ctx context.Context, in *MsgSudoContract, opts ...grpc.CallOption) (*MsgSudoContractResponse, error) + // PinCodes pins a set of code ids in the wasmvm cache. + PinCodes(ctx context.Context, in *MsgPinCodes, opts ...grpc.CallOption) (*MsgPinCodesResponse, error) + // UnpinCodes unpins a set of code ids in the wasmvm cache. + UnpinCodes(ctx context.Context, in *MsgUnpinCodes, opts ...grpc.CallOption) (*MsgUnpinCodesResponse, error) + // StoreAndInstantiateContract stores and instantiates the contract. + StoreAndInstantiateContract(ctx context.Context, in *MsgStoreAndInstantiateContract, opts ...grpc.CallOption) (*MsgStoreAndInstantiateContractResponse, error) } type msgClient struct { @@ -1106,31 +1533,75 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } -// MsgServer is the server API for Msg service. -type MsgServer interface { - // StoreCode to submit Wasm code to the system - StoreCode(context.Context, *MsgStoreCode) (*MsgStoreCodeResponse, error) - // InstantiateContract creates a new smart contract instance for the given - // code id. - InstantiateContract(context.Context, *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) - // InstantiateContract2 creates a new smart contract instance for the given - // code id with a predictable address - InstantiateContract2(context.Context, *MsgInstantiateContract2) (*MsgInstantiateContract2Response, error) - // Execute submits the given message data to a smart contract - ExecuteContract(context.Context, *MsgExecuteContract) (*MsgExecuteContractResponse, error) - // Migrate runs a code upgrade/ downgrade for a smart contract - MigrateContract(context.Context, *MsgMigrateContract) (*MsgMigrateContractResponse, error) - // UpdateAdmin sets a new admin for a smart contract - UpdateAdmin(context.Context, *MsgUpdateAdmin) (*MsgUpdateAdminResponse, error) - // ClearAdmin removes any admin stored for a smart contract - ClearAdmin(context.Context, *MsgClearAdmin) (*MsgClearAdminResponse, error) - // UpdateInstantiateConfig updates instantiate config for a smart contract - UpdateInstantiateConfig(context.Context, *MsgUpdateInstantiateConfig) (*MsgUpdateInstantiateConfigResponse, error) +func (c *msgClient) SudoContract(ctx context.Context, in *MsgSudoContract, opts ...grpc.CallOption) (*MsgSudoContractResponse, error) { + out := new(MsgSudoContractResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/SudoContract", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) PinCodes(ctx context.Context, in *MsgPinCodes, opts ...grpc.CallOption) (*MsgPinCodesResponse, error) { + out := new(MsgPinCodesResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/PinCodes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UnpinCodes(ctx context.Context, in *MsgUnpinCodes, opts ...grpc.CallOption) (*MsgUnpinCodesResponse, error) { + out := new(MsgUnpinCodesResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/UnpinCodes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) StoreAndInstantiateContract(ctx context.Context, in *MsgStoreAndInstantiateContract, opts ...grpc.CallOption) (*MsgStoreAndInstantiateContractResponse, error) { + out := new(MsgStoreAndInstantiateContractResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/StoreAndInstantiateContract", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // StoreCode to submit Wasm code to the system + StoreCode(context.Context, *MsgStoreCode) (*MsgStoreCodeResponse, error) + // InstantiateContract creates a new smart contract instance for the given + // code id. + InstantiateContract(context.Context, *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) + // InstantiateContract2 creates a new smart contract instance for the given + // code id with a predictable address + InstantiateContract2(context.Context, *MsgInstantiateContract2) (*MsgInstantiateContract2Response, error) + // Execute submits the given message data to a smart contract + ExecuteContract(context.Context, *MsgExecuteContract) (*MsgExecuteContractResponse, error) + // Migrate runs a code upgrade/ downgrade for a smart contract + MigrateContract(context.Context, *MsgMigrateContract) (*MsgMigrateContractResponse, error) + // UpdateAdmin sets a new admin for a smart contract + UpdateAdmin(context.Context, *MsgUpdateAdmin) (*MsgUpdateAdminResponse, error) + // ClearAdmin removes any admin stored for a smart contract + ClearAdmin(context.Context, *MsgClearAdmin) (*MsgClearAdminResponse, error) + // UpdateInstantiateConfig updates instantiate config for a smart contract + UpdateInstantiateConfig(context.Context, *MsgUpdateInstantiateConfig) (*MsgUpdateInstantiateConfigResponse, error) // UpdateParams defines a governance operation for updating the x/wasm // module parameters. The authority is defined in the keeper. // // Since: 0.40 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // SudoContract calls sudo on a contract. + SudoContract(context.Context, *MsgSudoContract) (*MsgSudoContractResponse, error) + // PinCodes pins a set of code ids in the wasmvm cache. + PinCodes(context.Context, *MsgPinCodes) (*MsgPinCodesResponse, error) + // UnpinCodes unpins a set of code ids in the wasmvm cache. + UnpinCodes(context.Context, *MsgUnpinCodes) (*MsgUnpinCodesResponse, error) + // StoreAndInstantiateContract stores and instantiates the contract. + StoreAndInstantiateContract(context.Context, *MsgStoreAndInstantiateContract) (*MsgStoreAndInstantiateContractResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1172,6 +1643,22 @@ func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateP return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) SudoContract(ctx context.Context, req *MsgSudoContract) (*MsgSudoContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SudoContract not implemented") +} + +func (*UnimplementedMsgServer) PinCodes(ctx context.Context, req *MsgPinCodes) (*MsgPinCodesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PinCodes not implemented") +} + +func (*UnimplementedMsgServer) UnpinCodes(ctx context.Context, req *MsgUnpinCodes) (*MsgUnpinCodesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnpinCodes not implemented") +} + +func (*UnimplementedMsgServer) StoreAndInstantiateContract(ctx context.Context, req *MsgStoreAndInstantiateContract) (*MsgStoreAndInstantiateContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StoreAndInstantiateContract not implemented") +} + func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } @@ -1338,6 +1825,78 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_SudoContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSudoContract) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SudoContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Msg/SudoContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SudoContract(ctx, req.(*MsgSudoContract)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_PinCodes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPinCodes) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).PinCodes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Msg/PinCodes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).PinCodes(ctx, req.(*MsgPinCodes)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UnpinCodes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUnpinCodes) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UnpinCodes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Msg/UnpinCodes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UnpinCodes(ctx, req.(*MsgUnpinCodes)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_StoreAndInstantiateContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgStoreAndInstantiateContract) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).StoreAndInstantiateContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Msg/StoreAndInstantiateContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).StoreAndInstantiateContract(ctx, req.(*MsgStoreAndInstantiateContract)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmwasm.wasm.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -1378,6 +1937,22 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "SudoContract", + Handler: _Msg_SudoContract_Handler, + }, + { + MethodName: "PinCodes", + Handler: _Msg_PinCodes_Handler, + }, + { + MethodName: "UnpinCodes", + Handler: _Msg_UnpinCodes_Handler, + }, + { + MethodName: "StoreAndInstantiateContract", + Handler: _Msg_StoreAndInstantiateContract_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmwasm/wasm/v1/tx.proto", @@ -2125,165 +2700,410 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgSudoContract) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgStoreCode) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgSudoContract) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSudoContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.Msg) > 0 { + i -= len(m.Msg) + copy(dAtA[i:], m.Msg) + i = encodeVarintTx(dAtA, i, uint64(len(m.Msg))) + i-- + dAtA[i] = 0x1a } - l = len(m.WASMByteCode) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x12 } - if m.InstantiatePermission != nil { - l = m.InstantiatePermission.Size() - n += 1 + l + sovTx(uint64(l)) + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgStoreCodeResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgSudoContractResponse) 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 *MsgSudoContractResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSudoContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.CodeID != 0 { - n += 1 + sovTx(uint64(m.CodeID)) - } - l = len(m.Checksum) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *MsgInstantiateContract) Size() (n int) { - if m == nil { - return 0 +func (m *MsgPinCodes) 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 *MsgPinCodes) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPinCodes) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Admin) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.CodeID != 0 { - n += 1 + sovTx(uint64(m.CodeID)) - } - l = len(m.Label) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Msg) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Funds) > 0 { - for _, e := range m.Funds { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) + if len(m.CodeIDs) > 0 { + dAtA5 := make([]byte, len(m.CodeIDs)*10) + var j4 int + for _, num := range m.CodeIDs { + for num >= 1<<7 { + dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j4++ + } + dAtA5[j4] = uint8(num) + j4++ } + i -= j4 + copy(dAtA[i:], dAtA5[:j4]) + i = encodeVarintTx(dAtA, i, uint64(j4)) + i-- + dAtA[i] = 0x12 } - return n + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *MsgInstantiateContract2) Size() (n int) { - if m == nil { - return 0 +func (m *MsgPinCodesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + return dAtA[:n], nil +} + +func (m *MsgPinCodesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPinCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUnpinCodes) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - l = len(m.Admin) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + return dAtA[:n], nil +} + +func (m *MsgUnpinCodes) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnpinCodes) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CodeIDs) > 0 { + dAtA7 := make([]byte, len(m.CodeIDs)*10) + var j6 int + for _, num := range m.CodeIDs { + for num >= 1<<7 { + dAtA7[j6] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j6++ + } + dAtA7[j6] = uint8(num) + j6++ + } + i -= j6 + copy(dAtA[i:], dAtA7[:j6]) + i = encodeVarintTx(dAtA, i, uint64(j6)) + i-- + dAtA[i] = 0x12 } - if m.CodeID != 0 { - n += 1 + sovTx(uint64(m.CodeID)) + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa } - l = len(m.Label) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + return len(dAtA) - i, nil +} + +func (m *MsgUnpinCodesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - l = len(m.Msg) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + return dAtA[:n], nil +} + +func (m *MsgUnpinCodesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnpinCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgStoreAndInstantiateContract) 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 *MsgStoreAndInstantiateContract) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStoreAndInstantiateContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0x62 + } + if len(m.Builder) > 0 { + i -= len(m.Builder) + copy(dAtA[i:], m.Builder) + i = encodeVarintTx(dAtA, i, uint64(len(m.Builder))) + i-- + dAtA[i] = 0x5a + } + if len(m.Source) > 0 { + i -= len(m.Source) + copy(dAtA[i:], m.Source) + i = encodeVarintTx(dAtA, i, uint64(len(m.Source))) + i-- + dAtA[i] = 0x52 } if len(m.Funds) > 0 { - for _, e := range m.Funds { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) + 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 = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a } } - l = len(m.Salt) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.Msg) > 0 { + i -= len(m.Msg) + copy(dAtA[i:], m.Msg) + i = encodeVarintTx(dAtA, i, uint64(len(m.Msg))) + i-- + dAtA[i] = 0x42 } - if m.FixMsg { - n += 2 + if len(m.Label) > 0 { + i -= len(m.Label) + copy(dAtA[i:], m.Label) + i = encodeVarintTx(dAtA, i, uint64(len(m.Label))) + i-- + dAtA[i] = 0x3a } - return n + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) + i-- + dAtA[i] = 0x32 + } + if m.UnpinCode { + i-- + if m.UnpinCode { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.InstantiatePermission != nil { + { + size, err := m.InstantiatePermission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.WASMByteCode) > 0 { + i -= len(m.WASMByteCode) + copy(dAtA[i:], m.WASMByteCode) + i = encodeVarintTx(dAtA, i, uint64(len(m.WASMByteCode))) + i-- + dAtA[i] = 0x1a + } + if len(m.RunAs) > 0 { + i -= len(m.RunAs) + copy(dAtA[i:], m.RunAs) + i = encodeVarintTx(dAtA, i, uint64(len(m.RunAs))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *MsgInstantiateContractResponse) Size() (n int) { +func (m *MsgStoreAndInstantiateContractResponse) 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 *MsgStoreAndInstantiateContractResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStoreAndInstantiateContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} + +func (m *MsgStoreCode) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Address) + l = len(m.Sender) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Data) + l = len(m.WASMByteCode) if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if m.InstantiatePermission != nil { + l = m.InstantiatePermission.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } -func (m *MsgInstantiateContract2Response) Size() (n int) { +func (m *MsgStoreCodeResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.CodeID != 0 { + n += 1 + sovTx(uint64(m.CodeID)) } - l = len(m.Data) + l = len(m.Checksum) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgExecuteContract) Size() (n int) { +func (m *MsgInstantiateContract) Size() (n int) { if m == nil { return 0 } @@ -2293,7 +3113,14 @@ func (m *MsgExecuteContract) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Contract) + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CodeID != 0 { + n += 1 + sovTx(uint64(m.CodeID)) + } + l = len(m.Label) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2310,20 +3137,7 @@ func (m *MsgExecuteContract) Size() (n int) { return n } -func (m *MsgExecuteContractResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgMigrateContract) Size() (n int) { +func (m *MsgInstantiateContract2) Size() (n int) { if m == nil { return 0 } @@ -2333,23 +3147,138 @@ func (m *MsgMigrateContract) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Contract) + l = len(m.Admin) if l > 0 { n += 1 + l + sovTx(uint64(l)) } if m.CodeID != 0 { n += 1 + sovTx(uint64(m.CodeID)) } + l = len(m.Label) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } l = len(m.Msg) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - return n -} - -func (m *MsgMigrateContractResponse) Size() (n int) { - if m == nil { - return 0 + if len(m.Funds) > 0 { + for _, e := range m.Funds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Salt) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.FixMsg { + n += 2 + } + return n +} + +func (m *MsgInstantiateContractResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgInstantiateContract2Response) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgExecuteContract) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Funds) > 0 { + for _, e := range m.Funds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgExecuteContractResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMigrateContract) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CodeID != 0 { + n += 1 + sovTx(uint64(m.CodeID)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMigrateContractResponse) Size() (n int) { + if m == nil { + return 0 } var l int _ = l @@ -2469,6 +3398,161 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgSudoContract) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSudoContractResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgPinCodes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.CodeIDs) > 0 { + l = 0 + for _, e := range m.CodeIDs { + l += sovTx(uint64(e)) + } + n += 1 + sovTx(uint64(l)) + l + } + return n +} + +func (m *MsgPinCodesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUnpinCodes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.CodeIDs) > 0 { + l = 0 + for _, e := range m.CodeIDs { + l += sovTx(uint64(e)) + } + n += 1 + sovTx(uint64(l)) + l + } + return n +} + +func (m *MsgUnpinCodesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgStoreAndInstantiateContract) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RunAs) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.WASMByteCode) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.InstantiatePermission != nil { + l = m.InstantiatePermission.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.UnpinCode { + n += 2 + } + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Label) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Funds) > 0 { + for _, e := range m.Funds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Source) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Builder) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgStoreAndInstantiateContractResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2477,7 +3561,1020 @@ func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { +func (m *MsgStoreCode) 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 ErrIntOverflowTx + } + 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: MsgStoreCode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStoreCode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WASMByteCode", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WASMByteCode = append(m.WASMByteCode[:0], dAtA[iNdEx:postIndex]...) + if m.WASMByteCode == nil { + m.WASMByteCode = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InstantiatePermission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InstantiatePermission == nil { + m.InstantiatePermission = &AccessConfig{} + } + if err := m.InstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgStoreCodeResponse) 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 ErrIntOverflowTx + } + 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: MsgStoreCodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStoreCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Checksum", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Checksum = append(m.Checksum[:0], dAtA[iNdEx:postIndex]...) + if m.Checksum == nil { + m.Checksum = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgInstantiateContract) 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 ErrIntOverflowTx + } + 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: MsgInstantiateContract: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateContract: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Label = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) + if m.Msg == nil { + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + 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 := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgInstantiateContract2) 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 ErrIntOverflowTx + } + 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: MsgInstantiateContract2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateContract2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Label = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) + if m.Msg == nil { + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + 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 + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Salt = append(m.Salt[:0], dAtA[iNdEx:postIndex]...) + if m.Salt == nil { + m.Salt = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FixMsg", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FixMsg = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgInstantiateContractResponse) 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 ErrIntOverflowTx + } + 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: MsgInstantiateContractResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgInstantiateContract2Response) 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 ErrIntOverflowTx + } + 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: MsgInstantiateContract2Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateContract2Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2500,10 +4597,10 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgStoreCode: wiretype end group for non-group") + return fmt.Errorf("proto: MsgExecuteContract: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgStoreCode: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgExecuteContract: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2540,7 +4637,39 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WASMByteCode", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -2567,14 +4696,14 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.WASMByteCode = append(m.WASMByteCode[:0], dAtA[iNdEx:postIndex]...) - if m.WASMByteCode == nil { - m.WASMByteCode = []byte{} + m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) + if m.Msg == nil { + m.Msg = []byte{} } iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InstantiatePermission", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Funds", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2601,10 +4730,8 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.InstantiatePermission == nil { - m.InstantiatePermission = &AccessConfig{} - } - if err := m.InstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 @@ -2630,7 +4757,7 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error { +func (m *MsgExecuteContractResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2653,34 +4780,15 @@ func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgStoreCodeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgExecuteContractResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgStoreCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgExecuteContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CodeID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Checksum", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -2707,9 +4815,9 @@ func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Checksum = append(m.Checksum[:0], dAtA[iNdEx:postIndex]...) - if m.Checksum == nil { - m.Checksum = []byte{} + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} } iNdEx = postIndex default: @@ -2734,7 +4842,7 @@ func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { +func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2757,10 +4865,10 @@ func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgInstantiateContract: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMigrateContract: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgInstantiateContract: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMigrateContract: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2797,7 +4905,7 @@ func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2825,7 +4933,7 @@ func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Admin = string(dAtA[iNdEx:postIndex]) + m.Contract = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 0 { @@ -2847,38 +4955,6 @@ func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { } } case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } @@ -2912,40 +4988,6 @@ func (m *MsgInstantiateContract) 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - 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 := skipTx(dAtA[iNdEx:]) @@ -2968,7 +5010,7 @@ func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgInstantiateContract2) Unmarshal(dAtA []byte) error { +func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2991,17 +5033,17 @@ func (m *MsgInstantiateContract2) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgInstantiateContract2: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMigrateContractResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgInstantiateContract2: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMigrateContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3011,78 +5053,80 @@ func (m *MsgInstantiateContract2) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Admin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgUpdateAdmin) 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 ErrIntOverflowTx } - m.CodeID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CodeID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if iNdEx >= l { + return io.ErrUnexpectedEOF } - case 4: + 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: MsgUpdateAdmin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateAdmin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3110,13 +5154,13 @@ func (m *MsgInstantiateContract2) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Label = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3126,31 +5170,29 @@ func (m *MsgInstantiateContract2) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) - if m.Msg == nil { - m.Msg = []byte{} - } + m.NewAdmin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Funds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3160,80 +5202,75 @@ func (m *MsgInstantiateContract2) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } 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 - } + m.Contract = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + byteLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Salt = append(m.Salt[:0], dAtA[iNdEx:postIndex]...) - if m.Salt == nil { - m.Salt = []byte{} + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgUpdateAdminResponse) 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 ErrIntOverflowTx } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FixMsg", wireType) + if iNdEx >= l { + return io.ErrUnexpectedEOF } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - m.FixMsg = bool(v != 0) + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateAdminResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3256,7 +5293,7 @@ func (m *MsgInstantiateContract2) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { +func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3279,15 +5316,15 @@ func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgInstantiateContractResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgClearAdmin: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgInstantiateContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgClearAdmin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3315,13 +5352,13 @@ func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3331,25 +5368,23 @@ func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } + m.Contract = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3373,7 +5408,7 @@ func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgInstantiateContract2Response) Unmarshal(dAtA []byte) error { +func (m *MsgClearAdminResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3396,15 +5431,66 @@ func (m *MsgInstantiateContract2Response) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgInstantiateContract2Response: wiretype end group for non-group") + return fmt.Errorf("proto: MsgClearAdminResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgInstantiateContract2Response: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgClearAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgUpdateInstantiateConfig) 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 ErrIntOverflowTx + } + 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: MsgUpdateInstantiateConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateInstantiateConfig: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3432,13 +5518,32 @@ func (m *MsgInstantiateContract2Response) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewInstantiatePermission", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3448,24 +5553,26 @@ func (m *MsgInstantiateContract2Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} + if m.NewInstantiatePermission == nil { + m.NewInstantiatePermission = &AccessConfig{} + } + if err := m.NewInstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -3490,7 +5597,7 @@ func (m *MsgInstantiateContract2Response) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateInstantiateConfigResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3513,47 +5620,66 @@ func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgExecuteContract: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateInstantiateConfigResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecuteContract: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateInstantiateConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgUpdateParams) 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 ErrIntOverflowTx + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3581,45 +5707,11 @@ func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) - if m.Msg == nil { - m.Msg = []byte{} - } + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Funds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3646,8 +5738,7 @@ func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { 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 { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3673,7 +5764,7 @@ func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgExecuteContractResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3696,46 +5787,12 @@ func (m *MsgExecuteContractResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgExecuteContractResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecuteContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3758,7 +5815,7 @@ func (m *MsgExecuteContractResponse) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { +func (m *MsgSudoContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3781,15 +5838,15 @@ func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMigrateContract: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSudoContract: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMigrateContract: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSudoContract: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3817,7 +5874,7 @@ func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -3852,25 +5909,6 @@ func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { m.Contract = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CodeID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } @@ -3926,7 +5964,58 @@ func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSudoContractResponse) 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 ErrIntOverflowTx + } + 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: MsgSudoContractResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSudoContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgPinCodes) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3949,17 +6038,17 @@ func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMigrateContractResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgPinCodes: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMigrateContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgPinCodes: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3969,26 +6058,100 @@ func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CodeIDs = append(m.CodeIDs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.CodeIDs) == 0 { + m.CodeIDs = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CodeIDs = append(m.CodeIDs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field CodeIDs", wireType) + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4011,7 +6174,7 @@ func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { +func (m *MsgPinCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4034,47 +6197,66 @@ func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateAdmin: wiretype end group for non-group") + return fmt.Errorf("proto: MsgPinCodesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateAdmin: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgPinCodesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *MsgUnpinCodes) 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 ErrIntOverflowTx + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + 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: MsgUnpinCodes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnpinCodes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4102,40 +6284,84 @@ func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NewAdmin = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - 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 ErrIntOverflowTx - } - if iNdEx >= l { + case 2: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CodeIDs = append(m.CodeIDs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.CodeIDs) == 0 { + m.CodeIDs = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CodeIDs = append(m.CodeIDs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field CodeIDs", wireType) } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4158,7 +6384,7 @@ func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgUpdateAdminResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUnpinCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4181,10 +6407,10 @@ func (m *MsgUpdateAdminResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateAdminResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUnpinCodesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUnpinCodesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4209,7 +6435,7 @@ func (m *MsgUpdateAdminResponse) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { +func (m *MsgStoreAndInstantiateContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4232,15 +6458,15 @@ func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgClearAdmin: wiretype end group for non-group") + return fmt.Errorf("proto: MsgStoreAndInstantiateContract: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClearAdmin: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgStoreAndInstantiateContract: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4268,11 +6494,11 @@ func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RunAs", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4300,113 +6526,133 @@ func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Contract = string(dAtA[iNdEx:postIndex]) + m.RunAs = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WASMByteCode", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { return ErrInvalidLengthTx } - if (iNdEx + skippy) > l { + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *MsgClearAdminResponse) 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 ErrIntOverflowTx + m.WASMByteCode = append(m.WASMByteCode[:0], dAtA[iNdEx:postIndex]...) + if m.WASMByteCode == nil { + m.WASMByteCode = []byte{} } - if iNdEx >= l { + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InstantiatePermission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if m.InstantiatePermission == nil { + m.InstantiatePermission = &AccessConfig{} + } + if err := m.InstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnpinCode", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgClearAdminResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClearAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err + m.UnpinCode = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *MsgUpdateInstantiateConfig) 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 ErrIntOverflowTx + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx } - if iNdEx >= l { + if postIndex > 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: MsgUpdateInstantiateConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateInstantiateConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4434,13 +6680,13 @@ func (m *MsgUpdateInstantiateConfig) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Label = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) + case 8: + 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 ErrIntOverflowTx @@ -4450,14 +6696,29 @@ func (m *MsgUpdateInstantiateConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CodeID |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - case 3: + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) + if m.Msg == nil { + m.Msg = []byte{} + } + iNdEx = postIndex + case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewInstantiatePermission", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Funds", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4484,118 +6745,46 @@ func (m *MsgUpdateInstantiateConfig) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.NewInstantiatePermission == nil { - m.NewInstantiatePermission = &AccessConfig{} - } - if err := m.NewInstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *MsgUpdateInstantiateConfigResponse) 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateInstantiateConfigResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateInstantiateConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - if (skippy < 0) || (iNdEx+skippy) < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *MsgUpdateParams) 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 ErrIntOverflowTx + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx } - if iNdEx >= l { + if postIndex > 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: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Source = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Builder", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4623,13 +6812,13 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.Builder = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 12: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4639,23 +6828,24 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.CodeHash = append(m.CodeHash[:0], dAtA[iNdEx:postIndex]...) + if m.CodeHash == nil { + m.CodeHash = []byte{} } iNdEx = postIndex default: @@ -4680,7 +6870,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { return nil } -func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgStoreAndInstantiateContractResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4703,10 +6893,10 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgStoreAndInstantiateContractResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgStoreAndInstantiateContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: From f871c2cfc9990d453139a725953faf4eafb78472 Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Fri, 17 Mar 2023 13:45:45 +0100 Subject: [PATCH 02/13] Fix simulations --- docs/proto/proto-docs.md | 42 +++- proto/cosmwasm/wasm/v1/tx.proto | 49 ++-- x/wasm/keeper/msg_server.go | 96 ++++++++ x/wasm/module.go | 6 +- x/wasm/simulation/operations.go | 1 + x/wasm/simulation/proposals.go | 108 ++++----- x/wasm/types/codec.go | 8 + x/wasm/types/tx.go | 160 +++++++++++++ x/wasm/types/tx.pb.go | 413 +++++++++++++++++++++----------- 9 files changed, 646 insertions(+), 237 deletions(-) diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index f7b3fd5a06..b55424e5b9 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -1513,7 +1513,7 @@ Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the governance account. | +| `authority` | [string](#string) | | Authority is the address of the governance account. | | `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the new WASM codes | @@ -1545,15 +1545,14 @@ Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the governance account. | -| `run_as` | [string](#string) | | | +| `authority` | [string](#string) | | Authority is the address of the governance account. | | `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | | `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | -| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional | +| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional. As default the uploaded contract is pinned to cache. | | `admin` | [string](#string) | | Admin is an optional address that can execute migrations | | `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. | | `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred from the authority account to the contract on instantiation | | `source` | [string](#string) | | Source is the URL where the code is hosted | | `builder` | [string](#string) | | Builder is the docker image used to build the code deterministically, used for smart contract verification | | `code_hash` | [bytes](#bytes) | | CodeHash is the SHA256 sum of the code outputted by builder, used for smart contract verification | @@ -1572,6 +1571,12 @@ for executing a MsgStoreAndInstantiateContract message. Since: 0.40 +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | Address is the bech32 address of the new contract instance. | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | + + @@ -1619,7 +1624,7 @@ Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the governance account. | +| `authority` | [string](#string) | | Authority is the address of the governance account. | | `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 | @@ -1637,6 +1642,11 @@ MsgSudoContract message. Since: 0.40 +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | + + @@ -1651,7 +1661,7 @@ Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the governance account. | +| `authority` | [string](#string) | | Authority is the address of the governance account. | | `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the WASM codes | @@ -1736,7 +1746,7 @@ Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the governance account. | +| `authority` | [string](#string) | | Authority is the address of the governance account. | | `params` | [Params](#cosmwasm.wasm.v1.Params) | | params defines the x/wasm parameters to update. NOTE: All parameters must be supplied. | @@ -1783,10 +1793,18 @@ Msg defines the wasm Msg service. | `UpdateParams` | [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams) | [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse) | UpdateParams defines a governance operation for updating the x/wasm module parameters. The authority is defined in the keeper. Since: 0.40 | | -| `SudoContract` | [MsgSudoContract](#cosmwasm.wasm.v1.MsgSudoContract) | [MsgSudoContractResponse](#cosmwasm.wasm.v1.MsgSudoContractResponse) | SudoContract calls sudo on a contract. | | -| `PinCodes` | [MsgPinCodes](#cosmwasm.wasm.v1.MsgPinCodes) | [MsgPinCodesResponse](#cosmwasm.wasm.v1.MsgPinCodesResponse) | PinCodes pins a set of code ids in the wasmvm cache. | | -| `UnpinCodes` | [MsgUnpinCodes](#cosmwasm.wasm.v1.MsgUnpinCodes) | [MsgUnpinCodesResponse](#cosmwasm.wasm.v1.MsgUnpinCodesResponse) | UnpinCodes unpins a set of code ids in the wasmvm cache. | | -| `StoreAndInstantiateContract` | [MsgStoreAndInstantiateContract](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContract) | [MsgStoreAndInstantiateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse) | StoreAndInstantiateContract stores and instantiates the contract. | | +| `SudoContract` | [MsgSudoContract](#cosmwasm.wasm.v1.MsgSudoContract) | [MsgSudoContractResponse](#cosmwasm.wasm.v1.MsgSudoContractResponse) | SudoContract defines a governance operation for calling sudo on a contract. The authority is defined in the keeper. + +Since: 0.40 | | +| `PinCodes` | [MsgPinCodes](#cosmwasm.wasm.v1.MsgPinCodes) | [MsgPinCodesResponse](#cosmwasm.wasm.v1.MsgPinCodesResponse) | PinCodes defines a governance operation for pinning a set of code ids in the wasmvm cache. The authority is defined in the keeper. + +Since: 0.40 | | +| `UnpinCodes` | [MsgUnpinCodes](#cosmwasm.wasm.v1.MsgUnpinCodes) | [MsgUnpinCodesResponse](#cosmwasm.wasm.v1.MsgUnpinCodesResponse) | UnpinCodes defines a governance operation for unpinning a set of code ids in the wasmvm cache. The authority is defined in the keeper. + +Since: 0.40 | | +| `StoreAndInstantiateContract` | [MsgStoreAndInstantiateContract](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContract) | [MsgStoreAndInstantiateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse) | StoreAndInstantiateContract defines a governance operation for storing and instantiating the contract. The authority is defined in the keeper. + +Since: 0.40 | | diff --git a/proto/cosmwasm/wasm/v1/tx.proto b/proto/cosmwasm/wasm/v1/tx.proto index bf0f2e284e..3add64c029 100644 --- a/proto/cosmwasm/wasm/v1/tx.proto +++ b/proto/cosmwasm/wasm/v1/tx.proto @@ -38,13 +38,25 @@ service Msg { // // Since: 0.40 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); - // SudoContract calls sudo on a contract. + // SudoContract defines a governance operation for calling sudo + // on a contract. The authority is defined in the keeper. + // + // Since: 0.40 rpc SudoContract(MsgSudoContract) returns (MsgSudoContractResponse); - // PinCodes pins a set of code ids in the wasmvm cache. + // PinCodes defines a governance operation for pinning a set of + // code ids in the wasmvm cache. The authority is defined in the keeper. + // + // Since: 0.40 rpc PinCodes(MsgPinCodes) returns (MsgPinCodesResponse); - // UnpinCodes unpins a set of code ids in the wasmvm cache. + // UnpinCodes defines a governance operation for unpinning a set of + // code ids in the wasmvm cache. The authority is defined in the keeper. + // + // Since: 0.40 rpc UnpinCodes(MsgUnpinCodes) returns (MsgUnpinCodesResponse); - // StoreAndInstantiateContract stores and instantiates the contract. + // StoreAndInstantiateContract defines a governance operation for storing + // and instantiating the contract. The authority is defined in the keeper. + // + // Since: 0.40 rpc StoreAndInstantiateContract(MsgStoreAndInstantiateContract) returns (MsgStoreAndInstantiateContractResponse); } @@ -229,7 +241,7 @@ message MsgUpdateInstantiateConfigResponse {} message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; - // authority is the address of the governance account. + // Authority is the address of the governance account. string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // params defines the x/wasm parameters to update. @@ -250,7 +262,7 @@ message MsgUpdateParamsResponse {} message MsgSudoContract { option (cosmos.msg.v1.signer) = "authority"; - // authority is the address of the governance account. + // Authority is the address of the governance account. string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract @@ -263,7 +275,10 @@ message MsgSudoContract { // MsgSudoContract message. // // Since: 0.40 -message MsgSudoContractResponse {} +message MsgSudoContractResponse { + // Data contains bytes to returned from the contract + bytes data = 1; +} // MsgPinCodes is the MsgPinCodes request type. // @@ -271,7 +286,7 @@ message MsgSudoContractResponse {} message MsgPinCodes { option (cosmos.msg.v1.signer) = "authority"; - // authority is the address of the governance account. + // Authority is the address of the governance account. string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeIDs references the new WASM codes repeated uint64 code_ids = 2 [ @@ -292,7 +307,7 @@ message MsgPinCodesResponse {} message MsgUnpinCodes { option (cosmos.msg.v1.signer) = "authority"; - // authority is the address of the governance account. + // Authority is the address of the governance account. string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeIDs references the WASM codes repeated uint64 code_ids = 2 [ @@ -314,14 +329,14 @@ message MsgUnpinCodesResponse {} message MsgStoreAndInstantiateContract { option (cosmos.msg.v1.signer) = "authority"; - // authority is the address of the governance account. + // Authority is the address of the governance account. string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - string run_as = 2; // WASMByteCode can be raw or gzip compressed bytes wasm_byte_code = 3 [ (gogoproto.customname) = "WASMByteCode" ]; // InstantiatePermission to apply on contract creation, optional AccessConfig instantiate_permission = 4; - // UnpinCode code on upload, optional + // UnpinCode code on upload, optional. As default the uploaded contract is + // pinned to cache. bool unpin_code = 5; // Admin is an optional address that can execute migrations string admin = 6; @@ -329,7 +344,8 @@ message MsgStoreAndInstantiateContract { string label = 7; // Msg json encoded message to be passed to the contract on instantiation bytes msg = 8 [ (gogoproto.casttype) = "RawContractMessage" ]; - // Funds coins that are transferred to the contract on instantiation + // Funds coins that are transferred from the authority account to the contract + // on instantiation repeated cosmos.base.v1beta1.Coin funds = 9 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" @@ -348,4 +364,9 @@ message MsgStoreAndInstantiateContract { // for executing a MsgStoreAndInstantiateContract message. // // Since: 0.40 -message MsgStoreAndInstantiateContractResponse {} \ No newline at end of file +message MsgStoreAndInstantiateContractResponse { + // Address is the bech32 address of the new contract instance. + string address = 1; + // Data contains bytes to returned from the contract + bytes data = 2; +} \ No newline at end of file diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go index bfc3e8b445..17990ecdba 100644 --- a/x/wasm/keeper/msg_server.go +++ b/x/wasm/keeper/msg_server.go @@ -238,3 +238,99 @@ func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam return &types.MsgUpdateParamsResponse{}, nil } + +// PinCodes pins a set of code ids in the wasmvm cache. +func (m msgServer) PinCodes(goCtx context.Context, req *types.MsgPinCodes) (*types.MsgPinCodesResponse, error) { + authority := m.paramStore.GetAuthority() + if authority != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + for _, codeID := range req.CodeIDs { + if err := m.keeper.PinCode(ctx, codeID); err != nil { + return nil, err + } + } + + return &types.MsgPinCodesResponse{}, nil +} + +// UnpinCodes unpins a set of code ids in the wasmvm cache. +func (m msgServer) UnpinCodes(goCtx context.Context, req *types.MsgUnpinCodes) (*types.MsgUnpinCodesResponse, error) { + authority := m.paramStore.GetAuthority() + if authority != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + for _, codeID := range req.CodeIDs { + if err := m.keeper.UnpinCode(ctx, codeID); err != nil { + return nil, err + } + } + + return &types.MsgUnpinCodesResponse{}, nil +} + +// SudoContract calls sudo on a contract. +func (m msgServer) SudoContract(goCtx context.Context, req *types.MsgSudoContract) (*types.MsgSudoContractResponse, error) { + authority := m.paramStore.GetAuthority() + if authority != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + contractAddr, err := sdk.AccAddressFromBech32(req.Contract) + if err != nil { + return nil, errorsmod.Wrap(err, "contract") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + data, err := m.keeper.Sudo(ctx, contractAddr, req.Msg) + if err != nil { + return nil, err + } + + return &types.MsgSudoContractResponse{Data: data}, nil +} + +// StoreAndInstantiateContract stores and instantiates the contract. +func (m msgServer) StoreAndInstantiateContract(goCtx context.Context, req *types.MsgStoreAndInstantiateContract) (*types.MsgStoreAndInstantiateContractResponse, error) { + authority := m.paramStore.GetAuthority() + if authority != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + authorityAddr, err := sdk.AccAddressFromBech32(authority) + if err != nil { + return nil, errorsmod.Wrap(err, "admin") + } + + if err = req.ValidateBasic(); err != nil { + return nil, err + } + + var adminAddr sdk.AccAddress + if req.Admin != "" { + if adminAddr, err = sdk.AccAddressFromBech32(req.Admin); err != nil { + return nil, errorsmod.Wrap(err, "admin") + } + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + codeID, _, err := m.keeper.Create(ctx, authorityAddr, req.WASMByteCode, req.InstantiatePermission) + if err != nil { + return nil, err + } + + contractAddr, data, err := m.keeper.Instantiate(ctx, codeID, authorityAddr, adminAddr, req.Msg, req.Label, req.Funds) + if err != nil { + return nil, err + } + + return &types.MsgStoreAndInstantiateContractResponse{ + Address: contractAddr.String(), + Data: data, + }, nil +} diff --git a/x/wasm/module.go b/x/wasm/module.go index 272b32d1a4..6fc956289f 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -208,9 +208,9 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { simulation.RandomizedGenState(simState) } -// ProposalContents doesn't return any content functions for governance proposals. -func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return simulation.ProposalContents(am.bankKeeper, am.keeper) +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return simulation.ProposalMsgs(am.bankKeeper, am.keeper) } // RegisterStoreDecoder registers a decoder for supply module's types diff --git a/x/wasm/simulation/operations.go b/x/wasm/simulation/operations.go index 06c430eab7..ea5860b369 100644 --- a/x/wasm/simulation/operations.go +++ b/x/wasm/simulation/operations.go @@ -38,6 +38,7 @@ const ( // WasmKeeper is a subset of the wasm keeper used by simulations type WasmKeeper interface { + GetAuthority() string GetParams(ctx sdk.Context) types.Params IterateCodeInfos(ctx sdk.Context, cb func(uint64, types.CodeInfo) bool) IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool) diff --git a/x/wasm/simulation/proposals.go b/x/wasm/simulation/proposals.go index ebb78680f7..8fc7bd2d5b 100644 --- a/x/wasm/simulation/proposals.go +++ b/x/wasm/simulation/proposals.go @@ -4,7 +4,6 @@ import ( "math/rand" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" @@ -106,8 +105,7 @@ func ProposalMsgs(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedPropo // but this proposal may need more than it func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - // use the default gov module account address as authority - var authority sdk.AccAddress = address.Module("gov") + authority := wasmKeeper.GetAuthority() simAccount, _ := simtypes.RandomAcc(r, accs) @@ -116,7 +114,7 @@ func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn { permission := wasmKeeper.GetParams(ctx).InstantiateDefaultPermission.With(simAccount.Address) return &types.MsgStoreCode{ - Sender: authority.String(), + Sender: authority, WASMByteCode: wasmBz, InstantiatePermission: &permission, } @@ -124,12 +122,9 @@ func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn { } // Simulate instantiate contract proposal -// - func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - // use the default gov module account address as authority - var authority sdk.AccAddress = address.Module("gov") + authority := wasmKeeper.GetAuthority() // admin adminAccount, _ := simtypes.RandomAcc(r, accs) @@ -140,7 +135,7 @@ func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, c } return &types.MsgInstantiateContract{ - Sender: authority.String(), + Sender: authority, Admin: string(adminAccount.Address), CodeID: codeID, Label: simtypes.RandStringOfLength(r, 10), @@ -151,8 +146,6 @@ func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, c } // Simulate execute contract proposal -// - func SimulateExecuteContractProposal( _ BankKeeper, wasmKeeper WasmKeeper, @@ -161,8 +154,7 @@ func SimulateExecuteContractProposal( payloader MsgExecutePayloader, ) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - // use the default gov module account address as authority - var authority sdk.AccAddress = address.Module("gov") + authority := wasmKeeper.GetAuthority() ctAddress := contractSelector(ctx, wasmKeeper) if ctAddress == nil { @@ -170,7 +162,7 @@ func SimulateExecuteContractProposal( } return &types.MsgExecuteContract{ - Sender: authority.String(), + Sender: authority, Contract: ctAddress.String(), Funds: sdk.Coins{}, } @@ -198,10 +190,9 @@ func DefaultSimulateUpdateAdminProposalContractSelector( } // Simulate update admin contract proposal -// - func SimulateUpdateAdminProposal(wasmKeeper WasmKeeper, contractSelector UpdateAdminContractSelector) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + authority := wasmKeeper.GetAuthority() simAccount, _ := simtypes.RandomAcc(r, accs) ctAddress, _ := contractSelector(ctx, wasmKeeper, simAccount.Address.String()) if ctAddress == nil { @@ -209,7 +200,7 @@ func SimulateUpdateAdminProposal(wasmKeeper WasmKeeper, contractSelector UpdateA } return &types.MsgUpdateAdmin{ - Sender: "", + Sender: authority, NewAdmin: simtypes.RandomAccounts(r, 1)[0].Address.String(), Contract: ctAddress.String(), } @@ -231,16 +222,16 @@ func DefaultSimulateContractSelector( } // Simulate clear admin proposal -// - func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdminContractSelector) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + authority := wasmKeeper.GetAuthority() + ctAddress := contractSelector(ctx, wasmKeeper) if ctAddress == nil { return nil } return &types.MsgClearAdmin{ - Sender: "", + Sender: authority, Contract: ctAddress.String(), } } @@ -249,10 +240,10 @@ func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdm type MigrateContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.AccAddress // Simulate migrate contract proposal -// - func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector MigrateContractProposalContractSelector, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + authority := wasmKeeper.GetAuthority() + ctAddress := contractSelector(ctx, wasmKeeper) if ctAddress == nil { return nil @@ -264,7 +255,7 @@ func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector Mig } return &types.MsgMigrateContract{ - Sender: "", + Sender: authority, Contract: ctAddress.String(), CodeID: codeID, Msg: []byte(`{}`), @@ -275,17 +266,17 @@ func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector Mig type SudoContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.AccAddress // Simulate sudo contract proposal -// - func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoContractProposalContractSelector) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + authority := wasmKeeper.GetAuthority() + ctAddress := contractSelector(ctx, wasmKeeper) if ctAddress == nil { return nil } - return types.MsgSudoContract{ - Authority: "", + return &types.MsgSudoContract{ + Authority: authority, Contract: ctAddress.String(), Msg: []byte(`{}`), } @@ -293,45 +284,44 @@ func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoCo } // Simulate pin contract proposal -// - func SimulatePinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + authority := wasmKeeper.GetAuthority() + codeID := codeSelector(ctx, wasmKeeper) if codeID == 0 { return nil } return &types.MsgPinCodes{ - Authority: "", + Authority: authority, CodeIDs: []uint64{codeID}, } } } // Simulate unpin contract proposal -// - func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + authority := wasmKeeper.GetAuthority() + codeID := codeSelector(ctx, wasmKeeper) if codeID == 0 { return nil } - return types.NewUnpinCodesProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - []uint64{codeID}, - ) + return &types.MsgUnpinCodes{ + Authority: authority, + CodeIDs: []uint64{codeID}, + } } } // Simulate update instantiate config proposal -// - func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + authority := wasmKeeper.GetAuthority() + codeID := codeSelector(ctx, wasmKeeper) if codeID == 0 { return nil @@ -341,41 +331,33 @@ func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector permission := wasmKeeper.GetParams(ctx).InstantiateDefaultPermission config := permission.With(simAccount.Address) - configUpdate := types.AccessConfigUpdate{ - CodeID: codeID, - InstantiatePermission: config, + return &types.MsgUpdateInstantiateConfig{ + Sender: authority, + CodeID: codeID, + NewInstantiatePermission: &config, } - - return types.NewUpdateInstantiateConfigProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - configUpdate, - ) } } func SimulateStoreAndInstantiateContractProposal(wasmKeeper WasmKeeper) simtypes.MsgSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + authority := wasmKeeper.GetAuthority() + simAccount, _ := simtypes.RandomAcc(r, accs) adminAccount, _ := simtypes.RandomAcc(r, accs) wasmBz := testdata.ReflectContractWasm() permission := wasmKeeper.GetParams(ctx).InstantiateDefaultPermission.With(simAccount.Address) - return types.NewStoreAndInstantiateContractProposal( - simtypes.RandStringOfLength(r, 10), - simtypes.RandStringOfLength(r, 10), - simAccount.Address.String(), - wasmBz, - "", - "", - []byte{}, - &permission, - false, - adminAccount.Address.String(), - simtypes.RandStringOfLength(r, 10), - []byte(`{}`), - sdk.Coins{}, - ) + return &types.MsgStoreAndInstantiateContract{ + Authority: authority, + WASMByteCode: wasmBz, + InstantiatePermission: &permission, + UnpinCode: false, + Admin: adminAccount.Address.String(), + Label: simtypes.RandStringOfLength(r, 10), + Msg: []byte(`{}`), + Funds: sdk.Coins{}, + } } } diff --git a/x/wasm/types/codec.go b/x/wasm/types/codec.go index d486ea60e2..c25b338e02 100644 --- a/x/wasm/types/codec.go +++ b/x/wasm/types/codec.go @@ -24,6 +24,10 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgClearAdmin{}, "wasm/MsgClearAdmin", nil) cdc.RegisterConcrete(&MsgUpdateInstantiateConfig{}, "wasm/MsgUpdateInstantiateConfig", nil) cdc.RegisterConcrete(&MsgUpdateParams{}, "wasm/MsgUpdateParams", nil) + cdc.RegisterConcrete(&MsgSudoContract{}, "wasm/MsgSudoContract", nil) + cdc.RegisterConcrete(&MsgPinCodes{}, "wasm/MsgPinCodes", nil) + cdc.RegisterConcrete(&MsgUnpinCodes{}, "wasm/MsgUnpinCodes", nil) + cdc.RegisterConcrete(&MsgStoreAndInstantiateContract{}, "wasm/MsgStoreAndInstantiateContract", nil) cdc.RegisterConcrete(&PinCodesProposal{}, "wasm/PinCodesProposal", nil) cdc.RegisterConcrete(&UnpinCodesProposal{}, "wasm/UnpinCodesProposal", nil) @@ -68,6 +72,10 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgIBCSend{}, &MsgUpdateInstantiateConfig{}, &MsgUpdateParams{}, + &MsgSudoContract{}, + &MsgPinCodes{}, + &MsgUnpinCodes{}, + &MsgStoreAndInstantiateContract{}, ) registry.RegisterImplementations( (*v1beta1.Content)(nil), diff --git a/x/wasm/types/tx.go b/x/wasm/types/tx.go index 22c8f1b052..25a2305e96 100644 --- a/x/wasm/types/tx.go +++ b/x/wasm/types/tx.go @@ -478,5 +478,165 @@ func (msg MsgUpdateParams) GetSignBytes() []byte { } func (msg MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority") + } return msg.Params.ValidateBasic() } + +func (msg MsgPinCodes) Route() string { + return RouterKey +} + +func (msg MsgPinCodes) Type() string { + return "pin-codes" +} + +func (msg MsgPinCodes) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg MsgPinCodes) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgPinCodes) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority") + } + if len(msg.CodeIDs) == 0 { + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "empty code ids") + } + return nil +} + +func (msg MsgUnpinCodes) Route() string { + return RouterKey +} + +func (msg MsgUnpinCodes) Type() string { + return "unpin-codes" +} + +func (msg MsgUnpinCodes) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg MsgUnpinCodes) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgUnpinCodes) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority") + } + if len(msg.CodeIDs) == 0 { + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "empty code ids") + } + return nil +} + +func (msg MsgSudoContract) Route() string { + return RouterKey +} + +func (msg MsgSudoContract) Type() string { + return "sudo-contract" +} + +func (msg MsgSudoContract) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg MsgSudoContract) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgSudoContract) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority") + } + if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil { + return errorsmod.Wrap(err, "contract") + } + if err := msg.Msg.ValidateBasic(); err != nil { + return errorsmod.Wrap(err, "payload msg") + } + return nil +} + +func (msg MsgStoreAndInstantiateContract) Route() string { + return RouterKey +} + +func (msg MsgStoreAndInstantiateContract) Type() string { + return "store-and-instantiate-contract" +} + +func (msg MsgStoreAndInstantiateContract) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg MsgStoreAndInstantiateContract) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgStoreAndInstantiateContract) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority") + } + + if err := ValidateLabel(msg.Label); err != nil { + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "label is required") + } + + if !msg.Funds.IsValid() { + return sdkerrors.ErrInvalidCoins + } + + if len(msg.Admin) != 0 { + if _, err := sdk.AccAddressFromBech32(msg.Admin); err != nil { + return errorsmod.Wrap(err, "admin") + } + } + if err := msg.Msg.ValidateBasic(); err != nil { + return errorsmod.Wrap(err, "payload msg") + } + + if err := validateWasmCode(msg.WASMByteCode, MaxWasmSize); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "code bytes %s", err.Error()) + } + + if msg.InstantiatePermission != nil { + if err := msg.InstantiatePermission.ValidateBasic(); err != nil { + return errorsmod.Wrap(err, "instantiate permission") + } + // AccessTypeOnlyAddress is still considered valid as legacy instantiation permission + // but not for new contracts + if msg.InstantiatePermission.Permission == AccessTypeOnlyAddress { + return ErrInvalid.Wrap("unsupported type, use AccessTypeAnyOfAddresses instead") + } + // AccessTypeOnlyAddress is still considered valid as legacy instantiation permission + // but not for new contracts + if msg.InstantiatePermission.Permission == AccessTypeOnlyAddress { + return ErrInvalid.Wrap("unsupported type, use AccessTypeAnyOfAddresses instead") + } + } + return nil +} diff --git a/x/wasm/types/tx.pb.go b/x/wasm/types/tx.pb.go index ed97d19f8a..d661f41c69 100644 --- a/x/wasm/types/tx.pb.go +++ b/x/wasm/types/tx.pb.go @@ -795,7 +795,7 @@ var xxx_messageInfo_MsgUpdateInstantiateConfigResponse proto.InternalMessageInfo // // Since: 0.40 type MsgUpdateParams struct { - // authority is the address of the governance account. + // Authority is the address of the governance account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // params defines the x/wasm parameters to update. // @@ -889,7 +889,7 @@ var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo // // Since: 0.40 type MsgSudoContract struct { - // authority is the address of the governance account. + // Authority is the address of the governance account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // Contract is the address of the smart contract Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"` @@ -939,7 +939,10 @@ var xxx_messageInfo_MsgSudoContract proto.InternalMessageInfo // MsgSudoContract message. // // Since: 0.40 -type MsgSudoContractResponse struct{} +type MsgSudoContractResponse struct { + // Data contains bytes to returned from the contract + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} func (m *MsgSudoContractResponse) Reset() { *m = MsgSudoContractResponse{} } func (m *MsgSudoContractResponse) String() string { return proto.CompactTextString(m) } @@ -983,7 +986,7 @@ var xxx_messageInfo_MsgSudoContractResponse proto.InternalMessageInfo // // Since: 0.40 type MsgPinCodes struct { - // authority is the address of the governance account. + // Authority is the address of the governance account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // CodeIDs references the new WASM codes CodeIDs []uint64 `protobuf:"varint,2,rep,packed,name=code_ids,json=codeIds,proto3" json:"code_ids,omitempty" yaml:"code_ids"` @@ -1075,7 +1078,7 @@ var xxx_messageInfo_MsgPinCodesResponse proto.InternalMessageInfo // // Since: 0.40 type MsgUnpinCodes struct { - // authority is the address of the governance account. + // Authority is the address of the governance account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // CodeIDs references the WASM codes CodeIDs []uint64 `protobuf:"varint,2,rep,packed,name=code_ids,json=codeIds,proto3" json:"code_ids,omitempty" yaml:"code_ids"` @@ -1168,14 +1171,14 @@ var xxx_messageInfo_MsgUnpinCodesResponse proto.InternalMessageInfo // // Since: 0.40 type MsgStoreAndInstantiateContract struct { - // authority is the address of the governance account. + // Authority is the address of the governance account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - RunAs string `protobuf:"bytes,2,opt,name=run_as,json=runAs,proto3" json:"run_as,omitempty"` // WASMByteCode can be raw or gzip compressed WASMByteCode []byte `protobuf:"bytes,3,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"` // InstantiatePermission to apply on contract creation, optional InstantiatePermission *AccessConfig `protobuf:"bytes,4,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission,omitempty"` - // UnpinCode code on upload, optional + // UnpinCode code on upload, optional. As default the uploaded contract is + // pinned to cache. UnpinCode bool `protobuf:"varint,5,opt,name=unpin_code,json=unpinCode,proto3" json:"unpin_code,omitempty"` // Admin is an optional address that can execute migrations Admin string `protobuf:"bytes,6,opt,name=admin,proto3" json:"admin,omitempty"` @@ -1183,7 +1186,8 @@ type MsgStoreAndInstantiateContract struct { Label string `protobuf:"bytes,7,opt,name=label,proto3" json:"label,omitempty"` // Msg json encoded message to be passed to the contract on instantiation Msg RawContractMessage `protobuf:"bytes,8,opt,name=msg,proto3,casttype=RawContractMessage" json:"msg,omitempty"` - // Funds coins that are transferred to the contract on instantiation + // Funds coins that are transferred from the authority account to the contract + // on instantiation Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,9,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` // Source is the URL where the code is hosted Source string `protobuf:"bytes,10,opt,name=source,proto3" json:"source,omitempty"` @@ -1237,7 +1241,12 @@ var xxx_messageInfo_MsgStoreAndInstantiateContract proto.InternalMessageInfo // for executing a MsgStoreAndInstantiateContract message. // // Since: 0.40 -type MsgStoreAndInstantiateContractResponse struct{} +type MsgStoreAndInstantiateContractResponse struct { + // Address is the bech32 address of the new contract instance. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Data contains bytes to returned from the contract + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} func (m *MsgStoreAndInstantiateContractResponse) Reset() { *m = MsgStoreAndInstantiateContractResponse{} @@ -1311,90 +1320,90 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/tx.proto", fileDescriptor_4f74d82755520264) } var fileDescriptor_4f74d82755520264 = []byte{ - // 1328 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x8f, 0xdb, 0x44, - 0x1b, 0x5f, 0x6f, 0x9c, 0xaf, 0x27, 0x79, 0xdb, 0x95, 0xbb, 0x1f, 0x5e, 0xf7, 0x6d, 0x12, 0x42, - 0x29, 0x29, 0x6a, 0x93, 0xdd, 0x80, 0x2a, 0xe8, 0x2d, 0x49, 0x91, 0xd8, 0x4a, 0x81, 0x95, 0x57, - 0xa5, 0x02, 0x55, 0x8a, 0x26, 0xf1, 0xac, 0x63, 0x35, 0xb6, 0x83, 0xc7, 0xee, 0xee, 0x1e, 0xb8, - 0x70, 0xe3, 0x56, 0xb8, 0x72, 0xe0, 0xc2, 0x89, 0x13, 0x07, 0xfa, 0x1f, 0x70, 0x28, 0x17, 0x54, - 0x71, 0xe2, 0x14, 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45, 0x04, - 0x04, 0xc9, 0x43, 0xc7, 0x50, 0x88, 0x98, 0x2a, 0x25, 0x2a, 0xb9, 0xfa, 0x76, 0xd5, 0xab, 0x3a, - 0xed, 0xb7, 0xaa, 0xd7, 0x6f, 0xd5, 0x96, 0xa9, 0x19, 0xcd, 0x9d, 0xa7, 0xa3, 0xe2, 0xca, 0xd7, - 0x3f, 0x17, 0x2b, 0xaa, 0x66, 0xf7, 0x9d, 0x6e, 0xb5, 0x67, 0xea, 0x5e, 0x8b, 0x78, 0x5f, 0x37, - 0x89, 0xf2, 0xd0, 0x6b, 0x27, 0xaa, 0x40, 0x64, 0xd7, 0xf2, 0x54, 0x09, 0xca, 0xdf, 0xaf, 0xc2, - 0x56, 0x74, 0x76, 0xea, 0xff, 0xcd, 0xf4, 0x08, 0x02, 0xf0, 0x04, 0x0d, 0x6c, 0x31, 0xcd, 0xfa, - 0x88, 0x3d, 0x0b, 0x5b, 0x90, 0x3e, 0xd4, 0x8e, 0x3b, 0x14, 0x64, 0xa6, 0xc4, 0x55, 0x32, 0x72, - 0xea, 0x50, 0x3b, 0x6e, 0x13, 0x75, 0x3a, 0x97, 0xef, 0x42, 0x21, 0x3a, 0x95, 0x41, 0x33, 0x8b, - 0x90, 0x46, 0x8a, 0x62, 0x61, 0x42, 0xbc, 0x94, 0xfa, 0x4b, 0xea, 0x55, 0x41, 0x36, 0xf2, 0xba, - 0x97, 0x3d, 0x97, 0xdf, 0x83, 0x62, 0x4c, 0x69, 0xce, 0x69, 0x70, 0xcc, 0x81, 0xd0, 0x26, 0xea, - 0xdb, 0xc7, 0xb8, 0xe7, 0x2c, 0x71, 0x0c, 0xe8, 0xa9, 0xf2, 0x64, 0xbc, 0x52, 0x07, 0x6b, 0xbf, - 0x64, 0x89, 0x33, 0x94, 0x2c, 0xf9, 0xcf, 0x74, 0xf4, 0x0e, 0x48, 0xf3, 0x31, 0x06, 0x09, 0xf3, - 0xd3, 0xc2, 0x85, 0xd2, 0xf2, 0x95, 0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, 0x7c, 0x20, 0xae, - 0x87, 0x26, 0x4f, 0x0f, 0xaa, 0xec, 0x49, 0xdf, 0xbe, 0x40, 0x61, 0x4f, 0xec, 0x94, 0xb7, 0xd9, - 0x44, 0x09, 0x43, 0x0a, 0xe0, 0x7e, 0xe9, 0xc2, 0x3d, 0x70, 0x14, 0x33, 0x38, 0x66, 0xe7, 0x85, - 0xfb, 0x97, 0xdc, 0x4e, 0x31, 0xe0, 0xc3, 0x00, 0x03, 0xf0, 0x8f, 0x39, 0xc8, 0xb5, 0x89, 0xba, - 0xaf, 0x19, 0xb4, 0x2b, 0xce, 0x9f, 0xe7, 0xb7, 0x28, 0x70, 0xd6, 0x69, 0x34, 0xd3, 0x89, 0x0a, - 0xdf, 0x2c, 0x8c, 0x47, 0xc5, 0xb4, 0xdb, 0x6a, 0xe4, 0xf7, 0x51, 0xf1, 0xe2, 0x09, 0xd2, 0x07, - 0xb7, 0xcb, 0xbe, 0x50, 0x59, 0x4e, 0xbb, 0xed, 0x37, 0x9f, 0xea, 0x0d, 0xb8, 0x14, 0x42, 0x14, - 0x20, 0xfd, 0x9c, 0x63, 0xc7, 0xed, 0x9e, 0x31, 0xfc, 0x17, 0x61, 0x75, 0x0f, 0xec, 0x04, 0x53, - 0x80, 0xf6, 0x09, 0xcf, 0xe6, 0x26, 0xa3, 0x7e, 0x0d, 0x43, 0x89, 0x22, 0x6a, 0xe7, 0x85, 0xbf, - 0x01, 0x29, 0xcb, 0x31, 0x3a, 0x88, 0xf8, 0x54, 0xc5, 0x72, 0x8c, 0x06, 0x89, 0xe0, 0xc4, 0x89, - 0x17, 0xe4, 0xc4, 0xfc, 0x0b, 0x70, 0x62, 0xe1, 0x0a, 0x80, 0x43, 0xd3, 0xe2, 0x42, 0x49, 0x32, - 0x82, 0x91, 0x75, 0xfc, 0x44, 0x4d, 0xe8, 0x56, 0x2a, 0x4c, 0xb7, 0x02, 0x26, 0x95, 0x8e, 0x60, - 0x52, 0x99, 0x33, 0x8c, 0xe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 0x67, 0x91, 0x0e, 0xdc, 0x3f, - 0x80, 0xfc, 0x14, 0xcf, 0x78, 0x69, 0x81, 0x15, 0x57, 0x44, 0xba, 0x7e, 0xaa, 0x48, 0xd8, 0xfa, - 0x14, 0x2d, 0x88, 0xb6, 0x1e, 0x16, 0x89, 0xb1, 0x1e, 0x35, 0xbb, 0x85, 0x7d, 0xc8, 0x04, 0x73, - 0xfb, 0x4a, 0xa4, 0x9a, 0xbf, 0x2d, 0xbd, 0xb2, 0x70, 0x3b, 0x5c, 0xe4, 0xd0, 0x7c, 0x8d, 0x2e, - 0xf2, 0x44, 0x20, 0xa6, 0xc8, 0xf3, 0xd3, 0x50, 0xf8, 0x94, 0x83, 0xcb, 0x8b, 0x46, 0xe1, 0x4e, - 0xfc, 0xb5, 0x14, 0xad, 0x21, 0xbd, 0x79, 0x56, 0x0d, 0x1f, 0x4b, 0xf3, 0xce, 0xd3, 0x5f, 0x0b, - 0x2b, 0x4f, 0xc7, 0x05, 0xee, 0xd9, 0xb8, 0xc0, 0xfd, 0x32, 0x2e, 0x70, 0x8f, 0x9f, 0x17, 0x56, - 0x9e, 0x3d, 0x2f, 0xac, 0xfc, 0xf4, 0xbc, 0xb0, 0xf2, 0xe1, 0xb5, 0xd0, 0x3c, 0x68, 0x99, 0x44, - 0xbf, 0xef, 0xbf, 0xc6, 0x52, 0x6a, 0xc7, 0xee, 0xeb, 0x2c, 0x36, 0x13, 0xba, 0x29, 0xf6, 0xc6, - 0xea, 0xf5, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x53, 0xb7, 0x4c, 0x68, 0x13, 0x00, 0x00, + // 1319 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xc6, 0xeb, 0xaf, 0x67, 0xd3, 0x46, 0x5b, 0x37, 0xd9, 0x6c, 0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 0xbb, + 0x99, 0x92, 0x8a, 0x70, 0x13, 0x45, 0xad, 0xde, 0x87, 0x4c, 0x90, 0x43, 0x15, 0x43, 0x95, 0x03, + 0x12, 0x52, 0xf9, 0x34, 0x09, 0xdf, 0xf4, 0x23, 0x80, 0x00, 0x29, 0x2a, 0x84, 0xea, 0x8d, 0x05, + 0xa4, 0x57, 0x4f, 0x11, 0xf0, 0xed, 0x7e, 0x04, 0x6b, 0x51, 0x04, 0xe8, 0xf6, 0x1c, 0x70, 0x33, + 0xd2, 0xd2, 0x1b, 0x67, 0x91, 0xf6, 0xdd, 0x3f, 0x81, 0xec, 0x04, 0x25, 0x79, 0x69, 0x8e, 0x15, + 0x47, 0x44, 0xba, 0x75, 0xaa, 0x48, 0xd0, 0xfa, 0x04, 0x83, 0x08, 0xb7, 0x1e, 0x14, 0x89, 0xb0, + 0x1e, 0x3a, 0xe6, 0x77, 0x20, 0xe5, 0x8f, 0xf3, 0xeb, 0xa1, 0x6a, 0xde, 0xb6, 0xf4, 0xca, 0xdc, + 0xed, 0xe0, 0x21, 0x07, 0xc6, 0x6e, 0xf8, 0x21, 0x8f, 0x05, 0x22, 0x0e, 0x79, 0x76, 0x48, 0x0a, + 0x9f, 0x70, 0x70, 0x6d, 0xde, 0x84, 0xdc, 0x88, 0xbe, 0x96, 0xc2, 0x35, 0xa4, 0x37, 0xcf, 0xaa, + 0xe1, 0x61, 0xa9, 0xdf, 0x3f, 0xfe, 0x2d, 0xbf, 0x74, 0x3c, 0xca, 0x73, 0xcf, 0x47, 0x79, 0xee, + 0xd7, 0x51, 0x9e, 0x7b, 0x76, 0x92, 0x5f, 0x7a, 0x7e, 0x92, 0x5f, 0xfa, 0xf9, 0x24, 0xbf, 0xf4, + 0xc1, 0xcd, 0xc0, 0xf4, 0x68, 0x98, 0x44, 0x7f, 0xec, 0xbd, 0xf1, 0x52, 0xaa, 0x87, 0xce, 0x9b, + 0x2f, 0x36, 0x41, 0xda, 0x09, 0xf6, 0x72, 0xeb, 0xf5, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x77, + 0x6c, 0x46, 0x8e, 0x93, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1434,13 +1443,25 @@ type MsgClient interface { // // Since: 0.40 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) - // SudoContract calls sudo on a contract. + // SudoContract defines a governance operation for calling sudo + // on a contract. The authority is defined in the keeper. + // + // Since: 0.40 SudoContract(ctx context.Context, in *MsgSudoContract, opts ...grpc.CallOption) (*MsgSudoContractResponse, error) - // PinCodes pins a set of code ids in the wasmvm cache. + // PinCodes defines a governance operation for pinning a set of + // code ids in the wasmvm cache. The authority is defined in the keeper. + // + // Since: 0.40 PinCodes(ctx context.Context, in *MsgPinCodes, opts ...grpc.CallOption) (*MsgPinCodesResponse, error) - // UnpinCodes unpins a set of code ids in the wasmvm cache. + // UnpinCodes defines a governance operation for unpinning a set of + // code ids in the wasmvm cache. The authority is defined in the keeper. + // + // Since: 0.40 UnpinCodes(ctx context.Context, in *MsgUnpinCodes, opts ...grpc.CallOption) (*MsgUnpinCodesResponse, error) - // StoreAndInstantiateContract stores and instantiates the contract. + // StoreAndInstantiateContract defines a governance operation for storing + // and instantiating the contract. The authority is defined in the keeper. + // + // Since: 0.40 StoreAndInstantiateContract(ctx context.Context, in *MsgStoreAndInstantiateContract, opts ...grpc.CallOption) (*MsgStoreAndInstantiateContractResponse, error) } @@ -1594,13 +1615,25 @@ type MsgServer interface { // // Since: 0.40 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) - // SudoContract calls sudo on a contract. + // SudoContract defines a governance operation for calling sudo + // on a contract. The authority is defined in the keeper. + // + // Since: 0.40 SudoContract(context.Context, *MsgSudoContract) (*MsgSudoContractResponse, error) - // PinCodes pins a set of code ids in the wasmvm cache. + // PinCodes defines a governance operation for pinning a set of + // code ids in the wasmvm cache. The authority is defined in the keeper. + // + // Since: 0.40 PinCodes(context.Context, *MsgPinCodes) (*MsgPinCodesResponse, error) - // UnpinCodes unpins a set of code ids in the wasmvm cache. + // UnpinCodes defines a governance operation for unpinning a set of + // code ids in the wasmvm cache. The authority is defined in the keeper. + // + // Since: 0.40 UnpinCodes(context.Context, *MsgUnpinCodes) (*MsgUnpinCodesResponse, error) - // StoreAndInstantiateContract stores and instantiates the contract. + // StoreAndInstantiateContract defines a governance operation for storing + // and instantiating the contract. The authority is defined in the keeper. + // + // Since: 0.40 StoreAndInstantiateContract(context.Context, *MsgStoreAndInstantiateContract) (*MsgStoreAndInstantiateContractResponse, error) } @@ -2764,6 +2797,13 @@ func (m *MsgSudoContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -3014,13 +3054,6 @@ func (m *MsgStoreAndInstantiateContract) MarshalToSizedBuffer(dAtA []byte) (int, i-- dAtA[i] = 0x1a } - if len(m.RunAs) > 0 { - i -= len(m.RunAs) - copy(dAtA[i:], m.RunAs) - i = encodeVarintTx(dAtA, i, uint64(len(m.RunAs))) - i-- - dAtA[i] = 0x12 - } if len(m.Authority) > 0 { i -= len(m.Authority) copy(dAtA[i:], m.Authority) @@ -3051,6 +3084,20 @@ func (m *MsgStoreAndInstantiateContractResponse) MarshalToSizedBuffer(dAtA []byt _ = i var l int _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -3425,6 +3472,10 @@ func (m *MsgSudoContractResponse) Size() (n int) { } var l int _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -3496,10 +3547,6 @@ func (m *MsgStoreAndInstantiateContract) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.RunAs) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.WASMByteCode) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -3550,6 +3597,14 @@ func (m *MsgStoreAndInstantiateContractResponse) Size() (n int) { } var l int _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -5993,6 +6048,40 @@ func (m *MsgSudoContractResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgSudoContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -6496,38 +6585,6 @@ func (m *MsgStoreAndInstantiateContract) Unmarshal(dAtA []byte) error { } m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - 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 ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RunAs = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field WASMByteCode", wireType) @@ -6899,6 +6956,72 @@ func (m *MsgStoreAndInstantiateContractResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgStoreAndInstantiateContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From a6d571be4c740cccca9a6ca0f323939839b96dd3 Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Mon, 20 Mar 2023 21:56:48 +0100 Subject: [PATCH 03/13] Update cli --- x/wasm/client/cli/gov_tx.go | 360 +++++++++++++++++------------------ x/wasm/client/cli/new_tx.go | 13 +- x/wasm/client/cli/tx.go | 15 +- x/wasm/client/cli/tx_test.go | 2 +- 4 files changed, 189 insertions(+), 201 deletions(-) diff --git a/x/wasm/client/cli/gov_tx.go b/x/wasm/client/cli/gov_tx.go index 035d54a1bb..3de05b4c35 100644 --- a/x/wasm/client/cli/gov_tx.go +++ b/x/wasm/client/cli/gov_tx.go @@ -3,7 +3,6 @@ package cli import ( "bytes" "crypto/sha256" - "encoding/hex" "fmt" "net/url" "strconv" @@ -14,7 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/docker/distribution/reference" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -26,7 +25,7 @@ import ( func ProposalStoreCodeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "wasm-store [wasm file] --title [text] --description [text] --run-as [address] --unpin-code [unpin_code] --source [source] --builder [builder] --code-hash [code_hash]", + Use: "wasm-store [wasm file] --title [text] --description [text] --authority [address]", Short: "Submit a wasm binary proposal", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -34,58 +33,32 @@ func ProposalStoreCodeCmd() *cobra.Command { if err != nil { return err } - - src, err := parseStoreCodeArgs(args[0], clientCtx.FromAddress, cmd.Flags()) - if err != nil { - return err - } - runAs, err := cmd.Flags().GetString(flagRunAs) + authority, err := cmd.Flags().GetString(flagAuthority) if err != nil { - return fmt.Errorf("run-as: %s", err) - } - if len(runAs) == 0 { - return errors.New("run-as address is required") + return fmt.Errorf("authority: %s", err) } - unpinCode, err := cmd.Flags().GetBool(flagUnpinCode) - if err != nil { - return err + if len(authority) == 0 { + return errors.New("authority address is required") } - source, builder, codeHash, err := parseVerificationFlags(src.WASMByteCode, cmd.Flags()) + src, err := parseStoreCodeArgs(args[0], authority, cmd.Flags()) if err != nil { return err } - content := types.StoreCodeProposal{ - Title: proposalTitle, - Description: proposalDescr, - RunAs: runAs, - WASMByteCode: src.WASMByteCode, - InstantiatePermission: src.InstantiatePermission, - UnpinCode: unpinCode, - Source: source, - Builder: builder, - CodeHash: codeHash, - } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } - - cmd.Flags().String(flagRunAs, "", "The address that is stored as code creator") - cmd.Flags().Bool(flagUnpinCode, false, "Unpin code on upload, optional") - cmd.Flags().String(flagSource, "", "Code Source URL is a valid absolute HTTPS URI to the contract's source code,") - cmd.Flags().String(flagBuilder, "", "Builder is a valid docker image name with tag, such as \"cosmwasm/workspace-optimizer:0.12.9\"") - cmd.Flags().BytesHex(flagCodeHash, nil, "CodeHash is the sha256 hash of the wasm code") addInstantiatePermissionFlags(cmd) // proposal flags @@ -141,7 +114,7 @@ func parseVerificationFlags(gzippedWasm []byte, flags *flag.FlagSet) (string, st func ProposalInstantiateContractCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "instantiate-contract [code_id_int64] [json_encoded_init_args] --label [text] --title [text] --description [text] --run-as [address] --admin [address,optional] --amount [coins,optional]", + Use: "instantiate-contract [code_id_int64] [json_encoded_init_args] --authority [address] --label [text] --title [text] --description [text] --admin [address,optional] --amount [coins,optional]", Short: "Submit an instantiate wasm contract proposal", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -150,46 +123,35 @@ func ProposalInstantiateContractCmd() *cobra.Command { return err } - src, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, clientCtx.FromAddress, cmd.Flags()) + authority, err := cmd.Flags().GetString(flagAuthority) if err != nil { - return err + return fmt.Errorf("authority: %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") + if len(authority) == 0 { + return errors.New("authority address is required") } - content := types.InstantiateContractProposal{ - Title: proposalTitle, - Description: proposalDescr, - RunAs: runAs, - Admin: src.Admin, - CodeID: src.CodeID, - Label: src.Label, - Msg: src.Msg, - Funds: src.Funds, + src, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, authority, cmd.Flags()) + if err != nil { + return err } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation") cmd.Flags().String(flagLabel, "", "A human-readable name for this contract in lists") cmd.Flags().String(flagAdmin, "", "Address or key name of an admin") - cmd.Flags().String(flagRunAs, "", "The address that pays the init funds. It is the creator of the contract and passed to the contract as sender on proposal execution") cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin") // proposal flags @@ -198,9 +160,8 @@ func ProposalInstantiateContractCmd() *cobra.Command { } func ProposalInstantiateContract2Cmd() *cobra.Command { - decoder := newArgDecoder(hex.DecodeString) cmd := &cobra.Command{ - Use: "instantiate-contract-2 [code_id_int64] [json_encoded_init_args] [salt] --label [text] --title [text] --description [text] --run-as [address] --admin [address,optional] --amount [coins,optional] --fix-msg [bool,optional]", + Use: "instantiate-contract-2 [code_id_int64] [json_encoded_init_args] --authority [address] --label [text] --title [text] --description [text] --admin [address,optional] --amount [coins,optional]", Short: "Submit an instantiate wasm contract proposal with predictable address", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { @@ -209,40 +170,29 @@ func ProposalInstantiateContract2Cmd() *cobra.Command { return err } - src, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, clientCtx.FromAddress, cmd.Flags()) + authority, err := cmd.Flags().GetString(flagAuthority) if err != nil { - return err + return fmt.Errorf("authority: %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") + if len(authority) == 0 { + return errors.New("authority address is required") } - salt, err := decoder.DecodeString(args[2]) + src, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, authority, cmd.Flags()) if err != nil { - return fmt.Errorf("salt: %w", err) + return err } - fixMsg, err := cmd.Flags().GetBool(flagFixMsg) - if err != nil { - return fmt.Errorf("fix msg: %w", err) - } - - content := types.NewInstantiateContract2Proposal(proposalTitle, proposalDescr, runAs, src.Admin, src.CodeID, src.Label, src.Msg, src.Funds, salt, fixMsg) - - msg, err := v1beta1.NewMsgSubmitProposal(content, deposit, clientCtx.GetFromAddress()) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } @@ -250,10 +200,7 @@ func ProposalInstantiateContract2Cmd() *cobra.Command { cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation") cmd.Flags().String(flagLabel, "", "A human-readable name for this contract in lists") cmd.Flags().String(flagAdmin, "", "Address of an admin") - cmd.Flags().String(flagRunAs, "", "The address that pays the init funds. It is the creator of the contract and passed to the contract as sender on proposal execution") cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin") - cmd.Flags().Bool(flagFixMsg, false, "An optional flag to include the json_encoded_init_args for the predictable address generation mode") - decoder.RegisterFlags(cmd.PersistentFlags(), "salt") // proposal flags addCommonProposalFlags(cmd) @@ -262,7 +209,7 @@ func ProposalInstantiateContract2Cmd() *cobra.Command { func ProposalStoreAndInstantiateContractCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "store-instantiate [wasm file] [json_encoded_init_args] --label [text] --title [text] --description [text] --run-as [address]" + + Use: "store-instantiate [wasm file] [json_encoded_init_args] --authority [address] --label [text] --title [text] --description [text]" + "--unpin-code [unpin_code,optional] --source [source,optional] --builder [builder,optional] --code-hash [code_hash,optional] --admin [address,optional] --amount [coins,optional]", Short: "Submit and instantiate a wasm contract proposal", Args: cobra.ExactArgs(2), @@ -272,16 +219,18 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command { return err } - src, err := parseStoreCodeArgs(args[0], clientCtx.FromAddress, cmd.Flags()) + authority, err := cmd.Flags().GetString(flagAuthority) if err != nil { - return err + return fmt.Errorf("authority: %s", err) } - runAs, err := cmd.Flags().GetString(flagRunAs) - if err != nil { - return fmt.Errorf("run-as: %s", err) + + if len(authority) == 0 { + return errors.New("authority address is required") } - if len(runAs) == 0 { - return errors.New("run-as address is required") + + src, err := parseStoreCodeArgs(args[0], authority, cmd.Flags()) + if err != nil { + return err } unpinCode, err := cmd.Flags().GetBool(flagUnpinCode) @@ -343,10 +292,8 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command { } } - content := types.StoreAndInstantiateContractProposal{ - Title: proposalTitle, - Description: proposalDescr, - RunAs: runAs, + msg := types.MsgStoreAndInstantiateContract{ + Authority: authority, WASMByteCode: src.WASMByteCode, InstantiatePermission: src.InstantiatePermission, UnpinCode: unpinCode, @@ -359,20 +306,19 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command { Funds: amount, } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } - cmd.Flags().String(flagRunAs, "", "The address that is stored as code creator. It is the creator of the contract and passed to the contract as sender on proposal execution") cmd.Flags().Bool(flagUnpinCode, false, "Unpin code on upload, optional") cmd.Flags().String(flagSource, "", "Code Source URL is a valid absolute HTTPS URI to the contract's source code,") cmd.Flags().String(flagBuilder, "", "Builder is a valid docker image name with tag, such as \"cosmwasm/workspace-optimizer:0.12.9\"") @@ -389,7 +335,7 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command { func ProposalMigrateContractCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "migrate-contract [contract_addr_bech32] [new_code_id_int64] [json_encoded_migration_args]", + Use: "migrate-contract [contract_addr_bech32] [new_code_id_int64] [json_encoded_migration_args] --authority [address]", Short: "Submit a migrate wasm contract to a new code version proposal", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { @@ -398,32 +344,32 @@ func ProposalMigrateContractCmd() *cobra.Command { return err } - src, err := parseMigrateContractArgs(args, clientCtx) + authority, err := cmd.Flags().GetString(flagAuthority) if err != nil { - return err + return fmt.Errorf("authority: %s", err) + } + + if len(authority) == 0 { + return errors.New("authority address is required") } - content := types.MigrateContractProposal{ - Title: proposalTitle, - Description: proposalDescr, - Contract: src.Contract, - CodeID: src.CodeID, - Msg: src.Msg, + src, err := parseMigrateContractArgs(args, authority) + if err != nil { + return err } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } - // proposal flags addCommonProposalFlags(cmd) return cmd @@ -431,7 +377,7 @@ func ProposalMigrateContractCmd() *cobra.Command { func ProposalExecuteContractCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "execute-contract [contract_addr_bech32] [json_encoded_migration_args]", + Use: "execute-contract [contract_addr_bech32] [json_encoded_migration_args] --authority [address]", Short: "Submit a execute wasm contract proposal (run by any address)", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -440,6 +386,15 @@ func ProposalExecuteContractCmd() *cobra.Command { return err } + authority, err := cmd.Flags().GetString(flagAuthority) + if err != nil { + return fmt.Errorf("authority: %s", err) + } + + if len(authority) == 0 { + return errors.New("authority address is required") + } + contract := args[0] execMsg := []byte(args[1]) amountStr, err := cmd.Flags().GetString(flagAmount) @@ -450,37 +405,26 @@ func ProposalExecuteContractCmd() *cobra.Command { 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") - } - content := types.ExecuteContractProposal{ - Title: proposalTitle, - Description: proposalDescr, - Contract: contract, - Msg: execMsg, - RunAs: runAs, - Funds: funds, + msg := types.MsgExecuteContract{ + Sender: authority, + Contract: contract, + Msg: execMsg, + Funds: funds, } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } - 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 @@ -490,7 +434,7 @@ func ProposalExecuteContractCmd() *cobra.Command { func ProposalSudoContractCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "sudo-contract [contract_addr_bech32] [json_encoded_migration_args]", + Use: "sudo-contract [contract_addr_bech32] [json_encoded_migration_args] --authority [address]", Short: "Submit a sudo wasm contract proposal (to call privileged commands)", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -499,29 +443,33 @@ func ProposalSudoContractCmd() *cobra.Command { return err } - contract := args[0] - sudoMsg := []byte(args[1]) + authority, err := cmd.Flags().GetString(flagAuthority) + if err != nil { + return fmt.Errorf("authority: %s", err) + } + + if len(authority) == 0 { + return errors.New("authority address is required") + } - content := types.SudoContractProposal{ - Title: proposalTitle, - Description: proposalDescr, - Contract: contract, - Msg: sudoMsg, + msg := types.MsgSudoContract{ + Authority: authority, + Contract: args[0], + Msg: []byte(args[1]), } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } - // proposal flagsExecute addCommonProposalFlags(cmd) return cmd @@ -529,7 +477,7 @@ func ProposalSudoContractCmd() *cobra.Command { func ProposalUpdateContractAdminCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "set-contract-admin [contract_addr_bech32] [new_admin_addr_bech32]", + Use: "set-contract-admin [contract_addr_bech32] [new_admin_addr_bech32] --authority [address]", Short: "Submit a new admin for a contract proposal", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -538,24 +486,26 @@ func ProposalUpdateContractAdminCmd() *cobra.Command { return err } - src := parseUpdateContractAdminArgs(args, clientCtx) + authority, err := cmd.Flags().GetString(flagAuthority) + if err != nil { + return fmt.Errorf("authority: %s", err) + } - content := types.UpdateAdminProposal{ - Title: proposalTitle, - Description: proposalDescr, - Contract: src.Contract, - NewAdmin: src.NewAdmin, + if len(authority) == 0 { + return errors.New("authority address is required") } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + src := parseUpdateContractAdminArgs(args, authority) + + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } @@ -566,7 +516,7 @@ func ProposalUpdateContractAdminCmd() *cobra.Command { func ProposalClearContractAdminCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "clear-contract-admin [contract_addr_bech32]", + Use: "clear-contract-admin [contract_addr_bech32] --authority [address]", 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 { @@ -575,21 +525,29 @@ func ProposalClearContractAdminCmd() *cobra.Command { return err } - content := types.ClearAdminProposal{ - Title: proposalTitle, - Description: proposalDescr, - Contract: args[0], + authority, err := cmd.Flags().GetString(flagAuthority) + if err != nil { + return fmt.Errorf("authority: %s", err) } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + if len(authority) == 0 { + return errors.New("authority address is required") + } + + msg := types.MsgClearAdmin{ + Sender: authority, + Contract: args[0], + } + + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } @@ -600,7 +558,7 @@ func ProposalClearContractAdminCmd() *cobra.Command { func ProposalPinCodesCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "pin-codes [code-ids]", + Use: "pin-codes [code-ids] --authority [address]", Short: "Submit a pin code proposal for pinning a code to cache", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -609,26 +567,34 @@ func ProposalPinCodesCmd() *cobra.Command { return err } + authority, err := cmd.Flags().GetString(flagAuthority) + if err != nil { + return fmt.Errorf("authority: %s", err) + } + + if len(authority) == 0 { + return errors.New("authority address is required") + } + codeIds, err := parsePinCodesArgs(args) if err != nil { return err } - content := types.PinCodesProposal{ - Title: proposalTitle, - Description: proposalDescr, - CodeIDs: codeIds, + msg := types.MsgPinCodes{ + Authority: authority, + CodeIDs: codeIds, } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } @@ -651,7 +617,7 @@ func parsePinCodesArgs(args []string) ([]uint64, error) { func ProposalUnpinCodesCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "unpin-codes [code-ids]", + Use: "unpin-codes [code-ids] --authority [address]", Short: "Submit a unpin code proposal for unpinning a code to cache", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -659,27 +625,34 @@ func ProposalUnpinCodesCmd() *cobra.Command { if err != nil { return err } + authority, err := cmd.Flags().GetString(flagAuthority) + if err != nil { + return fmt.Errorf("authority: %s", err) + } + + if len(authority) == 0 { + return errors.New("authority address is required") + } codeIds, err := parsePinCodesArgs(args) if err != nil { return err } - content := types.UnpinCodesProposal{ - Title: proposalTitle, - Description: proposalDescr, - CodeIDs: codeIds, + msg := types.MsgUnpinCodes{ + Authority: authority, + CodeIDs: codeIds, } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } @@ -758,25 +731,39 @@ $ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1 if err != nil { return err } + + authority, err := cmd.Flags().GetString(flagAuthority) + if err != nil { + return fmt.Errorf("authority: %s", err) + } + + if len(authority) == 0 { + return errors.New("authority address is required") + } + updates, err := parseAccessConfigUpdates(args) if err != nil { return err } - content := types.UpdateInstantiateConfigProposal{ - Title: proposalTitle, - Description: proposalDescr, - AccessConfigUpdates: updates, + msgs := make([]sdk.Msg, len(updates)) + for i, update := range updates { + msgs[i] = &types.MsgUpdateInstantiateConfig{ + Sender: authority, + CodeID: update.CodeID, + NewInstantiatePermission: &update.InstantiatePermission, + } } - msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) + + proposalMsg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { + if err = proposalMsg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, SilenceUsage: true, } @@ -789,6 +776,7 @@ func addCommonProposalFlags(cmd *cobra.Command) { cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") + cmd.Flags().String(flagAuthority, "", "The address of the governance account.") } func getProposalInfo(cmd *cobra.Command) (client.Context, string, string, sdk.Coins, error) { diff --git a/x/wasm/client/cli/new_tx.go b/x/wasm/client/cli/new_tx.go index a3d61466ac..39562248c8 100644 --- a/x/wasm/client/cli/new_tx.go +++ b/x/wasm/client/cli/new_tx.go @@ -25,7 +25,7 @@ func MigrateContractCmd() *cobra.Command { return err } - msg, err := parseMigrateContractArgs(args, clientCtx) + msg, err := parseMigrateContractArgs(args, clientCtx.GetFromAddress().String()) if err != nil { return err } @@ -40,7 +40,7 @@ func MigrateContractCmd() *cobra.Command { return cmd } -func parseMigrateContractArgs(args []string, cliCtx client.Context) (types.MsgMigrateContract, error) { +func parseMigrateContractArgs(args []string, sender string) (types.MsgMigrateContract, error) { // get the id of the code to instantiate codeID, err := strconv.ParseUint(args[1], 10, 64) if err != nil { @@ -50,7 +50,7 @@ func parseMigrateContractArgs(args []string, cliCtx client.Context) (types.MsgMi migrateMsg := args[2] msg := types.MsgMigrateContract{ - Sender: cliCtx.GetFromAddress().String(), + Sender: sender, Contract: args[0], CodeID: codeID, Msg: []byte(migrateMsg), @@ -71,8 +71,7 @@ func UpdateContractAdminCmd() *cobra.Command { return err } - msg := parseUpdateContractAdminArgs(args, clientCtx) - + msg := parseUpdateContractAdminArgs(args, clientCtx.GetFromAddress().String()) if err := msg.ValidateBasic(); err != nil { return err } @@ -84,9 +83,9 @@ func UpdateContractAdminCmd() *cobra.Command { return cmd } -func parseUpdateContractAdminArgs(args []string, cliCtx client.Context) types.MsgUpdateAdmin { +func parseUpdateContractAdminArgs(args []string, sender string) types.MsgUpdateAdmin { msg := types.MsgUpdateAdmin{ - Sender: cliCtx.GetFromAddress().String(), + Sender: sender, Contract: args[0], NewAdmin: args[1], } diff --git a/x/wasm/client/cli/tx.go b/x/wasm/client/cli/tx.go index 788cde4e84..84d97a0552 100644 --- a/x/wasm/client/cli/tx.go +++ b/x/wasm/client/cli/tx.go @@ -44,6 +44,7 @@ const ( flagMaxFunds = "max-funds" flagAllowAllMsgs = "allow-all-messages" flagNoTokenTransfer = "no-token-transfer" //nolint:gosec + flagAuthority = "authority" ) // GetTxCmd returns the transaction commands for this module @@ -82,7 +83,7 @@ func StoreCodeCmd() *cobra.Command { if err != nil { return err } - msg, err := parseStoreCodeArgs(args[0], clientCtx.GetFromAddress(), cmd.Flags()) + msg, err := parseStoreCodeArgs(args[0], clientCtx.GetFromAddress().String(), cmd.Flags()) if err != nil { return err } @@ -100,7 +101,7 @@ func StoreCodeCmd() *cobra.Command { } // Prepares MsgStoreCode object from flags with gzipped wasm byte code field -func parseStoreCodeArgs(file string, sender sdk.AccAddress, flags *flag.FlagSet) (types.MsgStoreCode, error) { +func parseStoreCodeArgs(file string, sender string, flags *flag.FlagSet) (types.MsgStoreCode, error) { wasm, err := os.ReadFile(file) if err != nil { return types.MsgStoreCode{}, err @@ -123,7 +124,7 @@ func parseStoreCodeArgs(file string, sender sdk.AccAddress, flags *flag.FlagSet) } msg := types.MsgStoreCode{ - Sender: sender.String(), + Sender: sender, WASMByteCode: wasm, InstantiatePermission: perm, } @@ -209,7 +210,7 @@ $ %s tx wasm instantiate 1 '{"foo":"bar"}' --admin="$(%s keys show mykey -a)" \ if err != nil { return err } - msg, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, clientCtx.GetFromAddress(), cmd.Flags()) + msg, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, clientCtx.GetFromAddress().String(), cmd.Flags()) if err != nil { return err } @@ -260,7 +261,7 @@ $ %s tx wasm instantiate2 1 '{"foo":"bar"}' $(echo -n "testing" | xxd -ps) --adm if err != nil { return fmt.Errorf("fix msg: %w", err) } - data, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, clientCtx.GetFromAddress(), cmd.Flags()) + data, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, clientCtx.GetFromAddress().String(), cmd.Flags()) if err != nil { return err } @@ -292,7 +293,7 @@ $ %s tx wasm instantiate2 1 '{"foo":"bar"}' $(echo -n "testing" | xxd -ps) --adm return cmd } -func parseInstantiateArgs(rawCodeID, initMsg string, kr keyring.Keyring, sender sdk.AccAddress, flags *flag.FlagSet) (*types.MsgInstantiateContract, error) { +func parseInstantiateArgs(rawCodeID, initMsg string, kr keyring.Keyring, sender string, flags *flag.FlagSet) (*types.MsgInstantiateContract, error) { // get the id of the code to instantiate codeID, err := strconv.ParseUint(rawCodeID, 10, 64) if err != nil { @@ -351,7 +352,7 @@ func parseInstantiateArgs(rawCodeID, initMsg string, kr keyring.Keyring, sender // build and sign the transaction, then broadcast to Tendermint msg := types.MsgInstantiateContract{ - Sender: sender.String(), + Sender: sender, CodeID: codeID, Label: label, Funds: amount, diff --git a/x/wasm/client/cli/tx_test.go b/x/wasm/client/cli/tx_test.go index 8d6dfcf840..3e625a9ffc 100644 --- a/x/wasm/client/cli/tx_test.go +++ b/x/wasm/client/cli/tx_test.go @@ -106,7 +106,7 @@ func TestParseVerificationFlags(t *testing.T) { flagSet := ProposalStoreCodeCmd().Flags() require.NoError(t, flagSet.Parse(spec.args)) - gotMsg, err := parseStoreCodeArgs(spec.srcPath, mySender, flagSet) + gotMsg, err := parseStoreCodeArgs(spec.srcPath, mySender.String(), flagSet) require.NoError(t, err) require.True(t, ioutils.IsGzip(gotMsg.WASMByteCode)) From b646fcafeab30380cc27369723adcb94ff659863 Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Tue, 21 Mar 2023 16:54:12 +0100 Subject: [PATCH 04/13] Fix implementation --- x/wasm/keeper/keeper_test.go | 2 +- x/wasm/keeper/msg_server.go | 111 +++++++++++++++++++++++++---------- x/wasm/keeper/test_common.go | 2 +- x/wasm/types/tx.go | 15 ++--- 4 files changed, 86 insertions(+), 44 deletions(-) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 91413b2e2a..b9addff343 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -751,7 +751,7 @@ func TestInstantiateWithContractFactoryChildQueriesParent(t *testing.T) { // overwrite wasmvm in router router := baseapp.NewMsgServiceRouter() router.SetInterfaceRegistry(keepers.EncodingConfig.InterfaceRegistry) - types.RegisterMsgServer(router, newMsgServerImpl(NewDefaultPermissionKeeper(keeper), *keeper)) + types.RegisterMsgServer(router, NewMsgServerImpl(keeper)) keeper.messenger = NewDefaultMessageHandler(router, nil, nil, nil, keepers.EncodingConfig.Marshaler, nil) // overwrite wasmvm in response handler keeper.wasmVMResponseHandler = NewDefaultWasmVMContractResponseHandler(NewMessageDispatcher(keeper.messenger, keeper)) diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go index 17990ecdba..1b6d3e7897 100644 --- a/x/wasm/keeper/msg_server.go +++ b/x/wasm/keeper/msg_server.go @@ -11,26 +11,14 @@ import ( var _ types.MsgServer = msgServer{} -// abstract type -type paramStore interface { - GetAuthority() string - SetParams(ctx sdk.Context, params types.Params) error -} - // grpc message server implementation type msgServer struct { - keeper types.ContractOpsKeeper - paramStore paramStore + keeper Keeper } // NewMsgServerImpl default constructor func NewMsgServerImpl(k *Keeper) types.MsgServer { - return newMsgServerImpl(NewDefaultPermissionKeeper(k), k) -} - -// newMsgServerImpl internal constructor to overwrite interfaces for testing -func newMsgServerImpl(k types.ContractOpsKeeper, p paramStore) types.MsgServer { - return &msgServer{keeper: k, paramStore: p} + return &msgServer{keeper: *k} } // StoreCode stores a new wasm code on chain @@ -44,7 +32,14 @@ func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*t return nil, errorsmod.Wrap(err, "sender") } - codeID, checksum, err := m.keeper.Create(ctx, senderAddr, msg.WASMByteCode, msg.InstantiatePermission) + var policy AuthorizationPolicy + if msg.Sender == m.keeper.GetAuthority() { + policy = GovAuthorizationPolicy{} + } else { + policy = DefaultAuthorizationPolicy{} + } + + codeID, checksum, err := m.keeper.create(ctx, senderAddr, msg.WASMByteCode, msg.InstantiatePermission, policy) if err != nil { return nil, err } @@ -73,7 +68,14 @@ func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst } } - contractAddr, data, err := m.keeper.Instantiate(ctx, msg.CodeID, senderAddr, adminAddr, msg.Msg, msg.Label, msg.Funds) + var policy AuthorizationPolicy + if msg.Sender == m.keeper.GetAuthority() { + policy = GovAuthorizationPolicy{} + } else { + policy = DefaultAuthorizationPolicy{} + } + + contractAddr, data, err := m.keeper.instantiate(ctx, msg.CodeID, senderAddr, adminAddr, msg.Msg, msg.Label, msg.Funds, m.keeper.ClassicAddressGenerator(), policy) if err != nil { return nil, err } @@ -102,7 +104,16 @@ func (m msgServer) InstantiateContract2(goCtx context.Context, msg *types.MsgIns } } - contractAddr, data, err := m.keeper.Instantiate2(ctx, msg.CodeID, senderAddr, adminAddr, msg.Msg, msg.Label, msg.Funds, msg.Salt, msg.FixMsg) + var policy AuthorizationPolicy + if msg.Sender == m.keeper.GetAuthority() { + policy = GovAuthorizationPolicy{} + } else { + policy = DefaultAuthorizationPolicy{} + } + + addrGenerator := PredicableAddressGenerator(senderAddr, msg.Salt, msg.Msg, msg.FixMsg) + + contractAddr, data, err := m.keeper.instantiate(ctx, msg.CodeID, senderAddr, adminAddr, msg.Msg, msg.Label, msg.Funds, addrGenerator, policy) if err != nil { return nil, err } @@ -128,7 +139,7 @@ func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteC return nil, errorsmod.Wrap(err, "contract") } - data, err := m.keeper.Execute(ctx, contractAddr, senderAddr, msg.Msg, msg.Funds) + data, err := m.keeper.execute(ctx, contractAddr, senderAddr, msg.Msg, msg.Funds) if err != nil { return nil, err } @@ -153,7 +164,14 @@ func (m msgServer) MigrateContract(goCtx context.Context, msg *types.MsgMigrateC return nil, errorsmod.Wrap(err, "contract") } - data, err := m.keeper.Migrate(ctx, contractAddr, senderAddr, msg.CodeID, msg.Msg) + var policy AuthorizationPolicy + if msg.Sender == m.keeper.GetAuthority() { + policy = GovAuthorizationPolicy{} + } else { + policy = DefaultAuthorizationPolicy{} + } + + data, err := m.keeper.migrate(ctx, contractAddr, senderAddr, msg.CodeID, msg.Msg, policy) if err != nil { return nil, err } @@ -182,7 +200,14 @@ func (m msgServer) UpdateAdmin(goCtx context.Context, msg *types.MsgUpdateAdmin) return nil, errorsmod.Wrap(err, "new admin") } - if err := m.keeper.UpdateContractAdmin(ctx, contractAddr, senderAddr, newAdminAddr); err != nil { + var policy AuthorizationPolicy + if msg.Sender == m.keeper.GetAuthority() { + policy = GovAuthorizationPolicy{} + } else { + policy = DefaultAuthorizationPolicy{} + } + + if err := m.keeper.setContractAdmin(ctx, contractAddr, senderAddr, newAdminAddr, policy); err != nil { return nil, err } @@ -204,7 +229,14 @@ func (m msgServer) ClearAdmin(goCtx context.Context, msg *types.MsgClearAdmin) ( return nil, errorsmod.Wrap(err, "contract") } - if err := m.keeper.ClearContractAdmin(ctx, contractAddr, senderAddr); err != nil { + var policy AuthorizationPolicy + if msg.Sender == m.keeper.GetAuthority() { + policy = GovAuthorizationPolicy{} + } else { + policy = DefaultAuthorizationPolicy{} + } + + if err := m.keeper.setContractAdmin(ctx, contractAddr, senderAddr, nil, policy); err != nil { return nil, err } @@ -217,7 +249,15 @@ func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.Msg } ctx := sdk.UnwrapSDKContext(goCtx) - if err := m.keeper.SetAccessConfig(ctx, msg.CodeID, sdk.AccAddress(msg.Sender), *msg.NewInstantiatePermission); err != nil { + + var policy AuthorizationPolicy + if msg.Sender == m.keeper.GetAuthority() { + policy = GovAuthorizationPolicy{} + } else { + policy = DefaultAuthorizationPolicy{} + } + + if err := m.keeper.setAccessConfig(ctx, msg.CodeID, sdk.AccAddress(msg.Sender), *msg.NewInstantiatePermission, policy); err != nil { return nil, err } @@ -226,13 +266,13 @@ func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.Msg // UpdateParams updates the module parameters func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - authority := m.paramStore.GetAuthority() + authority := m.keeper.GetAuthority() if authority != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) - if err := m.paramStore.SetParams(ctx, req.Params); err != nil { + if err := m.keeper.SetParams(ctx, req.Params); err != nil { return nil, err } @@ -241,14 +281,14 @@ func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam // PinCodes pins a set of code ids in the wasmvm cache. func (m msgServer) PinCodes(goCtx context.Context, req *types.MsgPinCodes) (*types.MsgPinCodesResponse, error) { - authority := m.paramStore.GetAuthority() + authority := m.keeper.GetAuthority() if authority != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) for _, codeID := range req.CodeIDs { - if err := m.keeper.PinCode(ctx, codeID); err != nil { + if err := m.keeper.pinCode(ctx, codeID); err != nil { return nil, err } } @@ -258,14 +298,14 @@ func (m msgServer) PinCodes(goCtx context.Context, req *types.MsgPinCodes) (*typ // UnpinCodes unpins a set of code ids in the wasmvm cache. func (m msgServer) UnpinCodes(goCtx context.Context, req *types.MsgUnpinCodes) (*types.MsgUnpinCodesResponse, error) { - authority := m.paramStore.GetAuthority() + authority := m.keeper.GetAuthority() if authority != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) for _, codeID := range req.CodeIDs { - if err := m.keeper.UnpinCode(ctx, codeID); err != nil { + if err := m.keeper.unpinCode(ctx, codeID); err != nil { return nil, err } } @@ -275,7 +315,7 @@ func (m msgServer) UnpinCodes(goCtx context.Context, req *types.MsgUnpinCodes) ( // SudoContract calls sudo on a contract. func (m msgServer) SudoContract(goCtx context.Context, req *types.MsgSudoContract) (*types.MsgSudoContractResponse, error) { - authority := m.paramStore.GetAuthority() + authority := m.keeper.GetAuthority() if authority != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) } @@ -296,7 +336,7 @@ func (m msgServer) SudoContract(goCtx context.Context, req *types.MsgSudoContrac // StoreAndInstantiateContract stores and instantiates the contract. func (m msgServer) StoreAndInstantiateContract(goCtx context.Context, req *types.MsgStoreAndInstantiateContract) (*types.MsgStoreAndInstantiateContractResponse, error) { - authority := m.paramStore.GetAuthority() + authority := m.keeper.GetAuthority() if authority != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) } @@ -319,12 +359,19 @@ func (m msgServer) StoreAndInstantiateContract(goCtx context.Context, req *types ctx := sdk.UnwrapSDKContext(goCtx) - codeID, _, err := m.keeper.Create(ctx, authorityAddr, req.WASMByteCode, req.InstantiatePermission) + var policy AuthorizationPolicy + if req.Authority == m.keeper.GetAuthority() { + policy = GovAuthorizationPolicy{} + } else { + policy = DefaultAuthorizationPolicy{} + } + + codeID, _, err := m.keeper.create(ctx, authorityAddr, req.WASMByteCode, req.InstantiatePermission, policy) if err != nil { return nil, err } - contractAddr, data, err := m.keeper.Instantiate(ctx, codeID, authorityAddr, adminAddr, req.Msg, req.Label, req.Funds) + contractAddr, data, err := m.keeper.instantiate(ctx, codeID, authorityAddr, adminAddr, req.Msg, req.Label, req.Funds, m.keeper.ClassicAddressGenerator(), policy) if err != nil { return nil, err } diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index d67441ad67..d5cd223311 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -468,7 +468,7 @@ func createTestInput( gov.NewAppModule(appCodec, govKeeper, accountKeeper, bankKeeper, subspace(govtypes.ModuleName)), ) am.RegisterServices(module.NewConfigurator(appCodec, msgRouter, querier)) - types.RegisterMsgServer(msgRouter, newMsgServerImpl(NewDefaultPermissionKeeper(keeper), keeper)) + types.RegisterMsgServer(msgRouter, NewMsgServerImpl(&keeper)) types.RegisterQueryServer(querier, NewGrpcQuerier(appCodec, keys[types.ModuleName], keeper, keeper.queryGasLimit)) keepers := TestKeepers{ diff --git a/x/wasm/types/tx.go b/x/wasm/types/tx.go index 25a2305e96..30c9c41ac7 100644 --- a/x/wasm/types/tx.go +++ b/x/wasm/types/tx.go @@ -74,11 +74,6 @@ func (msg MsgStoreCode) ValidateBasic() error { if msg.InstantiatePermission.Permission == AccessTypeOnlyAddress { return ErrInvalid.Wrap("unsupported type, use AccessTypeAnyOfAddresses instead") } - // AccessTypeOnlyAddress is still considered valid as legacy instantiation permission - // but not for new contracts - if msg.InstantiatePermission.Permission == AccessTypeOnlyAddress { - return ErrInvalid.Wrap("unsupported type, use AccessTypeAnyOfAddresses instead") - } } return nil } @@ -615,6 +610,11 @@ func (msg MsgStoreAndInstantiateContract) ValidateBasic() error { return errorsmod.Wrap(err, "admin") } } + + if err := ValidateVerificationInfo(msg.Source, msg.Builder, msg.CodeHash); err != nil { + return errorsmod.Wrapf(err, "code verification info") + } + if err := msg.Msg.ValidateBasic(); err != nil { return errorsmod.Wrap(err, "payload msg") } @@ -632,11 +632,6 @@ func (msg MsgStoreAndInstantiateContract) ValidateBasic() error { if msg.InstantiatePermission.Permission == AccessTypeOnlyAddress { return ErrInvalid.Wrap("unsupported type, use AccessTypeAnyOfAddresses instead") } - // AccessTypeOnlyAddress is still considered valid as legacy instantiation permission - // but not for new contracts - if msg.InstantiatePermission.Permission == AccessTypeOnlyAddress { - return ErrInvalid.Wrap("unsupported type, use AccessTypeAnyOfAddresses instead") - } } return nil } From 4388e4ae7c831c263e0ad8636d215ad08e64072d Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Tue, 21 Mar 2023 17:08:51 +0100 Subject: [PATCH 05/13] Fix cli tests --- x/wasm/client/cli/gov_tx_test.go | 2 +- x/wasm/client/cli/tx_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/wasm/client/cli/gov_tx_test.go b/x/wasm/client/cli/gov_tx_test.go index bc498f0fbe..da62d498c0 100644 --- a/x/wasm/client/cli/gov_tx_test.go +++ b/x/wasm/client/cli/gov_tx_test.go @@ -145,7 +145,7 @@ func TestParseCodeInfoFlags(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - flags := ProposalStoreCodeCmd().Flags() + flags := ProposalStoreAndInstantiateContractCmd().Flags() require.NoError(t, flags.Parse(spec.args)) _, _, _, gotErr := parseVerificationFlags(wasmBin, flags) if spec.expErr { diff --git a/x/wasm/client/cli/tx_test.go b/x/wasm/client/cli/tx_test.go index 3e625a9ffc..cd318ee931 100644 --- a/x/wasm/client/cli/tx_test.go +++ b/x/wasm/client/cli/tx_test.go @@ -103,7 +103,7 @@ func TestParseVerificationFlags(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - flagSet := ProposalStoreCodeCmd().Flags() + flagSet := ProposalStoreAndInstantiateContractCmd().Flags() require.NoError(t, flagSet.Parse(spec.args)) gotMsg, err := parseStoreCodeArgs(spec.srcPath, mySender.String(), flagSet) From f42c802105b9fc7a43a41d39b339874e11b74c7d Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Tue, 21 Mar 2023 18:50:45 +0100 Subject: [PATCH 06/13] Fix lint errors --- x/wasm/client/cli/gov_tx.go | 3 ++- x/wasm/keeper/proposal_handler.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/x/wasm/client/cli/gov_tx.go b/x/wasm/client/cli/gov_tx.go index 3de05b4c35..ad53d3d606 100644 --- a/x/wasm/client/cli/gov_tx.go +++ b/x/wasm/client/cli/gov_tx.go @@ -748,10 +748,11 @@ $ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1 msgs := make([]sdk.Msg, len(updates)) for i, update := range updates { + permission := update.InstantiatePermission msgs[i] = &types.MsgUpdateInstantiateConfig{ Sender: authority, CodeID: update.CodeID, - NewInstantiatePermission: &update.InstantiatePermission, + NewInstantiatePermission: &permission, } } diff --git a/x/wasm/keeper/proposal_handler.go b/x/wasm/keeper/proposal_handler.go index e47e973983..91a7f253cf 100644 --- a/x/wasm/keeper/proposal_handler.go +++ b/x/wasm/keeper/proposal_handler.go @@ -20,6 +20,8 @@ func NewWasmProposalHandler(k decoratedKeeper, enabledProposalTypes []types.Prop } // NewWasmProposalHandlerX creates a new governance Handler for wasm proposals +// +//nolint:staticcheck func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []types.ProposalType) v1beta1.Handler { enabledTypes := make(map[string]struct{}, len(enabledProposalTypes)) for i := range enabledProposalTypes { @@ -63,6 +65,7 @@ func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []t } } +//nolint:staticcheck func handleStoreCodeProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.StoreCodeProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -88,6 +91,7 @@ func handleStoreCodeProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types return k.PinCode(ctx, codeID) } +//nolint:staticcheck func handleInstantiateProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.InstantiateContractProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -115,6 +119,7 @@ func handleInstantiateProposal(ctx sdk.Context, k types.ContractOpsKeeper, p typ return nil } +//nolint:staticcheck func handleInstantiate2Proposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.InstantiateContract2Proposal) error { // Validatebasic with proposal if err := p.ValidateBasic(); err != nil { @@ -147,6 +152,7 @@ func handleInstantiate2Proposal(ctx sdk.Context, k types.ContractOpsKeeper, p ty return nil } +//nolint:staticcheck func handleStoreAndInstantiateContractProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.StoreAndInstantiateContractProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -189,6 +195,7 @@ func handleStoreAndInstantiateContractProposal(ctx sdk.Context, k types.Contract return nil } +//nolint:staticcheck func handleMigrateProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.MigrateContractProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -212,6 +219,7 @@ func handleMigrateProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.M return nil } +//nolint:staticcheck func handleSudoProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.SudoContractProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -233,6 +241,7 @@ func handleSudoProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.Sudo return nil } +//nolint:staticcheck func handleExecuteProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.ExecuteContractProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -258,6 +267,7 @@ func handleExecuteProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.E return nil } +//nolint:staticcheck func handleUpdateAdminProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.UpdateAdminProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -274,6 +284,7 @@ func handleUpdateAdminProposal(ctx sdk.Context, k types.ContractOpsKeeper, p typ return k.UpdateContractAdmin(ctx, contractAddr, nil, newAdminAddr) } +//nolint:staticcheck func handleClearAdminProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.ClearAdminProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -287,6 +298,7 @@ func handleClearAdminProposal(ctx sdk.Context, k types.ContractOpsKeeper, p type return err } +//nolint:staticcheck func handlePinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.PinCodesProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -299,6 +311,7 @@ func handlePinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types. return nil } +//nolint:staticcheck func handleUnpinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.UnpinCodesProposal) error { if err := p.ValidateBasic(); err != nil { return err @@ -311,6 +324,7 @@ func handleUnpinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p type return nil } +//nolint:staticcheck func handleUpdateInstantiateConfigProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.UpdateInstantiateConfigProposal) error { if err := p.ValidateBasic(); err != nil { return err From e9bb86fa7e1d4077d1c9d3e56c245d14a52b6354 Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Tue, 21 Mar 2023 23:30:56 +0100 Subject: [PATCH 07/13] Fix simulations --- x/wasm/simulation/proposals.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/x/wasm/simulation/proposals.go b/x/wasm/simulation/proposals.go index 8fc7bd2d5b..aeda227b23 100644 --- a/x/wasm/simulation/proposals.go +++ b/x/wasm/simulation/proposals.go @@ -136,7 +136,7 @@ func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, c return &types.MsgInstantiateContract{ Sender: authority, - Admin: string(adminAccount.Address), + Admin: adminAccount.Address.String(), CodeID: codeID, Label: simtypes.RandStringOfLength(r, 10), Msg: []byte(`{}`), @@ -161,11 +161,17 @@ func SimulateExecuteContractProposal( return nil } - return &types.MsgExecuteContract{ + msg := &types.MsgExecuteContract{ Sender: authority, Contract: ctAddress.String(), Funds: sdk.Coins{}, } + + if err := payloader(msg); err != nil { + return nil + } + + return msg } } From 935c6fd0109e3dce95c6f66789cd77346d970c4e Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Wed, 22 Mar 2023 10:32:14 +0100 Subject: [PATCH 08/13] fix comments --- x/wasm/keeper/msg_server.go | 76 +++++++++---------------------------- 1 file changed, 18 insertions(+), 58 deletions(-) diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go index 1b6d3e7897..17e69f3895 100644 --- a/x/wasm/keeper/msg_server.go +++ b/x/wasm/keeper/msg_server.go @@ -13,12 +13,12 @@ var _ types.MsgServer = msgServer{} // grpc message server implementation type msgServer struct { - keeper Keeper + keeper *Keeper } // NewMsgServerImpl default constructor func NewMsgServerImpl(k *Keeper) types.MsgServer { - return &msgServer{keeper: *k} + return &msgServer{keeper: k} } // StoreCode stores a new wasm code on chain @@ -32,12 +32,7 @@ func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*t return nil, errorsmod.Wrap(err, "sender") } - var policy AuthorizationPolicy - if msg.Sender == m.keeper.GetAuthority() { - policy = GovAuthorizationPolicy{} - } else { - policy = DefaultAuthorizationPolicy{} - } + policy := m.selectAuthorizationPolicy(msg.Sender) codeID, checksum, err := m.keeper.create(ctx, senderAddr, msg.WASMByteCode, msg.InstantiatePermission, policy) if err != nil { @@ -68,12 +63,7 @@ func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst } } - var policy AuthorizationPolicy - if msg.Sender == m.keeper.GetAuthority() { - policy = GovAuthorizationPolicy{} - } else { - policy = DefaultAuthorizationPolicy{} - } + policy := m.selectAuthorizationPolicy(msg.Sender) contractAddr, data, err := m.keeper.instantiate(ctx, msg.CodeID, senderAddr, adminAddr, msg.Msg, msg.Label, msg.Funds, m.keeper.ClassicAddressGenerator(), policy) if err != nil { @@ -104,12 +94,7 @@ func (m msgServer) InstantiateContract2(goCtx context.Context, msg *types.MsgIns } } - var policy AuthorizationPolicy - if msg.Sender == m.keeper.GetAuthority() { - policy = GovAuthorizationPolicy{} - } else { - policy = DefaultAuthorizationPolicy{} - } + policy := m.selectAuthorizationPolicy(msg.Sender) addrGenerator := PredicableAddressGenerator(senderAddr, msg.Salt, msg.Msg, msg.FixMsg) @@ -164,12 +149,7 @@ func (m msgServer) MigrateContract(goCtx context.Context, msg *types.MsgMigrateC return nil, errorsmod.Wrap(err, "contract") } - var policy AuthorizationPolicy - if msg.Sender == m.keeper.GetAuthority() { - policy = GovAuthorizationPolicy{} - } else { - policy = DefaultAuthorizationPolicy{} - } + policy := m.selectAuthorizationPolicy(msg.Sender) data, err := m.keeper.migrate(ctx, contractAddr, senderAddr, msg.CodeID, msg.Msg, policy) if err != nil { @@ -200,12 +180,7 @@ func (m msgServer) UpdateAdmin(goCtx context.Context, msg *types.MsgUpdateAdmin) return nil, errorsmod.Wrap(err, "new admin") } - var policy AuthorizationPolicy - if msg.Sender == m.keeper.GetAuthority() { - policy = GovAuthorizationPolicy{} - } else { - policy = DefaultAuthorizationPolicy{} - } + policy := m.selectAuthorizationPolicy(msg.Sender) if err := m.keeper.setContractAdmin(ctx, contractAddr, senderAddr, newAdminAddr, policy); err != nil { return nil, err @@ -229,12 +204,7 @@ func (m msgServer) ClearAdmin(goCtx context.Context, msg *types.MsgClearAdmin) ( return nil, errorsmod.Wrap(err, "contract") } - var policy AuthorizationPolicy - if msg.Sender == m.keeper.GetAuthority() { - policy = GovAuthorizationPolicy{} - } else { - policy = DefaultAuthorizationPolicy{} - } + policy := m.selectAuthorizationPolicy(msg.Sender) if err := m.keeper.setContractAdmin(ctx, contractAddr, senderAddr, nil, policy); err != nil { return nil, err @@ -249,13 +219,7 @@ func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.Msg } ctx := sdk.UnwrapSDKContext(goCtx) - - var policy AuthorizationPolicy - if msg.Sender == m.keeper.GetAuthority() { - policy = GovAuthorizationPolicy{} - } else { - policy = DefaultAuthorizationPolicy{} - } + policy := m.selectAuthorizationPolicy(msg.Sender) if err := m.keeper.setAccessConfig(ctx, msg.CodeID, sdk.AccAddress(msg.Sender), *msg.NewInstantiatePermission, policy); err != nil { return nil, err @@ -336,12 +300,7 @@ func (m msgServer) SudoContract(goCtx context.Context, req *types.MsgSudoContrac // StoreAndInstantiateContract stores and instantiates the contract. func (m msgServer) StoreAndInstantiateContract(goCtx context.Context, req *types.MsgStoreAndInstantiateContract) (*types.MsgStoreAndInstantiateContractResponse, error) { - authority := m.keeper.GetAuthority() - if authority != req.Authority { - return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) - } - - authorityAddr, err := sdk.AccAddressFromBech32(authority) + authorityAddr, err := sdk.AccAddressFromBech32(req.Authority) if err != nil { return nil, errorsmod.Wrap(err, "admin") } @@ -358,13 +317,7 @@ func (m msgServer) StoreAndInstantiateContract(goCtx context.Context, req *types } ctx := sdk.UnwrapSDKContext(goCtx) - - var policy AuthorizationPolicy - if req.Authority == m.keeper.GetAuthority() { - policy = GovAuthorizationPolicy{} - } else { - policy = DefaultAuthorizationPolicy{} - } + policy := m.selectAuthorizationPolicy(req.Authority) codeID, _, err := m.keeper.create(ctx, authorityAddr, req.WASMByteCode, req.InstantiatePermission, policy) if err != nil { @@ -381,3 +334,10 @@ func (m msgServer) StoreAndInstantiateContract(goCtx context.Context, req *types Data: data, }, nil } + +func (m msgServer) selectAuthorizationPolicy(actor string) AuthorizationPolicy { + if actor == m.keeper.GetAuthority() { + return GovAuthorizationPolicy{} + } + return DefaultAuthorizationPolicy{} +} From 69d00e8f54bf85ed30b86fae7e03889d00408f98 Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Thu, 23 Mar 2023 11:22:16 +0100 Subject: [PATCH 09/13] Add integration tests --- x/wasm/keeper/msg_server.go | 2 +- x/wasm/keeper/msg_server_integration_test.go | 284 ++++++++++++++++++- 2 files changed, 283 insertions(+), 3 deletions(-) diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go index 17e69f3895..f4e70b0bc5 100644 --- a/x/wasm/keeper/msg_server.go +++ b/x/wasm/keeper/msg_server.go @@ -302,7 +302,7 @@ func (m msgServer) SudoContract(goCtx context.Context, req *types.MsgSudoContrac func (m msgServer) StoreAndInstantiateContract(goCtx context.Context, req *types.MsgStoreAndInstantiateContract) (*types.MsgStoreAndInstantiateContractResponse, error) { authorityAddr, err := sdk.AccAddressFromBech32(req.Authority) if err != nil { - return nil, errorsmod.Wrap(err, "admin") + return nil, errorsmod.Wrap(err, "authority") } if err = req.ValidateBasic(); err != nil { diff --git a/x/wasm/keeper/msg_server_integration_test.go b/x/wasm/keeper/msg_server_integration_test.go index ea426646cb..486dcac00f 100644 --- a/x/wasm/keeper/msg_server_integration_test.go +++ b/x/wasm/keeper/msg_server_integration_test.go @@ -3,7 +3,9 @@ package keeper_test import ( "crypto/sha256" _ "embed" + "encoding/json" "testing" + "time" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,12 +16,16 @@ import ( "github.com/stretchr/testify/require" "github.com/CosmWasm/wasmd/app" + "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/CosmWasm/wasmd/x/wasm/types" ) //go:embed testdata/reflect.wasm var wasmContract []byte +//go:embed testdata/hackatom.wasm +var hackatomContract []byte + func TestStoreCode(t *testing.T) { wasmApp := app.Setup(t) ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) @@ -118,8 +124,8 @@ func TestUpdateParams(t *testing.T) { expInstantiateType: types.AccessTypeEverybody, }, } - for msg, spec := range specs { - t.Run(msg, func(t *testing.T) { + for name, spec := range specs { + t.Run(name, func(t *testing.T) { err := wasmApp.WasmKeeper.SetParams(ctx, types.DefaultParams()) require.NoError(t, err) @@ -136,3 +142,277 @@ func TestUpdateParams(t *testing.T) { }) } } + +func TestPinCodes(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) + + var ( + myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + ) + + specs := map[string]struct { + addr string + expErr bool + }{ + "pin codes with authority": { + addr: authority, + expErr: false, + }, + "pin codes without authority": { + addr: myAddress.String(), + expErr: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + // setup + _, _, sender := testdata.KeyTestPubAddr() + msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) { + m.WASMByteCode = wasmContract + m.Sender = sender.String() + }) + + //store code + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + require.NoError(t, err) + var result types.MsgStoreCodeResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result)) + require.False(t, wasmApp.WasmKeeper.IsPinnedCode(ctx, result.CodeID)) + + // when + msgPinCodes := &types.MsgPinCodes{ + Authority: spec.addr, + CodeIDs: []uint64{result.CodeID}, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgPinCodes)(ctx, msgPinCodes) + + //then + if spec.expErr { + require.Error(t, err) + assert.False(t, wasmApp.WasmKeeper.IsPinnedCode(ctx, result.CodeID)) + } else { + require.NoError(t, err) + assert.True(t, wasmApp.WasmKeeper.IsPinnedCode(ctx, result.CodeID)) + } + }) + } +} + +func TestUnpinCodes(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) + + var ( + myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + ) + + specs := map[string]struct { + addr string + expErr bool + }{ + "unpin codes with authority": { + addr: authority, + expErr: false, + }, + "unpin codes without authority": { + addr: myAddress.String(), + expErr: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + // setup + _, _, sender := testdata.KeyTestPubAddr() + msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) { + m.WASMByteCode = wasmContract + m.Sender = sender.String() + }) + + // store code + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + require.NoError(t, err) + var result types.MsgStoreCodeResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result)) + + // pin code + msgPin := &types.MsgPinCodes{ + Authority: authority, + CodeIDs: []uint64{result.CodeID}, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgPin)(ctx, msgPin) + require.NoError(t, err) + assert.True(t, wasmApp.WasmKeeper.IsPinnedCode(ctx, result.CodeID)) + + // when + msgUnpinCodes := &types.MsgUnpinCodes{ + Authority: spec.addr, + CodeIDs: []uint64{result.CodeID}, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgUnpinCodes)(ctx, msgUnpinCodes) + + //then + if spec.expErr { + require.Error(t, err) + assert.True(t, wasmApp.WasmKeeper.IsPinnedCode(ctx, result.CodeID)) + } else { + require.NoError(t, err) + assert.False(t, wasmApp.WasmKeeper.IsPinnedCode(ctx, result.CodeID)) + } + }) + } +} + +func TestSudoContract(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + + var ( + myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + ) + + type StealMsg struct { + Recipient string `json:"recipient"` + Amount []sdk.Coin `json:"amount"` + } + + stealMsg := struct { + Steal StealMsg `json:"steal_funds"` + }{Steal: StealMsg{ + Recipient: myAddress.String(), + Amount: []sdk.Coin{}, + }} + + stealMsgBz, err := json.Marshal(stealMsg) + require.NoError(t, err) + + specs := map[string]struct { + addr string + expErr bool + }{ + "sudo contract with authority": { + addr: authority, + expErr: false, + }, + "sudo contract without authority": { + addr: myAddress.String(), + expErr: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + // setup + _, _, sender := testdata.KeyTestPubAddr() + msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) { + m.WASMByteCode = hackatomContract + m.Sender = sender.String() + }) + + //store code + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + require.NoError(t, err) + var storeCodeResponse types.MsgStoreCodeResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &storeCodeResponse)) + + // instantiate contract + initMsg := keeper.HackatomExampleInitMsg{ + Verifier: sender, + Beneficiary: myAddress, + } + initMsgBz, err := json.Marshal(initMsg) + require.NoError(t, err) + + msgInstantiate := &types.MsgInstantiateContract{ + Sender: sender.String(), + Admin: sender.String(), + CodeID: storeCodeResponse.CodeID, + Label: "test", + Msg: initMsgBz, + Funds: sdk.Coins{}, + } + rsp, err = wasmApp.MsgServiceRouter().Handler(msgInstantiate)(ctx, msgInstantiate) + require.NoError(t, err) + var instantiateResponse types.MsgInstantiateContractResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &instantiateResponse)) + + // when + msgSudoContract := &types.MsgSudoContract{ + Authority: spec.addr, + Msg: stealMsgBz, + Contract: instantiateResponse.Address, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgSudoContract)(ctx, msgSudoContract) + + //then + if spec.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestStoreAndInstantiateContract(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + + var ( + myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + ) + + specs := map[string]struct { + addr string + permission *types.AccessConfig + expErr bool + }{ + "allow nodbody permission with authority": { + addr: authority, + permission: &types.AllowNobody, + expErr: false, + }, + "allow nodbody permission without authority": { + addr: myAddress.String(), + permission: &types.AllowNobody, + expErr: true, + }, + "allow everybody permission with authority": { + addr: authority, + permission: &types.AllowEverybody, + expErr: false, + }, + "allow everybody permission without authority": { + addr: myAddress.String(), + permission: &types.AllowEverybody, + expErr: false, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + + // when + msg := &types.MsgStoreAndInstantiateContract{ + Authority: spec.addr, + WASMByteCode: wasmContract, + InstantiatePermission: spec.permission, + Admin: myAddress.String(), + UnpinCode: false, + Label: "test", + Msg: []byte(`{}`), + Funds: sdk.Coins{}, + } + _, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + + //then + if spec.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} From dc74df26fdff8d060278e65514b63a215fc8884a Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Thu, 23 Mar 2023 17:41:29 +0100 Subject: [PATCH 10/13] Add more integration tests --- x/wasm/keeper/msg_server_integration_test.go | 151 +++++++++++++++++-- 1 file changed, 139 insertions(+), 12 deletions(-) diff --git a/x/wasm/keeper/msg_server_integration_test.go b/x/wasm/keeper/msg_server_integration_test.go index 486dcac00f..d287e1e518 100644 --- a/x/wasm/keeper/msg_server_integration_test.go +++ b/x/wasm/keeper/msg_server_integration_test.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/assert" @@ -60,7 +59,7 @@ func TestUpdateParams(t *testing.T) { var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) oneAddressAccessConfig = types.AccessTypeOnlyAddress.With(myAddress) - govAuthority = wasmApp.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String() + govAuthority = wasmApp.WasmKeeper.GetAuthority() ) specs := map[string]struct { @@ -156,11 +155,11 @@ func TestPinCodes(t *testing.T) { addr string expErr bool }{ - "pin codes with authority": { + "authority can pin codes": { addr: authority, expErr: false, }, - "pin codes without authority": { + "other address cannot pin codes": { addr: myAddress.String(), expErr: true, }, @@ -213,11 +212,11 @@ func TestUnpinCodes(t *testing.T) { addr string expErr bool }{ - "unpin codes with authority": { + "authority can unpin codes": { addr: authority, expErr: false, }, - "unpin codes without authority": { + "other address cannot unpin codes": { addr: myAddress.String(), expErr: true, }, @@ -293,11 +292,11 @@ func TestSudoContract(t *testing.T) { addr string expErr bool }{ - "sudo contract with authority": { + "authority can call sudo on a contract": { addr: authority, expErr: false, }, - "sudo contract without authority": { + "other address cannot call sudo on a contract": { addr: myAddress.String(), expErr: true, }, @@ -370,22 +369,22 @@ func TestStoreAndInstantiateContract(t *testing.T) { permission *types.AccessConfig expErr bool }{ - "allow nodbody permission with authority": { + "authority can store and instantiate when permission is nobody": { addr: authority, permission: &types.AllowNobody, expErr: false, }, - "allow nodbody permission without authority": { + "other address cannot store and instantiate when permission is nobody": { addr: myAddress.String(), permission: &types.AllowNobody, expErr: true, }, - "allow everybody permission with authority": { + "authority can store and instantiate when permission is everybody": { addr: authority, permission: &types.AllowEverybody, expErr: false, }, - "allow everybody permission without authority": { + "other address can store and instantiate when permission is everybody": { addr: myAddress.String(), permission: &types.AllowEverybody, expErr: false, @@ -416,3 +415,131 @@ func TestStoreAndInstantiateContract(t *testing.T) { }) } } + +func TestUpdateAdmin(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + + var ( + myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + _, _, otherAddr = testdata.KeyTestPubAddr() + ) + + specs := map[string]struct { + addr string + expErr bool + }{ + "authority can update admin": { + addr: authority, + expErr: false, + }, + "admin can update admin": { + addr: myAddress.String(), + expErr: false, + }, + "other address cannot update admin": { + addr: otherAddr.String(), + expErr: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + _, _, newAdmin := testdata.KeyTestPubAddr() + + // setup + msg := &types.MsgStoreAndInstantiateContract{ + Authority: spec.addr, + WASMByteCode: wasmContract, + InstantiatePermission: &types.AllowEverybody, + Admin: myAddress.String(), + UnpinCode: false, + Label: "test", + Msg: []byte(`{}`), + Funds: sdk.Coins{}, + } + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + require.NoError(t, err) + var storeAndInstantiateResponse types.MsgStoreAndInstantiateContractResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &storeAndInstantiateResponse)) + + // when + msgUpdateAdmin := &types.MsgUpdateAdmin{ + Sender: spec.addr, + NewAdmin: newAdmin.String(), + Contract: storeAndInstantiateResponse.Address, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgUpdateAdmin)(ctx, msgUpdateAdmin) + + //then + if spec.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestClearAdmin(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + + var ( + myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + _, _, otherAddr = testdata.KeyTestPubAddr() + ) + + specs := map[string]struct { + addr string + expErr bool + }{ + "authority can clear admin": { + addr: authority, + expErr: false, + }, + "admin can clear admin": { + addr: myAddress.String(), + expErr: false, + }, + "other address cannot clear admin": { + addr: otherAddr.String(), + expErr: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + + // setup + msg := &types.MsgStoreAndInstantiateContract{ + Authority: spec.addr, + WASMByteCode: wasmContract, + InstantiatePermission: &types.AllowEverybody, + Admin: myAddress.String(), + UnpinCode: false, + Label: "test", + Msg: []byte(`{}`), + Funds: sdk.Coins{}, + } + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + require.NoError(t, err) + var storeAndInstantiateResponse types.MsgStoreAndInstantiateContractResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &storeAndInstantiateResponse)) + + // when + msgClearAdmin := &types.MsgClearAdmin{ + Sender: spec.addr, + Contract: storeAndInstantiateResponse.Address, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgClearAdmin)(ctx, msgClearAdmin) + + //then + if spec.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} From 4ca74ba9a2d8e73f40d4d5857f9565c7d369081a Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Mon, 27 Mar 2023 10:39:05 +0200 Subject: [PATCH 11/13] Add tests --- x/wasm/keeper/msg_server_integration_test.go | 246 ++++++++++++++++++- 1 file changed, 242 insertions(+), 4 deletions(-) diff --git a/x/wasm/keeper/msg_server_integration_test.go b/x/wasm/keeper/msg_server_integration_test.go index d287e1e518..75dab7242e 100644 --- a/x/wasm/keeper/msg_server_integration_test.go +++ b/x/wasm/keeper/msg_server_integration_test.go @@ -369,22 +369,22 @@ func TestStoreAndInstantiateContract(t *testing.T) { permission *types.AccessConfig expErr bool }{ - "authority can store and instantiate when permission is nobody": { + "authority can store and instantiate a contract when permission is nobody": { addr: authority, permission: &types.AllowNobody, expErr: false, }, - "other address cannot store and instantiate when permission is nobody": { + "other address cannot store and instantiate a contract when permission is nobody": { addr: myAddress.String(), permission: &types.AllowNobody, expErr: true, }, - "authority can store and instantiate when permission is everybody": { + "authority can store and instantiate a contract when permission is everybody": { addr: authority, permission: &types.AllowEverybody, expErr: false, }, - "other address can store and instantiate when permission is everybody": { + "other address can store and instantiate a contract when permission is everybody": { addr: myAddress.String(), permission: &types.AllowEverybody, expErr: false, @@ -543,3 +543,241 @@ func TestClearAdmin(t *testing.T) { }) } } + +func TestMigrateContract(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + + var ( + myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + _, _, otherAddr = testdata.KeyTestPubAddr() + ) + + specs := map[string]struct { + addr string + expErr bool + }{ + "authority can migrate a contract": { + addr: authority, + expErr: false, + }, + "admin can migrate a contract": { + addr: myAddress.String(), + expErr: false, + }, + "other address cannot migrate a contract": { + addr: otherAddr.String(), + expErr: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + // setup + _, _, sender := testdata.KeyTestPubAddr() + msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) { + m.WASMByteCode = hackatomContract + m.Sender = sender.String() + }) + + //store code + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + require.NoError(t, err) + var storeCodeResponse types.MsgStoreCodeResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &storeCodeResponse)) + + // instantiate contract + initMsg := keeper.HackatomExampleInitMsg{ + Verifier: sender, + Beneficiary: myAddress, + } + initMsgBz, err := json.Marshal(initMsg) + require.NoError(t, err) + + msgInstantiate := &types.MsgInstantiateContract{ + Sender: sender.String(), + Admin: myAddress.String(), + CodeID: storeCodeResponse.CodeID, + Label: "test", + Msg: initMsgBz, + Funds: sdk.Coins{}, + } + rsp, err = wasmApp.MsgServiceRouter().Handler(msgInstantiate)(ctx, msgInstantiate) + require.NoError(t, err) + var instantiateResponse types.MsgInstantiateContractResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &instantiateResponse)) + + // when + migMsg := struct { + Verifier sdk.AccAddress `json:"verifier"` + }{Verifier: myAddress} + migMsgBz, err := json.Marshal(migMsg) + require.NoError(t, err) + msgMigrateContract := &types.MsgMigrateContract{ + Sender: spec.addr, + Msg: migMsgBz, + Contract: instantiateResponse.Address, + CodeID: storeCodeResponse.CodeID, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgMigrateContract)(ctx, msgMigrateContract) + + //then + if spec.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestInstantiateContract(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + + var ( + myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + ) + + specs := map[string]struct { + addr string + permission *types.AccessConfig + expErr bool + }{ + "authority can instantiate a contract when permission is nobody": { + addr: authority, + permission: &types.AllowNobody, + expErr: false, + }, + "other address cannot instantiate a contract when permission is nobody": { + addr: myAddress.String(), + permission: &types.AllowNobody, + expErr: true, + }, + "authority can instantiate a contract when permission is everybody": { + addr: authority, + permission: &types.AllowEverybody, + expErr: false, + }, + "other address can instantiate a contract when permission is everybody": { + addr: myAddress.String(), + permission: &types.AllowEverybody, + expErr: false, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + // setup + _, _, sender := testdata.KeyTestPubAddr() + msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) { + m.WASMByteCode = wasmContract + m.Sender = sender.String() + m.InstantiatePermission = spec.permission + }) + + // store code + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + require.NoError(t, err) + var result types.MsgStoreCodeResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result)) + + // when + msgInstantiate := &types.MsgInstantiateContract{ + Sender: spec.addr, + Admin: myAddress.String(), + CodeID: result.CodeID, + Label: "test", + Msg: []byte(`{}`), + Funds: sdk.Coins{}, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgInstantiate)(ctx, msgInstantiate) + + //then + if spec.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestInstantiateContract2(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + + var ( + myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + ) + + specs := map[string]struct { + addr string + salt string + permission *types.AccessConfig + expErr bool + }{ + "authority can instantiate a contract when permission is nobody": { + addr: authority, + permission: &types.AllowNobody, + salt: "salt1", + expErr: false, + }, + "other address cannot instantiate a contract when permission is nobody": { + addr: myAddress.String(), + permission: &types.AllowNobody, + salt: "salt2", + expErr: true, + }, + "authority can instantiate a contract when permission is everybody": { + addr: authority, + permission: &types.AllowEverybody, + salt: "salt3", + expErr: false, + }, + "other address can instantiate a contract when permission is everybody": { + addr: myAddress.String(), + permission: &types.AllowEverybody, + salt: "salt4", + expErr: false, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + // setup + _, _, sender := testdata.KeyTestPubAddr() + msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) { + m.WASMByteCode = wasmContract + m.Sender = sender.String() + m.InstantiatePermission = spec.permission + }) + + // store code + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + require.NoError(t, err) + var result types.MsgStoreCodeResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result)) + + // when + msgInstantiate := &types.MsgInstantiateContract2{ + Sender: spec.addr, + Admin: myAddress.String(), + CodeID: result.CodeID, + Label: "label", + Msg: []byte(`{}`), + Funds: sdk.Coins{}, + Salt: []byte(spec.salt), + FixMsg: true, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgInstantiate)(ctx, msgInstantiate) + + //then + if spec.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} From 6f6c46c363605c9b6cd3b4c8a1d75a056972e2bb Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Tue, 28 Mar 2023 09:54:55 +0200 Subject: [PATCH 12/13] Remove legacy proposal CLI --- x/wasm/client/cli/gov_tx.go | 810 ------------------------------ x/wasm/client/cli/gov_tx_test.go | 158 ------ x/wasm/client/cli/tx_test.go | 65 --- x/wasm/client/proposal_handler.go | 17 +- 4 files changed, 1 insertion(+), 1049 deletions(-) delete mode 100644 x/wasm/client/cli/gov_tx.go delete mode 100644 x/wasm/client/cli/gov_tx_test.go diff --git a/x/wasm/client/cli/gov_tx.go b/x/wasm/client/cli/gov_tx.go deleted file mode 100644 index ad53d3d606..0000000000 --- a/x/wasm/client/cli/gov_tx.go +++ /dev/null @@ -1,810 +0,0 @@ -package cli - -import ( - "bytes" - "crypto/sha256" - "fmt" - "net/url" - "strconv" - "strings" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/docker/distribution/reference" - "github.com/pkg/errors" - "github.com/spf13/cobra" - flag "github.com/spf13/pflag" - - "github.com/CosmWasm/wasmd/x/wasm/ioutils" - "github.com/CosmWasm/wasmd/x/wasm/types" -) - -func ProposalStoreCodeCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "wasm-store [wasm file] --title [text] --description [text] --authority [address]", - Short: "Submit a wasm binary proposal", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - src, err := parseStoreCodeArgs(args[0], authority, cmd.Flags()) - if err != nil { - return err - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - addInstantiatePermissionFlags(cmd) - - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func parseVerificationFlags(gzippedWasm []byte, flags *flag.FlagSet) (string, string, []byte, error) { - source, err := flags.GetString(flagSource) - if err != nil { - return "", "", nil, fmt.Errorf("source: %s", err) - } - builder, err := flags.GetString(flagBuilder) - if err != nil { - return "", "", nil, fmt.Errorf("builder: %s", err) - } - codeHash, err := flags.GetBytesHex(flagCodeHash) - if err != nil { - return "", "", nil, fmt.Errorf("codeHash: %s", err) - } - - // if any set require others to be set - if len(source) != 0 || len(builder) != 0 || len(codeHash) != 0 { - if source == "" { - return "", "", nil, fmt.Errorf("source is required") - } - if _, err = url.ParseRequestURI(source); err != nil { - return "", "", nil, fmt.Errorf("source: %s", err) - } - if builder == "" { - return "", "", nil, fmt.Errorf("builder is required") - } - if _, err := reference.ParseDockerRef(builder); err != nil { - return "", "", nil, fmt.Errorf("builder: %s", err) - } - if len(codeHash) == 0 { - return "", "", nil, fmt.Errorf("code hash is required") - } - // wasm is gzipped in parseStoreCodeArgs - // checksum generation will be decoupled here - // reference https://github.com/CosmWasm/wasmvm/issues/359 - raw, err := ioutils.Uncompress(gzippedWasm, uint64(types.MaxWasmSize)) - if err != nil { - return "", "", nil, fmt.Errorf("invalid zip: %w", err) - } - checksum := sha256.Sum256(raw) - if !bytes.Equal(checksum[:], codeHash) { - return "", "", nil, fmt.Errorf("code-hash mismatch: %X, checksum: %X", codeHash, checksum) - } - } - return source, builder, codeHash, nil -} - -func ProposalInstantiateContractCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "instantiate-contract [code_id_int64] [json_encoded_init_args] --authority [address] --label [text] --title [text] --description [text] --admin [address,optional] --amount [coins,optional]", - Short: "Submit an instantiate wasm contract proposal", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - src, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, authority, cmd.Flags()) - if err != nil { - return err - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation") - cmd.Flags().String(flagLabel, "", "A human-readable name for this contract in lists") - cmd.Flags().String(flagAdmin, "", "Address or key name of an admin") - cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin") - - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func ProposalInstantiateContract2Cmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "instantiate-contract-2 [code_id_int64] [json_encoded_init_args] --authority [address] --label [text] --title [text] --description [text] --admin [address,optional] --amount [coins,optional]", - Short: "Submit an instantiate wasm contract proposal with predictable address", - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - src, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, authority, cmd.Flags()) - if err != nil { - return err - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - - cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation") - cmd.Flags().String(flagLabel, "", "A human-readable name for this contract in lists") - cmd.Flags().String(flagAdmin, "", "Address of an admin") - cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin") - - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func ProposalStoreAndInstantiateContractCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "store-instantiate [wasm file] [json_encoded_init_args] --authority [address] --label [text] --title [text] --description [text]" + - "--unpin-code [unpin_code,optional] --source [source,optional] --builder [builder,optional] --code-hash [code_hash,optional] --admin [address,optional] --amount [coins,optional]", - Short: "Submit and instantiate a wasm contract proposal", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - src, err := parseStoreCodeArgs(args[0], authority, cmd.Flags()) - if err != nil { - return err - } - - unpinCode, err := cmd.Flags().GetBool(flagUnpinCode) - if err != nil { - return err - } - - source, builder, codeHash, err := parseVerificationFlags(src.WASMByteCode, cmd.Flags()) - if err != nil { - return err - } - - amountStr, err := cmd.Flags().GetString(flagAmount) - if err != nil { - return fmt.Errorf("amount: %s", err) - } - amount, err := sdk.ParseCoinsNormalized(amountStr) - if err != nil { - return fmt.Errorf("amount: %s", err) - } - label, err := cmd.Flags().GetString(flagLabel) - if err != nil { - return fmt.Errorf("label: %s", err) - } - if label == "" { - return errors.New("label is required on all contracts") - } - adminStr, err := cmd.Flags().GetString(flagAdmin) - if err != nil { - return fmt.Errorf("admin: %s", err) - } - noAdmin, err := cmd.Flags().GetBool(flagNoAdmin) - if err != nil { - return fmt.Errorf("no-admin: %s", err) - } - - // ensure sensible admin is set (or explicitly immutable) - if adminStr == "" && !noAdmin { - return fmt.Errorf("you must set an admin or explicitly pass --no-admin to make it immutible (wasmd issue #719)") - } - if adminStr != "" && noAdmin { - return fmt.Errorf("you set an admin and passed --no-admin, those cannot both be true") - } - - if adminStr != "" { - addr, err := sdk.AccAddressFromBech32(adminStr) - if err != nil { - info, err := clientCtx.Keyring.Key(adminStr) - if err != nil { - return fmt.Errorf("admin %s", err) - } - admin, err := info.GetAddress() - if err != nil { - return err - } - adminStr = admin.String() - } else { - adminStr = addr.String() - } - } - - msg := types.MsgStoreAndInstantiateContract{ - Authority: authority, - WASMByteCode: src.WASMByteCode, - InstantiatePermission: src.InstantiatePermission, - UnpinCode: unpinCode, - Source: source, - Builder: builder, - CodeHash: codeHash, - Admin: adminStr, - Label: label, - Msg: []byte(args[1]), - Funds: amount, - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - - cmd.Flags().Bool(flagUnpinCode, false, "Unpin code on upload, optional") - cmd.Flags().String(flagSource, "", "Code Source URL is a valid absolute HTTPS URI to the contract's source code,") - cmd.Flags().String(flagBuilder, "", "Builder is a valid docker image name with tag, such as \"cosmwasm/workspace-optimizer:0.12.9\"") - cmd.Flags().BytesHex(flagCodeHash, nil, "CodeHash is the sha256 hash of the wasm code") - cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation") - cmd.Flags().String(flagLabel, "", "A human-readable name for this contract in lists") - cmd.Flags().String(flagAdmin, "", "Address or key name of an admin") - cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin") - addInstantiatePermissionFlags(cmd) - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func ProposalMigrateContractCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "migrate-contract [contract_addr_bech32] [new_code_id_int64] [json_encoded_migration_args] --authority [address]", - 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, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - src, err := parseMigrateContractArgs(args, authority) - if err != nil { - return err - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func ProposalExecuteContractCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "execute-contract [contract_addr_bech32] [json_encoded_migration_args] --authority [address]", - 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, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - 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) - } - - msg := types.MsgExecuteContract{ - Sender: authority, - Contract: contract, - Msg: execMsg, - Funds: funds, - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation") - - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func ProposalSudoContractCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "sudo-contract [contract_addr_bech32] [json_encoded_migration_args] --authority [address]", - 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, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - msg := types.MsgSudoContract{ - Authority: authority, - Contract: args[0], - Msg: []byte(args[1]), - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - // proposal flagsExecute - addCommonProposalFlags(cmd) - return cmd -} - -func ProposalUpdateContractAdminCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "set-contract-admin [contract_addr_bech32] [new_admin_addr_bech32] --authority [address]", - Short: "Submit a new admin for a contract proposal", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - src := parseUpdateContractAdminArgs(args, authority) - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func ProposalClearContractAdminCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "clear-contract-admin [contract_addr_bech32] --authority [address]", - 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, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - msg := types.MsgClearAdmin{ - Sender: authority, - Contract: args[0], - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func ProposalPinCodesCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "pin-codes [code-ids] --authority [address]", - 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, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - codeIds, err := parsePinCodesArgs(args) - if err != nil { - return err - } - - msg := types.MsgPinCodes{ - Authority: authority, - CodeIDs: codeIds, - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func parsePinCodesArgs(args []string) ([]uint64, error) { - codeIDs := make([]uint64, len(args)) - for i, c := range args { - codeID, err := strconv.ParseUint(c, 10, 64) - if err != nil { - return codeIDs, fmt.Errorf("code IDs: %s", err) - } - codeIDs[i] = codeID - } - return codeIDs, nil -} - -func ProposalUnpinCodesCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "unpin-codes [code-ids] --authority [address]", - 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, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - codeIds, err := parsePinCodesArgs(args) - if err != nil { - return err - } - - msg := types.MsgUnpinCodes{ - Authority: authority, - CodeIDs: codeIds, - } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func parseAccessConfig(raw string) (c types.AccessConfig, err error) { - switch raw { - case "nobody": - return types.AllowNobody, nil - case "everybody": - return types.AllowEverybody, nil - default: - parts := strings.Split(raw, ",") - addrs := make([]sdk.AccAddress, len(parts)) - for i, v := range parts { - addr, err := sdk.AccAddressFromBech32(v) - if err != nil { - return types.AccessConfig{}, fmt.Errorf("unable to parse address %q: %s", v, err) - } - addrs[i] = addr - } - defer func() { // convert panic in ".With" to error for better output - if r := recover(); r != nil { - err = r.(error) - } - }() - cfg := types.AccessTypeAnyOfAddresses.With(addrs...) - return cfg, cfg.ValidateBasic() - } -} - -func parseAccessConfigUpdates(args []string) ([]types.AccessConfigUpdate, error) { - updates := make([]types.AccessConfigUpdate, len(args)) - for i, c := range args { - // format: code_id:access_config - // access_config: nobody|everybody|address(es) - parts := strings.Split(c, ":") - if len(parts) != 2 { - return nil, fmt.Errorf("invalid format") - } - - codeID, err := strconv.ParseUint(parts[0], 10, 64) - if err != nil { - return nil, fmt.Errorf("invalid code ID: %s", err) - } - - accessConfig, err := parseAccessConfig(parts[1]) - if err != nil { - return nil, err - } - updates[i] = types.AccessConfigUpdate{ - CodeID: codeID, - InstantiatePermission: accessConfig, - } - } - return updates, nil -} - -func ProposalUpdateInstantiateConfigCmd() *cobra.Command { - bech32Prefix := sdk.GetConfig().GetBech32AccountAddrPrefix() - cmd := &cobra.Command{ - Use: "update-instantiate-config [code-id:permission]...", - Short: "Submit an update instantiate config proposal.", - Args: cobra.MinimumNArgs(1), - Long: strings.TrimSpace( - fmt.Sprintf(`Submit an update instantiate config proposal for multiple code ids. - -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, proposalDescr, deposit, err := getProposalInfo(cmd) - if err != nil { - return err - } - - authority, err := cmd.Flags().GetString(flagAuthority) - if err != nil { - return fmt.Errorf("authority: %s", err) - } - - if len(authority) == 0 { - return errors.New("authority address is required") - } - - updates, err := parseAccessConfigUpdates(args) - if err != nil { - return err - } - - msgs := make([]sdk.Msg, len(updates)) - for i, update := range updates { - permission := update.InstantiatePermission - msgs[i] = &types.MsgUpdateInstantiateConfig{ - Sender: authority, - CodeID: update.CodeID, - NewInstantiatePermission: &permission, - } - } - - proposalMsg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, proposalDescr) - if err != nil { - return err - } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) - }, - SilenceUsage: true, - } - // proposal flags - addCommonProposalFlags(cmd) - return cmd -} - -func addCommonProposalFlags(cmd *cobra.Command) { - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck - cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(flagAuthority, "", "The address of the governance account.") -} - -func getProposalInfo(cmd *cobra.Command) (client.Context, string, string, sdk.Coins, error) { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return client.Context{}, "", "", nil, err - } - - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck - if err != nil { - return clientCtx, proposalTitle, "", nil, err - } - - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck - if err != nil { - return client.Context{}, proposalTitle, proposalDescr, nil, err - } - - depositArg, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return client.Context{}, proposalTitle, proposalDescr, nil, err - } - - deposit, err := sdk.ParseCoinsNormalized(depositArg) - if err != nil { - return client.Context{}, proposalTitle, proposalDescr, deposit, err - } - - return clientCtx, proposalTitle, proposalDescr, deposit, nil -} diff --git a/x/wasm/client/cli/gov_tx_test.go b/x/wasm/client/cli/gov_tx_test.go deleted file mode 100644 index da62d498c0..0000000000 --- a/x/wasm/client/cli/gov_tx_test.go +++ /dev/null @@ -1,158 +0,0 @@ -package cli - -import ( - "os" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/CosmWasm/wasmd/x/wasm/types" -) - -func TestParseAccessConfigUpdates(t *testing.T) { - specs := map[string]struct { - src []string - exp []types.AccessConfigUpdate - expErr bool - }{ - "nobody": { - src: []string{"1:nobody"}, - exp: []types.AccessConfigUpdate{{ - CodeID: 1, - InstantiatePermission: types.AccessConfig{Permission: types.AccessTypeNobody}, - }}, - }, - "everybody": { - src: []string{"1:everybody"}, - exp: []types.AccessConfigUpdate{{ - CodeID: 1, - InstantiatePermission: types.AccessConfig{Permission: types.AccessTypeEverybody}, - }}, - }, - "any of addresses - single": { - src: []string{"1:cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x"}, - exp: []types.AccessConfigUpdate{ - { - CodeID: 1, - InstantiatePermission: types.AccessConfig{ - Permission: types.AccessTypeAnyOfAddresses, - Addresses: []string{"cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x"}, - }, - }, - }, - }, - "any of addresses - multiple": { - src: []string{"1:cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x,cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"}, - exp: []types.AccessConfigUpdate{ - { - CodeID: 1, - InstantiatePermission: types.AccessConfig{ - Permission: types.AccessTypeAnyOfAddresses, - Addresses: []string{"cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x", "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"}, - }, - }, - }, - }, - "multiple code ids with different permissions": { - src: []string{"1:cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x,cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", "2:nobody"}, - exp: []types.AccessConfigUpdate{ - { - CodeID: 1, - InstantiatePermission: types.AccessConfig{ - Permission: types.AccessTypeAnyOfAddresses, - Addresses: []string{"cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x", "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"}, - }, - }, { - CodeID: 2, - InstantiatePermission: types.AccessConfig{ - Permission: types.AccessTypeNobody, - }, - }, - }, - }, - "any of addresses - empty list": { - src: []string{"1:"}, - expErr: true, - }, - "any of addresses - invalid address": { - src: []string{"1:foo"}, - expErr: true, - }, - "any of addresses - duplicate address": { - src: []string{"1:cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x,cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x"}, - expErr: true, - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - got, gotErr := parseAccessConfigUpdates(spec.src) - if spec.expErr { - require.Error(t, gotErr) - return - } - require.NoError(t, gotErr) - assert.Equal(t, spec.exp, got) - }) - } -} - -func TestParseCodeInfoFlags(t *testing.T) { - correctSource := "https://github.com/CosmWasm/wasmd/blob/main/x/wasm/keeper/testdata/hackatom.wasm" - correctBuilderRef := "cosmwasm/workspace-optimizer:0.12.9" - - wasmBin, err := os.ReadFile("../../keeper/testdata/hackatom.wasm.gzip") - require.NoError(t, err) - - checksumStr := "beb3de5e9b93b52e514c74ce87ccddb594b9bcd33b7f1af1bb6da63fc883917b" - - specs := map[string]struct { - args []string - expErr bool - }{ - "source missing": { - args: []string{"--builder=" + correctBuilderRef, "--code-hash=" + checksumStr}, - expErr: true, - }, - "builder missing": { - args: []string{"--code-source-url=" + correctSource, "--code-hash=" + checksumStr}, - expErr: true, - }, - "code hash missing": { - args: []string{"--code-source-url=" + correctSource, "--builder=" + correctBuilderRef}, - expErr: true, - }, - "source format wrong": { - args: []string{"--code-source-url=" + "format_wrong", "--builder=" + correctBuilderRef, "--code-hash=" + checksumStr}, - expErr: true, - }, - "builder format wrong": { - args: []string{"--code-source-url=" + correctSource, "--builder=" + "format//", "--code-hash=" + checksumStr}, - expErr: true, - }, - "code hash wrong": { - args: []string{"--code-source-url=" + correctSource, "--builder=" + correctBuilderRef, "--code-hash=" + "AA"}, - expErr: true, - }, - "happy path, none set": { - args: []string{}, - expErr: false, - }, - "happy path all set": { - args: []string{"--code-source-url=" + correctSource, "--builder=" + correctBuilderRef, "--code-hash=" + checksumStr}, - expErr: false, - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - flags := ProposalStoreAndInstantiateContractCmd().Flags() - require.NoError(t, flags.Parse(spec.args)) - _, _, _, gotErr := parseVerificationFlags(wasmBin, flags) - if spec.expErr { - require.Error(t, gotErr) - return - } - require.NoError(t, gotErr) - }) - } -} diff --git a/x/wasm/client/cli/tx_test.go b/x/wasm/client/cli/tx_test.go index cd318ee931..888df2b51f 100644 --- a/x/wasm/client/cli/tx_test.go +++ b/x/wasm/client/cli/tx_test.go @@ -1,14 +1,11 @@ package cli import ( - "encoding/hex" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/CosmWasm/wasmd/x/wasm/ioutils" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -60,65 +57,3 @@ func TestParseAccessConfigFlags(t *testing.T) { }) } } - -func TestParseVerificationFlags(t *testing.T) { - mySender := sdk.MustAccAddressFromBech32("cosmos1wyqh3n50ecatjg4vww5crmtd0nmyzusnwckw4at4gluc0m5m477q4arfek") - - specs := map[string]struct { - srcPath string - args []string - expErr bool - expSource string - expBuilder string - expCodeHash string - }{ - "gov store zipped": { - srcPath: "../../keeper/testdata/hackatom.wasm.gzip", - args: []string{ - "--instantiate-everybody=true", "--code-hash=beb3de5e9b93b52e514c74ce87ccddb594b9bcd33b7f1af1bb6da63fc883917b", - "--code-source-url=https://example.com", "--builder=cosmwasm/workspace-optimizer:0.12.11", - }, - expBuilder: "cosmwasm/workspace-optimizer:0.12.11", - expSource: "https://example.com", - expCodeHash: "beb3de5e9b93b52e514c74ce87ccddb594b9bcd33b7f1af1bb6da63fc883917b", - }, - "gov store raw": { - srcPath: "../../keeper/testdata/hackatom.wasm", - args: []string{ - "--instantiate-everybody=true", "--code-hash=beb3de5e9b93b52e514c74ce87ccddb594b9bcd33b7f1af1bb6da63fc883917b", - "--code-source-url=https://example.com", "--builder=cosmwasm/workspace-optimizer:0.12.11", - }, - expBuilder: "cosmwasm/workspace-optimizer:0.12.11", - expSource: "https://example.com", - expCodeHash: "beb3de5e9b93b52e514c74ce87ccddb594b9bcd33b7f1af1bb6da63fc883917b", - }, - "gov store checksum mismatch": { - srcPath: "../../keeper/testdata/hackatom.wasm", - args: []string{ - "--instantiate-everybody=true", "--code-hash=0000de5e9b93b52e514c74ce87ccddb594b9bcd33b7f1af1bb6da63fc883917b", - "--code-source-url=https://example.com", "--builder=cosmwasm/workspace-optimizer:0.12.11", - }, - expErr: true, - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - flagSet := ProposalStoreAndInstantiateContractCmd().Flags() - require.NoError(t, flagSet.Parse(spec.args)) - - gotMsg, err := parseStoreCodeArgs(spec.srcPath, mySender.String(), flagSet) - require.NoError(t, err) - require.True(t, ioutils.IsGzip(gotMsg.WASMByteCode)) - - gotSource, gotBuilder, gotCodeHash, gotErr := parseVerificationFlags(gotMsg.WASMByteCode, flagSet) - if spec.expErr { - require.Error(t, gotErr) - return - } - require.NoError(t, gotErr) - assert.Equal(t, spec.expSource, gotSource) - assert.Equal(t, spec.expBuilder, gotBuilder) - assert.Equal(t, spec.expCodeHash, hex.EncodeToString(gotCodeHash)) - }) - } -} diff --git a/x/wasm/client/proposal_handler.go b/x/wasm/client/proposal_handler.go index deba8070ca..ce0a706e3e 100644 --- a/x/wasm/client/proposal_handler.go +++ b/x/wasm/client/proposal_handler.go @@ -2,22 +2,7 @@ package client import ( govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - - "github.com/CosmWasm/wasmd/x/wasm/client/cli" ) // ProposalHandlers define the wasm cli proposal types and rest handler. -var ProposalHandlers = []govclient.ProposalHandler{ - govclient.NewProposalHandler(cli.ProposalStoreCodeCmd), - govclient.NewProposalHandler(cli.ProposalInstantiateContractCmd), - govclient.NewProposalHandler(cli.ProposalMigrateContractCmd), - govclient.NewProposalHandler(cli.ProposalExecuteContractCmd), - govclient.NewProposalHandler(cli.ProposalSudoContractCmd), - govclient.NewProposalHandler(cli.ProposalUpdateContractAdminCmd), - govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd), - govclient.NewProposalHandler(cli.ProposalPinCodesCmd), - govclient.NewProposalHandler(cli.ProposalUnpinCodesCmd), - govclient.NewProposalHandler(cli.ProposalUpdateInstantiateConfigCmd), - govclient.NewProposalHandler(cli.ProposalStoreAndInstantiateContractCmd), - govclient.NewProposalHandler(cli.ProposalInstantiateContract2Cmd), -} +var ProposalHandlers = []govclient.ProposalHandler{} From b58c320eaca39bb816ff2579e875a923811a607b Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Wed, 29 Mar 2023 22:32:54 +0200 Subject: [PATCH 13/13] fix comments --- app/app.go | 7 +- x/wasm/alias.go | 2 +- x/wasm/client/cli/tx.go | 1 - x/wasm/client/proposal_handler.go | 8 - x/wasm/keeper/msg_server.go | 24 +- x/wasm/keeper/msg_server_integration_test.go | 74 ++++ x/wasm/keeper/proposal_handler.go | 4 +- x/wasm/types/tx_test.go | 389 +++++++++++++++++++ 8 files changed, 493 insertions(+), 16 deletions(-) delete mode 100644 x/wasm/client/proposal_handler.go diff --git a/app/app.go b/app/app.go index 55a4d0af73..037dca2009 100644 --- a/app/app.go +++ b/app/app.go @@ -122,9 +122,9 @@ import ( "github.com/spf13/cast" "github.com/CosmWasm/wasmd/x/wasm" - wasmclient "github.com/CosmWasm/wasmd/x/wasm/client" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" ) const appName = "WasmApp" @@ -194,14 +194,13 @@ var ( mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( - append( - wasmclient.ProposalHandlers, + []govclient.ProposalHandler{ paramsclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler, ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler, - ), + }, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, diff --git a/x/wasm/alias.go b/x/wasm/alias.go index 83480ab4dd..7b10c4198a 100644 --- a/x/wasm/alias.go +++ b/x/wasm/alias.go @@ -57,7 +57,7 @@ var ( WasmQuerier = keeper.WasmQuerier CreateTestInput = keeper.CreateTestInput TestHandler = keeper.TestHandler - NewWasmProposalHandler = keeper.NewWasmProposalHandler + NewWasmProposalHandler = keeper.NewWasmProposalHandler //nolint:staticcheck NewQuerier = keeper.Querier ContractFromPortID = keeper.ContractFromPortID WithWasmEngine = keeper.WithWasmEngine diff --git a/x/wasm/client/cli/tx.go b/x/wasm/client/cli/tx.go index 84d97a0552..04c229701b 100644 --- a/x/wasm/client/cli/tx.go +++ b/x/wasm/client/cli/tx.go @@ -44,7 +44,6 @@ const ( flagMaxFunds = "max-funds" flagAllowAllMsgs = "allow-all-messages" flagNoTokenTransfer = "no-token-transfer" //nolint:gosec - flagAuthority = "authority" ) // GetTxCmd returns the transaction commands for this module diff --git a/x/wasm/client/proposal_handler.go b/x/wasm/client/proposal_handler.go deleted file mode 100644 index ce0a706e3e..0000000000 --- a/x/wasm/client/proposal_handler.go +++ /dev/null @@ -1,8 +0,0 @@ -package client - -import ( - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" -) - -// ProposalHandlers define the wasm cli proposal types and rest handler. -var ProposalHandlers = []govclient.ProposalHandler{} diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go index f4e70b0bc5..3c5c3e72e8 100644 --- a/x/wasm/keeper/msg_server.go +++ b/x/wasm/keeper/msg_server.go @@ -219,9 +219,13 @@ func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.Msg } ctx := sdk.UnwrapSDKContext(goCtx) + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, errorsmod.Wrap(err, "sender") + } policy := m.selectAuthorizationPolicy(msg.Sender) - if err := m.keeper.setAccessConfig(ctx, msg.CodeID, sdk.AccAddress(msg.Sender), *msg.NewInstantiatePermission, policy); err != nil { + if err := m.keeper.setAccessConfig(ctx, msg.CodeID, senderAddr, *msg.NewInstantiatePermission, policy); err != nil { return nil, err } @@ -230,6 +234,9 @@ func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.Msg // UpdateParams updates the module parameters func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } authority := m.keeper.GetAuthority() if authority != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) @@ -245,6 +252,10 @@ func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam // PinCodes pins a set of code ids in the wasmvm cache. func (m msgServer) PinCodes(goCtx context.Context, req *types.MsgPinCodes) (*types.MsgPinCodesResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authority := m.keeper.GetAuthority() if authority != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) @@ -262,6 +273,10 @@ func (m msgServer) PinCodes(goCtx context.Context, req *types.MsgPinCodes) (*typ // UnpinCodes unpins a set of code ids in the wasmvm cache. func (m msgServer) UnpinCodes(goCtx context.Context, req *types.MsgUnpinCodes) (*types.MsgUnpinCodesResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authority := m.keeper.GetAuthority() if authority != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) @@ -279,6 +294,9 @@ func (m msgServer) UnpinCodes(goCtx context.Context, req *types.MsgUnpinCodes) ( // SudoContract calls sudo on a contract. func (m msgServer) SudoContract(goCtx context.Context, req *types.MsgSudoContract) (*types.MsgSudoContractResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } authority := m.keeper.GetAuthority() if authority != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) @@ -300,6 +318,10 @@ func (m msgServer) SudoContract(goCtx context.Context, req *types.MsgSudoContrac // StoreAndInstantiateContract stores and instantiates the contract. func (m msgServer) StoreAndInstantiateContract(goCtx context.Context, req *types.MsgStoreAndInstantiateContract) (*types.MsgStoreAndInstantiateContractResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authorityAddr, err := sdk.AccAddressFromBech32(req.Authority) if err != nil { return nil, errorsmod.Wrap(err, "authority") diff --git a/x/wasm/keeper/msg_server_integration_test.go b/x/wasm/keeper/msg_server_integration_test.go index 75dab7242e..d176c77e65 100644 --- a/x/wasm/keeper/msg_server_integration_test.go +++ b/x/wasm/keeper/msg_server_integration_test.go @@ -781,3 +781,77 @@ func TestInstantiateContract2(t *testing.T) { }) } } + +func TestUpdateInstantiateConfig(t *testing.T) { + wasmApp := app.Setup(t) + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + + var ( + creator sdk.AccAddress = make([]byte, types.ContractAddrLen) + authority = wasmApp.WasmKeeper.GetAuthority() + ) + + specs := map[string]struct { + addr string + permission *types.AccessConfig + expErr bool + }{ + "authority can update instantiate config when permission is subset": { + addr: authority, + permission: &types.AllowNobody, + expErr: false, + }, + "creator can update instantiate config when permission is subset": { + addr: creator.String(), + permission: &types.AllowNobody, + expErr: false, + }, + "authority can update instantiate config when permission is not subset": { + addr: authority, + permission: &types.AllowEverybody, + expErr: false, + }, + "creator cannot update instantiate config when permission is not subset": { + addr: creator.String(), + permission: &types.AllowEverybody, + expErr: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + // setup + err := wasmApp.WasmKeeper.SetParams(ctx, types.Params{ + CodeUploadAccess: types.AllowEverybody, + InstantiateDefaultPermission: types.AccessTypeNobody, + }) + require.NoError(t, err) + + msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) { + m.WASMByteCode = wasmContract + m.Sender = creator.String() + m.InstantiatePermission = &types.AllowNobody + }) + + // store code + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + require.NoError(t, err) + var result types.MsgStoreCodeResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result)) + + // when + msgUpdateInstantiateConfig := &types.MsgUpdateInstantiateConfig{ + Sender: spec.addr, + CodeID: result.CodeID, + NewInstantiatePermission: spec.permission, + } + _, err = wasmApp.MsgServiceRouter().Handler(msgUpdateInstantiateConfig)(ctx, msgUpdateInstantiateConfig) + + //then + if spec.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/wasm/keeper/proposal_handler.go b/x/wasm/keeper/proposal_handler.go index 91a7f253cf..82048ca3e8 100644 --- a/x/wasm/keeper/proposal_handler.go +++ b/x/wasm/keeper/proposal_handler.go @@ -15,13 +15,15 @@ import ( ) // NewWasmProposalHandler creates a new governance Handler for wasm proposals +// +// Deprecated: Do not use. func NewWasmProposalHandler(k decoratedKeeper, enabledProposalTypes []types.ProposalType) v1beta1.Handler { return NewWasmProposalHandlerX(NewGovPermissionKeeper(k), enabledProposalTypes) } // NewWasmProposalHandlerX creates a new governance Handler for wasm proposals // -//nolint:staticcheck +// Deprecated: Do not use. func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []types.ProposalType) v1beta1.Handler { enabledTypes := make(map[string]struct{}, len(enabledProposalTypes)) for i := range enabledProposalTypes { diff --git a/x/wasm/types/tx_test.go b/x/wasm/types/tx_test.go index 628f259503..355beae1bb 100644 --- a/x/wasm/types/tx_test.go +++ b/x/wasm/types/tx_test.go @@ -748,3 +748,392 @@ func TestMsgUpdateInstantiateConfig(t *testing.T) { }) } } + +func TestMsgUpdateParamsValidation(t *testing.T) { + bad, err := sdk.AccAddressFromHexUnsafe("012345") + require.NoError(t, err) + badAddress := bad.String() + // proper address size + goodAddress := sdk.AccAddress(make([]byte, 20)).String() + + specs := map[string]struct { + src MsgUpdateParams + expErr bool + }{ + "all good": { + src: MsgUpdateParams{ + Authority: goodAddress, + Params: DefaultParams(), + }, + }, + "bad authority": { + src: MsgUpdateParams{ + Authority: badAddress, + Params: DefaultParams(), + }, + expErr: true, + }, + "empty authority": { + src: MsgUpdateParams{ + Params: DefaultParams(), + }, + expErr: true, + }, + } + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + err := spec.src.ValidateBasic() + if spec.expErr { + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgPinCodesValidation(t *testing.T) { + bad, err := sdk.AccAddressFromHexUnsafe("012345") + require.NoError(t, err) + badAddress := bad.String() + // proper address size + goodAddress := sdk.AccAddress(make([]byte, 20)).String() + + specs := map[string]struct { + src MsgPinCodes + expErr bool + }{ + "all good": { + src: MsgPinCodes{ + Authority: goodAddress, + CodeIDs: []uint64{1}, + }, + }, + "bad authority": { + src: MsgPinCodes{ + Authority: badAddress, + CodeIDs: []uint64{1}, + }, + expErr: true, + }, + "empty authority": { + src: MsgPinCodes{ + CodeIDs: []uint64{1}, + }, + expErr: true, + }, + "empty code ids": { + src: MsgPinCodes{ + Authority: goodAddress, + }, + expErr: true, + }, + } + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + err := spec.src.ValidateBasic() + if spec.expErr { + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgUnpinCodesValidation(t *testing.T) { + bad, err := sdk.AccAddressFromHexUnsafe("012345") + require.NoError(t, err) + badAddress := bad.String() + // proper address size + goodAddress := sdk.AccAddress(make([]byte, 20)).String() + + specs := map[string]struct { + src MsgUnpinCodes + expErr bool + }{ + "all good": { + src: MsgUnpinCodes{ + Authority: goodAddress, + CodeIDs: []uint64{1}, + }, + }, + "bad authority": { + src: MsgUnpinCodes{ + Authority: badAddress, + CodeIDs: []uint64{1}, + }, + expErr: true, + }, + "empty authority": { + src: MsgUnpinCodes{ + CodeIDs: []uint64{1}, + }, + expErr: true, + }, + "empty code ids": { + src: MsgUnpinCodes{ + Authority: goodAddress, + }, + expErr: true, + }, + } + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + err := spec.src.ValidateBasic() + if spec.expErr { + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgSudoContractValidation(t *testing.T) { + bad, err := sdk.AccAddressFromHexUnsafe("012345") + require.NoError(t, err) + badAddress := bad.String() + // proper address size + goodAddress := sdk.AccAddress(make([]byte, 20)).String() + anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String() + + specs := map[string]struct { + src MsgSudoContract + expErr bool + }{ + "all good": { + src: MsgSudoContract{ + Authority: goodAddress, + Contract: anotherGoodAddress, + Msg: []byte("{}"), + }, + }, + "bad authority": { + src: MsgSudoContract{ + Authority: badAddress, + Contract: anotherGoodAddress, + Msg: []byte("{}"), + }, + expErr: true, + }, + "empty authority": { + src: MsgSudoContract{ + Contract: anotherGoodAddress, + Msg: []byte("{}"), + }, + expErr: true, + }, + "bad contract addr": { + src: MsgSudoContract{ + Authority: goodAddress, + Contract: badAddress, + Msg: []byte("{}"), + }, + expErr: true, + }, + "empty contract addr": { + src: MsgSudoContract{ + Authority: goodAddress, + Msg: []byte("{}"), + }, + expErr: true, + }, + "non json sudoMsg": { + src: MsgSudoContract{ + Authority: goodAddress, + Contract: anotherGoodAddress, + Msg: []byte("invalid json"), + }, + expErr: true, + }, + "empty sudoMsg": { + src: MsgSudoContract{ + Authority: goodAddress, + Contract: anotherGoodAddress, + }, + expErr: true, + }, + } + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + err := spec.src.ValidateBasic() + if spec.expErr { + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgStoreAndInstantiateContractValidation(t *testing.T) { + bad, err := sdk.AccAddressFromHexUnsafe("012345") + require.NoError(t, err) + badAddress := bad.String() + // proper address size + goodAddress := sdk.AccAddress(make([]byte, 20)).String() + sdk.GetConfig().SetAddressVerifier(VerifyAddressLen()) + + cases := map[string]struct { + msg MsgStoreAndInstantiateContract + valid bool + }{ + "empty": { + msg: MsgStoreAndInstantiateContract{}, + valid: false, + }, + "correct minimal": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + Msg: []byte("{}"), + WASMByteCode: []byte("foo"), + }, + valid: true, + }, + "missing byte code": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + Msg: []byte("{}"), + }, + valid: false, + }, + "missing label": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Msg: []byte("{}"), + WASMByteCode: []byte("foo"), + }, + valid: false, + }, + "label too long": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: strings.Repeat("food", 33), + Msg: []byte("{}"), + WASMByteCode: []byte("foo"), + }, + valid: false, + }, + "bad sender minimal": { + msg: MsgStoreAndInstantiateContract{ + Authority: badAddress, + Label: "foo", + Msg: []byte("{}"), + WASMByteCode: []byte("foo"), + }, + valid: false, + }, + "bad admin": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + Msg: []byte("{}"), + WASMByteCode: []byte("foo"), + Admin: badAddress, + }, + valid: false, + }, + "correct maximal": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + Msg: []byte(`{"some": "data"}`), + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(200)}}, + WASMByteCode: []byte("foo"), + InstantiatePermission: &AllowEverybody, + UnpinCode: true, + Admin: goodAddress, + Source: "http://source.com", + Builder: "builder", + CodeHash: []byte("{}"), + }, + valid: true, + }, + "invalid source": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + Msg: []byte("{}"), + WASMByteCode: []byte("foo"), + Admin: goodAddress, + Source: "source", + }, + valid: false, + }, + "empty builder": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + Msg: []byte("{}"), + WASMByteCode: []byte("foo"), + Admin: goodAddress, + Source: "http://source.com", + }, + valid: false, + }, + "empty code hash": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + Msg: []byte("{}"), + WASMByteCode: []byte("foo"), + Admin: goodAddress, + Source: "http://source.com", + Builder: "builder", + }, + valid: false, + }, + "negative funds": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + Msg: []byte(`{"some": "data"}`), + // we cannot use sdk.NewCoin() constructors as they panic on creating invalid data (before we can test) + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(-200)}}, + WASMByteCode: []byte("foo"), + }, + valid: false, + }, + "non json init msg": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + Msg: []byte("invalid-json"), + WASMByteCode: []byte("foo"), + }, + valid: false, + }, + "empty init msg": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + Label: "foo", + WASMByteCode: []byte("foo"), + }, + valid: false, + }, + "invalid InstantiatePermission": { + msg: MsgStoreAndInstantiateContract{ + Authority: goodAddress, + WASMByteCode: []byte("foo"), + Label: "foo", + Msg: []byte(`{"some": "data"}`), + InstantiatePermission: &AccessConfig{Permission: AccessTypeOnlyAddress, Address: badAddress}, + }, + valid: false, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if tc.valid { + assert.NoError(t, err) + } else { + assert.Error(t, err) + } + }) + } +}