From 87e049dc6a38d4b6258be507f411189aa164893d Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Fri, 19 Mar 2021 11:12:15 +0100 Subject: [PATCH] Format protobuf definitions --- proto/cosmwasm/wasm/v1beta1/genesis.proto | 58 ++--- proto/cosmwasm/wasm/v1beta1/ibc.proto | 24 ++- proto/cosmwasm/wasm/v1beta1/proposal.proto | 164 +++++++------- proto/cosmwasm/wasm/v1beta1/query.proto | 235 ++++++++++++--------- proto/cosmwasm/wasm/v1beta1/tx.proto | 43 ++-- proto/cosmwasm/wasm/v1beta1/types.proto | 155 ++++++++------ 6 files changed, 380 insertions(+), 299 deletions(-) diff --git a/proto/cosmwasm/wasm/v1beta1/genesis.proto b/proto/cosmwasm/wasm/v1beta1/genesis.proto index 31c8729d78..c00fd066bc 100644 --- a/proto/cosmwasm/wasm/v1beta1/genesis.proto +++ b/proto/cosmwasm/wasm/v1beta1/genesis.proto @@ -9,42 +9,52 @@ option go_package = "github.com/CosmWasm/wasmd/x/wasm/types"; // GenesisState - genesis state of x/wasm message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated Code codes = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "codes,omitempty"]; - repeated Contract contracts = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "contracts,omitempty"]; - repeated Sequence sequences = 4 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "sequences,omitempty"]; - repeated GenMsgs gen_msgs = 5 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "gen_msgs,omitempty"]; + Params params = 1 [ (gogoproto.nullable) = false ]; + repeated Code codes = 2 + [ (gogoproto.nullable) = false, (gogoproto.jsontag) = "codes,omitempty" ]; + repeated Contract contracts = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "contracts,omitempty" + ]; + repeated Sequence sequences = 4 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "sequences,omitempty" + ]; + repeated GenMsgs gen_msgs = 5 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "gen_msgs,omitempty" + ]; - // GenMsgs define the messages that can be executed during genesis phase in order. - // The intention is to have more human readable data that is auditable. - message GenMsgs { - // sum is a single message - oneof sum { - MsgStoreCode store_code = 1; - MsgInstantiateContract instantiate_contract = 2; - MsgExecuteContract execute_contract = 3; - } + // GenMsgs define the messages that can be executed during genesis phase in + // order. The intention is to have more human readable data that is auditable. + message GenMsgs { + // sum is a single message + oneof sum { + MsgStoreCode store_code = 1; + MsgInstantiateContract instantiate_contract = 2; + MsgExecuteContract execute_contract = 3; } + } } // Code struct encompasses CodeInfo and CodeBytes message Code { - uint64 code_id = 1 [(gogoproto.customname) = "CodeID"]; - CodeInfo code_info = 2 [(gogoproto.nullable) = false]; - bytes code_bytes = 3; - // Pinned to wasmvm cache - bool pinned = 4; + uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; + CodeInfo code_info = 2 [ (gogoproto.nullable) = false ]; + bytes code_bytes = 3; + // Pinned to wasmvm cache + bool pinned = 4; } // Contract struct encompasses ContractAddress, ContractInfo, and ContractState message Contract { - string contract_address = 1; - ContractInfo contract_info = 2 [(gogoproto.nullable) = false]; - repeated Model contract_state = 3 [(gogoproto.nullable) = false]; + string contract_address = 1; + ContractInfo contract_info = 2 [ (gogoproto.nullable) = false ]; + repeated Model contract_state = 3 [ (gogoproto.nullable) = false ]; } // Sequence key and value of an id generation counter message Sequence { - bytes id_key = 1 [(gogoproto.customname) = "IDKey"]; - uint64 value = 2; + bytes id_key = 1 [ (gogoproto.customname) = "IDKey" ]; + uint64 value = 2; } \ No newline at end of file diff --git a/proto/cosmwasm/wasm/v1beta1/ibc.proto b/proto/cosmwasm/wasm/v1beta1/ibc.proto index 30aa45a92e..e0462c34b8 100644 --- a/proto/cosmwasm/wasm/v1beta1/ibc.proto +++ b/proto/cosmwasm/wasm/v1beta1/ibc.proto @@ -8,21 +8,23 @@ option (gogoproto.goproto_getters_all) = false; // MsgIBCSend message MsgIBCSend { - // the channel by which the packet will be sent - string channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""]; + // the channel by which the packet will be sent + string channel = 2 [ (gogoproto.moretags) = "yaml:\"source_channel\"" ]; - // Timeout height relative to the current block height. - // The timeout is disabled when set to 0. - uint64 timeout_height = 4 [(gogoproto.moretags) = "yaml:\"timeout_height\""]; - // Timeout timestamp (in nanoseconds) relative to the current block timestamp. - // The timeout is disabled when set to 0. - uint64 timeout_timestamp = 5 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; + // Timeout height relative to the current block height. + // The timeout is disabled when set to 0. + uint64 timeout_height = 4 + [ (gogoproto.moretags) = "yaml:\"timeout_height\"" ]; + // Timeout timestamp (in nanoseconds) relative to the current block timestamp. + // The timeout is disabled when set to 0. + uint64 timeout_timestamp = 5 + [ (gogoproto.moretags) = "yaml:\"timeout_timestamp\"" ]; - // data is the payload to transfer - bytes data = 6 [(gogoproto.casttype) = "encoding/json.RawMessage"]; + // data is the payload to transfer + bytes data = 6 [ (gogoproto.casttype) = "encoding/json.RawMessage" ]; } // MsgIBCCloseChannel port and channel need to be owned by the contract message MsgIBCCloseChannel { - string channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""]; + string channel = 2 [ (gogoproto.moretags) = "yaml:\"source_channel\"" ]; } diff --git a/proto/cosmwasm/wasm/v1beta1/proposal.proto b/proto/cosmwasm/wasm/v1beta1/proposal.proto index f636b266d2..88052c8273 100644 --- a/proto/cosmwasm/wasm/v1beta1/proposal.proto +++ b/proto/cosmwasm/wasm/v1beta1/proposal.proto @@ -12,102 +12,110 @@ option (gogoproto.equal_all) = true; // StoreCodeProposal gov proposal content type to submit WASM code to the system message StoreCodeProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; - // WASMByteCode can be raw or gzip compressed - bytes wasm_byte_code = 4 [(gogoproto.customname) = "WASMByteCode"]; - // Source is a valid absolute HTTPS URI to the contract's source code, optional - string source = 5; - // Builder is a valid docker image name with tag, optional - string builder = 6; - // InstantiatePermission to apply on contract creation, optional - AccessConfig instantiate_permission = 7; + // Title is a short summary + string title = 1; + // Description is a human readable text + string description = 2; + // RunAs is the address that is passed to the contract's environment as sender + string run_as = 3; + // WASMByteCode can be raw or gzip compressed + bytes wasm_byte_code = 4 [ (gogoproto.customname) = "WASMByteCode" ]; + // Source is a valid absolute HTTPS URI to the contract's source code, + // optional + string source = 5; + // Builder is a valid docker image name with tag, optional + string builder = 6; + // InstantiatePermission to apply on contract creation, optional + AccessConfig instantiate_permission = 7; } -// InstantiateContractProposal gov proposal content type to instantiate a contract. +// InstantiateContractProposal gov proposal content type to instantiate a +// contract. message InstantiateContractProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; - // Admin is an optional address that can execute migrations - string admin = 4; - // CodeID is the reference to the stored WASM code - uint64 code_id = 5 [(gogoproto.customname) = "CodeID"]; - // Label is optional metadata to be stored with a constract instance. - string label = 6; - // InitMsg json encoded message to be passed to the contract on instantiation - bytes init_msg = 7 [(gogoproto.casttype) = "encoding/json.RawMessage"]; - // Funds coins that are transferred to the contract on instantiation - repeated cosmos.base.v1beta1.Coin funds = 8 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + // Title is a short summary + string title = 1; + // Description is a human readable text + string description = 2; + // RunAs is the address that is passed to the contract's environment as sender + string run_as = 3; + // Admin is an optional address that can execute migrations + string admin = 4; + // CodeID is the reference to the stored WASM code + uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ]; + // Label is optional metadata to be stored with a constract instance. + string label = 6; + // InitMsg json encoded message to be passed to the contract on instantiation + bytes init_msg = 7 [ (gogoproto.casttype) = "encoding/json.RawMessage" ]; + // Funds coins that are transferred to the contract on instantiation + repeated cosmos.base.v1beta1.Coin funds = 8 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // MigrateContractProposal gov proposal content type to migrate a contract. message MigrateContractProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; - // Contract is the address of the smart contract - string contract = 4; - // CodeID references the new WASM code - uint64 code_id = 5 [(gogoproto.customname) = "CodeID"]; - // MigrateMsg json encoded message to be passed to the contract on migration - bytes migrate_msg = 6 [(gogoproto.casttype) = "encoding/json.RawMessage"]; + // Title is a short summary + string title = 1; + // Description is a human readable text + string description = 2; + // RunAs is the address that is passed to the contract's environment as sender + string run_as = 3; + // Contract is the address of the smart contract + string contract = 4; + // CodeID references the new WASM code + uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ]; + // MigrateMsg json encoded message to be passed to the contract on migration + bytes migrate_msg = 6 [ (gogoproto.casttype) = "encoding/json.RawMessage" ]; } // UpdateAdminProposal gov proposal content type to set an admin for a contract. message UpdateAdminProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // NewAdmin address to be set - string new_admin = 3 [(gogoproto.moretags) = "yaml:\"new_admin\""]; - // Contract is the address of the smart contract - string contract = 4; + // Title is a short summary + string title = 1; + // Description is a human readable text + string description = 2; + // NewAdmin address to be set + string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; + // Contract is the address of the smart contract + string contract = 4; } -// ClearAdminProposal gov proposal content type to clear the admin of a contract. +// ClearAdminProposal gov proposal content type to clear the admin of a +// contract. message ClearAdminProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // Contract is the address of the smart contract - string contract = 3; + // Title is a short summary + string title = 1; + // Description is a human readable text + string description = 2; + // Contract is the address of the smart contract + string contract = 3; } -// PinCodesProposal gov proposal content type to pin a set of code ids in the wasmvm cache. +// PinCodesProposal gov proposal content type to pin a set of code ids in the +// wasmvm cache. message PinCodesProposal { - // Title is a short summary - string title = 1 [(gogoproto.moretags) = "yaml:\"title\""]; - // Description is a human readable text - string description = 2 [(gogoproto.moretags) = "yaml:\"description\""]; - // CodeIDs references the new WASM codes - repeated uint64 code_ids = 3 [ - (gogoproto.customname) = "CodeIDs", - (gogoproto.moretags) = "yaml:\"code_ids\"" - ]; + // Title is a short summary + string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ]; + // Description is a human readable text + string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ]; + // CodeIDs references the new WASM codes + repeated uint64 code_ids = 3 [ + (gogoproto.customname) = "CodeIDs", + (gogoproto.moretags) = "yaml:\"code_ids\"" + ]; } -// UnpinCodesProposal gov proposal content type to unpin a set of code ids in the wasmvm cache. +// UnpinCodesProposal gov proposal content type to unpin a set of code ids in +// the wasmvm cache. message UnpinCodesProposal { - // Title is a short summary - string title = 1 [(gogoproto.moretags) = "yaml:\"title\""]; - // Description is a human readable text - string description = 2 [(gogoproto.moretags) = "yaml:\"description\""]; - // CodeIDs references the WASM codes - repeated uint64 code_ids = 3 [ - (gogoproto.customname) = "CodeIDs", - (gogoproto.moretags) = "yaml:\"code_ids\"" - ]; + // Title is a short summary + string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ]; + // Description is a human readable text + string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ]; + // CodeIDs references the WASM codes + repeated uint64 code_ids = 3 [ + (gogoproto.customname) = "CodeIDs", + (gogoproto.moretags) = "yaml:\"code_ids\"" + ]; } diff --git a/proto/cosmwasm/wasm/v1beta1/query.proto b/proto/cosmwasm/wasm/v1beta1/query.proto index 0ff06a20a3..1ddc871283 100644 --- a/proto/cosmwasm/wasm/v1beta1/query.proto +++ b/proto/cosmwasm/wasm/v1beta1/query.proto @@ -12,164 +12,195 @@ option (gogoproto.equal_all) = false; // Query provides defines the gRPC querier service service Query { - // ContractInfo gets the contract meta data - rpc ContractInfo (QueryContractInfoRequest) returns (QueryContractInfoResponse) { - option (google.api.http).get = "/wasm/v1beta1/contract/{address}"; - } - // ContractHistory gets the contract code history - rpc ContractHistory (QueryContractHistoryRequest) returns (QueryContractHistoryResponse) { - option (google.api.http).get = "/wasm/v1beta1/contract/{address}/history"; - } - // ContractsByCode lists all smart contracts for a code id - rpc ContractsByCode (QueryContractsByCodeRequest) returns (QueryContractsByCodeResponse) { - option (google.api.http).get = "/wasm/v1beta1/code/{code_id}/contracts"; - } - // AllContractState gets all raw store data for a single contract - rpc AllContractState (QueryAllContractStateRequest) returns (QueryAllContractStateResponse) { - option (google.api.http).get = "/wasm/v1beta1/contract/{address}/state"; - } - // RawContractState gets single key from the raw store data of a contract - rpc RawContractState (QueryRawContractStateRequest) returns (QueryRawContractStateResponse) { - option (google.api.http).get = "/wasm/v1beta1/contract/{address}/raw/{query_data}"; - } - // SmartContractState get smart query result from the contract - rpc SmartContractState (QuerySmartContractStateRequest) returns (QuerySmartContractStateResponse) { - option (google.api.http).get = "/wasm/v1beta1/contract/{address}/smart/{query_data}"; - } - // Code gets the binary code and metadata for a singe wasm code - rpc Code (QueryCodeRequest) returns (QueryCodeResponse) { - option (google.api.http).get = "/wasm/v1beta1/code/{code_id}"; - } - // Codes gets the metadata for all stored wasm codes - rpc Codes (QueryCodesRequest) returns (QueryCodesResponse) { - option (google.api.http).get = "/wasm/v1beta1/code"; - } -} - -// QueryContractInfoRequest is the request type for the Query/ContractInfo RPC method + // ContractInfo gets the contract meta data + rpc ContractInfo(QueryContractInfoRequest) + returns (QueryContractInfoResponse) { + option (google.api.http).get = "/wasm/v1beta1/contract/{address}"; + } + // ContractHistory gets the contract code history + rpc ContractHistory(QueryContractHistoryRequest) + returns (QueryContractHistoryResponse) { + option (google.api.http).get = "/wasm/v1beta1/contract/{address}/history"; + } + // ContractsByCode lists all smart contracts for a code id + rpc ContractsByCode(QueryContractsByCodeRequest) + returns (QueryContractsByCodeResponse) { + option (google.api.http).get = "/wasm/v1beta1/code/{code_id}/contracts"; + } + // AllContractState gets all raw store data for a single contract + rpc AllContractState(QueryAllContractStateRequest) + returns (QueryAllContractStateResponse) { + option (google.api.http).get = "/wasm/v1beta1/contract/{address}/state"; + } + // RawContractState gets single key from the raw store data of a contract + rpc RawContractState(QueryRawContractStateRequest) + returns (QueryRawContractStateResponse) { + option (google.api.http).get = + "/wasm/v1beta1/contract/{address}/raw/{query_data}"; + } + // SmartContractState get smart query result from the contract + rpc SmartContractState(QuerySmartContractStateRequest) + returns (QuerySmartContractStateResponse) { + option (google.api.http).get = + "/wasm/v1beta1/contract/{address}/smart/{query_data}"; + } + // Code gets the binary code and metadata for a singe wasm code + rpc Code(QueryCodeRequest) returns (QueryCodeResponse) { + option (google.api.http).get = "/wasm/v1beta1/code/{code_id}"; + } + // Codes gets the metadata for all stored wasm codes + rpc Codes(QueryCodesRequest) returns (QueryCodesResponse) { + option (google.api.http).get = "/wasm/v1beta1/code"; + } +} + +// QueryContractInfoRequest is the request type for the Query/ContractInfo RPC +// method message QueryContractInfoRequest { - // address is the address of the contract to query - string address = 1; + // address is the address of the contract to query + string address = 1; } -// QueryContractInfoResponse is the response type for the Query/ContractInfo RPC method +// QueryContractInfoResponse is the response type for the Query/ContractInfo RPC +// method message QueryContractInfoResponse { - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; - // address is the address of the contract - string address = 1; - ContractInfo contract_info = 2 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""]; + // address is the address of the contract + string address = 1; + ContractInfo contract_info = 2 + [ (gogoproto.embed) = true, (gogoproto.jsontag) = "" ]; } -// QueryContractHistoryRequest is the request type for the Query/ContractHistory RPC method +// QueryContractHistoryRequest is the request type for the Query/ContractHistory +// RPC method message QueryContractHistoryRequest { - // address is the address of the contract to query - string address = 1; - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; + // address is the address of the contract to query + string address = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryContractHistoryResponse is the response type for the Query/ContractHistory RPC method +// QueryContractHistoryResponse is the response type for the +// Query/ContractHistory RPC method message QueryContractHistoryResponse { - repeated ContractCodeHistoryEntry entries = 1 [(gogoproto.nullable) = false]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated ContractCodeHistoryEntry entries = 1 + [ (gogoproto.nullable) = false ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryContractsByCodeRequest is the request type for the Query/ContractsByCode RPC method +// QueryContractsByCodeRequest is the request type for the Query/ContractsByCode +// RPC method message QueryContractsByCodeRequest { - uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; + uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// ContractInfoWithAddress adds the address (key) to the ContractInfo representation +// ContractInfoWithAddress adds the address (key) to the ContractInfo +// representation message ContractInfoWithAddress { - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; - string address = 1; - ContractInfo contract_info = 2 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""]; + string address = 1; + ContractInfo contract_info = 2 + [ (gogoproto.embed) = true, (gogoproto.jsontag) = "" ]; } -// QueryContractsByCodeResponse is the response type for the Query/ContractsByCode RPC method +// QueryContractsByCodeResponse is the response type for the +// Query/ContractsByCode RPC method message QueryContractsByCodeResponse { - repeated ContractInfoWithAddress contract_infos = 1 [(gogoproto.nullable) = false]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated ContractInfoWithAddress contract_infos = 1 + [ (gogoproto.nullable) = false ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryAllContractStateRequest is the request type for the Query/AllContractState RPC method +// QueryAllContractStateRequest is the request type for the +// Query/AllContractState RPC method message QueryAllContractStateRequest { - // address is the address of the contract - string address = 1; - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; + // address is the address of the contract + string address = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryAllContractStateResponse is the response type for the Query/AllContractState RPC method +// QueryAllContractStateResponse is the response type for the +// Query/AllContractState RPC method message QueryAllContractStateResponse { - repeated Model models = 1 [(gogoproto.nullable) = false]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated Model models = 1 [ (gogoproto.nullable) = false ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryRawContractStateRequest is the request type for the Query/RawContractState RPC method +// QueryRawContractStateRequest is the request type for the +// Query/RawContractState RPC method message QueryRawContractStateRequest { - // address is the address of the contract - string address = 1; - bytes query_data = 2; + // address is the address of the contract + string address = 1; + bytes query_data = 2; } -// QueryRawContractStateResponse is the response type for the Query/RawContractState RPC method +// QueryRawContractStateResponse is the response type for the +// Query/RawContractState RPC method message QueryRawContractStateResponse { - // Data contains the raw store data - bytes data = 1; + // Data contains the raw store data + bytes data = 1; } -// QuerySmartContractStateRequest is the request type for the Query/SmartContractState RPC method +// QuerySmartContractStateRequest is the request type for the +// Query/SmartContractState RPC method message QuerySmartContractStateRequest { - // address is the address of the contract - string address = 1; - // QueryData contains the query data passed to the contract - bytes query_data = 2; + // address is the address of the contract + string address = 1; + // QueryData contains the query data passed to the contract + bytes query_data = 2; } -// QuerySmartContractStateResponse is the response type for the Query/SmartContractState RPC method +// QuerySmartContractStateResponse is the response type for the +// Query/SmartContractState RPC method message QuerySmartContractStateResponse { - // Data contains the json data returned from the smart contract - bytes data = 1 [(gogoproto.casttype) = "encoding/json.RawMessage"]; + // Data contains the json data returned from the smart contract + bytes data = 1 [ (gogoproto.casttype) = "encoding/json.RawMessage" ]; } // QueryCodeRequest is the request type for the Query/Code RPC method message QueryCodeRequest { - uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID + uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID } // CodeInfoResponse contains code meta data from CodeInfo message CodeInfoResponse { - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; - uint64 code_id = 1 [(gogoproto.customname) = "CodeID", (gogoproto.jsontag) = "id"]; // id for legacy support - string creator = 2; - bytes data_hash = 3 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"]; - string source = 4; - string builder = 5; + uint64 code_id = 1 [ + (gogoproto.customname) = "CodeID", + (gogoproto.jsontag) = "id" + ]; // id for legacy support + string creator = 2; + bytes data_hash = 3 + [ (gogoproto.casttype) = + "github.com/tendermint/tendermint/libs/bytes.HexBytes" ]; + string source = 4; + string builder = 5; } // QueryCodeResponse is the response type for the Query/Code RPC method message QueryCodeResponse { - option (gogoproto.equal) = true; - CodeInfoResponse code_info = 1 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""]; - bytes data = 2 [(gogoproto.jsontag) = "data"]; + option (gogoproto.equal) = true; + CodeInfoResponse code_info = 1 + [ (gogoproto.embed) = true, (gogoproto.jsontag) = "" ]; + bytes data = 2 [ (gogoproto.jsontag) = "data" ]; } // QueryCodesRequest is the request type for the Query/Codes RPC method message QueryCodesRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; } // QueryCodesResponse is the response type for the Query/Codes RPC method message QueryCodesResponse { - repeated CodeInfoResponse code_infos = 1 [(gogoproto.nullable) = false]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated CodeInfoResponse code_infos = 1 [ (gogoproto.nullable) = false ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/proto/cosmwasm/wasm/v1beta1/tx.proto b/proto/cosmwasm/wasm/v1beta1/tx.proto index e2eea0e8be..a7747ec11f 100644 --- a/proto/cosmwasm/wasm/v1beta1/tx.proto +++ b/proto/cosmwasm/wasm/v1beta1/tx.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package cosmwasm.wasm.v1beta1; - import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "cosmwasm/wasm/v1beta1/types.proto"; @@ -14,7 +13,8 @@ service Msg { // StoreCode to submit Wasm code to the system rpc StoreCode(MsgStoreCode) returns (MsgStoreCodeResponse); // Instantiate creates a new smart contract instance for the given code id. - rpc InstantiateContract(MsgInstantiateContract) returns (MsgInstantiateContractResponse); + rpc InstantiateContract(MsgInstantiateContract) + returns (MsgInstantiateContractResponse); // Execute submits the given message data to a smart contract rpc ExecuteContract(MsgExecuteContract) returns (MsgExecuteContractResponse); // Migrate runs a code upgrade/ downgrade for a smart contract @@ -30,34 +30,40 @@ message MsgStoreCode { // Sender is the that actor that signed the messages string sender = 1; // WASMByteCode can be raw or gzip compressed - bytes wasm_byte_code = 2 [(gogoproto.customname) = "WASMByteCode"]; - // Source is a valid absolute HTTPS URI to the contract's source code, optional + bytes wasm_byte_code = 2 [ (gogoproto.customname) = "WASMByteCode" ]; + // Source is a valid absolute HTTPS URI to the contract's source code, + // optional string source = 3; // Builder is a valid docker image name with tag, optional string builder = 4; - // InstantiatePermission access control to apply on contract creation, optional + // InstantiatePermission access control to apply on contract creation, + // optional AccessConfig instantiate_permission = 5; } // MsgStoreCodeResponse returns store result data. -message MsgStoreCodeResponse{ +message MsgStoreCodeResponse { // CodeID is the reference to the stored WASM code - uint64 code_id = 1 [(gogoproto.customname) = "CodeID"]; + uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; } -// MsgInstantiateContract create a new smart contract instance for the given code id. +// MsgInstantiateContract create a new smart contract instance for the given +// code id. message MsgInstantiateContract { // Sender is the that actor that signed the messages string sender = 1; // Admin is an optional address that can execute migrations string admin = 2; // CodeID is the reference to the stored WASM code - uint64 code_id = 3 [(gogoproto.customname) = "CodeID"]; + uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; // Label is optional metadata to be stored with a contract instance. string label = 4; // InitMsg json encoded message to be passed to the contract on instantiation - bytes init_msg = 5 [(gogoproto.casttype) = "encoding/json.RawMessage"]; + bytes init_msg = 5 [ (gogoproto.casttype) = "encoding/json.RawMessage" ]; // Funds coins that are transferred to the contract on instantiation - repeated cosmos.base.v1beta1.Coin funds = 6 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin funds = 6 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // MsgInstantiateContractResponse return instantiation result data message MsgInstantiateContractResponse { @@ -74,9 +80,12 @@ message MsgExecuteContract { // Contract is the address of the smart contract string contract = 2; // Msg json encoded message to be passed to the contract - bytes msg = 3 [(gogoproto.casttype) = "encoding/json.RawMessage"]; + bytes msg = 3 [ (gogoproto.casttype) = "encoding/json.RawMessage" ]; // Funds coins that are transferred to the contract on execution - repeated cosmos.base.v1beta1.Coin funds = 5 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin funds = 5 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // MsgExecuteContractResponse returns execution result data. @@ -92,9 +101,9 @@ message MsgMigrateContract { // Contract is the address of the smart contract string contract = 2; // CodeID references the new WASM code - uint64 code_id = 3 [(gogoproto.customname) = "CodeID"]; + uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; // MigrateMsg json encoded message to be passed to the contract on migration - bytes migrate_msg = 4 [(gogoproto.casttype) = "encoding/json.RawMessage"]; + bytes migrate_msg = 4 [ (gogoproto.casttype) = "encoding/json.RawMessage" ]; } // MsgMigrateContractResponse returns contract migration result data. @@ -115,7 +124,7 @@ message MsgUpdateAdmin { } // MsgUpdateAdminResponse returns empty data -message MsgUpdateAdminResponse{} +message MsgUpdateAdminResponse {} // MsgClearAdmin removes any admin stored for a smart contract message MsgClearAdmin { @@ -126,4 +135,4 @@ message MsgClearAdmin { } // MsgClearAdminResponse returns empty data -message MsgClearAdminResponse{} +message MsgClearAdminResponse {} diff --git a/proto/cosmwasm/wasm/v1beta1/types.proto b/proto/cosmwasm/wasm/v1beta1/types.proto index 64c538db1f..bf976ddcb8 100644 --- a/proto/cosmwasm/wasm/v1beta1/types.proto +++ b/proto/cosmwasm/wasm/v1beta1/types.proto @@ -9,107 +9,128 @@ option (gogoproto.equal_all) = true; // AccessType permission types enum AccessType { - option (gogoproto.goproto_enum_prefix) = false; - option (gogoproto.goproto_enum_stringer) = false; - // AccessTypeUnspecified placeholder for empty value - ACCESS_TYPE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "AccessTypeUnspecified"]; - // AccessTypeNobody forbidden - ACCESS_TYPE_NOBODY = 1 [(gogoproto.enumvalue_customname) = "AccessTypeNobody"]; - // AccessTypeOnlyAddress restricted to an address - ACCESS_TYPE_ONLY_ADDRESS = 2 [(gogoproto.enumvalue_customname) = "AccessTypeOnlyAddress"]; - // AccessTypeEverybody unrestricted - ACCESS_TYPE_EVERYBODY = 3 [(gogoproto.enumvalue_customname) = "AccessTypeEverybody"]; + option (gogoproto.goproto_enum_prefix) = false; + option (gogoproto.goproto_enum_stringer) = false; + // AccessTypeUnspecified placeholder for empty value + ACCESS_TYPE_UNSPECIFIED = 0 + [ (gogoproto.enumvalue_customname) = "AccessTypeUnspecified" ]; + // AccessTypeNobody forbidden + ACCESS_TYPE_NOBODY = 1 + [ (gogoproto.enumvalue_customname) = "AccessTypeNobody" ]; + // AccessTypeOnlyAddress restricted to an address + ACCESS_TYPE_ONLY_ADDRESS = 2 + [ (gogoproto.enumvalue_customname) = "AccessTypeOnlyAddress" ]; + // AccessTypeEverybody unrestricted + ACCESS_TYPE_EVERYBODY = 3 + [ (gogoproto.enumvalue_customname) = "AccessTypeEverybody" ]; } // AccessTypeParam message AccessTypeParam { - option (gogoproto.goproto_stringer) = true; - AccessType value = 1 [(gogoproto.moretags) = "yaml:\"value\""]; + option (gogoproto.goproto_stringer) = true; + AccessType value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; } // AccessConfig access control type. message AccessConfig { - option (gogoproto.goproto_stringer) = true; - AccessType permission = 1 [(gogoproto.moretags) = "yaml:\"permission\""]; - string address = 2 [(gogoproto.moretags) = "yaml:\"address\""]; + option (gogoproto.goproto_stringer) = true; + AccessType permission = 1 [ (gogoproto.moretags) = "yaml:\"permission\"" ]; + string address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; } // Params defines the set of wasm parameters. message Params { - option (gogoproto.goproto_stringer) = false; - AccessConfig code_upload_access = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"code_upload_access\""]; - AccessType instantiate_default_permission = 2 [(gogoproto.moretags) = "yaml:\"instantiate_default_permission\""]; - uint64 max_wasm_code_size = 3 [(gogoproto.moretags) = "yaml:\"max_wasm_code_size\""]; + option (gogoproto.goproto_stringer) = false; + AccessConfig code_upload_access = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"code_upload_access\"" + ]; + AccessType instantiate_default_permission = 2 + [ (gogoproto.moretags) = "yaml:\"instantiate_default_permission\"" ]; + uint64 max_wasm_code_size = 3 + [ (gogoproto.moretags) = "yaml:\"max_wasm_code_size\"" ]; } // CodeInfo is data for the uploaded contract WASM code message CodeInfo { - // CodeHash is the unique identifier created by wasmvm - bytes code_hash = 1; - // Creator address who initially stored the code - string creator = 2; - // Source is a valid absolute HTTPS URI to the contract's source code, optional - string source = 3; - // Builder is a valid docker image name with tag, optional - string builder = 4; - // InstantiateConfig access control to apply on contract creation, optional - AccessConfig instantiate_config = 5 [(gogoproto.nullable) = false]; + // CodeHash is the unique identifier created by wasmvm + bytes code_hash = 1; + // Creator address who initially stored the code + string creator = 2; + // Source is a valid absolute HTTPS URI to the contract's source code, + // optional + string source = 3; + // Builder is a valid docker image name with tag, optional + string builder = 4; + // InstantiateConfig access control to apply on contract creation, optional + AccessConfig instantiate_config = 5 [ (gogoproto.nullable) = false ]; } // ContractInfo stores a WASM contract instance message ContractInfo { - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; - // CodeID is the reference to the stored Wasm code - uint64 code_id = 1 [(gogoproto.customname) = "CodeID"]; - // Creator address who initially instantiated the contract - string creator = 2; - // Admin is an optional address that can execute migrations - string admin = 3; - // Label is optional metadata to be stored with a contract instance. - string label = 4; - // Created Tx position when the contract was instantiated. - // This data should kept internal and not be exposed via query results. Just use for sorting - AbsoluteTxPosition created = 5; - string ibc_port_id = 6 [(gogoproto.customname) = "IBCPortID"]; + // CodeID is the reference to the stored Wasm code + uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; + // Creator address who initially instantiated the contract + string creator = 2; + // Admin is an optional address that can execute migrations + string admin = 3; + // Label is optional metadata to be stored with a contract instance. + string label = 4; + // Created Tx position when the contract was instantiated. + // This data should kept internal and not be exposed via query results. Just + // use for sorting + AbsoluteTxPosition created = 5; + string ibc_port_id = 6 [ (gogoproto.customname) = "IBCPortID" ]; } // ContractCodeHistoryOperationType actions that caused a code change enum ContractCodeHistoryOperationType { - option (gogoproto.goproto_enum_prefix) = false; - // ContractCodeHistoryOperationTypeUnspecified placeholder for empty value - CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "ContractCodeHistoryOperationTypeUnspecified"]; - // ContractCodeHistoryOperationTypeInit on chain contract instantiation - CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT = 1 [(gogoproto.enumvalue_customname) = "ContractCodeHistoryOperationTypeInit"]; - // ContractCodeHistoryOperationTypeMigrate code migration - CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE = 2 [(gogoproto.enumvalue_customname) = "ContractCodeHistoryOperationTypeMigrate"]; - // ContractCodeHistoryOperationTypeGenesis based on genesis data - CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS = 3 [(gogoproto.enumvalue_customname) = "ContractCodeHistoryOperationTypeGenesis"]; + option (gogoproto.goproto_enum_prefix) = false; + // ContractCodeHistoryOperationTypeUnspecified placeholder for empty value + CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED = 0 + [ (gogoproto.enumvalue_customname) = + "ContractCodeHistoryOperationTypeUnspecified" ]; + // ContractCodeHistoryOperationTypeInit on chain contract instantiation + CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT = 1 + [ (gogoproto.enumvalue_customname) = + "ContractCodeHistoryOperationTypeInit" ]; + // ContractCodeHistoryOperationTypeMigrate code migration + CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE = 2 + [ (gogoproto.enumvalue_customname) = + "ContractCodeHistoryOperationTypeMigrate" ]; + // ContractCodeHistoryOperationTypeGenesis based on genesis data + CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS = 3 + [ (gogoproto.enumvalue_customname) = + "ContractCodeHistoryOperationTypeGenesis" ]; } // ContractCodeHistoryEntry metadata to a contract. message ContractCodeHistoryEntry { - ContractCodeHistoryOperationType operation = 1; - // CodeID is the reference to the stored WASM code - uint64 code_id = 2 [(gogoproto.customname) = "CodeID"]; - // Updated Tx position when the operation was executed. - AbsoluteTxPosition updated = 3; - bytes msg = 4 [(gogoproto.casttype) = "encoding/json.RawMessage"]; - + ContractCodeHistoryOperationType operation = 1; + // CodeID is the reference to the stored WASM code + uint64 code_id = 2 [ (gogoproto.customname) = "CodeID" ]; + // Updated Tx position when the operation was executed. + AbsoluteTxPosition updated = 3; + bytes msg = 4 [ (gogoproto.casttype) = "encoding/json.RawMessage" ]; } -// AbsoluteTxPosition is a unique transaction position that allows for global ordering of transactions. +// AbsoluteTxPosition is a unique transaction position that allows for global +// ordering of transactions. message AbsoluteTxPosition { - // BlockHeight is the block the contract was created at - uint64 block_height = 1; - // TxIndex is a monotonic counter within the block (actual transaction index, or gas consumed) - uint64 tx_index = 2; + // BlockHeight is the block the contract was created at + uint64 block_height = 1; + // TxIndex is a monotonic counter within the block (actual transaction index, + // or gas consumed) + uint64 tx_index = 2; } // Model is a struct that holds a KV pair message Model { - // hex-encode key to read it better (this is often ascii) - bytes key = 1 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"]; - // base64-encode raw value - bytes value = 2; + // hex-encode key to read it better (this is often ascii) + bytes key = 1 [ (gogoproto.casttype) = + "github.com/tendermint/tendermint/libs/bytes.HexBytes" ]; + // base64-encode raw value + bytes value = 2; }