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

feat: Introduce Cosmos Scalars #9933

Merged
merged 41 commits into from Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0b6a4df
draft
cyberbono3 Aug 13, 2021
711d581
fix auth.proto
cyberbono3 Aug 13, 2021
6c82789
fix event.proto
cyberbono3 Aug 13, 2021
2a846b9
get rid of TODO
cyberbono3 Aug 13, 2021
e833de0
cleanup
cyberbono3 Aug 13, 2021
22e1baf
add scalar field to FieldOptions
cyberbono3 Aug 16, 2021
9264d4f
update
cyberbono3 Aug 16, 2021
b3dfa7e
fix reflection.proto
cyberbono3 Aug 16, 2021
d9776f4
fix genesis.proto
cyberbono3 Aug 16, 2021
1f3e244
fix vesting.proto
cyberbono3 Aug 16, 2021
73397e5
apply reviewer comments
cyberbono3 Aug 17, 2021
084c2a9
cleanup
cyberbono3 Aug 17, 2021
e4bd120
fix staking.proto
cyberbono3 Aug 17, 2021
1164971
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into cy…
cyberbono3 Aug 17, 2021
ca11a3d
fix bank.proto
cyberbono3 Aug 18, 2021
d4474df
fix abci.proto
cyberbono3 Aug 18, 2021
5f47cd4
fix commit_info.proto
cyberbono3 Aug 18, 2021
0376fe1
fix capability.proto
cyberbono3 Aug 18, 2021
505cdd2
fix tx.proto
cyberbono3 Aug 18, 2021
7232691
fix evidence.proto
cyberbono3 Aug 18, 2021
57dbae5
fix types.proto
cyberbono3 Aug 18, 2021
0730f2a
fix mint.proto
cyberbono3 Aug 18, 2021
3b4130d
update go_package in cosmos.proto
cyberbono3 Aug 19, 2021
0fffd04
remove interface_type from MessageOptions in cosmos.proto
cyberbono3 Aug 19, 2021
1e668e3
restore interface_type in cosmos.proto and include *.pb.go
cyberbono3 Aug 24, 2021
a7e6ffa
proto-gen
cyberbono3 Sep 15, 2021
61ccb2b
resolve merge conflicts
cyberbono3 Sep 15, 2021
d8d1e3f
make proto-gen
cyberbono3 Sep 15, 2021
fa0f0f1
update go.mod and protocgen.sh
cyberbono3 Sep 16, 2021
0532c92
remove interfacetype from protocgen.sh
cyberbono3 Sep 16, 2021
acf2615
scripts/protocgen.sh
cyberbono3 Sep 16, 2021
7a3123d
make test-all works properly
cyberbono3 Sep 16, 2021
c912dab
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into cy…
cyberbono3 Sep 16, 2021
aa30774
Merge branch 'master' into cyberbono3/introduce-cosmos-scalars
cyberbono3 Sep 16, 2021
41f81de
add changelog entry
cyberbono3 Sep 18, 2021
20419bf
merge master into my branch and resolve conflicts
cyberbono3 Sep 18, 2021
aa7e529
Update scripts/protocgen.sh
cyberbono3 Sep 20, 2021
c421312
add comments to cosmos.proto
cyberbono3 Sep 20, 2021
07303ab
Merge branch 'master' into cyberbono3/introduce-cosmos-scalars
atheeshp Sep 21, 2021
d1ed91c
Update CHANGELOG.md
amaury1093 Sep 21, 2021
193c335
Merge branch 'master' into cyberbono3/introduce-cosmos-scalars
amaury1093 Sep 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion proto/cosmos/auth/v1beta1/auth.proto
Expand Up @@ -17,7 +17,7 @@ message BaseAccount {

option (cosmos_proto.implements_interface) = "AccountI";

string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any pub_key = 2
[(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""];
uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""];
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/auth/v1beta1/query.proto
Expand Up @@ -54,7 +54,7 @@ message QueryAccountRequest {
option (gogoproto.goproto_getters) = false;

// address defines the address to query for.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// QueryAccountResponse is the response type for the Query/Account RPC method.
Expand Down
10 changes: 6 additions & 4 deletions proto/cosmos/authz/v1beta1/event.proto
@@ -1,24 +1,26 @@
syntax = "proto3";
package cosmos.authz.v1beta1;

import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/authz";

// EventGrant is emitted on Msg/Grant
message EventGrant {
// Msg type URL for which an autorization is granted
string msg_type_url = 2;
// Granter account address
string granter = 3;
string granter = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Grantee account address
string grantee = 4;
string grantee = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// EventRevoke is emitted on Msg/Revoke
message EventRevoke {
// Msg type URL for which an autorization is revoked
string msg_type_url = 2;
// Granter account address
string granter = 3;
string granter = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Grantee account address
string grantee = 4;
string grantee = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
4 changes: 2 additions & 2 deletions proto/cosmos/authz/v1beta1/genesis.proto
Expand Up @@ -15,8 +15,8 @@ message GenesisState {

// GrantAuthorization defines the GenesisState/GrantAuthorization type.
message GrantAuthorization {
string granter = 1;
string grantee = 2;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];

google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "Authorization"];
google.protobuf.Timestamp expiration = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
Expand Down
5 changes: 3 additions & 2 deletions proto/cosmos/authz/v1beta1/query.proto
Expand Up @@ -4,6 +4,7 @@ package cosmos.authz.v1beta1;
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos/authz/v1beta1/authz.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/authz";

Expand All @@ -17,8 +18,8 @@ service Query {

// QueryGrantsRequest is the request type for the Query/Grants RPC method.
message QueryGrantsRequest {
string granter = 1;
string grantee = 2;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Optional, msg_type_url, when set, will query only grants matching given msg type.
string msg_type_url = 3;
// pagination defines an pagination for the request.
Expand Down
10 changes: 5 additions & 5 deletions proto/cosmos/authz/v1beta1/tx.proto
Expand Up @@ -32,8 +32,8 @@ service Msg {
// MsgGrant is a request type for Grant method. It declares authorization to the grantee
// on behalf of the granter with the provided expiration time.
message MsgGrant {
string granter = 1;
string grantee = 2;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];

cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false];
}
Expand All @@ -47,7 +47,7 @@ message MsgExecResponse {
// authorizations granted to the grantee. Each message should have only
// one signer corresponding to the granter of the authorization.
message MsgExec {
string grantee = 1;
string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Authorization Msg requests to execute. Each msg must implement Authorization interface
// The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg))
// triple and validate it.
Expand All @@ -60,8 +60,8 @@ message MsgGrantResponse {}
// MsgRevoke revokes any authorization with the provided sdk.Msg type on the
// granter's account with that has been granted to the grantee.
message MsgRevoke {
string granter = 1;
string grantee = 2;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];;
string msg_type_url = 3;
}

Expand Down
6 changes: 3 additions & 3 deletions proto/cosmos/bank/v1beta1/bank.proto
Expand Up @@ -28,7 +28,7 @@ message Input {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin coins = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
Expand All @@ -38,7 +38,7 @@ message Output {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin coins = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
Expand Down Expand Up @@ -68,7 +68,7 @@ message DenomUnit {
// 1 denom = 1^exponent base_denom
// (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
// exponent = 6, thus: 1 atom = 10^6 uatom).
uint32 exponent = 2;
uint32 exponent = 2 [(cosmos_proto.scalar) = "cosmos.Int"];
// aliases is a list of string aliases for the given denom
repeated string aliases = 3;
}
Expand Down
3 changes: 2 additions & 1 deletion proto/cosmos/bank/v1beta1/genesis.proto
Expand Up @@ -4,6 +4,7 @@ package cosmos.bank.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/bank/v1beta1/bank.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";

Expand Down Expand Up @@ -31,7 +32,7 @@ message Balance {
option (gogoproto.goproto_getters) = false;

// address is the address of the balance holder.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// coins defines the different coins this balance holds.
repeated cosmos.base.v1beta1.Coin coins = 2
Expand Down
7 changes: 4 additions & 3 deletions proto/cosmos/bank/v1beta1/query.proto
Expand Up @@ -6,6 +6,7 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/bank/v1beta1/bank.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";

Expand Down Expand Up @@ -60,7 +61,7 @@ message QueryBalanceRequest {
option (gogoproto.goproto_getters) = false;

// address is the address to query balances for.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// denom is the coin denom to query balances for.
string denom = 2;
Expand All @@ -78,7 +79,7 @@ message QueryAllBalancesRequest {
option (gogoproto.goproto_getters) = false;

// address is the address to query balances for.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
Expand Down Expand Up @@ -181,7 +182,7 @@ message QueryDenomOwnersRequest {
// balance of the denominated token.
message DenomOwner {
// address defines the address that owns a particular denomination.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];;

// balance is the balance of the denominated coin for an account.
cosmos.base.v1beta1.Coin balance = 2 [(gogoproto.nullable) = false];
Expand Down
5 changes: 3 additions & 2 deletions proto/cosmos/bank/v1beta1/tx.proto
Expand Up @@ -4,6 +4,7 @@ package cosmos.bank.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/bank/v1beta1/bank.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";

Expand All @@ -21,8 +22,8 @@ message MsgSend {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""];
string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""];
string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.moretags) = "yaml:\"from_address\""];
string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.moretags) = "yaml:\"to_address\""];
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
Expand Down
17 changes: 9 additions & 8 deletions proto/cosmos/base/abci/v1beta1/abci.proto
Expand Up @@ -4,6 +4,7 @@ package cosmos.base.abci.v1beta1;
import "gogoproto/gogo.proto";
import "tendermint/abci/types.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/types";
option (gogoproto.goproto_stringer_all) = false;
Expand All @@ -13,13 +14,13 @@ option (gogoproto.goproto_stringer_all) = false;
message TxResponse {
option (gogoproto.goproto_getters) = false;
// The block height
int64 height = 1;
int64 height = 1 [(cosmos_proto.scalar) = "cosmos.Int"];
// The transaction hash.
string txhash = 2 [(gogoproto.customname) = "TxHash"];
// Namespace for the Code
string codespace = 3;
// Response code.
uint32 code = 4;
uint32 code = 4 [(cosmos_proto.scalar) = "cosmos.Int"];
// Result bytes, if any.
string data = 5;
// The output of the application's logger (raw string). May be
Expand All @@ -30,9 +31,9 @@ message TxResponse {
// Additional information. May be non-deterministic.
string info = 8;
// Amount of gas requested for transaction.
int64 gas_wanted = 9;
int64 gas_wanted = 9 [(cosmos_proto.scalar) = "cosmos.Int"];
// Amount of gas consumed by transaction.
int64 gas_used = 10;
int64 gas_used = 10 [(cosmos_proto.scalar) = "cosmos.Int"];
// The request transaction bytes.
google.protobuf.Any tx = 11;
// Time of the previous block. For heights > 1, it's the weighted median of
Expand All @@ -45,7 +46,7 @@ message TxResponse {
message ABCIMessageLog {
option (gogoproto.stringer) = true;

uint32 msg_index = 1;
uint32 msg_index = 1 [(cosmos_proto.scalar) = "cosmos.Int"];
string log = 2;

// Events contains a slice of Event objects that were emitted during some
Expand All @@ -72,10 +73,10 @@ message Attribute {
// GasInfo defines tx execution gas context.
message GasInfo {
// GasWanted is the maximum units of work we allow this tx to perform.
uint64 gas_wanted = 1 [(gogoproto.moretags) = "yaml:\"gas_wanted\""];
uint64 gas_wanted = 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.moretags) = "yaml:\"gas_wanted\""];

// GasUsed is the amount of gas actually consumed.
uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\""];
uint64 gas_used = 2 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.moretags) = "yaml:\"gas_used\""];
}

// Result is the union of ResponseFormat and ResponseCheckTx.
Expand Down Expand Up @@ -125,7 +126,7 @@ message SearchTxsResult {
// Count of all txs
uint64 total_count = 1 [(gogoproto.moretags) = "yaml:\"total_count\"", (gogoproto.jsontag) = "total_count"];
// Count of txs in current page
uint64 count = 2;
uint64 count = 2 ;
// Index of current page, start from 1
uint64 page_number = 3 [(gogoproto.moretags) = "yaml:\"page_number\"", (gogoproto.jsontag) = "page_number"];
// Count of total pages
Expand Down
2 changes: 2 additions & 0 deletions proto/cosmos/base/query/v1beta1/pagination.proto
@@ -1,6 +1,8 @@
syntax = "proto3";
package cosmos.base.query.v1beta1;

import "cosmos_proto/cosmos.proto";
cyberbono3 marked this conversation as resolved.
Show resolved Hide resolved

option go_package = "github.com/cosmos/cosmos-sdk/types/query";

// PageRequest is to be embedded in gRPC request messages for efficient
Expand Down
1 change: 1 addition & 0 deletions proto/cosmos/base/snapshots/v1beta1/snapshot.proto
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package cosmos.base.snapshots.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/snapshots/types";

Expand Down
3 changes: 2 additions & 1 deletion proto/cosmos/base/store/v1beta1/commit_info.proto
Expand Up @@ -2,14 +2,15 @@ syntax = "proto3";
package cosmos.base.store.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/store/types";

// CommitInfo defines commit information used by the multi-store when committing
// a version/height.
message CommitInfo {
int64 version = 1;
repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false];
repeated StoreInfo store_infos = 2;
}

// StoreInfo defines store-specific commit information. It contains a reference
Expand Down
1 change: 1 addition & 0 deletions proto/cosmos/base/store/v1beta1/snapshot.proto
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package cosmos.base.store.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/store/types";

Expand Down
3 changes: 2 additions & 1 deletion proto/cosmos/base/tendermint/v1beta1/query.proto
Expand Up @@ -8,6 +8,7 @@ import "tendermint/p2p/types.proto";
import "tendermint/types/block.proto";
import "tendermint/types/types.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice";

Expand Down Expand Up @@ -71,7 +72,7 @@ message GetLatestValidatorSetResponse {

// Validator is the type for the validator-set.
message Validator {
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any pub_key = 2;
int64 voting_power = 3;
int64 proposer_priority = 4;
Expand Down
7 changes: 4 additions & 3 deletions proto/cosmos/base/v1beta1/coin.proto
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package cosmos.base.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/types";
option (gogoproto.goproto_stringer_all) = false;
Expand All @@ -26,15 +27,15 @@ message DecCoin {
option (gogoproto.equal) = true;

string denom = 1;
string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
string amount = 2 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
}

// IntProto defines a Protobuf wrapper around an Int object.
message IntProto {
string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
string int = 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
}

// DecProto defines a Protobuf wrapper around a Dec object.
message DecProto {
string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
string dec = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
}
1 change: 0 additions & 1 deletion proto/cosmos/capability/v1beta1/capability.proto
Expand Up @@ -9,7 +9,6 @@ import "gogoproto/gogo.proto";
// provided to a Capability must be globally unique.
message Capability {
option (gogoproto.goproto_stringer) = false;

uint64 index = 1 [(gogoproto.moretags) = "yaml:\"index\""];
}

Expand Down
3 changes: 2 additions & 1 deletion proto/cosmos/crisis/v1beta1/tx.proto
Expand Up @@ -4,6 +4,7 @@ package cosmos.crisis.v1beta1;
option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types";

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

// Msg defines the bank Msg service.
service Msg {
Expand All @@ -16,7 +17,7 @@ message MsgVerifyInvariant {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string sender = 1;
string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string invariant_module_name = 2 [(gogoproto.moretags) = "yaml:\"invariant_module_name\""];
string invariant_route = 3 [(gogoproto.moretags) = "yaml:\"invariant_route\""];
}
Expand Down