Make show-validator kms aware#2975
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2975 +/- ##
===========================================
- Coverage 56.29% 56.11% -0.18%
===========================================
Files 120 120
Lines 8406 8432 +26
===========================================
Hits 4732 4732
- Misses 3352 3378 +26
Partials 322 322 |
| return &cmd | ||
| } | ||
|
|
||
| //This is a copy of a the same function from Tendermint. |
There was a problem hiding this comment.
Could we import it from Tendermint then?
There was a problem hiding this comment.
For that it would be needed to be exported/public first.
There was a problem hiding this comment.
Is there a reason for it not to be, if other code (e.g. the SDK) is likely to want to use it?
There was a problem hiding this comment.
Yes, you are probably right. If this is the only use-case (return the remote signer's pub-key), we might consider adding a simple method that does exactly this instead. I thought privValidator.GetPubKey() does exactly this (as it sends a request in the remote case and returns what was read from the file in the FilePV case). Have not tried if this works though.
There was a problem hiding this comment.
OK, it's not as simple as this. I think, a way to make this work without changing the tendermint API: add a flag --priv_validator_laddr to this command. If this is not empty (e.g. --priv_validator_laddr=tcp://127.0.0.1:26659), spin up a tendermint node (like in the start sub-command), get the validator object via:
pubKey := tmNode.PrivValidator().GetPubKey() // this might err (currently even panic) if remote signer is not avail.
pk, _ := types.Bech32ifyConsPub(pubKey)
fmt.Println(pk)Alternatively, the method below createAndStartPrivValidatorSocketClient could be exported.
|
Is there a way to implement a unit test for this? |
Would be more like an integration test: spin up a remote signer and see if the |
|
|
||
| //Check to see if there is valid KMS url | ||
| if cfg.PrivValidator != "" { | ||
| privval, err := createAndStartPrivValidatorSocketClient(cfg.PrivValidator, ctx.Logger) |
There was a problem hiding this comment.
This won't work. cfg.PrivValidator will contain config/priv_validator.json while createAndStartPrivValidatorSocketClient expects a listen address.
|
@liamsi Are you working on this PR? |
|
It looks like we're fixing this upstream - @liamsi is that correct / can we close this? |
Make the
show-validatorcommand aware of the KMS and pull a public key from the kmsdocs/)PENDING.mdwith issue #Files changedin the github PR explorerFor Admin Use: