-
Notifications
You must be signed in to change notification settings - Fork 353
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
Add generate_bls_to_execution_change
#313
Conversation
34fc753
to
8ee1f9c
Compare
8ee1f9c
to
42cd2ce
Compare
42cd2ce
to
6a4ba11
Compare
genesis_validator_root=devnet_chain_setting_dict['genesis_validator_root'], | ||
) | ||
|
||
# TODO: generate multiple? |
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.
yes, please kind sir allow for the bulk bonus feature mentioned here https://notes.ethereum.org/YGWpjmGHQceeq1gijiZuJg
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.
Still reviewing the logic in-depth, but this like a good start.
num_keys=num_validators, | ||
amounts=amounts, | ||
chain_setting=chain_setting, | ||
start_index=validator_start_index, |
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.
this validator_start_index throws an uncaught exception if the user misenters, you can't tell from the response that this was incorrect and user probably might not know what the right answer is.
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.
Hey @james-prysm could you elaborate on this case more? I tried to input random English and the cli did detect my wrong input and asked for re-input. What was the testing input you used?
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 broke it :)
https://gist.github.com/infosecual/d7de7005bf54732a863dce21d503e445
using "1,2,3,4,5,6,7,8,9,10"
as the input to: Please enter a list of the old BLS withdrawal credentials of your validator(s). Split multiple items with whitespaces or commas.:
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.
@hwwhww I totally missed this, put in the wrong validator_start_index with the corresponding validator indexs and it broke.
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.
use case is
using a mnemonic of 1800 keys, 0~1799 index
input for validator_start_index: 1
validator_index: 0
withdrawal_credentials: 0x004652a99d8c9278708a98dab2c09b45cf09ea732037a17583ae2513a329fd8a
execution_address:
i get the following error
File "staking_deposit/utils/validation.py", line 246, in validate_bls_withdrawal_credentials_matching staking_deposit.exceptions.ValidationError: The given withdrawal credentials is matching the old BLS withdrawal credentials that mnemonic generated. [76365] Failed to execute script 'deposit' due to unhandled exception!
if i used validator_start_index:0 it works
amounts=amounts, | ||
chain_setting=chain_setting, | ||
start_index=validator_start_index, | ||
hex_eth1_withdrawal_address=execution_address, |
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.
can both non hex and hex be handled? or if the error for non hex lets the user know,I believe some users will get the withdrawal pub key from the intial deposit.json which doesn't have 0x
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.
bls_withdrawal_credentials_list
can be with 0x
prefix or no 0x
.
eth1_withdrawal_address
requires the checksum form and 0x
prefix.
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.
@hwwhww Does this mean if the user pastes an all lowercase address it will be blocked?
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.
@wackerow
in a very edge case, an all-number address is a valid checksum address 😄 but I understand what you mean, yes, the input addresses have to be checksummed and capital letters matter.
list(key for key in ALL_CHAINS.keys() if key != PRATER) | ||
), | ||
) | ||
@load_mnemonic_arguments_decorator |
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.
can we have a prompt or something to make sure the user is doing this offline? to get the signatures in an airgapped location or something.
|
||
|
||
if __name__ == '__main__': | ||
check_python_version() | ||
print('\n***Using the tool on an offline and secure device is highly recommended to keep your mnemonic safe.***\n') |
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.
@james-prysm, per https://github.com/ethereum/staking-deposit-cli/pull/313/files#r1087833602, I made a warning at the beginning.
Hey @CarlBeek It is printed before we select language now because I'm not sure how to print/echo the message before the user input sensitive data. do you have an idea of how to make it translatable?
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 don't see an obvious way of doing so, unfortunately
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.
Fantastic work on this epic PR @hwwhww!
Having reviewed this again, I think we can move to merge this into dev
. The core logic seems good to me.
That said, I do think there we need a bit more polish before putting this in front of mainnet
users things like:
- clarifying the wording around the different types of indices
- stretch goal, we calculate the
start_index
from the withdrawal credentials
- stretch goal, we calculate the
- try remove all the
eth1
verbiage - Clean up the warning messages a bit, I think we've taken them overboard and users will get lost/numbed
I have a few nit-picky things I noticed while doing a security review, none enough of an issue to stop merging to |
@@ -168,6 +169,22 @@ Success! | |||
Your keys can be found at: <YOUR_FOLDER_PATH> | |||
``` | |||
|
|||
###### `generate-bls-to-execution-change` Arguments | |||
|
|||
You can use `bls-to-execution-change --help` to see all arguments. Note that if there are missing arguments that the CLI needs, it will ask you for them. |
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.
If you try to run the bls-to-execution-change
subcommand with --help
it will actually skip the help menu and drop right into interactive mode:
user@laptop:~/repos/staking-deposit-cli$ python3 ./staking_deposit/deposit.py generate-bls-to-execution-change --help
***Using the tool on an offline and secure device is highly recommended to keep your mnemonic safe.***
Please choose your language ['1. العربية', '2. ελληνικά', '3. English', '4. Français', '5. Bahasa melayu', '6. Italiano', '7. 日本語', '8. 한국어', '9. Português do Brasil', '10. român', '11. Türkçe', '12. 简体中文']: [English]:
There may be a reason to specify "mnemonic language" vs. "language" since we have these as two separate fields in the initial validator credential creation:
When we create the bls change message in interactive mode it might be good to specify that we mean mnemonic language here:
I understand that this is not really a change that this PR made and it is technically inheriting this "Please choose your language" string from the We would probably want to change the
|
The default help menu has an unintended newline or line wrap and is a little bit harder to read now. You can see the difference between
Notice the last 3 lines here. |
https://docs.prylabs.network/docs/wallet/withdraw-validator we updated our guide to include how to use some commands. |
Is it planned to support non-interactive usage for the |
fix error message grammar
There is the --non_interactive flag, had to read the code to find it. |
6968c15
to
36af26e
Compare
36af26e
to
ee052fa
Compare
Updated
Unsolved
|
Add `generate_bls_to_execution_change`
👉 Tutorial 👈
This PR is in review.
20230210 updated:
generate_bls_to_execution_change
functionality against binary executable files and different platforms.20230201 updated:
Arguments
See README -
generate-bls-to-execution-change
Arguments.Testing command:
With
--devnet_chain_setting
Run pytest
TODOs
generate_btec
?