Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add amino annotations to proto #1280

Merged
merged 2 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ import (
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/spf13/cast"

govclient "github.com/cosmos/cosmos-sdk/x/gov/client"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
)

const appName = "WasmApp"
Expand Down
18 changes: 17 additions & 1 deletion proto/buf.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Protobufs

This is the public protocol buffers API for [Wasmd](https://github.com/CosmWasm/wasmd).
This is the public protocol buffers API for [Wasmd](https://github.com/CosmWasm/wasmd).

## Download

The `buf` CLI comes with an export command. Use `buf export -h` for details

#### Examples:

Download cosmwasm protos for a commit:
```bash
buf export buf.build/cosmwasm/wasmd:${commit} --output ./tmp
```

Download all project protos:
```bash
buf export . --output ./tmp
```
17 changes: 15 additions & 2 deletions proto/cosmwasm/wasm/v1/authz.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,33 @@ import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "google/protobuf/any.proto";
import "amino/amino.proto";

option go_package = "github.com/CosmWasm/wasmd/x/wasm/types";
option (gogoproto.goproto_getters_all) = false;

// ContractExecutionAuthorization defines authorization for wasm execute.
// Since: wasmd 0.30
message ContractExecutionAuthorization {
option (amino.name) = "wasm/ContractExecutionAuthorization";
option (cosmos_proto.implements_interface) =
"cosmos.authz.v1beta1.Authorization";

// Grants for contract executions
repeated ContractGrant grants = 1 [ (gogoproto.nullable) = false ];
repeated ContractGrant grants = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// ContractMigrationAuthorization defines authorization for wasm contract
// migration. Since: wasmd 0.30
message ContractMigrationAuthorization {
option (amino.name) = "wasm/ContractMigrationAuthorization";
option (cosmos_proto.implements_interface) =
"cosmos.authz.v1beta1.Authorization";

// Grants for contract migrations
repeated ContractGrant grants = 1 [ (gogoproto.nullable) = false ];
repeated ContractGrant grants = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// ContractGrant a granted permission for a single contract
Expand All @@ -51,6 +56,7 @@ message ContractGrant {
// MaxCallsLimit limited number of calls to the contract. No funds transferable.
// Since: wasmd 0.30
message MaxCallsLimit {
option (amino.name) = "wasm/MaxCallsLimit";
option (cosmos_proto.implements_interface) =
"cosmwasm.wasm.v1.ContractAuthzLimitX";

Expand All @@ -61,12 +67,14 @@ message MaxCallsLimit {
// MaxFundsLimit defines the maximal amounts that can be sent to the contract.
// Since: wasmd 0.30
message MaxFundsLimit {
option (amino.name) = "wasm/MaxFundsLimit";
option (cosmos_proto.implements_interface) =
"cosmwasm.wasm.v1.ContractAuthzLimitX";

// Amounts is the maximal amount of tokens transferable to the contract.
repeated cosmos.base.v1beta1.Coin amounts = 1 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
Expand All @@ -75,6 +83,7 @@ message MaxFundsLimit {
// the maximal number of calls executable. Both need to remain >0 to be valid.
// Since: wasmd 0.30
message CombinedLimit {
option (amino.name) = "wasm/CombinedLimit";
option (cosmos_proto.implements_interface) =
"cosmwasm.wasm.v1.ContractAuthzLimitX";

Expand All @@ -83,6 +92,7 @@ message CombinedLimit {
// Amounts is the maximal amount of tokens transferable to the contract.
repeated cosmos.base.v1beta1.Coin amounts = 2 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
Expand All @@ -91,6 +101,7 @@ message CombinedLimit {
// message.
// Since: wasmd 0.30
message AllowAllMessagesFilter {
option (amino.name) = "wasm/AllowAllMessagesFilter";
option (cosmos_proto.implements_interface) =
"cosmwasm.wasm.v1.ContractAuthzFilterX";
}
Expand All @@ -99,6 +110,7 @@ message AllowAllMessagesFilter {
// the json object to be executed.
// Since: wasmd 0.30
message AcceptedMessageKeysFilter {
option (amino.name) = "wasm/AcceptedMessageKeysFilter";
option (cosmos_proto.implements_interface) =
"cosmwasm.wasm.v1.ContractAuthzFilterX";

Expand All @@ -110,6 +122,7 @@ message AcceptedMessageKeysFilter {
// executed.
// Since: wasmd 0.30
message AcceptedMessagesFilter {
option (amino.name) = "wasm/AcceptedMessagesFilter";
option (cosmos_proto.implements_interface) =
"cosmwasm.wasm.v1.ContractAuthzFilterX";

Expand Down
24 changes: 17 additions & 7 deletions proto/cosmwasm/wasm/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,36 @@ package cosmwasm.wasm.v1;

import "gogoproto/gogo.proto";
import "cosmwasm/wasm/v1/types.proto";
import "amino/amino.proto";

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" ];
Params params = 1
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
repeated Code codes = 2 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.jsontag) = "codes,omitempty"
];
repeated Contract contracts = 3 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.jsontag) = "contracts,omitempty"
];
repeated Sequence sequences = 4 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.jsontag) = "sequences,omitempty"
];
}

// Code struct encompasses CodeInfo and CodeBytes
message Code {
uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ];
CodeInfo code_info = 2 [ (gogoproto.nullable) = false ];
CodeInfo code_info = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
bytes code_bytes = 3;
// Pinned to wasmvm cache
bool pinned = 4;
Expand All @@ -33,10 +41,12 @@ message Code {
// 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 ];
ContractInfo contract_info = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
repeated Model contract_state = 3
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
repeated ContractCodeHistoryEntry contract_code_history = 4
[ (gogoproto.nullable) = false ];
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// Sequence key and value of an id generation counter
Expand Down
22 changes: 20 additions & 2 deletions proto/cosmwasm/wasm/v1/proposal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmwasm/wasm/v1/types.proto";
import "amino/amino.proto";

option go_package = "github.com/CosmWasm/wasmd/x/wasm/types";
option (gogoproto.goproto_stringer_all) = false;
Expand All @@ -17,6 +18,7 @@ option (gogoproto.equal_all) = true;
// a v1 governance proposal.
message StoreCodeProposal {
option deprecated = true;
option (amino.name) = "wasm/StoreCodeProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand Down Expand Up @@ -49,6 +51,7 @@ message StoreCodeProposal {
// a v1 governance proposal.
message InstantiateContractProposal {
option deprecated = true;
option (amino.name) = "wasm/InstantiateContractProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -68,6 +71,7 @@ message InstantiateContractProposal {
// Funds coins that are transferred to the contract on instantiation
repeated cosmos.base.v1beta1.Coin funds = 8 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
Expand All @@ -78,6 +82,7 @@ message InstantiateContractProposal {
// a v1 governance proposal.
message InstantiateContract2Proposal {
option deprecated = true;
option (amino.name) = "wasm/InstantiateContract2Proposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -97,6 +102,7 @@ message InstantiateContract2Proposal {
// Funds coins that are transferred to the contract on instantiation
repeated cosmos.base.v1beta1.Coin funds = 8 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
// Salt is an arbitrary value provided by the sender. Size can be 1 to 64.
Expand All @@ -112,6 +118,7 @@ message InstantiateContract2Proposal {
// a v1 governance proposal.
message MigrateContractProposal {
option deprecated = true;
option (amino.name) = "wasm/MigrateContractProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -134,6 +141,7 @@ message MigrateContractProposal {
// a v1 governance proposal.
message SudoContractProposal {
option deprecated = true;
option (amino.name) = "wasm/SudoContractProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -152,6 +160,7 @@ message SudoContractProposal {
// a v1 governance proposal.
message ExecuteContractProposal {
option deprecated = true;
option (amino.name) = "wasm/ExecuteContractProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -167,6 +176,7 @@ message ExecuteContractProposal {
// Funds coins that are transferred to the contract on instantiation
repeated cosmos.base.v1beta1.Coin funds = 6 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
Expand All @@ -177,6 +187,7 @@ message ExecuteContractProposal {
// a v1 governance proposal.
message UpdateAdminProposal {
option deprecated = true;
option (amino.name) = "wasm/UpdateAdminProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -195,6 +206,7 @@ message UpdateAdminProposal {
// a v1 governance proposal.
message ClearAdminProposal {
option deprecated = true;
option (amino.name) = "wasm/ClearAdminProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -211,6 +223,7 @@ message ClearAdminProposal {
// a v1 governance proposal.
message PinCodesProposal {
option deprecated = true;
option (amino.name) = "wasm/PinCodesProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -230,6 +243,7 @@ message PinCodesProposal {
// a v1 governance proposal.
message UnpinCodesProposal {
option deprecated = true;
option (amino.name) = "wasm/UnpinCodesProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -249,7 +263,8 @@ message AccessConfigUpdate {
// CodeID is the reference to the stored WASM code to be updated
uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ];
// InstantiatePermission to apply to the set of code ids
AccessConfig instantiate_permission = 2 [ (gogoproto.nullable) = false ];
AccessConfig instantiate_permission = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for
Expand All @@ -258,6 +273,7 @@ message AccessConfigUpdate {
// the x/gov module via a v1 governance proposal.
message UpdateInstantiateConfigProposal {
option deprecated = true;
option (amino.name) = "wasm/UpdateInstantiateConfigProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -267,7 +283,7 @@ message UpdateInstantiateConfigProposal {
// AccessConfigUpdate contains the list of code ids and the access config
// to be applied.
repeated AccessConfigUpdate access_config_updates = 3
[ (gogoproto.nullable) = false ];
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for
Expand All @@ -276,6 +292,7 @@ message UpdateInstantiateConfigProposal {
// the x/gov module via a v1 governance proposal.
message StoreAndInstantiateContractProposal {
option deprecated = true;
option (amino.name) = "wasm/StoreAndInstantiateContractProposal";
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

// Title is a short summary
Expand All @@ -299,6 +316,7 @@ message StoreAndInstantiateContractProposal {
// Funds coins that are transferred to the contract on instantiation
repeated cosmos.base.v1beta1.Coin funds = 10 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
// Source is the URL where the code is hosted
Expand Down
Loading