Skip to content

Commit

Permalink
chore: re-add IntProto and DecProto and deprecate msg (backport #22925)…
Browse files Browse the repository at this point in the history
… (#22928)

Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
mergify[bot] and julienrbrt authored Dec 17, 2024
1 parent bf4f3c7 commit 6634711
Show file tree
Hide file tree
Showing 5 changed files with 1,123 additions and 743 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
### API Breaking Changes

* (baseapp) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) `SetProtocolVersion` has been renamed to `SetAppVersion`. It now updates the consensus params in baseapp's `ParamStore`.
* (types) [#16918](https://github.com/cosmos/cosmos-sdk/pull/16918) Remove `IntProto` and `DecProto`. Instead, `math.Int` and `math.LegacyDec` should be used respectively. Both types support `Marshal` and `Unmarshal` which should be used for binary marshaling.
* (types) [#16918](https://github.com/cosmos/cosmos-sdk/pull/16918), [#22925](https://github.com/cosmos/cosmos-sdk/pull/22925) Deprecate `IntProto` and `DecProto`. Instead, `math.Int` and `math.LegacyDec` should be used respectively. Both types support `Marshal` and `Unmarshal` which should be used for binary marshaling.
* (client) [#17215](https://github.com/cosmos/cosmos-sdk/pull/17215) `server.StartCmd`,`server.ExportCmd`,`server.NewRollbackCmd`,`pruning.Cmd`,`genutilcli.InitCmd`,`genutilcli.GenTxCmd`,`genutilcli.CollectGenTxsCmd`,`genutilcli.AddGenesisAccountCmd`, do not take a home directory anymore. It is inferred from the root command.
* (client) [#17259](https://github.com/cosmos/cosmos-sdk/pull/17259) Remove deprecated `clientCtx.PrintObjectLegacy`. Use `clientCtx.PrintProto` or `clientCtx.PrintRaw` instead.
* (types) [#17348](https://github.com/cosmos/cosmos-sdk/pull/17348) Remove the `WrapServiceResult` function.
Expand Down
24 changes: 24 additions & 0 deletions proto/cosmos/base/v1beta1/coin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,27 @@ message DecCoin {
(gogoproto.nullable) = false
];
}

// IntProto defines a Protobuf wrapper around an Int object.
// Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal.
message IntProto {
option deprecated = true;

string int = 1 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

// DecProto defines a Protobuf wrapper around a Dec object.
// Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal.
message DecProto {
option deprecated = true;

string dec = 1 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];
}
12 changes: 12 additions & 0 deletions types/coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -955,3 +955,15 @@ func NormalizeCoins(coins []DecCoin) Coins {

return result
}

// ----------------------------------------------------------------------------

// Deprecated: Use math.Int instead.
func (ip IntProto) String() string {
return ip.Int.String()
}

// Deprecated: Use math.LegacyDec instead.
func (dp DecProto) String() string {
return dp.Dec.String()
}
Loading

0 comments on commit 6634711

Please sign in to comment.