-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consensus key seems different size when bech32-encoded #228
Comments
@greg-szabo it's using the public key formatting logic from tendermint-rs, so if something is wrong, it's a tendermint-rs bug: https://docs.rs/tendermint/0.16.0/tendermint/public_key/enum.PublicKey.html#method.to_bech32 It seems like it might be something to do with Amino vs Protobuf framing? I still don't understand the story around public keys and in particular Bech32 public keys going forward:
For it to print the key in Bech32, it needs to be able to determine what Bech32 prefix needs to be used. It presently does this in a somewhat janky way: https://github.com/iqlusioninc/tmkms/blob/develop/src/commands/yubihsm/keys/list.rs#L62-L72 If the key isn't configured for use in any particular chain, it can't determine the Bech32 prefix so it prints it as raw hex. |
Cool! As for the first part of the issue, I'll try to go through the SDK code too and see if I can find the discrepancy in Tendermint-rs. As for the second part, it would be easier to test for me if I had a way to delete consensus keys so I can just create/delete multiple keys. I couldn't find a |
There presently isn't support in TMKMS for deleting keys. You'd need to use |
Thanks for the pointer,
I'll look into the bech encoding in Tendermint next. |
The key needs to be in the keyring for one and only one chain, or else it will print hex. It should probably be changed to print the Bech32 for all registered chains. |
I believe this was fixed in informalsystems/tendermint-rs#690 |
It seems that the consensus key generated on the YubiHSM is different in size than the one generated by a simple gaiad command:
gaiad version:
cosmoshub-test-stargate
tmkms version:
0.10.0-alpha7
Compare size:
The first key was generated in the amino times, but the second key showed a same-size consensus key at generation.
Additionally, you can see that if a random label is used, then the key is not printed with the correct bech32 encoding.
The text was updated successfully, but these errors were encountered: