From 02948d3c8d55d944e9b8ec90e63eb756f5ec5bec Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Tue, 10 Nov 2020 12:36:22 +0100 Subject: [PATCH] Add protobuf comments --- buf.yaml | 2 +- doc/proto.md | 198 +++++++++++++-------------- x/wasm/internal/types/genesis.pb.go | 2 +- x/wasm/internal/types/genesis.proto | 2 +- x/wasm/internal/types/msg.pb.go | 57 +++++--- x/wasm/internal/types/msg.proto | 28 +++- x/wasm/internal/types/params_test.go | 4 +- x/wasm/internal/types/proposal.pb.go | 59 +++++--- x/wasm/internal/types/proposal.proto | 23 +++- x/wasm/internal/types/query.pb.go | 37 ++++- x/wasm/internal/types/query.proto | 29 +++- x/wasm/internal/types/types.pb.go | 62 ++++++--- x/wasm/internal/types/types.proto | 30 +++- 13 files changed, 363 insertions(+), 170 deletions(-) diff --git a/buf.yaml b/buf.yaml index 97da997731..94866e9ab6 100644 --- a/buf.yaml +++ b/buf.yaml @@ -10,7 +10,7 @@ build: lint: use: - DEFAULT -# - COMMENTS + - COMMENTS - FILE_LOWER_SNAKE_CASE except: - UNARY_RPC diff --git a/doc/proto.md b/doc/proto.md index 8ca9f0f066..175a05e027 100644 --- a/doc/proto.md +++ b/doc/proto.md @@ -125,7 +125,7 @@ GenesisState - genesis state of x/wasm ### Sequence -Sequence id and value of a counter +Sequence key and value of an id generation counter | Field | Type | Label | Description | @@ -157,13 +157,13 @@ Sequence id and value of a counter ### MsgClearAdmin - +MsgClearAdmin removes any admin stored for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [bytes](#bytes) | | | -| contract | [bytes](#bytes) | | | +| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages | +| contract | [bytes](#bytes) | | Contract is the address of the smart contract | @@ -173,15 +173,15 @@ Sequence id and value of a counter ### MsgExecuteContract - +MsgExecuteContract submits the given message data to a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [bytes](#bytes) | | | -| contract | [bytes](#bytes) | | | -| msg | [bytes](#bytes) | | | -| sent_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages | +| contract | [bytes](#bytes) | | Contract is the address of the smart contract | +| msg | [bytes](#bytes) | | Msg json encoded message to be passed to the contract | +| sent_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | SentFunds coins that are transferred to the contract on execution | @@ -191,17 +191,17 @@ Sequence id and value of a counter ### MsgInstantiateContract - +MsgInstantiateContract create a new smart contract instance for the given code id. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [bytes](#bytes) | | | +| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages | | admin | [bytes](#bytes) | | Admin is an optional address that can execute migrations | -| code_id | [uint64](#uint64) | | | -| label | [string](#string) | | | -| init_msg | [bytes](#bytes) | | | -| init_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| label | [string](#string) | | Label is optional metadata to be stored with a contract instance. | +| init_msg | [bytes](#bytes) | | InitMsg json encoded message to be passed to the contract on instantiation | +| init_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | InitFunds coins that are transferred to the contract on instantiation | @@ -211,15 +211,15 @@ Sequence id and value of a counter ### MsgMigrateContract - +MsgMigrateContract runs a code upgrade/ downgrade for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [bytes](#bytes) | | | -| contract | [bytes](#bytes) | | | -| code_id | [uint64](#uint64) | | | -| migrate_msg | [bytes](#bytes) | | | +| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages | +| contract | [bytes](#bytes) | | Contract is the address of the smart contract | +| code_id | [uint64](#uint64) | | CodeID references the new WASM code | +| migrate_msg | [bytes](#bytes) | | MigrateMsg json encoded message to be passed to the contract on migration | @@ -229,16 +229,16 @@ Sequence id and value of a counter ### MsgStoreCode - +MsgStoreCode submit WASM code to the system | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [bytes](#bytes) | | | +| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages | | wasm_byte_code | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | | source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | | builder | [string](#string) | | Builder is a valid docker image name with tag, optional | -| instantiate_permission | [AccessConfig](#wasmd.x.wasmd.v1beta1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | +| instantiate_permission | [AccessConfig](#wasmd.x.wasmd.v1beta1.AccessConfig) | | InstantiatePermission access control to apply on contract creation, optional | @@ -248,14 +248,14 @@ Sequence id and value of a counter ### MsgUpdateAdmin - +MsgUpdateAdmin sets a new admin for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [bytes](#bytes) | | | -| new_admin | [bytes](#bytes) | | | -| contract | [bytes](#bytes) | | | +| sender | [bytes](#bytes) | | Sender is the that actor that signed the messages | +| new_admin | [bytes](#bytes) | | NewAdmin address to be set | +| contract | [bytes](#bytes) | | Contract is the address of the smart contract | @@ -286,9 +286,9 @@ ClearAdminProposal gov proposal content type to clear the admin of a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | | -| description | [string](#string) | | | -| contract | [bytes](#bytes) | | | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | +| contract | [bytes](#bytes) | | Contract is the address of the smart contract | @@ -303,14 +303,14 @@ InstantiateContractProposal gov proposal content type to instantiate a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | | -| description | [string](#string) | | | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | | run_as | [bytes](#bytes) | | RunAs is the address that is passed to the contract's environment as sender | | admin | [bytes](#bytes) | | Admin is an optional address that can execute migrations | -| code_id | [uint64](#uint64) | | | -| label | [string](#string) | | | -| init_msg | [bytes](#bytes) | | | -| init_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| label | [string](#string) | | Label is optional metadata to be stored with a constract instance. | +| init_msg | [bytes](#bytes) | | InitMsg json encoded message to be passed to the contract on instantiation | +| init_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | InitFunds coins that are transferred to the contract on instantiation | @@ -325,12 +325,12 @@ MigrateContractProposal gov proposal content type to migrate a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | | -| description | [string](#string) | | | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | | run_as | [bytes](#bytes) | | RunAs is the address that is passed to the contract's environment as sender | -| contract | [bytes](#bytes) | | | -| code_id | [uint64](#uint64) | | | -| migrate_msg | [bytes](#bytes) | | | +| contract | [bytes](#bytes) | | Contract is the address of the smart contract | +| code_id | [uint64](#uint64) | | CodeID references the new WASM code | +| migrate_msg | [bytes](#bytes) | | MigrateMsg json encoded message to be passed to the contract on migration | @@ -340,13 +340,13 @@ MigrateContractProposal gov proposal content type to migrate a contract. ### StoreCodeProposal - +StoreCodeProposal gov proposal content type to submit WASM code to the system | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | | -| description | [string](#string) | | | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | | run_as | [bytes](#bytes) | | RunAs is the address that is passed to the contract's environment as sender | | wasm_byte_code | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | | source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | @@ -366,10 +366,10 @@ UpdateAdminProposal gov proposal content type to set an admin for a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | | -| description | [string](#string) | | | -| new_admin | [bytes](#bytes) | | | -| contract | [bytes](#bytes) | | | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | +| new_admin | [bytes](#bytes) | | NewAdmin address to be set | +| contract | [bytes](#bytes) | | Contract is the address of the smart contract | @@ -395,7 +395,7 @@ UpdateAdminProposal gov proposal content type to set an admin for a contract. ### CodeInfoResponse - +CodeInfoResponse contains code meta data from CodeInfo | Field | Type | Label | Description | @@ -430,7 +430,7 @@ ContractInfoWithAddress adds the address (key) to the ContractInfo representatio ### QueryAllContractStateRequest - +QueryAllContractStateRequest is the request type for the Query/AllContractState RPC method | Field | Type | Label | Description | @@ -445,7 +445,7 @@ ContractInfoWithAddress adds the address (key) to the ContractInfo representatio ### QueryAllContractStateResponse - +QueryAllContractStateResponse is the response type for the Query/AllContractState RPC method | Field | Type | Label | Description | @@ -460,7 +460,7 @@ ContractInfoWithAddress adds the address (key) to the ContractInfo representatio ### QueryCodeRequest - +QueryCodeRequest is the request type for the Query/Code RPC method | Field | Type | Label | Description | @@ -475,7 +475,7 @@ ContractInfoWithAddress adds the address (key) to the ContractInfo representatio ### QueryCodeResponse - +QueryCodeResponse is the response type for the Query/Code RPC method | Field | Type | Label | Description | @@ -491,7 +491,7 @@ ContractInfoWithAddress adds the address (key) to the ContractInfo representatio ### QueryCodesResponse - +QueryCodesResponse is the response type for the Query/Codes RPC method | Field | Type | Label | Description | @@ -506,7 +506,7 @@ ContractInfoWithAddress adds the address (key) to the ContractInfo representatio ### QueryContractHistoryRequest - +QueryContractHistoryRequest is the request type for the Query/ContractHistory RPC method | Field | Type | Label | Description | @@ -521,7 +521,7 @@ ContractInfoWithAddress adds the address (key) to the ContractInfo representatio ### QueryContractHistoryResponse - +QueryContractHistoryResponse is the response type for the Query/ContractHistory RPC method | Field | Type | Label | Description | @@ -567,7 +567,7 @@ QueryContractInfoResponse is the response type for the Query/ContractInfo RPC me ### QueryContractsByCodeRequest - +QueryContractsByCodeRequest is the request type for the Query/ContractsByCode RPC method | Field | Type | Label | Description | @@ -582,7 +582,7 @@ QueryContractInfoResponse is the response type for the Query/ContractInfo RPC me ### QueryContractsByCodeResponse - +QueryContractsByCodeResponse is the response type for the Query/ContractsByCode RPC method | Field | Type | Label | Description | @@ -597,7 +597,7 @@ QueryContractInfoResponse is the response type for the Query/ContractInfo RPC me ### QueryRawContractStateRequest - +QueryRawContractStateRequest is the request type for the Query/RawContractState RPC method | Field | Type | Label | Description | @@ -613,12 +613,12 @@ QueryContractInfoResponse is the response type for the Query/ContractInfo RPC me ### QueryRawContractStateResponse - +QueryRawContractStateResponse is the response type for the Query/RawContractState RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| data | [bytes](#bytes) | | | +| data | [bytes](#bytes) | | Data contains the raw store data | @@ -628,13 +628,13 @@ QueryContractInfoResponse is the response type for the Query/ContractInfo RPC me ### QuerySmartContractStateRequest - +QuerySmartContractStateRequest is the request type for the Query/SmartContractState RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | address | [bytes](#bytes) | | address is the address of the contract | -| query_data | [bytes](#bytes) | | | +| query_data | [bytes](#bytes) | | QueryData contains the query data passed to the contract | @@ -644,12 +644,12 @@ QueryContractInfoResponse is the response type for the Query/ContractInfo RPC me ### QuerySmartContractStateResponse - +QuerySmartContractStateResponse is the response type for the Query/SmartContractState RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| data | [bytes](#bytes) | | | +| data | [bytes](#bytes) | | Data contains the json data returned from the smart contract | @@ -669,14 +669,14 @@ Query provides defines the gRPC querier service | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| -| ContractInfo | [QueryContractInfoRequest](#wasmd.x.wasmd.v1beta1.QueryContractInfoRequest) | [QueryContractInfoResponse](#wasmd.x.wasmd.v1beta1.QueryContractInfoResponse) | | -| ContractHistory | [QueryContractHistoryRequest](#wasmd.x.wasmd.v1beta1.QueryContractHistoryRequest) | [QueryContractHistoryResponse](#wasmd.x.wasmd.v1beta1.QueryContractHistoryResponse) | | -| ContractsByCode | [QueryContractsByCodeRequest](#wasmd.x.wasmd.v1beta1.QueryContractsByCodeRequest) | [QueryContractsByCodeResponse](#wasmd.x.wasmd.v1beta1.QueryContractsByCodeResponse) | | -| AllContractState | [QueryAllContractStateRequest](#wasmd.x.wasmd.v1beta1.QueryAllContractStateRequest) | [QueryAllContractStateResponse](#wasmd.x.wasmd.v1beta1.QueryAllContractStateResponse) | | -| RawContractState | [QueryRawContractStateRequest](#wasmd.x.wasmd.v1beta1.QueryRawContractStateRequest) | [QueryRawContractStateResponse](#wasmd.x.wasmd.v1beta1.QueryRawContractStateResponse) | | -| SmartContractState | [QuerySmartContractStateRequest](#wasmd.x.wasmd.v1beta1.QuerySmartContractStateRequest) | [QuerySmartContractStateResponse](#wasmd.x.wasmd.v1beta1.QuerySmartContractStateResponse) | | -| Code | [QueryCodeRequest](#wasmd.x.wasmd.v1beta1.QueryCodeRequest) | [QueryCodeResponse](#wasmd.x.wasmd.v1beta1.QueryCodeResponse) | | -| Codes | [.google.protobuf.Empty](#google.protobuf.Empty) | [QueryCodesResponse](#wasmd.x.wasmd.v1beta1.QueryCodesResponse) | | +| ContractInfo | [QueryContractInfoRequest](#wasmd.x.wasmd.v1beta1.QueryContractInfoRequest) | [QueryContractInfoResponse](#wasmd.x.wasmd.v1beta1.QueryContractInfoResponse) | ContractInfo gets the contract meta data | +| ContractHistory | [QueryContractHistoryRequest](#wasmd.x.wasmd.v1beta1.QueryContractHistoryRequest) | [QueryContractHistoryResponse](#wasmd.x.wasmd.v1beta1.QueryContractHistoryResponse) | ContractHistory gets the contract code history | +| ContractsByCode | [QueryContractsByCodeRequest](#wasmd.x.wasmd.v1beta1.QueryContractsByCodeRequest) | [QueryContractsByCodeResponse](#wasmd.x.wasmd.v1beta1.QueryContractsByCodeResponse) | ContractsByCode lists all smart contracts for a code id | +| AllContractState | [QueryAllContractStateRequest](#wasmd.x.wasmd.v1beta1.QueryAllContractStateRequest) | [QueryAllContractStateResponse](#wasmd.x.wasmd.v1beta1.QueryAllContractStateResponse) | AllContractState gets all raw store data for a single contract | +| RawContractState | [QueryRawContractStateRequest](#wasmd.x.wasmd.v1beta1.QueryRawContractStateRequest) | [QueryRawContractStateResponse](#wasmd.x.wasmd.v1beta1.QueryRawContractStateResponse) | RawContractState gets single key from the raw store data of a contract | +| SmartContractState | [QuerySmartContractStateRequest](#wasmd.x.wasmd.v1beta1.QuerySmartContractStateRequest) | [QuerySmartContractStateResponse](#wasmd.x.wasmd.v1beta1.QuerySmartContractStateResponse) | SmartContractState get smart query result from the contract | +| Code | [QueryCodeRequest](#wasmd.x.wasmd.v1beta1.QueryCodeRequest) | [QueryCodeResponse](#wasmd.x.wasmd.v1beta1.QueryCodeResponse) | Code gets the binary code and metadata for a singe wasm code | +| Codes | [.google.protobuf.Empty](#google.protobuf.Empty) | [QueryCodesResponse](#wasmd.x.wasmd.v1beta1.QueryCodesResponse) | Codes gets the metadata for all stored wasm codes | @@ -708,7 +708,7 @@ AbsoluteTxPosition can be used to sort contracts ### AccessConfig - +AccessConfig access control type. | Field | Type | Label | Description | @@ -724,7 +724,7 @@ AbsoluteTxPosition can be used to sort contracts ### AccessTypeParam - +AccessTypeParam | Field | Type | Label | Description | @@ -744,11 +744,11 @@ CodeInfo is data for the uploaded contract WASM code | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| code_hash | [bytes](#bytes) | | | -| creator | [bytes](#bytes) | | | -| source | [string](#string) | | | -| builder | [string](#string) | | | -| instantiate_config | [AccessConfig](#wasmd.x.wasmd.v1beta1.AccessConfig) | | | +| code_hash | [bytes](#bytes) | | CodeHash is the unique CodeID | +| creator | [bytes](#bytes) | | Creator address who initially stored the code | +| source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | +| builder | [string](#string) | | Builder is a valid docker image name with tag, optional | +| instantiate_config | [AccessConfig](#wasmd.x.wasmd.v1beta1.AccessConfig) | | InstantiateConfig access control to apply on contract creation, optional | @@ -758,14 +758,14 @@ CodeInfo is data for the uploaded contract WASM code ### ContractCodeHistoryEntry -ContractCodeHistoryEntry stores code updates to a contract. +ContractCodeHistoryEntry metadata to a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | operation | [ContractCodeHistoryOperationType](#wasmd.x.wasmd.v1beta1.ContractCodeHistoryOperationType) | | | -| code_id | [uint64](#uint64) | | | -| updated | [AbsoluteTxPosition](#wasmd.x.wasmd.v1beta1.AbsoluteTxPosition) | | | +| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| updated | [AbsoluteTxPosition](#wasmd.x.wasmd.v1beta1.AbsoluteTxPosition) | | Updated Tx position when the operation was executed. | | msg | [bytes](#bytes) | | | @@ -776,7 +776,7 @@ ContractCodeHistoryEntry stores code updates to a contract. ### ContractHistory - +ContractHistory contains a sorted list of code updates to a contract | Field | Type | Label | Description | @@ -796,11 +796,11 @@ ContractInfo stores a WASM contract instance | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| code_id | [uint64](#uint64) | | | -| creator | [bytes](#bytes) | | | -| admin | [bytes](#bytes) | | | -| label | [string](#string) | | | -| created | [AbsoluteTxPosition](#wasmd.x.wasmd.v1beta1.AbsoluteTxPosition) | | never show this in query results, just use for sorting (Note: when using json tag "-" amino refused to serialize it...) | +| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| creator | [bytes](#bytes) | | Creator address who initially instantiated the contract | +| admin | [bytes](#bytes) | | Admin is an optional address that can execute migrations | +| label | [string](#string) | | Label is optional metadata to be stored with a contract instance. | +| created | [AbsoluteTxPosition](#wasmd.x.wasmd.v1beta1.AbsoluteTxPosition) | | Created Tx position when the contract was instantiated. This data should kept internal and not be exposed via query results. Just use for sorting | @@ -845,28 +845,28 @@ Params defines the set of wasm parameters. ### AccessType - +AccessType permission types | Name | Number | Description | | ---- | ------ | ----------- | -| ACCESS_TYPE_UNSPECIFIED | 0 | | -| ACCESS_TYPE_NOBODY | 1 | | -| ACCESS_TYPE_ONLY_ADDRESS | 2 | | -| ACCESS_TYPE_EVERYBODY | 3 | | +| ACCESS_TYPE_UNSPECIFIED | 0 | AccessTypeUnspecified placeholder for empty value | +| ACCESS_TYPE_NOBODY | 1 | AccessTypeNobody forbidden | +| ACCESS_TYPE_ONLY_ADDRESS | 2 | AccessTypeOnlyAddress restricted to an address | +| ACCESS_TYPE_EVERYBODY | 3 | AccessTypeEverybody unrestricted | ### ContractCodeHistoryOperationType - +ContractCodeHistoryOperationType actions that caused a code change | Name | Number | Description | | ---- | ------ | ----------- | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED | 0 | | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT | 1 | | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE | 2 | | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS | 3 | | +| CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED | 0 | ContractCodeHistoryOperationTypeUnspecified placeholder for empty value | +| CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT | 1 | ContractCodeHistoryOperationTypeInit on chain contract instantiation | +| CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE | 2 | ContractCodeHistoryOperationTypeMigrate code migration | +| CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS | 3 | ContractCodeHistoryOperationTypeGenesis based on genesis data | diff --git a/x/wasm/internal/types/genesis.pb.go b/x/wasm/internal/types/genesis.pb.go index ac67c197bb..2eaf406ed6 100644 --- a/x/wasm/internal/types/genesis.pb.go +++ b/x/wasm/internal/types/genesis.pb.go @@ -215,7 +215,7 @@ func (m *Contract) GetContractState() []Model { return nil } -// Sequence id and value of a counter +// Sequence key and value of an id generation counter type Sequence struct { IDKey []byte `protobuf:"bytes,1,opt,name=id_key,json=idKey,proto3" json:"id_key,omitempty"` Value uint64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` diff --git a/x/wasm/internal/types/genesis.proto b/x/wasm/internal/types/genesis.proto index cf5529b28d..711a7fab4a 100644 --- a/x/wasm/internal/types/genesis.proto +++ b/x/wasm/internal/types/genesis.proto @@ -28,7 +28,7 @@ message Contract { repeated Model contract_state = 3 [(gogoproto.nullable) = false]; } -// Sequence id and value of a counter +// Sequence key and value of an id generation counter message Sequence { bytes id_key = 1 [(gogoproto.customname) = "IDKey"]; uint64 value = 2; diff --git a/x/wasm/internal/types/msg.pb.go b/x/wasm/internal/types/msg.pb.go index e39f7ae21c..5ea86c6f19 100644 --- a/x/wasm/internal/types/msg.pb.go +++ b/x/wasm/internal/types/msg.pb.go @@ -26,7 +26,9 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgStoreCode submit WASM code to the system type MsgStoreCode struct { + // Sender is the that actor that signed the messages Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` // WASMByteCode can be raw or gzip compressed WASMByteCode []byte `protobuf:"bytes,2,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"` @@ -34,7 +36,7 @@ type MsgStoreCode struct { Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"` // Builder is a valid docker image name with tag, optional Builder string `protobuf:"bytes,4,opt,name=builder,proto3" json:"builder,omitempty"` - // InstantiatePermission to apply on contract creation, optional + // InstantiatePermission access control to apply on contract creation, optional InstantiatePermission *AccessConfig `protobuf:"bytes,5,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission,omitempty"` } @@ -71,14 +73,20 @@ func (m *MsgStoreCode) XXX_DiscardUnknown() { var xxx_messageInfo_MsgStoreCode proto.InternalMessageInfo +// MsgInstantiateContract create a new smart contract instance for the given code id. type MsgInstantiateContract struct { + // Sender is the that actor that signed the messages Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` // Admin is an optional address that can execute migrations - Admin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=admin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"admin,omitempty"` - CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` - Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` - InitMsg encoding_json.RawMessage `protobuf:"bytes,5,opt,name=init_msg,json=initMsg,proto3,casttype=encoding/json.RawMessage" json:"init_msg,omitempty"` - InitFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=init_funds,json=initFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"init_funds"` + Admin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=admin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"admin,omitempty"` + // CodeID is the reference to the stored WASM code + CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // Label is optional metadata to be stored with a contract instance. + Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` + // InitMsg json encoded message to be passed to the contract on instantiation + InitMsg encoding_json.RawMessage `protobuf:"bytes,5,opt,name=init_msg,json=initMsg,proto3,casttype=encoding/json.RawMessage" json:"init_msg,omitempty"` + // InitFunds coins that are transferred to the contract on instantiation + InitFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=init_funds,json=initFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"init_funds"` } func (m *MsgInstantiateContract) Reset() { *m = MsgInstantiateContract{} } @@ -114,11 +122,16 @@ func (m *MsgInstantiateContract) XXX_DiscardUnknown() { var xxx_messageInfo_MsgInstantiateContract proto.InternalMessageInfo +// MsgExecuteContract submits the given message data to a smart contract type MsgExecuteContract struct { - Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` - Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` - Msg encoding_json.RawMessage `protobuf:"bytes,3,opt,name=msg,proto3,casttype=encoding/json.RawMessage" json:"msg,omitempty"` - SentFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=sent_funds,json=sentFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"sent_funds"` + // Sender is the that actor that signed the messages + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` + // Contract is the address of the smart contract + Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` + // Msg json encoded message to be passed to the contract + Msg encoding_json.RawMessage `protobuf:"bytes,3,opt,name=msg,proto3,casttype=encoding/json.RawMessage" json:"msg,omitempty"` + // SentFunds coins that are transferred to the contract on execution + SentFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=sent_funds,json=sentFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"sent_funds"` } func (m *MsgExecuteContract) Reset() { *m = MsgExecuteContract{} } @@ -154,11 +167,16 @@ func (m *MsgExecuteContract) XXX_DiscardUnknown() { var xxx_messageInfo_MsgExecuteContract proto.InternalMessageInfo +// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract type MsgMigrateContract struct { - Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` - Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` - CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` - MigrateMsg encoding_json.RawMessage `protobuf:"bytes,4,opt,name=migrate_msg,json=migrateMsg,proto3,casttype=encoding/json.RawMessage" json:"migrate_msg,omitempty"` + // Sender is the that actor that signed the messages + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` + // Contract is the address of the smart contract + Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` + // CodeID references the new WASM code + CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // MigrateMsg json encoded message to be passed to the contract on migration + MigrateMsg encoding_json.RawMessage `protobuf:"bytes,4,opt,name=migrate_msg,json=migrateMsg,proto3,casttype=encoding/json.RawMessage" json:"migrate_msg,omitempty"` } func (m *MsgMigrateContract) Reset() { *m = MsgMigrateContract{} } @@ -194,9 +212,13 @@ func (m *MsgMigrateContract) XXX_DiscardUnknown() { var xxx_messageInfo_MsgMigrateContract proto.InternalMessageInfo +// MsgUpdateAdmin sets a new admin for a smart contract type MsgUpdateAdmin struct { - Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` + // Sender is the that actor that signed the messages + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` + // NewAdmin address to be set NewAdmin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=new_admin,json=newAdmin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"new_admin,omitempty"` + // Contract is the address of the smart contract Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` } @@ -233,8 +255,11 @@ func (m *MsgUpdateAdmin) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateAdmin proto.InternalMessageInfo +// MsgClearAdmin removes any admin stored for a smart contract type MsgClearAdmin struct { - Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` + // Sender is the that actor that signed the messages + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` + // Contract is the address of the smart contract Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` } diff --git a/x/wasm/internal/types/msg.proto b/x/wasm/internal/types/msg.proto index 87f994eacf..cd4b6960e6 100644 --- a/x/wasm/internal/types/msg.proto +++ b/x/wasm/internal/types/msg.proto @@ -10,7 +10,9 @@ option go_package = "github.com/CosmWasm/wasmd/x/wasmd/internal/types"; option (gogoproto.goproto_getters_all) = false; +// MsgStoreCode submit WASM code to the system message MsgStoreCode { + // Sender is the that actor that signed the messages bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; // WASMByteCode can be raw or gzip compressed bytes wasm_byte_code = 2 [(gogoproto.customname) = "WASMByteCode"]; @@ -18,41 +20,65 @@ message MsgStoreCode { string source = 3; // Builder is a valid docker image name with tag, optional string builder = 4; - // InstantiatePermission to apply on contract creation, optional + // InstantiatePermission access control to apply on contract creation, optional AccessConfig instantiate_permission = 5; } +// MsgInstantiateContract create a new smart contract instance for the given code id. message MsgInstantiateContract { + // Sender is the that actor that signed the messages bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; // Admin is an optional address that can execute migrations bytes admin = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // CodeID is the reference to the stored WASM code 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"]; + // InitFunds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin init_funds = 6 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } +// MsgExecuteContract submits the given message data to a smart contract message MsgExecuteContract { + // Sender is the that actor that signed the messages bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // Contract is the address of the smart contract bytes contract = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // Msg json encoded message to be passed to the contract bytes msg = 3 [(gogoproto.casttype) = "encoding/json.RawMessage"]; + // SentFunds coins that are transferred to the contract on execution repeated cosmos.base.v1beta1.Coin sent_funds = 5 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } +// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract message MsgMigrateContract { + // Sender is the that actor that signed the messages bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // Contract is the address of the smart contract bytes contract = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // CodeID references the new WASM code 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"]; } +// MsgUpdateAdmin sets a new admin for a smart contract message MsgUpdateAdmin { + // Sender is the that actor that signed the messages bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // NewAdmin address to be set bytes new_admin = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // Contract is the address of the smart contract bytes contract = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } + +// MsgClearAdmin removes any admin stored for a smart contract message MsgClearAdmin { + // Sender is the that actor that signed the messages bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // Contract is the address of the smart contract bytes contract = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } diff --git a/x/wasm/internal/types/params_test.go b/x/wasm/internal/types/params_test.go index abbe8b2cd1..56cd92691e 100644 --- a/x/wasm/internal/types/params_test.go +++ b/x/wasm/internal/types/params_test.go @@ -124,7 +124,7 @@ func TestAccessTypeMarshalJson(t *testing.T) { src AccessType exp string }{ - "Unspecified": {src: AccessTypeUnspecified, exp: `"Unspecified"`}, + "Unspecified": {src: AccessTypeUnspecified, exp: `"Unspecified"`}, "Nobody": {src: AccessTypeNobody, exp: `"Nobody"`}, "OnlyAddress": {src: AccessTypeOnlyAddress, exp: `"OnlyAddress"`}, "Everybody": {src: AccessTypeEverybody, exp: `"Everybody"`}, @@ -144,7 +144,7 @@ func TestAccessTypeUnmarshalJson(t *testing.T) { src string exp AccessType }{ - "Unspecified": {src: `"Unspecified"`, exp: AccessTypeUnspecified}, + "Unspecified": {src: `"Unspecified"`, exp: AccessTypeUnspecified}, "Nobody": {src: `"Nobody"`, exp: AccessTypeNobody}, "OnlyAddress": {src: `"OnlyAddress"`, exp: AccessTypeOnlyAddress}, "Everybody": {src: `"Everybody"`, exp: AccessTypeEverybody}, diff --git a/x/wasm/internal/types/proposal.pb.go b/x/wasm/internal/types/proposal.pb.go index abc83e0a12..dfd0496f3f 100644 --- a/x/wasm/internal/types/proposal.pb.go +++ b/x/wasm/internal/types/proposal.pb.go @@ -27,8 +27,11 @@ var _ = math.Inf // 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 type StoreCodeProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // Title is a short summary + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // Description is a human readable text Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // RunAs is the address that is passed to the contract's environment as sender RunAs github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"run_as,omitempty"` @@ -76,16 +79,22 @@ var xxx_messageInfo_StoreCodeProposal proto.InternalMessageInfo // InstantiateContractProposal gov proposal content type to instantiate a contract. type InstantiateContractProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // Title is a short summary + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // Description is a human readable text Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // RunAs is the address that is passed to the contract's environment as sender RunAs github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"run_as,omitempty"` // Admin is an optional address that can execute migrations - Admin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=admin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"admin,omitempty"` - CodeID uint64 `protobuf:"varint,5,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` - Label string `protobuf:"bytes,6,opt,name=label,proto3" json:"label,omitempty"` - InitMsg encoding_json.RawMessage `protobuf:"bytes,7,opt,name=init_msg,json=initMsg,proto3,casttype=encoding/json.RawMessage" json:"init_msg,omitempty"` - InitFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,8,rep,name=init_funds,json=initFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"init_funds"` + Admin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=admin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"admin,omitempty"` + // CodeID is the reference to the stored WASM code + CodeID uint64 `protobuf:"varint,5,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // Label is optional metadata to be stored with a constract instance. + Label string `protobuf:"bytes,6,opt,name=label,proto3" json:"label,omitempty"` + // InitMsg json encoded message to be passed to the contract on instantiation + InitMsg encoding_json.RawMessage `protobuf:"bytes,7,opt,name=init_msg,json=initMsg,proto3,casttype=encoding/json.RawMessage" json:"init_msg,omitempty"` + // InitFunds coins that are transferred to the contract on instantiation + InitFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,8,rep,name=init_funds,json=initFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"init_funds"` } func (m *InstantiateContractProposal) Reset() { *m = InstantiateContractProposal{} } @@ -122,13 +131,18 @@ var xxx_messageInfo_InstantiateContractProposal proto.InternalMessageInfo // MigrateContractProposal gov proposal content type to migrate a contract. type MigrateContractProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // Title is a short summary + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // Description is a human readable text Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // RunAs is the address that is passed to the contract's environment as sender - RunAs github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"run_as,omitempty"` - Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` - CodeID uint64 `protobuf:"varint,5,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` - MigrateMsg encoding_json.RawMessage `protobuf:"bytes,6,opt,name=migrate_msg,json=migrateMsg,proto3,casttype=encoding/json.RawMessage" json:"migrate_msg,omitempty"` + RunAs github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=run_as,json=runAs,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"run_as,omitempty"` + // Contract is the address of the smart contract + Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` + // CodeID references the new WASM code + CodeID uint64 `protobuf:"varint,5,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // MigrateMsg json encoded message to be passed to the contract on migration + MigrateMsg encoding_json.RawMessage `protobuf:"bytes,6,opt,name=migrate_msg,json=migrateMsg,proto3,casttype=encoding/json.RawMessage" json:"migrate_msg,omitempty"` } func (m *MigrateContractProposal) Reset() { *m = MigrateContractProposal{} } @@ -165,10 +179,14 @@ var xxx_messageInfo_MigrateContractProposal proto.InternalMessageInfo // UpdateAdminProposal gov proposal content type to set an admin for a contract. type UpdateAdminProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - NewAdmin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=new_admin,json=newAdmin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"new_admin,omitempty" yaml:"new_admin"` - Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` + // Title is a short summary + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // Description is a human readable text + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // NewAdmin address to be set + NewAdmin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=new_admin,json=newAdmin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"new_admin,omitempty" yaml:"new_admin"` + // Contract is the address of the smart contract + Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` } func (m *UpdateAdminProposal) Reset() { *m = UpdateAdminProposal{} } @@ -205,9 +223,12 @@ var xxx_messageInfo_UpdateAdminProposal proto.InternalMessageInfo // ClearAdminProposal gov proposal content type to clear the admin of a contract. type ClearAdminProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` + // Title is a short summary + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // Description is a human readable text + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // Contract is the address of the smart contract + Contract github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=contract,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"contract,omitempty"` } func (m *ClearAdminProposal) Reset() { *m = ClearAdminProposal{} } diff --git a/x/wasm/internal/types/proposal.proto b/x/wasm/internal/types/proposal.proto index eea5db0b31..24f5d9de27 100644 --- a/x/wasm/internal/types/proposal.proto +++ b/x/wasm/internal/types/proposal.proto @@ -10,8 +10,11 @@ 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 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 bytes run_as = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; @@ -27,42 +30,58 @@ message StoreCodeProposal { // 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 bytes run_as = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; // Admin is an optional address that can execute migrations bytes admin = 4 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // 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"]; + // InitFunds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin init_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 bytes run_as = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // Contract is the address of the smart contract bytes contract = 4 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // 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 bytes new_admin = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", (gogoproto.moretags) = "yaml:\"new_admin\""]; + // Contract is the address of the smart contract bytes contract = 4 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } // 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 bytes contract = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } diff --git a/x/wasm/internal/types/query.pb.go b/x/wasm/internal/types/query.pb.go index 12b34f2433..79935c7a80 100644 --- a/x/wasm/internal/types/query.pb.go +++ b/x/wasm/internal/types/query.pb.go @@ -113,6 +113,7 @@ func (m *QueryContractInfoResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryContractInfoResponse proto.InternalMessageInfo +// QueryContractHistoryRequest is the request type for the Query/ContractHistory RPC method type QueryContractHistoryRequest struct { // address is the address of the contract to query Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` @@ -151,6 +152,7 @@ func (m *QueryContractHistoryRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryContractHistoryRequest proto.InternalMessageInfo +// QueryContractHistoryResponse is the response type for the Query/ContractHistory RPC method type QueryContractHistoryResponse struct { Entries []ContractCodeHistoryEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries"` } @@ -188,6 +190,7 @@ func (m *QueryContractHistoryResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryContractHistoryResponse proto.InternalMessageInfo +// QueryContractsByCodeRequest is the request type for the Query/ContractsByCode RPC method type QueryContractsByCodeRequest struct { CodeId uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` } @@ -264,6 +267,7 @@ func (m *ContractInfoWithAddress) XXX_DiscardUnknown() { var xxx_messageInfo_ContractInfoWithAddress proto.InternalMessageInfo +// QueryContractsByCodeResponse is the response type for the Query/ContractsByCode RPC method type QueryContractsByCodeResponse struct { ContractInfos []ContractInfoWithAddress `protobuf:"bytes,1,rep,name=contract_infos,json=contractInfos,proto3" json:"contract_infos"` } @@ -301,6 +305,7 @@ func (m *QueryContractsByCodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryContractsByCodeResponse proto.InternalMessageInfo +// QueryAllContractStateRequest is the request type for the Query/AllContractState RPC method type QueryAllContractStateRequest struct { // address is the address of the contract Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` @@ -339,6 +344,7 @@ func (m *QueryAllContractStateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllContractStateRequest proto.InternalMessageInfo +// QueryAllContractStateResponse is the response type for the Query/AllContractState RPC method type QueryAllContractStateResponse struct { Models []Model `protobuf:"bytes,1,rep,name=models,proto3" json:"models"` } @@ -376,6 +382,7 @@ func (m *QueryAllContractStateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllContractStateResponse proto.InternalMessageInfo +// QueryRawContractStateRequest is the request type for the Query/RawContractState RPC method type QueryRawContractStateRequest struct { // address is the address of the contract Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` @@ -415,7 +422,9 @@ func (m *QueryRawContractStateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryRawContractStateRequest proto.InternalMessageInfo +// QueryRawContractStateResponse is the response type for the Query/RawContractState RPC method type QueryRawContractStateResponse struct { + // Data contains the raw store data Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` } @@ -452,10 +461,12 @@ func (m *QueryRawContractStateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryRawContractStateResponse proto.InternalMessageInfo +// QuerySmartContractStateRequest is the request type for the Query/SmartContractState RPC method type QuerySmartContractStateRequest struct { // address is the address of the contract - Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` - QueryData []byte `protobuf:"bytes,2,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"` + Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` + // QueryData contains the query data passed to the contract + QueryData []byte `protobuf:"bytes,2,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"` } func (m *QuerySmartContractStateRequest) Reset() { *m = QuerySmartContractStateRequest{} } @@ -491,7 +502,9 @@ func (m *QuerySmartContractStateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySmartContractStateRequest proto.InternalMessageInfo +// QuerySmartContractStateResponse is the response type for the Query/SmartContractState RPC method type QuerySmartContractStateResponse struct { + // Data contains the json data returned from the smart contract Data encoding_json.RawMessage `protobuf:"bytes,1,opt,name=data,proto3,casttype=encoding/json.RawMessage" json:"data,omitempty"` } @@ -528,6 +541,7 @@ func (m *QuerySmartContractStateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySmartContractStateResponse proto.InternalMessageInfo +// QueryCodeRequest is the request type for the Query/Code RPC method type QueryCodeRequest struct { CodeId uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` } @@ -565,6 +579,7 @@ func (m *QueryCodeRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryCodeRequest proto.InternalMessageInfo +// CodeInfoResponse contains code meta data from CodeInfo type CodeInfoResponse struct { CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"id"` Creator github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=creator,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"creator,omitempty"` @@ -606,6 +621,7 @@ func (m *CodeInfoResponse) XXX_DiscardUnknown() { var xxx_messageInfo_CodeInfoResponse proto.InternalMessageInfo +// QueryCodeResponse is the response type for the Query/Code RPC method type QueryCodeResponse struct { *CodeInfoResponse `protobuf:"bytes,1,opt,name=code_info,json=codeInfo,proto3,embedded=code_info" json:""` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data"` @@ -644,6 +660,7 @@ func (m *QueryCodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryCodeResponse proto.InternalMessageInfo +// QueryCodesResponse is the response type for the Query/Codes RPC method type QueryCodesResponse struct { CodeInfos []CodeInfoResponse `protobuf:"bytes,1,rep,name=code_infos,json=codeInfos,proto3" json:"code_infos"` } @@ -1243,13 +1260,21 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // ContractInfo gets the contract meta data ContractInfo(ctx context.Context, in *QueryContractInfoRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error) + // ContractHistory gets the contract code history ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) + // ContractsByCode lists all smart contracts for a code id ContractsByCode(ctx context.Context, in *QueryContractsByCodeRequest, opts ...grpc.CallOption) (*QueryContractsByCodeResponse, error) + // AllContractState gets all raw store data for a single contract AllContractState(ctx context.Context, in *QueryAllContractStateRequest, opts ...grpc.CallOption) (*QueryAllContractStateResponse, error) + // RawContractState gets single key from the raw store data of a contract RawContractState(ctx context.Context, in *QueryRawContractStateRequest, opts ...grpc.CallOption) (*QueryRawContractStateResponse, error) + // SmartContractState get smart query result from the contract SmartContractState(ctx context.Context, in *QuerySmartContractStateRequest, opts ...grpc.CallOption) (*QuerySmartContractStateResponse, error) + // Code gets the binary code and metadata for a singe wasm code Code(ctx context.Context, in *QueryCodeRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) + // Codes gets the metadata for all stored wasm codes Codes(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) } @@ -1335,13 +1360,21 @@ func (c *queryClient) Codes(ctx context.Context, in *types.Empty, opts ...grpc.C // QueryServer is the server API for Query service. type QueryServer interface { + // ContractInfo gets the contract meta data ContractInfo(context.Context, *QueryContractInfoRequest) (*QueryContractInfoResponse, error) + // ContractHistory gets the contract code history ContractHistory(context.Context, *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) + // ContractsByCode lists all smart contracts for a code id ContractsByCode(context.Context, *QueryContractsByCodeRequest) (*QueryContractsByCodeResponse, error) + // AllContractState gets all raw store data for a single contract AllContractState(context.Context, *QueryAllContractStateRequest) (*QueryAllContractStateResponse, error) + // RawContractState gets single key from the raw store data of a contract RawContractState(context.Context, *QueryRawContractStateRequest) (*QueryRawContractStateResponse, error) + // SmartContractState get smart query result from the contract SmartContractState(context.Context, *QuerySmartContractStateRequest) (*QuerySmartContractStateResponse, error) + // Code gets the binary code and metadata for a singe wasm code Code(context.Context, *QueryCodeRequest) (*QueryCodeResponse, error) + // Codes gets the metadata for all stored wasm codes Codes(context.Context, *types.Empty) (*QueryCodesResponse, error) } diff --git a/x/wasm/internal/types/query.proto b/x/wasm/internal/types/query.proto index ded7271434..63a6a14728 100644 --- a/x/wasm/internal/types/query.proto +++ b/x/wasm/internal/types/query.proto @@ -12,27 +12,35 @@ option (gogoproto.equal_all) = true; // 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 (google.protobuf.Empty) returns (QueryCodesResponse) { option (google.api.http).get = "/wasm/v1beta1/code"; } @@ -50,15 +58,17 @@ message QueryContractInfoResponse { ContractInfo contract_info = 2 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""]; } +// QueryContractHistoryRequest is the request type for the Query/ContractHistory RPC method message QueryContractHistoryRequest { // address is the address of the contract to query bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } +// QueryContractHistoryResponse is the response type for the Query/ContractHistory RPC method message QueryContractHistoryResponse { repeated ContractCodeHistoryEntry entries = 1 [(gogoproto.nullable) = false]; } - +// 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 } @@ -68,44 +78,53 @@ message ContractInfoWithAddress { bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; ContractInfo contract_info = 2 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""]; } - +// QueryContractsByCodeResponse is the response type for the Query/ContractsByCode RPC method message QueryContractsByCodeResponse { repeated ContractInfoWithAddress contract_infos = 1 [(gogoproto.nullable) = false]; } +// QueryAllContractStateRequest is the request type for the Query/AllContractState RPC method message QueryAllContractStateRequest { // address is the address of the contract bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } +// QueryAllContractStateResponse is the response type for the Query/AllContractState RPC method message QueryAllContractStateResponse { repeated Model models = 1 [(gogoproto.nullable) = false]; } +// QueryRawContractStateRequest is the request type for the Query/RawContractState RPC method message QueryRawContractStateRequest { // address is the address of the contract bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; bytes query_data = 2; } - +// QueryRawContractStateResponse is the response type for the Query/RawContractState RPC method message QueryRawContractStateResponse { + // Data contains the raw store data bytes data = 1; } +// QuerySmartContractStateRequest is the request type for the Query/SmartContractState RPC method message QuerySmartContractStateRequest { // address is the address of the contract bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // QueryData contains the query data passed to the contract bytes query_data = 2; } - +// 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"]; } +// 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 } +// CodeInfoResponse contains code meta data from CodeInfo message CodeInfoResponse { uint64 code_id = 1 [(gogoproto.customname) = "CodeID", (gogoproto.jsontag) = "id"]; // id for legacy support bytes creator = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; @@ -114,11 +133,13 @@ message CodeInfoResponse { string builder = 5; } +// QueryCodeResponse is the response type for the Query/Code RPC method message QueryCodeResponse { CodeInfoResponse code_info = 1 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""]; bytes data = 2 [(gogoproto.jsontag) = "data"]; } +// QueryCodesResponse is the response type for the Query/Codes RPC method message QueryCodesResponse { repeated CodeInfoResponse code_infos = 1 [(gogoproto.nullable) = false]; } diff --git a/x/wasm/internal/types/types.pb.go b/x/wasm/internal/types/types.pb.go index 6a4c8fbb20..6fa38d167f 100644 --- a/x/wasm/internal/types/types.pb.go +++ b/x/wasm/internal/types/types.pb.go @@ -27,13 +27,18 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// AccessType permission types type AccessType int32 const ( + // AccessTypeUnspecified placeholder for empty value AccessTypeUnspecified AccessType = 0 - AccessTypeNobody AccessType = 1 + // AccessTypeNobody forbidden + AccessTypeNobody AccessType = 1 + // AccessTypeOnlyAddress restricted to an address AccessTypeOnlyAddress AccessType = 2 - AccessTypeEverybody AccessType = 3 + // AccessTypeEverybody unrestricted + AccessTypeEverybody AccessType = 3 ) var AccessType_name = map[int32]string{ @@ -54,13 +59,18 @@ func (AccessType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_45de2b3fc8aff6aa, []int{0} } +// ContractCodeHistoryOperationType actions that caused a code change type ContractCodeHistoryOperationType int32 const ( + // ContractCodeHistoryOperationTypeUnspecified placeholder for empty value ContractCodeHistoryOperationTypeUnspecified ContractCodeHistoryOperationType = 0 - ContractCodeHistoryOperationTypeInit ContractCodeHistoryOperationType = 1 - ContractCodeHistoryOperationTypeMigrate ContractCodeHistoryOperationType = 2 - ContractCodeHistoryOperationTypeGenesis ContractCodeHistoryOperationType = 3 + // ContractCodeHistoryOperationTypeInit on chain contract instantiation + ContractCodeHistoryOperationTypeInit ContractCodeHistoryOperationType = 1 + // ContractCodeHistoryOperationTypeMigrate code migration + ContractCodeHistoryOperationTypeMigrate ContractCodeHistoryOperationType = 2 + // ContractCodeHistoryOperationTypeGenesis based on genesis data + ContractCodeHistoryOperationTypeGenesis ContractCodeHistoryOperationType = 3 ) var ContractCodeHistoryOperationType_name = map[int32]string{ @@ -85,6 +95,7 @@ func (ContractCodeHistoryOperationType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_45de2b3fc8aff6aa, []int{1} } +// AccessTypeParam type AccessTypeParam struct { Value AccessType `protobuf:"varint,1,opt,name=value,proto3,enum=wasmd.x.wasmd.v1beta1.AccessType" json:"value,omitempty" yaml:"value"` } @@ -122,6 +133,7 @@ func (m *AccessTypeParam) XXX_DiscardUnknown() { var xxx_messageInfo_AccessTypeParam proto.InternalMessageInfo +// AccessConfig access control type. type AccessConfig struct { Permission AccessType `protobuf:"varint,1,opt,name=permission,proto3,enum=wasmd.x.wasmd.v1beta1.AccessType" json:"permission,omitempty" yaml:"permission"` Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty" yaml:"address"` @@ -201,11 +213,16 @@ var xxx_messageInfo_Params proto.InternalMessageInfo // CodeInfo is data for the uploaded contract WASM code type CodeInfo struct { - CodeHash []byte `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` - Creator github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=creator,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"creator,omitempty"` - Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"` - Builder string `protobuf:"bytes,4,opt,name=builder,proto3" json:"builder,omitempty"` - InstantiateConfig AccessConfig `protobuf:"bytes,5,opt,name=instantiate_config,json=instantiateConfig,proto3" json:"instantiate_config"` + // CodeHash is the unique CodeID + CodeHash []byte `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` + // Creator address who initially stored the code + Creator github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=creator,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"creator,omitempty"` + // Source is a valid absolute HTTPS URI to the contract's source code, optional + Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"` + // Builder is a valid docker image name with tag, optional + Builder string `protobuf:"bytes,4,opt,name=builder,proto3" json:"builder,omitempty"` + // InstantiateConfig access control to apply on contract creation, optional + InstantiateConfig AccessConfig `protobuf:"bytes,5,opt,name=instantiate_config,json=instantiateConfig,proto3" json:"instantiate_config"` } func (m *CodeInfo) Reset() { *m = CodeInfo{} } @@ -243,12 +260,16 @@ var xxx_messageInfo_CodeInfo proto.InternalMessageInfo // ContractInfo stores a WASM contract instance type ContractInfo struct { - CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // CodeID is the reference to the stored WASM code + CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // Creator address who initially instantiated the contract Creator github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=creator,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"creator,omitempty"` - Admin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=admin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"admin,omitempty"` - Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` - // never show this in query results, just use for sorting - // (Note: when using json tag "-" amino refused to serialize it...) + // Admin is an optional address that can execute migrations + Admin github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=admin,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"admin,omitempty"` + // Label is optional metadata to be stored with a contract instance. + Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` + // Created Tx position when the contract was instantiated. + // This data should kept internal and not be exposed via query results. Just use for sorting Created *AbsoluteTxPosition `protobuf:"bytes,5,opt,name=created,proto3" json:"created,omitempty"` } @@ -285,6 +306,7 @@ func (m *ContractInfo) XXX_DiscardUnknown() { var xxx_messageInfo_ContractInfo proto.InternalMessageInfo +// ContractHistory contains a sorted list of code updates to a contract type ContractHistory struct { CodeHistoryEntries []ContractCodeHistoryEntry `protobuf:"bytes,1,rep,name=code_history_entries,json=codeHistoryEntries,proto3" json:"code_history_entries"` } @@ -322,12 +344,14 @@ func (m *ContractHistory) XXX_DiscardUnknown() { var xxx_messageInfo_ContractHistory proto.InternalMessageInfo -// ContractCodeHistoryEntry stores code updates to a contract. +// ContractCodeHistoryEntry metadata to a contract. type ContractCodeHistoryEntry struct { Operation ContractCodeHistoryOperationType `protobuf:"varint,1,opt,name=operation,proto3,enum=wasmd.x.wasmd.v1beta1.ContractCodeHistoryOperationType" json:"operation,omitempty"` - CodeID uint64 `protobuf:"varint,2,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` - Updated *AbsoluteTxPosition `protobuf:"bytes,3,opt,name=updated,proto3" json:"updated,omitempty"` - Msg encoding_json.RawMessage `protobuf:"bytes,4,opt,name=msg,proto3,casttype=encoding/json.RawMessage" json:"msg,omitempty"` + // CodeID is the reference to the stored WASM code + CodeID uint64 `protobuf:"varint,2,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // Updated Tx position when the operation was executed. + Updated *AbsoluteTxPosition `protobuf:"bytes,3,opt,name=updated,proto3" json:"updated,omitempty"` + Msg encoding_json.RawMessage `protobuf:"bytes,4,opt,name=msg,proto3,casttype=encoding/json.RawMessage" json:"msg,omitempty"` } func (m *ContractCodeHistoryEntry) Reset() { *m = ContractCodeHistoryEntry{} } diff --git a/x/wasm/internal/types/types.proto b/x/wasm/internal/types/types.proto index b23ab3a6b4..cebf796fdd 100644 --- a/x/wasm/internal/types/types.proto +++ b/x/wasm/internal/types/types.proto @@ -7,20 +7,27 @@ option go_package = "github.com/CosmWasm/wasmd/x/wasmd/internal/types"; option (gogoproto.goproto_getters_all) = false; 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"]; } +// AccessTypeParam message AccessTypeParam { 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\""]; @@ -37,40 +44,57 @@ message Params { // CodeInfo is data for the uploaded contract WASM code message CodeInfo { + // CodeHash is the unique CodeID bytes code_hash = 1; + // Creator address who initially stored the code bytes creator = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // 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 { + // CodeID is the reference to the stored WASM code uint64 code_id = 1 [(gogoproto.customname) = "CodeID"]; + // Creator address who initially instantiated the contract bytes creator = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // Admin is an optional address that can execute migrations bytes admin = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + // Label is optional metadata to be stored with a contract instance. string label = 4; - // never show this in query results, just use for sorting - // (Note: when using json tag "-" amino refused to serialize it...) + // 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; } +// 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"]; } +// ContractHistory contains a sorted list of code updates to a contract message ContractHistory { repeated ContractCodeHistoryEntry code_history_entries = 1 [(gogoproto.nullable) = false]; } -// ContractCodeHistoryEntry stores code updates to a contract. +// 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"];