Skip to content

Commit

Permalink
Check if validator pubkey is nil before setting it (sei-protocol#137)
Browse files Browse the repository at this point in the history
## Describe your changes and provide context
`seid status` fails for non-validator nodes. It turns out that the check
for `ValidatorInfo.Pubkey` here
https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/status.go#L52
isn't in our branch, which causes it to fail with a nil pointer.
## Testing performed to validate your change
Verified and tested on rpc node:
```
/home/ubuntu/sei-chain# seid status | jq
{
  "NodeInfo": {
    "protocol_version": {
      "p2p": "8",
      "block": "11",
...
```
  • Loading branch information
philipsu522 authored Jan 19, 2023
1 parent c967a06 commit 4a8a244
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/rpc/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ func StatusCommand() *cobra.Command {
return err
}

var pk cryptotypes.PubKey
// `status` has TM pubkeys, we need to convert them to our pubkeys.
pk, err := cryptocodec.FromTmPubKeyInterface(status.ValidatorInfo.PubKey)
if err != nil {
return err
if status.ValidatorInfo.PubKey != nil {
pk, err = cryptocodec.FromTmPubKeyInterface(status.ValidatorInfo.PubKey)
if err != nil {
return err
}
}

statusWithPk := resultStatus{
NodeInfo: status.NodeInfo,
SyncInfo: status.SyncInfo,
Expand Down

0 comments on commit 4a8a244

Please sign in to comment.