Skip to content

Commit cd3540b

Browse files
fix(client): panic math.LegacyDec deserialization (#20912)
1 parent 1cc3043 commit cd3540b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
3939

4040
### Bug Fixes
4141

42+
* (client) [#20912](https://github.com/cosmos/cosmos-sdk/pull/20912) Fix `math.LegacyDec` type deserialization in GRPC queries.
43+
4244
* (x/group) [#20750](https://github.com/cosmos/cosmos-sdk/pull/20750) x/group shouldn't claim "orm" error codespace. This prevents any chain Cosmos SDK `v0.47` chain to use the ORM module.
4345

4446
## [v0.47.12](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.12) - 2024-06-10

client/cmd.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ func ValidateCmd(cmd *cobra.Command, args []string) error {
9292
// - client.Context field pre-populated & flag not set: uses pre-populated value
9393
// - client.Context field pre-populated & flag set: uses set flag value
9494
func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Context, error) {
95-
if clientCtx.OutputFormat == "" || flagSet.Changed(cli.OutputFlag) {
96-
output, _ := flagSet.GetString(cli.OutputFlag)
97-
clientCtx = clientCtx.WithOutputFormat(output)
98-
}
99-
10095
if clientCtx.HomeDir == "" || flagSet.Changed(flags.FlagHome) {
10196
homeDir, _ := flagSet.GetString(flags.FlagHome)
10297
clientCtx = clientCtx.WithHomeDir(homeDir)
@@ -165,12 +160,20 @@ func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Cont
165160
})))
166161
}
167162

163+
dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(grpc.ForceCodec(clientCtx.gRPCCodec())))
164+
168165
grpcClient, err := grpc.Dial(grpcURI, dialOpts...)
169166
if err != nil {
170167
return Context{}, err
171168
}
172169
clientCtx = clientCtx.WithGRPCClient(grpcClient)
173170
}
171+
172+
// this should be last as gRPCCodec overwrites output flag to JSON
173+
if clientCtx.OutputFormat == "" || flagSet.Changed(cli.OutputFlag) {
174+
output, _ := flagSet.GetString(cli.OutputFlag)
175+
clientCtx = clientCtx.WithOutputFormat(output)
176+
}
174177
}
175178

176179
return clientCtx, nil

0 commit comments

Comments
 (0)