From 6872cae7784a0ce28fb49445a07270ee9b603c19 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Tue, 10 May 2022 17:55:02 +0200 Subject: [PATCH] chore: Audit x/staking and add "Since" proto comments (#11920) --- proto/cosmos/auth/v1beta1/query.proto | 6 ++++++ proto/cosmos/bank/v1beta1/query.proto | 12 ++++++++++++ proto/cosmos/base/snapshots/v1beta1/snapshot.proto | 14 ++++++++++++++ proto/cosmos/crypto/hd/v1/hd.proto | 1 + proto/cosmos/crypto/keyring/v1/record.proto | 1 + proto/cosmos/feegrant/v1beta1/query.proto | 7 ++++++- proto/cosmos/params/v1beta1/query.proto | 8 ++++++++ proto/cosmos/staking/v1beta1/staking.proto | 2 ++ proto/cosmos/staking/v1beta1/tx.proto | 6 ++++++ proto/cosmos/upgrade/v1beta1/tx.proto | 3 ++- proto/cosmos/vesting/v1beta1/tx.proto | 12 ++++++++++++ x/staking/module.go | 2 +- 12 files changed, 71 insertions(+), 3 deletions(-) diff --git a/proto/cosmos/auth/v1beta1/query.proto b/proto/cosmos/auth/v1beta1/query.proto index aa51cfb0123b..894429bdaaf0 100644 --- a/proto/cosmos/auth/v1beta1/query.proto +++ b/proto/cosmos/auth/v1beta1/query.proto @@ -30,6 +30,8 @@ service Query { } // ModuleAccounts returns all the existing module accounts. + // + // Since: cosmos-sdk 0.46 rpc ModuleAccounts(QueryModuleAccountsRequest) returns (QueryModuleAccountsResponse) { option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts"; } @@ -85,6 +87,8 @@ message QueryAccountRequest { } // QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. +// +// Since: cosmos-sdk 0.46 message QueryModuleAccountsRequest {} // QueryParamsResponse is the response type for the Query/Params RPC method. @@ -103,6 +107,8 @@ message QueryAccountResponse { message QueryParamsRequest {} // QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. +// +// Since: cosmos-sdk 0.46 message QueryModuleAccountsResponse { repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "ModuleAccountI"]; } diff --git a/proto/cosmos/bank/v1beta1/query.proto b/proto/cosmos/bank/v1beta1/query.proto index cbe7f38adcf7..635471c4b9dd 100644 --- a/proto/cosmos/bank/v1beta1/query.proto +++ b/proto/cosmos/bank/v1beta1/query.proto @@ -24,6 +24,8 @@ service Query { // SpendableBalances queries the spenable balance of all coins for a single // account. + // + // Since: cosmos-sdk 0.46 rpc SpendableBalances(QuerySpendableBalancesRequest) returns (QuerySpendableBalancesResponse) { option (google.api.http).get = "/cosmos/bank/v1beta1/spendable_balances/{address}"; } @@ -56,6 +58,8 @@ service Query { // DenomOwners queries for all account addresses that own a particular token // denomination. + // + // Since: cosmos-sdk 0.46 rpc DenomOwners(QueryDenomOwnersRequest) returns (QueryDenomOwnersResponse) { option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners/{denom}"; } @@ -104,6 +108,8 @@ message QueryAllBalancesResponse { // QuerySpendableBalancesRequest defines the gRPC request structure for querying // an account's spendable balances. +// +// Since: cosmos-sdk 0.46 message QuerySpendableBalancesRequest { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -117,6 +123,8 @@ message QuerySpendableBalancesRequest { // QuerySpendableBalancesResponse defines the gRPC response structure for querying // an account's spendable balances. +// +// Since: cosmos-sdk 0.46 message QuerySpendableBalancesResponse { // balances is the spendable balances of all the coins. repeated cosmos.base.v1beta1.Coin balances = 1 @@ -214,6 +222,8 @@ message QueryDenomOwnersRequest { // DenomOwner defines structure representing an account that owns or holds a // particular denominated token. It contains the account address and account // balance of the denominated token. +// +// Since: cosmos-sdk 0.46 message DenomOwner { // address defines the address that owns a particular denomination. string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -223,6 +233,8 @@ message DenomOwner { } // QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. +// +// Since: cosmos-sdk 0.46 message QueryDenomOwnersResponse { repeated DenomOwner denom_owners = 1; diff --git a/proto/cosmos/base/snapshots/v1beta1/snapshot.proto b/proto/cosmos/base/snapshots/v1beta1/snapshot.proto index a89e0b4c361c..022f8e067263 100644 --- a/proto/cosmos/base/snapshots/v1beta1/snapshot.proto +++ b/proto/cosmos/base/snapshots/v1beta1/snapshot.proto @@ -20,6 +20,8 @@ message Metadata { } // SnapshotItem is an item contained in a rootmulti.Store snapshot. +// +// Since: cosmos-sdk 0.46 message SnapshotItem { // item is the specific type of snapshot item. oneof item { @@ -33,11 +35,15 @@ message SnapshotItem { } // SnapshotStoreItem contains metadata about a snapshotted store. +// +// Since: cosmos-sdk 0.46 message SnapshotStoreItem { string name = 1; } // SnapshotIAVLItem is an exported IAVL node. +// +// Since: cosmos-sdk 0.46 message SnapshotIAVLItem { bytes key = 1; bytes value = 2; @@ -48,23 +54,31 @@ message SnapshotIAVLItem { } // SnapshotExtensionMeta contains metadata about an external snapshotter. +// +// Since: cosmos-sdk 0.46 message SnapshotExtensionMeta { string name = 1; uint32 format = 2; } // SnapshotExtensionPayload contains payloads of an external snapshotter. +// +// Since: cosmos-sdk 0.46 message SnapshotExtensionPayload { bytes payload = 1; } // SnapshotKVItem is an exported Key/Value Pair +// +// Since: cosmos-sdk 0.46 message SnapshotKVItem { bytes key = 1; bytes value = 2; } // SnapshotSchema is an exported schema of smt store +// +// Since: cosmos-sdk 0.46 message SnapshotSchema{ repeated bytes keys = 1; } diff --git a/proto/cosmos/crypto/hd/v1/hd.proto b/proto/cosmos/crypto/hd/v1/hd.proto index e4a95afcba9f..bb079ce66501 100644 --- a/proto/cosmos/crypto/hd/v1/hd.proto +++ b/proto/cosmos/crypto/hd/v1/hd.proto @@ -1,3 +1,4 @@ +// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.crypto.hd.v1; diff --git a/proto/cosmos/crypto/keyring/v1/record.proto b/proto/cosmos/crypto/keyring/v1/record.proto index 9b2d3c96439f..1461c0193c9b 100644 --- a/proto/cosmos/crypto/keyring/v1/record.proto +++ b/proto/cosmos/crypto/keyring/v1/record.proto @@ -1,3 +1,4 @@ +// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.crypto.keyring.v1; diff --git a/proto/cosmos/feegrant/v1beta1/query.proto b/proto/cosmos/feegrant/v1beta1/query.proto index 59c992c911d6..baef77701623 100644 --- a/proto/cosmos/feegrant/v1beta1/query.proto +++ b/proto/cosmos/feegrant/v1beta1/query.proto @@ -23,7 +23,8 @@ service Query { } // AllowancesByGranter returns all the grants given by an address - // Since v0.46 + // + // Since: cosmos-sdk 0.46 rpc AllowancesByGranter(QueryAllowancesByGranterRequest) returns (QueryAllowancesByGranterResponse) { option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}"; } @@ -62,6 +63,8 @@ message QueryAllowancesResponse { } // QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. +// +// Since: cosmos-sdk 0.46 message QueryAllowancesByGranterRequest { string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -70,6 +73,8 @@ message QueryAllowancesByGranterRequest { } // QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. +// +// Since: cosmos-sdk 0.46 message QueryAllowancesByGranterResponse { // allowances that have been issued by the granter. repeated cosmos.feegrant.v1beta1.Grant allowances = 1; diff --git a/proto/cosmos/params/v1beta1/query.proto b/proto/cosmos/params/v1beta1/query.proto index 3b1c9a760092..97d0a71d7f5e 100644 --- a/proto/cosmos/params/v1beta1/query.proto +++ b/proto/cosmos/params/v1beta1/query.proto @@ -16,6 +16,8 @@ service Query { } // Subspaces queries for all registered subspaces and all keys for a subspace. + // + // Since: cosmos-sdk 0.46 rpc Subspaces(QuerySubspacesRequest) returns (QuerySubspacesResponse) { option (google.api.http).get = "/cosmos/params/v1beta1/subspaces"; } @@ -38,16 +40,22 @@ message QueryParamsResponse { // QuerySubspacesRequest defines a request type for querying for all registered // subspaces and all keys for a subspace. +// +// Since: cosmos-sdk 0.46 message QuerySubspacesRequest {} // QuerySubspacesResponse defines the response types for querying for all // registered subspaces and all keys for a subspace. +// +// Since: cosmos-sdk 0.46 message QuerySubspacesResponse { repeated Subspace subspaces = 1; } // Subspace defines a parameter subspace name and all the keys that exist for // the subspace. +// +// Since: cosmos-sdk 0.46 message Subspace { string subspace = 1; repeated string keys = 2; diff --git a/proto/cosmos/staking/v1beta1/staking.proto b/proto/cosmos/staking/v1beta1/staking.proto index dcf2645fa247..6dc965feab47 100644 --- a/proto/cosmos/staking/v1beta1/staking.proto +++ b/proto/cosmos/staking/v1beta1/staking.proto @@ -117,6 +117,8 @@ message Validator { // commission defines the commission parameters. Commission commission = 10 [(gogoproto.nullable) = false]; // min_self_delegation is the validator's self declared minimum self delegation. + // + // Since: cosmos-sdk 0.46 string min_self_delegation = 11 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", diff --git a/proto/cosmos/staking/v1beta1/tx.proto b/proto/cosmos/staking/v1beta1/tx.proto index b7dac39861d8..ca8f76df19dc 100644 --- a/proto/cosmos/staking/v1beta1/tx.proto +++ b/proto/cosmos/staking/v1beta1/tx.proto @@ -35,6 +35,8 @@ service Msg { // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation // and delegate back to previous validator. + // + // Since: cosmos-sdk 0.46 rpc CancelUnbondingDelegation(MsgCancelUnbondingDelegation) returns (MsgCancelUnbondingDelegationResponse); } @@ -142,6 +144,8 @@ message MsgUndelegateResponse { } // MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator +// +// Since: cosmos-sdk 0.46 message MsgCancelUnbondingDelegation{ option (cosmos.msg.v1.signer) = "delegator_address"; option (gogoproto.equal) = false; @@ -156,4 +160,6 @@ message MsgCancelUnbondingDelegation{ } // MsgCancelUnbondingDelegationResponse +// +// Since: cosmos-sdk 0.46 message MsgCancelUnbondingDelegationResponse{} diff --git a/proto/cosmos/upgrade/v1beta1/tx.proto b/proto/cosmos/upgrade/v1beta1/tx.proto index 9b04bf44bebc..7a2931da2148 100644 --- a/proto/cosmos/upgrade/v1beta1/tx.proto +++ b/proto/cosmos/upgrade/v1beta1/tx.proto @@ -1,3 +1,4 @@ +// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.upgrade.v1beta1; @@ -52,4 +53,4 @@ message MsgCancelUpgrade { // MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. // // Since: cosmos-sdk 0.46 -message MsgCancelUpgradeResponse {} \ No newline at end of file +message MsgCancelUpgradeResponse {} diff --git a/proto/cosmos/vesting/v1beta1/tx.proto b/proto/cosmos/vesting/v1beta1/tx.proto index 211bad09e0ad..27511ba80cbd 100644 --- a/proto/cosmos/vesting/v1beta1/tx.proto +++ b/proto/cosmos/vesting/v1beta1/tx.proto @@ -17,9 +17,13 @@ service Msg { rpc CreateVestingAccount(MsgCreateVestingAccount) returns (MsgCreateVestingAccountResponse); // CreatePermanentLockedAccount defines a method that enables creating a permanent // locked account. + // + // Since: cosmos-sdk 0.46 rpc CreatePermanentLockedAccount(MsgCreatePermanentLockedAccount) returns (MsgCreatePermanentLockedAccountResponse); // CreatePeriodicVestingAccount defines a method that enables creating a // periodic vesting account. + // + // Since: cosmos-sdk 0.46 rpc CreatePeriodicVestingAccount(MsgCreatePeriodicVestingAccount) returns (MsgCreatePeriodicVestingAccountResponse); } @@ -44,6 +48,8 @@ message MsgCreateVestingAccountResponse {} // MsgCreatePermanentLockedAccount defines a message that enables creating a permanent // locked account. +// +// Since: cosmos-sdk 0.46 message MsgCreatePermanentLockedAccount { option (gogoproto.equal) = true; @@ -54,10 +60,14 @@ message MsgCreatePermanentLockedAccount { } // MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. +// +// Since: cosmos-sdk 0.46 message MsgCreatePermanentLockedAccountResponse {} // MsgCreateVestingAccount defines a message that enables creating a vesting // account. +// +// Since: cosmos-sdk 0.46 message MsgCreatePeriodicVestingAccount { option (cosmos.msg.v1.signer) = "from_address"; @@ -71,4 +81,6 @@ message MsgCreatePeriodicVestingAccount { // MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount // response type. +// +// Since: cosmos-sdk 0.46 message MsgCreatePeriodicVestingAccountResponse {} diff --git a/x/staking/module.go b/x/staking/module.go index c1051be3c99d..93b41daef60a 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -23,7 +23,7 @@ import ( ) const ( - consensusVersion uint64 = 4 + consensusVersion uint64 = 3 ) var (