Skip to content

Commit

Permalink
Changing --execution_address to --withdrawal_address
Browse files Browse the repository at this point in the history
  • Loading branch information
valefar-on-discord committed Jun 27, 2024
1 parent d9f6a4d commit 31672f6
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 53 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ You can use `new-mnemonic --help` to see all arguments. Note that if there are m
| `--mnemonic_language` | String. Options: `简体中文`, `繁體中文`, `český jazyk`, `English`, `Italiano`, `한국어`, `Português`, `Español`. Default to `English` | The language of the mnemonic word list |
| `--folder` | String. Pointing to `./validator_keys` by default | The folder path for the keystore(s) and deposit(s) |
| `--chain` | String. `mainnet` by default | The chain setting for the signing domain. |
| `--execution_address` | String. Ethereum execution address in hexadecimal encoded form | If this field is set and valid, the given execution address will be used to create the withdrawal credentials. Otherwise, it will generate withdrawal credentials with the mnemonic-derived withdrawal public key in [ERC-2334 format](https://eips.ethereum.org/EIPS/eip-2334#eth2-specific-parameters). |
| `--withdrawal_address` | String. Ethereum execution address in hexadecimal encoded form | If this field is set and valid, the given execution address will be used to create the withdrawal credentials. Otherwise, it will generate withdrawal credentials with the mnemonic-derived withdrawal public key in [ERC-2334 format](https://eips.ethereum.org/EIPS/eip-2334#eth2-specific-parameters). |
| `--pbkdf2` | Flag | Will use pbkdf2 key derivation instead of scrypt for generated keystore files as defined in EIP-2335. This can be a good alternative if you intend to work with a large number of keys. |

###### `existing-mnemonic` Arguments
Expand All @@ -172,7 +172,7 @@ You can use `existing-mnemonic --help` to see all arguments. Note that if there
| `--num_validators` | Non-negative integer | The number of new signing keys you want to generate. Note that the child key(s) are generated via the same master key. |
| `--folder` | String. Pointing to `./validator_keys` by default | The folder path for the keystore(s) and deposit(s) |
| `--chain` | String. `mainnet` by default | The chain setting for the signing domain. |
| `--execution_address` | String. Ethereum execution address in hexadecimal encoded form | If this field is set and valid, the given execution address will be used to create the withdrawal credentials. Otherwise, it will generate withdrawal credentials with the mnemonic-derived withdrawal public key in [ERC-2334 format](https://eips.ethereum.org/EIPS/eip-2334#eth2-specific-parameters). |
| `--withdrawal_address` | String. Ethereum execution address in hexadecimal encoded form | If this field is set and valid, the given execution address will be used to create the withdrawal credentials. Otherwise, it will generate withdrawal credentials with the mnemonic-derived withdrawal public key in [ERC-2334 format](https://eips.ethereum.org/EIPS/eip-2334#eth2-specific-parameters). |
| `--pbkdf2` | Flag | Will use pbkdf2 key derivation instead of scrypt for generated keystore files as defined in EIP-2335. This can be a good alternative if you intend to work with a large number of keys. |

###### Successful message
Expand Down Expand Up @@ -203,7 +203,7 @@ You can use `bls-to-execution-change --help` to see all arguments. Note that if
| `--validator_start_index` | Non-negative integer | The index position for the keys to start generating withdrawal credentials in [ERC-2334 format](https://eips.ethereum.org/EIPS/eip-2334#eth2-specific-parameters). |
| `--validator_indices` | String of integer(s) | A list of the chosen validator index number(s) as identified on the beacon chain. Split multiple items with whitespaces or commas. |
| `--bls_withdrawal_credentials_list` | String of hexstring(s). | A list of the old BLS withdrawal credentials of the given validator(s). It is for confirming you are using the correct keys. Split multiple items with whitespaces or commas. |
| `--execution_address` | String. Ethereum execution address in hexadecimal encoded form | If this field is set and valid, the given execution address will be used to create the withdrawal credentials. Otherwise, it will generate withdrawal credentials with the mnemonic-derived withdrawal public key in [ERC-2334 format](https://eips.ethereum.org/EIPS/eip-2334#eth2-specific-parameters). |
| `--withdrawal_address` | String. Ethereum execution address in hexadecimal encoded form | If this field is set and valid, the given execution address will be used to create the withdrawal credentials. Otherwise, it will generate withdrawal credentials with the mnemonic-derived withdrawal public key in [ERC-2334 format](https://eips.ethereum.org/EIPS/eip-2334#eth2-specific-parameters). |
| `--devnet_chain_setting` | String. JSON string `'{"network_name": "<NETWORK_NAME>", "genesis_fork_version": "<GENESIS_FORK_VERSION>", "exit_fork_version": "<EXIT_FORK_VERSION>", "genesis_validator_root": "<GENESIS_VALIDATOR_ROOT>"}'` | The custom chain setting of a devnet or testnet. Note that it will override your `--chain` choice. |

###### `exit-transaction-keystore` Arguments
Expand Down
2 changes: 1 addition & 1 deletion docs/src/existing_mnemonic.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Uses an existing BIP-39 mnemonic phrase for key generation.

- **`--keystore_password`**: The password that is used to encrypt the provided keystore. Note: It's not your mnemonic password. <span class="warning"></span>

- **`--execution_address`**: The Ethereum execution address for validator withdrawals.
- **`--withdrawal_address`**: The Ethereum execution address for validator withdrawals.

- **`--pbkdf2`**: Will use pbkdf2 key derivation instead of scrypt for generated keystore files as defined in [EIP-2335](https://eips.ethereum.org/EIPS/eip-2335#decryption-key). This can be a good alternative if you intend to work with a large number of keys, as it can improve performance however it is less secure. You should only use this option if you understand the associated risks and have familiarity with encryption.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/generate_bls_to_execution_change.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Generates a BLS to execution address change message.

- **`--bls_withdrawal_credentials_list`**: A list of the old BLS withdrawal credentials of the given validator(s). It is for confirming you are using the correct keys. Split multiple items with whitespaces or commas.

- **`--execution_address`**: If this field is set and valid, the given Ethereum execution address will be used to create the withdrawal credentials. Otherwise it will generate withdrawal credentials with the mnemonic-derived withdrawal public key.
- **`--withdrawal_address`**: If this field is set and valid, the given Ethereum execution address will be used to create the withdrawal credentials. Otherwise it will generate withdrawal credentials with the mnemonic-derived withdrawal public key.

- **`--devnet_chain_setting`**: The custom chain setting of a devnet or testnet. Note that it will override your `--chain` choice.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/new_mnemonic.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Generates a new BIP-39 mnemonic along with validator keystore and deposit files

- **`--keystore_password`**: The password that is used to encrypt the provided keystore. Note: It's not your mnemonic password. <span class="warning"></span>

- **`--execution_address`**: The Ethereum execution address for validator withdrawals.
- **`--withdrawal_address`**: The Ethereum execution address for validator withdrawals.

- **`--pbkdf2`**: Will use pbkdf2 key derivation instead of scrypt for generated keystore files as defined in [EIP-2335](https://eips.ethereum.org/EIPS/eip-2335#decryption-key). This can be a good alternative if you intend to work with a large number of keys, as it can improve performance however it is less secure. You should only use this option if you understand the associated risks and have familiarity with encryption.

Expand Down
18 changes: 9 additions & 9 deletions ethstaker_deposit/cli/generate_bls_to_execution_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ def _validate_credentials_match(kwargs: Dict[str, Any]) -> Optional[ValidationEr
@jit_option(
callback=captive_prompt_callback(
lambda address: validate_withdrawal_address(None, None, address),
lambda: load_text(['arg_execution_address', 'prompt'], func=FUNC_NAME),
lambda: load_text(['arg_execution_address', 'confirm'], func=FUNC_NAME),
lambda: load_text(['arg_execution_address', 'mismatch'], func=FUNC_NAME),
lambda: load_text(['arg_withdrawal_address', 'prompt'], func=FUNC_NAME),
lambda: load_text(['arg_withdrawal_address', 'confirm'], func=FUNC_NAME),
lambda: load_text(['arg_withdrawal_address', 'mismatch'], func=FUNC_NAME),
),
help=lambda: load_text(['arg_execution_address', 'help'], func=FUNC_NAME),
param_decls=['--execution_address'],
prompt=lambda: load_text(['arg_execution_address', 'prompt'], func=FUNC_NAME),
help=lambda: load_text(['arg_withdrawal_address', 'help'], func=FUNC_NAME),
param_decls=['--withdrawal_address'],
prompt=lambda: load_text(['arg_withdrawal_address', 'prompt'], func=FUNC_NAME),
)
@jit_option(
# Only for devnet tests
Expand All @@ -148,7 +148,7 @@ def generate_bls_to_execution_change(
validator_start_index: int,
validator_indices: Sequence[int],
bls_withdrawal_credentials_list: Sequence[bytes],
execution_address: HexAddress,
withdrawal_address: HexAddress,
devnet_chain_setting: str,
**kwargs: Any) -> None:
# Generate folder
Expand Down Expand Up @@ -188,7 +188,7 @@ def generate_bls_to_execution_change(
amounts=amounts,
chain_setting=chain_setting,
start_index=validator_start_index,
hex_withdrawal_address=execution_address,
hex_withdrawal_address=withdrawal_address,
)

# Check if the given old bls_withdrawal_credentials is as same as the mnemonic generated
Expand All @@ -212,7 +212,7 @@ def generate_bls_to_execution_change(
btec_file,
credentials.credentials,
input_validator_indices=validator_indices,
input_execution_address=execution_address,
input_withdrawal_address=withdrawal_address,
chain_setting=chain_setting,
)
if not json_file_validation_result:
Expand Down
16 changes: 8 additions & 8 deletions ethstaker_deposit/cli/generate_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ def generate_keys_arguments_decorator(function: Callable[..., Any]) -> Callable[
jit_option(
callback=captive_prompt_callback(
lambda address: validate_withdrawal_address(None, None, address),
lambda: load_text(['arg_execution_address', 'prompt'], func='generate_keys_arguments_decorator'),
lambda: load_text(['arg_execution_address', 'confirm'], func='generate_keys_arguments_decorator'),
lambda: load_text(['arg_execution_address', 'mismatch'], func='generate_keys_arguments_decorator'),
lambda: load_text(['arg_withdrawal_address', 'prompt'], func='generate_keys_arguments_decorator'),
lambda: load_text(['arg_withdrawal_address', 'confirm'], func='generate_keys_arguments_decorator'),
lambda: load_text(['arg_withdrawal_address', 'mismatch'], func='generate_keys_arguments_decorator'),
default="",
),
default="",
help=lambda: load_text(['arg_execution_address', 'help'], func='generate_keys_arguments_decorator'),
param_decls=['--execution_address'],
prompt=lambda: load_text(['arg_execution_address', 'prompt'], func='generate_keys_arguments_decorator'),
help=lambda: load_text(['arg_withdrawal_address', 'help'], func='generate_keys_arguments_decorator'),
param_decls=['--withdrawal_address'],
prompt=lambda: load_text(['arg_withdrawal_address', 'prompt'], func='generate_keys_arguments_decorator'),
),
jit_option(
default=False,
Expand All @@ -121,7 +121,7 @@ def generate_keys_arguments_decorator(function: Callable[..., Any]) -> Callable[
@click.pass_context
def generate_keys(ctx: click.Context, validator_start_index: int,
num_validators: int, folder: str, chain: str, keystore_password: str,
execution_address: HexAddress, pbkdf2: bool, **kwargs: Any) -> None:
withdrawal_address: HexAddress, pbkdf2: bool, **kwargs: Any) -> None:
mnemonic = ctx.obj['mnemonic']
mnemonic_password = ctx.obj['mnemonic_password']
amounts = [MAX_DEPOSIT_AMOUNT] * num_validators
Expand All @@ -139,7 +139,7 @@ def generate_keys(ctx: click.Context, validator_start_index: int,
amounts=amounts,
chain_setting=chain_setting,
start_index=validator_start_index,
hex_withdrawal_address=execution_address,
hex_withdrawal_address=withdrawal_address,
use_pbkdf2=pbkdf2
)
keystore_filefolders = credentials.export_keystores(password=keystore_password, folder=folder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"arg_generate_bls_to_execution_change" :{
"help": "Generating the SignedBLSToExecutionChange data to enable withdrawals on Ethereum Beacon Chain."
},
"arg_execution_address": {
"arg_withdrawal_address": {
"help": "The 20-byte Ethereum execution address that will be used in withdrawal",
"prompt": "Please enter the 20-byte execution address for the new withdrawal credentials. Note that you CANNOT change it once you have set it on chain.",
"confirm": "Repeat your execution address for confirmation.",
Expand Down
2 changes: 1 addition & 1 deletion ethstaker_deposit/intl/en/cli/generate_keys.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"confirm": "Repeat your keystore password for confirmation",
"mismatch": "Error: the two entered values do not match. Please type again."
},
"arg_execution_address": {
"arg_withdrawal_address": {
"help": "The 20-byte Ethereum execution address that will be used in withdrawal",
"prompt": "Please enter the optional 20-byte execution address for the new withdrawal credentials. Note that you CANNOT change it once you have set it on chain.",
"confirm": "Repeat your execution address for confirmation.",
Expand Down
8 changes: 4 additions & 4 deletions ethstaker_deposit/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def verify_bls_to_execution_change_json(filefolder: str,
credentials: Sequence[Credential],
*,
input_validator_indices: Sequence[int],
input_execution_address: str,
input_withdrawal_address: str,
chain_setting: BaseChainSetting) -> bool:
"""
Validate every BLSToExecutionChange found in the bls_to_execution_change JSON file folder.
Expand All @@ -186,7 +186,7 @@ def verify_bls_to_execution_change_json(filefolder: str,
'btec_dict': btec,
'credential': credential,
'input_validator_index': input_validator_index,
'input_execution_address': input_execution_address,
'input_withdrawal_address': input_withdrawal_address,
'chain_setting': chain_setting,
} for btec, credential, input_validator_index in zip(btec_json, credentials, input_validator_indices)]

Expand All @@ -202,7 +202,7 @@ def validate_bls_to_execution_change(btec_dict: Dict[str, Any],
credential: Credential,
*,
input_validator_index: int,
input_execution_address: str,
input_withdrawal_address: str,
chain_setting: BaseChainSetting) -> bool:
validator_index = int(btec_dict['message']['validator_index'])
from_bls_pubkey = BLSPubkey(decode_hex(btec_dict['message']['from_bls_pubkey']))
Expand All @@ -216,7 +216,7 @@ def validate_bls_to_execution_change(btec_dict: Dict[str, Any],
return False
if (
to_execution_address != credential.withdrawal_address
or to_execution_address != decode_hex(input_execution_address)
or to_execution_address != decode_hex(input_withdrawal_address)
):
return False
if genesis_validators_root != chain_setting.GENESIS_VALIDATORS_ROOT:
Expand Down
2 changes: 1 addition & 1 deletion test_binary_btec_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def main(argv):
'--bls_withdrawal_credentials_list', '0x00bd0b5a34de5fb17df08410b5e615dda87caf4fb72d0aac91ce5e52fc6aa8de',
'--validator_start_index', '0',
'--validator_indices', '1',
'--execution_address', '0x3434343434343434343434343434343434343434',
'--withdrawal_address', '0x3434343434343434343434343434343434343434',
]
proc = await asyncio.create_subprocess_shell(
' '.join(cmd_args),
Expand Down
2 changes: 1 addition & 1 deletion test_btec_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def main():
'--bls_withdrawal_credentials_list', '0x00bd0b5a34de5fb17df08410b5e615dda87caf4fb72d0aac91ce5e52fc6aa8de',
'--validator_start_index', '0',
'--validator_indices', '1',
'--execution_address', '0x3434343434343434343434343434343434343434',
'--withdrawal_address', '0x3434343434343434343434343434343434343434',
]
proc = await asyncio.create_subprocess_shell(
' '.join(cmd_args),
Expand Down
10 changes: 5 additions & 5 deletions tests/test_cli/test_existing_mnemonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_existing_mnemonic_bls_withdrawal() -> None:
'--language', 'english',
'--ignore_connectivity',
'existing-mnemonic',
'--execution_address', '',
'--withdrawal_address', '',
'--folder', my_folder_path,
'--mnemonic_password', 'TREZOR',
]
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_pbkdf2_new_mnemonic() -> None:
arguments = [
'--language', 'english',
'existing-mnemonic',
'--execution_address', '',
'--withdrawal_address', '',
'--folder', pbkdf2_folder_path,
'--pbkdf2',
]
Expand All @@ -200,7 +200,7 @@ def test_pbkdf2_new_mnemonic() -> None:
arguments = [
'--language', 'english',
'existing-mnemonic',
'--execution_address', '',
'--withdrawal_address', '',
'--folder', scrypt_folder_path,
]
result = runner.invoke(cli, arguments, input=data)
Expand Down Expand Up @@ -274,7 +274,7 @@ async def test_script() -> None:
'--validator_start_index', '1',
'--chain', 'mainnet',
'--keystore_password', 'MyPassword',
'--execution_address', '""',
'--withdrawal_address', '""',
'--folder', my_folder_path,
]
proc = await asyncio.create_subprocess_shell(
Expand Down Expand Up @@ -323,7 +323,7 @@ async def test_script_abbreviated_mnemonic() -> None:
'--validator_start_index', '1',
'--chain', 'mainnet',
'--keystore_password', 'MyPassword',
'--execution_address', '""',
'--withdrawal_address', '""',
'--folder', my_folder_path,
]
proc = await asyncio.create_subprocess_shell(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli/test_generate_bls_to_execution_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_existing_mnemonic_bls_withdrawal() -> None:
'--bls_withdrawal_credentials_list', '0x00bd0b5a34de5fb17df08410b5e615dda87caf4fb72d0aac91ce5e52fc6aa8de',
'--validator_start_index', '0',
'--validator_indices', '1',
'--execution_address', '0x3434343434343434343434343434343434343434',
'--withdrawal_address', '0x3434343434343434343434343434343434343434',
]
result = runner.invoke(cli, arguments, input=data)
assert result.exit_code == 0
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_existing_mnemonic_bls_withdrawal_multiple() -> None:
'--bls_withdrawal_credentials_list', '0x00bd0b5a34de5fb17df08410b5e615dda87caf4fb72d0aac91ce5e52fc6aa8de, 0x00a75d83f169fa6923f3dd78386d9608fab710d8f7fcf71ba9985893675d5382', # noqa: E501
'--validator_start_index', '0',
'--validator_indices', '1,2',
'--execution_address', '0x3434343434343434343434343434343434343434',
'--withdrawal_address', '0x3434343434343434343434343434343434343434',
]
result = runner.invoke(cli, arguments, input=data)
assert result.exit_code == 0
Expand Down
Loading

0 comments on commit 31672f6

Please sign in to comment.