Skip to content

Commit

Permalink
fix(client): panic math.LegacyDec deserialization (#20912)
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilkumarpilli committed Jul 15, 2024
1 parent 1cc3043 commit cd3540b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (client) [#20912](https://github.com/cosmos/cosmos-sdk/pull/20912) Fix `math.LegacyDec` type deserialization in GRPC queries.

* (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.

## [v0.47.12](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.12) - 2024-06-10
Expand Down
13 changes: 8 additions & 5 deletions client/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ func ValidateCmd(cmd *cobra.Command, args []string) error {
// - client.Context field pre-populated & flag not set: uses pre-populated value
// - client.Context field pre-populated & flag set: uses set flag value
func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Context, error) {
if clientCtx.OutputFormat == "" || flagSet.Changed(cli.OutputFlag) {
output, _ := flagSet.GetString(cli.OutputFlag)
clientCtx = clientCtx.WithOutputFormat(output)
}

if clientCtx.HomeDir == "" || flagSet.Changed(flags.FlagHome) {
homeDir, _ := flagSet.GetString(flags.FlagHome)
clientCtx = clientCtx.WithHomeDir(homeDir)
Expand Down Expand Up @@ -165,12 +160,20 @@ func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Cont
})))
}

dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(grpc.ForceCodec(clientCtx.gRPCCodec())))

grpcClient, err := grpc.Dial(grpcURI, dialOpts...)
if err != nil {
return Context{}, err
}
clientCtx = clientCtx.WithGRPCClient(grpcClient)
}

// this should be last as gRPCCodec overwrites output flag to JSON
if clientCtx.OutputFormat == "" || flagSet.Changed(cli.OutputFlag) {
output, _ := flagSet.GetString(cli.OutputFlag)
clientCtx = clientCtx.WithOutputFormat(output)
}
}

return clientCtx, nil
Expand Down

0 comments on commit cd3540b

Please sign in to comment.