From ee052fa42434abbb13edef994edc4c152a6f95ca Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Mon, 13 Mar 2023 23:20:02 +0800 Subject: [PATCH] Add more description of mnemonic language per @infosecual's suggestion --- README.md | 2 +- staking_deposit/intl/en/cli/new_mnemonic.json | 4 ++-- tests/test_cli/test_new_mnemonic.py | 12 +++++++++--- tests/test_utils/test_intl.py | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 50d68083..d2930db9 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ You can use `new-mnemonic --help` to see all arguments. Note that if there are m | Argument | Type | Description | | -------- | -------- | -------- | | `--num_validators` | Non-negative integer | The number of signing keys you want to generate. Note that the child key(s) are generated via the same master key. | -| `--mnemonic_language` | String. Options: `简体中文`, `繁體中文`, `český jazyk`, `English`, `Italiano`, `한국어`, `Português`, `Español`. Default to `English` | The mnemonic language | +| `--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. | | `--eth1_withdrawal_address` | String. Eth1 address in hexadecimal encoded form | If this field is set and valid, the given Eth1 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). | diff --git a/staking_deposit/intl/en/cli/new_mnemonic.json b/staking_deposit/intl/en/cli/new_mnemonic.json index feee3ac2..9a0d3d89 100644 --- a/staking_deposit/intl/en/cli/new_mnemonic.json +++ b/staking_deposit/intl/en/cli/new_mnemonic.json @@ -5,8 +5,8 @@ }, "arg_mnemonic_language": { "default": "english", - "help": "The language that your mnemonic is in", - "prompt": "Please choose your mnemonic language" + "help": "The language of the mnemonic word list", + "prompt": "Please choose the language of the mnemonic word list" }, "msg_mnemonic_presentation": "This is your mnemonic (seed phrase). Write it down and store it safely. It is the ONLY way to retrieve your deposit.", "msg_press_any_key": "Press any key when you have written down your mnemonic.", diff --git a/tests/test_cli/test_new_mnemonic.py b/tests/test_cli/test_new_mnemonic.py index 602d4350..67ef5054 100644 --- a/tests/test_cli/test_new_mnemonic.py +++ b/tests/test_cli/test_new_mnemonic.py @@ -10,7 +10,11 @@ from staking_deposit.cli import new_mnemonic from staking_deposit.deposit import cli from staking_deposit.key_handling.key_derivation.mnemonic import abbreviate_words -from staking_deposit.utils.constants import DEFAULT_VALIDATOR_KEYS_FOLDER_NAME, ETH1_ADDRESS_WITHDRAWAL_PREFIX, BLS_WITHDRAWAL_PREFIX +from staking_deposit.utils.constants import ( + BLS_WITHDRAWAL_PREFIX, + DEFAULT_VALIDATOR_KEYS_FOLDER_NAME, + ETH1_ADDRESS_WITHDRAWAL_PREFIX, +) from staking_deposit.utils.intl import load_text from .helpers import clean_key_folder, get_permissions, get_uuid @@ -164,13 +168,15 @@ async def test_script_bls_withdrawal() -> None: assert len(seed_phrase) > 0 # Check files - deposit_file = [key_file for key_file in key_files if key_file.startswith('deposit_data')][0] validator_keys_folder_path = os.path.join(my_folder_path, DEFAULT_VALIDATOR_KEYS_FOLDER_NAME) + _, _, key_files = next(os.walk(validator_keys_folder_path)) + + deposit_file = [key_file for key_file in key_files if key_file.startswith('deposit_data')][0] with open(validator_keys_folder_path + '/' + deposit_file, 'r') as f: deposits_dict = json.load(f) for deposit in deposits_dict: withdrawal_credentials = bytes.fromhex(deposit['withdrawal_credentials']) - assert withdrawal_credentials[:2] == BLS_WITHDRAWAL_PREFIX + assert withdrawal_credentials[:1] == BLS_WITHDRAWAL_PREFIX _, _, key_files = next(os.walk(validator_keys_folder_path)) diff --git a/tests/test_utils/test_intl.py b/tests/test_utils/test_intl.py index de4ffc9c..6a1a09fc 100644 --- a/tests/test_utils/test_intl.py +++ b/tests/test_utils/test_intl.py @@ -18,7 +18,7 @@ @pytest.mark.parametrize( 'params, file_path, func, lang, found_str', [ (['arg_mnemonic_language', 'prompt'], os.path.join('staking_deposit', 'cli', 'new_mnemonic.json'), - 'new_mnemonic', 'en', 'Please choose your mnemonic language'), + 'new_mnemonic', 'en', 'Please choose the language of the mnemonic word list'), (['arg_mnemonic_language', 'prompt'], os.path.join('staking_deposit', 'cli', 'new_mnemonic.json'), 'new_mnemonic', 'ja', 'ニーモニックの言語を選択してください'), ]