Skip to content

Commit

Permalink
fix: remove json tag (cosmos#10598)
Browse files Browse the repository at this point in the history
* remove json tag

* fix compile

* add changelog entry for breaking changes

* remove last two jsontags

* move chaglog to client

* add json_name to pubkey

* fix build

* fix some json tags in tests

* remove ormpb
  • Loading branch information
tac0turtle authored Dec 20, 2021
1 parent c3f4072 commit 3cbc38d
Show file tree
Hide file tree
Showing 17 changed files with 947 additions and 927 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ Ref: https://keepachangelog.com/en/1.0.0/

* [\#9594](https://github.com/cosmos/cosmos-sdk/pull/9594) Remove legacy REST API. Please see the [REST Endpoints Migration guide](https://docs.cosmos.network/master/migrations/rest.html) to migrate to the new REST endpoints.
* [\#9995](https://github.com/cosmos/cosmos-sdk/pull/9995) Increased gas cost for creating proposals.
* [\#10598](https://github.com/cosmos/cosmos-sdk/pull/10598) Remove `gogoproto.json_tag` from all proto files.
- The affected fields are:
- Message Proposal in goverance `id` is now `proposal_id`
- Message `MsgUnjail` `address` is no `validator_addr`
- Message `GenesisState` json representation of Gentxs is now `gen_txs`, previously `gentxs`
- Message `DelegatorStartingInfo` json representation of Height is now `height`, previously `creation_height`

### CLI Breaking Changes

Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/auth/v1beta1/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ message BaseAccount {
option (cosmos_proto.implements_interface) = "AccountI";

string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty"];
google.protobuf.Any pub_key = 2 [json_name = "public_key"];
uint64 account_number = 3;
uint64 sequence = 4;
}
Expand Down
6 changes: 3 additions & 3 deletions proto/cosmos/base/abci/v1beta1/abci.proto
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ message SearchTxsResult {
option (gogoproto.stringer) = true;

// Count of all txs
uint64 total_count = 1 [(gogoproto.jsontag) = "total_count"];
uint64 total_count = 1;
// Count of txs in current page
uint64 count = 2;
// Index of current page, start from 1
uint64 page_number = 3 [(gogoproto.jsontag) = "page_number"];
uint64 page_number = 3;
// Count of total pages
uint64 page_total = 4 [(gogoproto.jsontag) = "page_total"];
uint64 page_total = 4;
// Max count txs per page
uint64 limit = 5;
// List of txs in current page
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/distribution/v1beta1/distribution.proto
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ message DelegatorStartingInfo {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
uint64 height = 3 [(gogoproto.jsontag) = "creation_height"];
uint64 height = 3;
}

// DelegationDelegatorReward represents the properties
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/genutil/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/genutil/types";
// GenesisState defines the raw genesis transaction in JSON.
message GenesisState {
// gen_txs defines the genesis transactions.
repeated bytes gen_txs = 1 [(gogoproto.casttype) = "encoding/json.RawMessage", (gogoproto.jsontag) = "gentxs"];
repeated bytes gen_txs = 1 [(gogoproto.casttype) = "encoding/json.RawMessage"];
}
19 changes: 7 additions & 12 deletions proto/cosmos/gov/v1beta1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ message Deposit {
message Proposal {
option (gogoproto.equal) = true;

uint64 proposal_id = 1 [(gogoproto.jsontag) = "id"];
uint64 proposal_id = 1;
google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"];
ProposalStatus status = 3;
TallyResult final_tally_result = 4 [(gogoproto.nullable) = false];
Expand Down Expand Up @@ -151,24 +151,22 @@ message DepositParams {
// Minimum deposit for a proposal to enter voting period.
repeated cosmos.base.v1beta1.Coin min_deposit = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.jsontag) = "min_deposit,omitempty"
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];

// Maximum period for Atom holders to deposit on a proposal. Initial value: 2
// months.
google.protobuf.Duration max_deposit_period = 2 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.jsontag) = "max_deposit_period,omitempty"
(gogoproto.stdduration) = true
];
}

// VotingParams defines the params for voting on governance proposals.
message VotingParams {
// Length of the voting period.
google.protobuf.Duration voting_period = 1
[(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.jsontag) = "voting_period,omitempty"];
[(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
}

// TallyParams defines the params for tallying votes on governance proposals.
Expand All @@ -177,22 +175,19 @@ message TallyParams {
// considered valid.
bytes quorum = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "quorum,omitempty"
(gogoproto.nullable) = false
];

// Minimum proportion of Yes votes for proposal to pass. Default value: 0.5.
bytes threshold = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "threshold,omitempty"
(gogoproto.nullable) = false
];

// Minimum value of Veto votes to Total votes ratio for proposal to be
// vetoed. Default value: 1/3.
bytes veto_threshold = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "veto_threshold,omitempty"
(gogoproto.nullable) = false
];
}
6 changes: 3 additions & 3 deletions proto/cosmos/gov/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ message MsgSubmitProposal {

// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.
message MsgSubmitProposalResponse {
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
uint64 proposal_id = 1;
}

// MsgVote defines a message to cast a vote.
Expand All @@ -52,7 +52,7 @@ message MsgVote {
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;

uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
uint64 proposal_id = 1;
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
VoteOption option = 3;
}
Expand Down Expand Up @@ -86,7 +86,7 @@ message MsgDeposit {
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;

uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
uint64 proposal_id = 1;
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
Expand Down
4 changes: 2 additions & 2 deletions proto/cosmos/slashing/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ message MsgUnjail {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = true;

string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "address"];
string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgUnjailResponse defines the Msg/Unjail response type
message MsgUnjailResponse {}
message MsgUnjailResponse {}
6 changes: 2 additions & 4 deletions proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ message UnbondingDelegation {
// validator_address is the bech32-encoded address of the validator.
string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// entries are the unbonding delegation entries.
repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false]; // unbonding delegation entries
repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false]; // unbonding delegation entries
}

// UnbondingDelegationEntry defines an unbonding object with relevant metadata.
Expand Down Expand Up @@ -277,7 +277,7 @@ message Redelegation {
// validator_dst_address is the validator redelegation destination operator address.
string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// entries are the redelegation entries.
repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries
repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries
}

// Params defines the parameters for the staking module.
Expand Down Expand Up @@ -346,12 +346,10 @@ message Pool {
string not_bonded_tokens = 1 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.jsontag) = "not_bonded_tokens",
(gogoproto.nullable) = false
];
string bonded_tokens = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.jsontag) = "bonded_tokens",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
Expand Down
Loading

0 comments on commit 3cbc38d

Please sign in to comment.