Skip to content

Commit

Permalink
Proto Auditing: Replace ID with Id (cosmos#7032)
Browse files Browse the repository at this point in the history
* Proto Auditing: Replace ID with Id

* make proto-gen

* Update docs

Co-authored-by: Federico Kunze <[email protected]>
  • Loading branch information
amaury1093 and fedekunze authored Aug 14, 2020
1 parent 3735b18 commit 5559af8
Show file tree
Hide file tree
Showing 103 changed files with 1,925 additions and 1,964 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ be used to retrieve the actual proposal `Content`. Also the `NewMsgSubmitProposa
* (modules) [\#6834](https://github.com/cosmos/cosmos-sdk/issues/6834) Add `RegisterInterfaces` method to `AppModuleBasic` to support registration of protobuf interface types.
* (modules) [\#6734](https://github.com/cosmos/cosmos-sdk/issues/6834) Add `TxEncodingConfig` parameter to `AppModuleBasic.ValidateGenesis` command to support JSON tx decoding in `genutil`.
* (genesis) [\#7000](https://github.com/cosmos/cosmos-sdk/pull/7000) The root `GenesisState` is now decoded using `encoding/json` instead of amino so `int64` and `uint64` types are now encoded as integers as opposed to strings.
* (types) [\#7032](https://github.com/cosmos/cosmos-sdk/pull/7032) All types ending with `ID` (e.g. `ProposalID`) now end with `Id` (e.g. `ProposalId`), to match default Protobuf generated format. Also see [\#7033](https://github.com/cosmos/cosmos-sdk/pull/7033) for more details.


### Features
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/base/store/v1beta1/commit_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ message CommitInfo {
// between a store name and the commit ID.
message StoreInfo {
string name = 1;
CommitID commit_id = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "CommitID"];
CommitID commit_id = 2 [(gogoproto.nullable) = false];
}

// CommitID defines the committment information when a specific store is
Expand Down
1 change: 0 additions & 1 deletion proto/cosmos/gov/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
message GenesisState{
// starting_proposal_id is the ID of the starting proposal.
uint64 starting_proposal_id = 1 [
(gogoproto.customname) = "StartingProposalID",
(gogoproto.moretags) = "yaml:\"starting_proposal_id\""
];
// deposits defines all the deposits present at genesis.
Expand Down
10 changes: 6 additions & 4 deletions proto/cosmos/gov/v1beta1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ message TextProposal {
message Deposit {
option (gogoproto.equal) = true;

uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID", (gogoproto.moretags) = "yaml:\"proposal_id\""];
uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""];
bytes depositor = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
Expand All @@ -54,8 +54,10 @@ message Deposit {
message Proposal {
option (gogoproto.equal) = true;

uint64 proposal_id = 1
[(gogoproto.customname) = "ProposalID", (gogoproto.jsontag) = "id", (gogoproto.moretags) = "yaml:\"id\""];
uint64 proposal_id = 1 [
(gogoproto.jsontag) = "id",
(gogoproto.moretags) = "yaml:\"id\""
];
google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"];
ProposalStatus status = 3 [(gogoproto.moretags) = "yaml:\"proposal_status\""];
TallyResult final_tally_result = 4
Expand Down Expand Up @@ -112,7 +114,7 @@ message TallyResult {
message Vote {
option (gogoproto.equal) = true;

uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID", (gogoproto.moretags) = "yaml:\"proposal_id\""];
uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""];
bytes voter = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
VoteOption option = 3;
}
Expand Down
2 changes: 0 additions & 2 deletions proto/cosmos/gov/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ message MsgVote {

uint64 proposal_id = 1 [
(gogoproto.jsontag) = "proposal_id",
(gogoproto.customname) = "ProposalID",
(gogoproto.moretags) = "yaml:\"proposal_id\""
];
bytes voter = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
Expand All @@ -45,7 +44,6 @@ message MsgDeposit {

uint64 proposal_id = 1 [
(gogoproto.jsontag) = "proposal_id",
(gogoproto.customname) = "ProposalID",
(gogoproto.moretags) = "yaml:\"proposal_id\""
];
bytes depositor = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
Expand Down
36 changes: 18 additions & 18 deletions proto/ibc/channel/channel.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import "gogoproto/gogo.proto";
// MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It is
// called by a relayer on Chain A.
message MsgChannelOpenInit {
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
Channel channel = 3 [(gogoproto.nullable) = false];
bytes signer = 4 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel
// on Chain B.
message MsgChannelOpenTry {
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
Channel channel = 3 [(gogoproto.nullable) = false];
string counterparty_version = 4 [(gogoproto.moretags) = "yaml:\"counterparty_version\""];
bytes proof_init = 5 [(gogoproto.moretags) = "yaml:\"proof_init\""];
Expand All @@ -29,8 +29,8 @@ message MsgChannelOpenTry {
// MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge
// the change of channel state to TRYOPEN on Chain B.
message MsgChannelOpenAck {
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
string counterparty_version = 3 [(gogoproto.moretags) = "yaml:\"counterparty_version\""];
bytes proof_try = 4 [(gogoproto.moretags) = "yaml:\"proof_try\""];
uint64 proof_height = 5 [(gogoproto.moretags) = "yaml:\"proof_height\""];
Expand All @@ -40,8 +40,8 @@ message MsgChannelOpenAck {
// MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to acknowledge
// the change of channel state to OPEN on Chain A.
message MsgChannelOpenConfirm {
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
bytes proof_ack = 3 [(gogoproto.moretags) = "yaml:\"proof_ack\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 5 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
Expand All @@ -50,16 +50,16 @@ message MsgChannelOpenConfirm {
// MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain A
// to close a channel with Chain B.
message MsgChannelCloseInit {
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
bytes signer = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B
// to acknowledge the change of channel state to CLOSED on Chain A.
message MsgChannelCloseConfirm {
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
bytes proof_init = 3 [(gogoproto.moretags) = "yaml:\"proof_init\""];
uint64 proof_height = 4 [(gogoproto.moretags) = "yaml:\"proof_height\""];
bytes signer = 5 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
Expand Down Expand Up @@ -127,9 +127,9 @@ message IdentifiedChannel {
// opaque channel version, which is agreed upon during the handshake
string version = 5;
// port identifier
string port_id = 6 [(gogoproto.customname) = "PortID"];
string port_id = 6;
// channel identifier
string channel_id = 7 [(gogoproto.customname) = "ChannelID"];
string channel_id = 7;
}

// State defines if a channel is in one of the following states:
Expand Down Expand Up @@ -167,9 +167,9 @@ message Counterparty {
option (gogoproto.goproto_getters) = false;

// port on the counterparty chain which owns the other end of the channel.
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
// channel end on the counterparty chain
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
}

// Packet defines a type that carries data across different chains through IBC
Expand Down Expand Up @@ -202,9 +202,9 @@ message PacketAckCommitment {
option (gogoproto.goproto_getters) = false;

// channel port identifier.
string port_id = 1 [(gogoproto.customname) = "PortID", (gogoproto.moretags) = "yaml:\"port_id\""];
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
// channel unique identifier.
string channel_id = 2 [(gogoproto.customname) = "ChannelID", (gogoproto.moretags) = "yaml:\"channel_id\""];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
// packet sequence.
uint64 sequence = 3;
// packet commitment hash.
Expand Down
2 changes: 0 additions & 2 deletions proto/ibc/channel/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ message GenesisState {
// next send and receive sequences.
message PacketSequence {
string port_id = 1 [
(gogoproto.customname) = "PortID",
(gogoproto.moretags) = "yaml:\"port_id\""
];
string channel_id = 2 [
(gogoproto.customname) = "ChannelID",
(gogoproto.moretags) = "yaml:\"channel_id\""
];
uint64 sequence = 3;
Expand Down
38 changes: 18 additions & 20 deletions proto/ibc/channel/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ syntax = "proto3";
package ibc.channel;

import "ibc/client/client.proto";
import "gogoproto/gogo.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "ibc/channel/channel.proto";
import "google/protobuf/any.proto";
Expand Down Expand Up @@ -68,9 +67,9 @@ service Query {
// QueryChannelRequest is the request type for the Query/Channel RPC method
message QueryChannelRequest {
// port unique identifier
string port_id = 1 [(gogoproto.customname) = "PortID"];
string port_id = 1;
// channel unique identifier
string channel_id = 2 [(gogoproto.customname) = "ChannelID"];
string channel_id = 2;
}

// QueryChannelResponse is the response type for the Query/Channel RPC method.
Expand Down Expand Up @@ -127,9 +126,9 @@ message QueryConnectionChannelsResponse {
// RPC method
message QueryChannelClientStateRequest {
// port unique identifier
string port_id = 1 [(gogoproto.customname) = "PortID"];
string port_id = 1;
// channel unique identifier
string channel_id = 2 [(gogoproto.customname) = "ChannelID"];
string channel_id = 2;
}

// QueryChannelClientStateResponse is the Response type for the
Expand All @@ -149,9 +148,9 @@ message QueryChannelClientStateResponse {
// Query/ConsensusState RPC method
message QueryChannelConsensusStateRequest {
// port unique identifier
string port_id = 1 [(gogoproto.customname) = "PortID"];
string port_id = 1;
// channel unique identifier
string channel_id = 2 [(gogoproto.customname) = "ChannelID"];
string channel_id = 2;
// height of the consensus state
uint64 height = 3;
}
Expand All @@ -162,7 +161,7 @@ message QueryChannelConsensusStateResponse {
// consensus state associated with the channel
google.protobuf.Any consensus_state = 1;
// client ID associated with the consensus state
string client_id = 2 [(gogoproto.customname) = "ClientID"];
string client_id = 2;
// merkle proof of existence
bytes proof = 3;
// merkle proof path
Expand All @@ -175,9 +174,9 @@ message QueryChannelConsensusStateResponse {
// Query/PacketCommitment RPC method
message QueryPacketCommitmentRequest {
// port unique identifier
string port_id = 1 [(gogoproto.customname) = "PortID"];
string port_id = 1;
// channel unique identifier
string channel_id = 2 [(gogoproto.customname) = "ChannelID"];
string channel_id = 2;
// packet sequence
uint64 sequence = 3;
}
Expand All @@ -200,9 +199,9 @@ message QueryPacketCommitmentResponse {
// Query/QueryPacketCommitments RPC method
message QueryPacketCommitmentsRequest {
// port unique identifier
string port_id = 1 [(gogoproto.customname) = "PortID"];
string port_id = 1;
// channel unique identifier
string channel_id = 2 [(gogoproto.customname) = "ChannelID"];
string channel_id = 2;
// pagination request
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}
Expand All @@ -221,9 +220,9 @@ message QueryPacketCommitmentsResponse {
// Query/PacketAcknowledgement RPC method
message QueryPacketAcknowledgementRequest {
// port unique identifier
string port_id = 1 [(gogoproto.customname) = "PortID"];
string port_id = 1;
// channel unique identifier
string channel_id = 2 [(gogoproto.customname) = "ChannelID"];
string channel_id = 2;
// packet sequence
uint64 sequence = 3;
}
Expand All @@ -246,12 +245,11 @@ message QueryPacketAcknowledgementResponse {
// Query/UnrelayedPackets RPC method
message QueryUnrelayedPacketsRequest {
// port unique identifier
string port_id = 1 [(gogoproto.customname) = "PortID"];
string port_id = 1;
// channel unique identifier
string channel_id = 2 [(gogoproto.customname) = "ChannelID"];
string channel_id = 2;
// list of packet sequences
repeated uint64 packet_commitment_sequences = 3
[(gogoproto.customname) = "PacketCommitmentSequences"];
repeated uint64 packet_commitment_sequences = 3;
// flag indicating if the return value is packet commitments or
// acknowledgements
bool acknowledgements = 4;
Expand All @@ -270,9 +268,9 @@ message QueryUnrelayedPacketsResponse {
// Query/QueryNextSequenceReceiveRequest RPC method
message QueryNextSequenceReceiveRequest {
// port unique identifier
string port_id = 1 [(gogoproto.customname) = "PortID"];
string port_id = 1;
// channel unique identifier
string channel_id = 2 [(gogoproto.customname) = "ChannelID"];
string channel_id = 2;
}

// QuerySequenceResponse is the request type for the
Expand Down
2 changes: 1 addition & 1 deletion proto/ibc/client/client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import "google/protobuf/any.proto";
message IdentifiedClientState {
option (gogoproto.goproto_getters) = false;
// client identifier
string id = 1 [(gogoproto.customname) = "ID", (gogoproto.moretags) = "yaml:\"id\""];
string id = 1 [(gogoproto.moretags) = "yaml:\"id\""];
google.protobuf.Any client_state = 2;
}
5 changes: 1 addition & 4 deletions proto/ibc/client/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ import "google/protobuf/any.proto";
// GenesisClientState defines an identified ClientState as protobuf Any format.
message GenesisClientState {
string client_id = 1 [
(gogoproto.customname) = "ClientID",
(gogoproto.moretags) = "yaml:\"client_id\""
];
google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""];
}

// ClientConsensusStates defines all the stored consensus states for a given client.
message ClientConsensusStates {
string client_id = 1 [
(gogoproto.customname) = "ClientID"
];
string client_id = 1;
repeated google.protobuf.Any consensus_states = 2 [
(gogoproto.moretags) = "yaml:\"consensus_states\""
];
Expand Down
Loading

0 comments on commit 5559af8

Please sign in to comment.