Skip to content

Commit 9fb691a

Browse files
mmsqemergify[bot]
authored andcommitted
feat(client): add consensus address for debug cmd (#20328)
Co-authored-by: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> (cherry picked from commit 11de280) # Conflicts: # CHANGELOG.md # client/debug/main.go
1 parent 5b6045c commit 9fb691a

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,34 @@ Ref: https://keepachangelog.com/en/1.0.0/
3838

3939
## [Unreleased]
4040

41+
<<<<<<< HEAD
42+
=======
43+
Every module contains its own CHANGELOG.md. Please refer to the module you are interested in.
44+
45+
### Features
46+
47+
* (tests) [#20013](https://github.com/cosmos/cosmos-sdk/pull/20013) Introduce system tests to run multi node local testnet in CI
48+
* (runtime) [#19953](https://github.com/cosmos/cosmos-sdk/pull/19953) Implement `core/transaction.Service` in runtime.
49+
* (client) [#19905](https://github.com/cosmos/cosmos-sdk/pull/19905) Add grpc client config to `client.toml`.
50+
* (runtime) [#19571](https://github.com/cosmos/cosmos-sdk/pull/19571) Implement `core/router.Service` in runtime. This service is present in all modules (when using depinject).
51+
* (types) [#19164](https://github.com/cosmos/cosmos-sdk/pull/19164) Add a ValueCodec for the math.Uint type that can be used in collections maps.
52+
* (types) [#19281](https://github.com/cosmos/cosmos-sdk/pull/19281) Added a new method, `IsGT`, for `types.Coin`. This method is used to check if a `types.Coin` is greater than another `types.Coin`.
53+
* (client) [#18557](https://github.com/cosmos/cosmos-sdk/pull/18557) Add `--qrcode` flag to `keys show` command to support displaying keys address QR code.
54+
* (client) [#18101](https://github.com/cosmos/cosmos-sdk/pull/18101) Add a `keyring-default-keyname` in `client.toml` for specifying a default key name, and skip the need to use the `--from` flag when signing transactions.
55+
* (tests) [#17868](https://github.com/cosmos/cosmos-sdk/pull/17868) Added helper method `SubmitTestTx` in testutil to broadcast test txns to test e2e tests.
56+
* (client) [#17513](https://github.com/cosmos/cosmos-sdk/pull/17513) Allow overwriting `client.toml`. Use `client.CreateClientConfig` in place of `client.ReadFromClientConfig` and provide a custom template and a custom config.
57+
* (runtime) [#18475](https://github.com/cosmos/cosmos-sdk/pull/18475) Adds an implementation for core.branch.Service.
58+
* (baseapp) [#18499](https://github.com/cosmos/cosmos-sdk/pull/18499) Add `MsgRouter` response type from message name function.
59+
* (types) [#18768](https://github.com/cosmos/cosmos-sdk/pull/18768) Add MustValAddressFromBech32 function.
60+
* (gRPC) [#19049](https://github.com/cosmos/cosmos-sdk/pull/19049) Add debug log prints for each gRPC request.
61+
* (x/consensus) [#19483](https://github.com/cosmos/cosmos-sdk/pull/19483) Add consensus messages registration to consensus module.
62+
* (types) [#19759](https://github.com/cosmos/cosmos-sdk/pull/19759) Align SignerExtractionAdapter in PriorityNonceMempool Remove.
63+
* (client) [#19870](https://github.com/cosmos/cosmos-sdk/pull/19870) Add new query command `wait-tx`. Alias `event-query-tx-for` to `wait-tx` for backward compatibility.
64+
* (crypto/keyring) [#20212](https://github.com/cosmos/cosmos-sdk/pull/20212) Expose the db keyring used in the keystore.
65+
* (genutil) [#19971](https://github.com/cosmos/cosmos-sdk/pull/19971) Allow manually setting the consensus key type in genesis
66+
* (debug) [#20328](https://github.com/cosmos/cosmos-sdk/pull/20328) Add consensus address for debug cmd.
67+
68+
>>>>>>> 11de28062 (feat(client): add consensus address for debug cmd (#20328))
4169
### Improvements
4270

4371
* (runtime) [#20264](https://github.com/cosmos/cosmos-sdk/pull/20264) Expose grpc query router via depinject.

client/debug/main.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ $ %s debug addr cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg
256256
var addr []byte
257257

258258
// try hex, then bech32
259+
<<<<<<< HEAD
259260
var err error
260261
addr, err = hex.DecodeString(addrString)
261262
if err != nil {
@@ -268,13 +269,55 @@ $ %s debug addr cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg
268269
if err3 != nil {
269270
return fmt.Errorf("expected hex or bech32. Got errors: hex: %v, bech32 acc: %v, bech32 val: %v", err, err2, err3)
270271
}
272+
=======
273+
var (
274+
addr []byte
275+
err error
276+
)
277+
decodeFns := []func(text string) ([]byte, error){
278+
hex.DecodeString,
279+
clientCtx.AddressCodec.StringToBytes,
280+
clientCtx.ValidatorAddressCodec.StringToBytes,
281+
clientCtx.ConsensusAddressCodec.StringToBytes,
282+
}
283+
errs := make([]any, 0, len(decodeFns))
284+
for _, fn := range decodeFns {
285+
if addr, err = fn(addrString); err == nil {
286+
break
287+
>>>>>>> 11de28062 (feat(client): add consensus address for debug cmd (#20328))
288+
}
289+
errs = append(errs, err)
290+
}
291+
if len(errs) == len(decodeFns) {
292+
errTags := []string{
293+
"hex", "bech32 acc", "bech32 val", "bech32 con",
294+
}
295+
format := ""
296+
for i := range errs {
297+
if format != "" {
298+
format += ", "
299+
}
300+
format += errTags[i] + ": %w"
271301
}
302+
return fmt.Errorf("expected hex or bech32. Got errors: "+format, errs...)
272303
}
273304

305+
<<<<<<< HEAD
274306
cmd.Println("Address:", addr)
275307
cmd.Printf("Address (hex): %X\n", addr)
276308
cmd.Printf("Bech32 Acc: %s\n", sdk.AccAddress(addr))
277309
cmd.Printf("Bech32 Val: %s\n", sdk.ValAddress(addr))
310+
=======
311+
acc, _ := clientCtx.AddressCodec.BytesToString(addr)
312+
val, _ := clientCtx.ValidatorAddressCodec.BytesToString(addr)
313+
con, _ := clientCtx.ConsensusAddressCodec.BytesToString(addr)
314+
315+
cmd.Println("Address:", addr)
316+
cmd.Printf("Address (hex): %X\n", addr)
317+
cmd.Printf("Bech32 Acc: %s\n", acc)
318+
cmd.Printf("Bech32 Val: %s\n", val)
319+
cmd.Printf("Bech32 Con: %s\n", con)
320+
>>>>>>> 11de28062 (feat(client): add consensus address for debug cmd (#20328))
278321
return nil
279322
},
280323
}

0 commit comments

Comments
 (0)