Skip to content

Commit

Permalink
Add protobuf comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Nov 10, 2020
1 parent 15238cc commit 02948d3
Show file tree
Hide file tree
Showing 13 changed files with 363 additions and 170 deletions.
2 changes: 1 addition & 1 deletion buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build:
lint:
use:
- DEFAULT
# - COMMENTS
- COMMENTS
- FILE_LOWER_SNAKE_CASE
except:
- UNARY_RPC
Expand Down
198 changes: 99 additions & 99 deletions doc/proto.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x/wasm/internal/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/wasm/internal/types/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
57 changes: 41 additions & 16 deletions x/wasm/internal/types/msg.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion x/wasm/internal/types/msg.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,75 @@ 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"];
// 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 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"];
}
4 changes: 2 additions & 2 deletions x/wasm/internal/types/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`},
Expand All @@ -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},
Expand Down
Loading

0 comments on commit 02948d3

Please sign in to comment.