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

chore: re-add IntProto and DecProto and deprecate msg (backport #22925) #22928

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading