-
Notifications
You must be signed in to change notification settings - Fork 33
[2.0.0-dev] when outputting K1 public keys, always use PUB_K1_ format
#1561
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
Conversation
|
This LGTM. An ability to convert between the two formats seems like it would be useful. I would expect people to want a easy way to convert the |
Why not |
I see |
|
I tend to think cleos is the right spot too. Interestingly we already have a |
programs/cleos/main.cpp
Outdated
| }); | ||
| // output public key in new format | ||
| auto public_key_to_new = convert->add_subcommand("print_public_key_as_new", localized("Output a public key in new format (PUB_K1, PUB_R1, PUB_WA)")); | ||
| public_key_to_new->add_option("public_key", public_key_to_convert, localized("Public key to output in new format"))->required(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to come up with something better then 'new format' but 🤷♀️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generic ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think print_ is a bit verbose. Maybe convert public_key_as_legacy. Seems like print is implied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does convert imply that only one input format is allowed? We can get around naming the "new format" entirely by saying something like convert_public_key_from_legacy and convert_public_key_to_legacy. I was initially a little worried about using this phrasing because I want convert_public_key_from_legacy to pass through "new format" keys too (i.e. it doesn't require the input key to be legacy), because that makes it more useful in scripting environments imo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage: ./cleos convert [OPTIONS] SUBCOMMAND
Options:
-h,--help Print this help message and exit
--help-all Show all help
Subcommands:
pack_transaction From plain signed JSON to packed form
unpack_transaction From packed to plain signed JSON form
pack_action_data From JSON action data to packed form
unpack_action_data From packed to JSON action data form
Existing convert is what it is converting to.
To be consistent I think it would be:
legacy_public_key From existing public key to legacy form, i.e. EOS..
public_key From existing public key to canonical form, i.e. PUB_..
Other ideas instead of canonical: new, generic, standard, current
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I don't like about "new", "current", "updated", etc is that it implies it's.. well.. new. But it's not new it has been there since 1.0. "standard" may imply something more broadly standardized (think 'industry standard') so I don't think that's the best choice either.
So I would probably lean to "canonical". My one concern with it is that in this ball park there is already the concept of 'canonical signatures' and maybe that's overusing the word but oh well -- if it's most appropriate it's most appropriate.
I also considered "normalized" but I think canonical is still more appropriate than that.
doesn't seem right. just let exceptions escape (and cause failure) instead
|
There are quite a few |
|
I don't see any reason this can't target |
|
Don't think it's too breaking for a minor release? I'm not sure I can think of anything downstream it'll specifically break. Anyone who does some sort of string validation that a public key is EOS will have a problem, but hopefully no one is doing that any longer. Since 1.3/1.4 would not be a required upgrade it may be surprising for users to encounter difference responses on different endpoints if they continue to use some 1.0-1.2 endpoints. (but that's something that would have occurred during 2.0 upgrade too, though more limited in time where there would be a mix of 1.x and 2.0) You can bring it up in the team call. |
Actually, I forgot the default changed. I was thinking only of the new |
|
huh well yeah we could still split out the cleos convert functionality to main to be able to point to that as part of 1.3 deprecation notice. But I'm not sure it's really worth it. |
Probably not, lived without it this long. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the PR description, as now the commands are cleos convert legacy_public_key and cleos convert public_key.
|
Maybe it is too late. I feel the command names |
|
Not too late for changes I still need to go through and handle this (I expected to do this sooner which is why I didn't move to draft but now I'm not sure when I'll come back around to finish it off)
Yeah it's tough... I feel like currently it's no worse than existing subcommands here though. |
Yes, the existing |
|
But subcommands are shown in |
actually now that I stumbled on accounts.json I'll do a separate PR that scrubs all legacy keys, since it'll be touching dozens of megabytes |
Change nodeos/cleos/keosd to output K1 public keys in the
PUB_K1_format instead of the "legacy"EOS...format. Legacy K1 public keys that begin withEOSare still accepted as input, but spring will only output these keys asPUB_K1.... This effects everything fromcleos wallet keysto nodeos' RPC replies (which means even an old cleos will still display keys asPUB_K1...since nodeos will have returned those part of its reply).Two commands have been added to
cleos convert:print_public_key_as_legacyandprint_public_key_as_new. These commands will always print the given key in the respective format. (only K1 keys different between legacy and new).Work on #1518
Related: VaultaFoundation/mandel#44 EOSIO/eos#5155