Merge pull request #254 from ethereum/fix_abbreviated_test

Actually shortens words for abbrviated mnemonic test vectors
This commit is contained in:
Hsiao-Wei Wang 2022-03-29 06:18:36 -07:00 committed by GitHub
commit fce407cdd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@ import json
from typing import ( from typing import (
Sequence, Sequence,
) )
from unicodedata import normalize
from staking_deposit.utils.constants import ( from staking_deposit.utils.constants import (
MNEMONIC_LANG_OPTIONS, MNEMONIC_LANG_OPTIONS,
@ -12,6 +11,7 @@ from staking_deposit.utils.constants import (
from staking_deposit.key_handling.key_derivation.mnemonic import ( from staking_deposit.key_handling.key_derivation.mnemonic import (
_index_to_word, _index_to_word,
_get_word_list, _get_word_list,
abbreviate_words,
get_seed, get_seed,
get_mnemonic, get_mnemonic,
reconstruct_mnemonic, reconstruct_mnemonic,
@ -52,7 +52,8 @@ def test_reconstruct_mnemonic(test_mnemonic: str) -> None:
def abbreviate_mnemonic(mnemonic: str) -> str: def abbreviate_mnemonic(mnemonic: str) -> str:
words = str.split(mnemonic) words = str.split(mnemonic)
words = [normalize('NFKC', word) for word in words] words = abbreviate_words(words)
assert all([len(word) <= 4 for word in words])
return str.join(' ', words) return str.join(' ', words)