Skip to content

Commit

Permalink
Format protobuf definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Mar 19, 2021
1 parent 9db2c1e commit 87e049d
Show file tree
Hide file tree
Showing 6 changed files with 380 additions and 299 deletions.
58 changes: 34 additions & 24 deletions proto/cosmwasm/wasm/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
24 changes: 13 additions & 11 deletions proto/cosmwasm/wasm/v1beta1/ibc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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\"" ];
}
164 changes: 86 additions & 78 deletions proto/cosmwasm/wasm/v1beta1/proposal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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\""
];
}
Loading

0 comments on commit 87e049d

Please sign in to comment.