|
6 | 6 | from data.bip93_vectors import VECTOR_2, VECTOR_4 |
7 | 7 |
|
8 | 8 | import codex32 |
9 | | -from codex32 import CorrectionCandidate, MasterSeed, Share, parse_codex32 |
| 9 | +from codex32 import MasterSeed, Share, parse_codex32 |
10 | 10 | from codex32.checksums import _CRC, _crc_pad |
11 | | -from codex32.correction import _best |
12 | 11 | from codex32.gf32 import _multiply as _gf32_multiply |
13 | 12 | from codex32.profiles.ms32 import SEED_BYTE_LENGTHS, _has_generation_padding, _payload_padding |
14 | 13 |
|
@@ -60,26 +59,6 @@ def test_parsed_master_seed_validity_is_independent_of_crc() -> None: |
60 | 59 | assert generated.payload_symbols in {secret.payload_symbols for secret in parsed} |
61 | 60 |
|
62 | 61 |
|
63 | | -def test_tie_break_prefers_only_current_crc_padding() -> None: |
64 | | - parsed = [parse_codex32(VECTOR_4[f"secret_s_alternate_{padding}"]) for padding in range(16)] |
65 | | - assert all(isinstance(secret, MasterSeed) for secret in parsed) |
66 | | - current = next(secret for secret in parsed if _has_generation_padding(secret)) |
67 | | - previous = parsed[8] # Pad suffix produced before the final XOR was added. |
68 | | - other = parsed[0] |
69 | | - assert current not in (previous, other) |
70 | | - |
71 | | - def candidates(*secrets: MasterSeed) -> list[CorrectionCandidate]: |
72 | | - return [CorrectionCandidate(s, (), 1, 0, 0, _has_generation_padding(s)) for s in secrets] |
73 | | - |
74 | | - assert tuple(item.artifact for item in _best(candidates(other, previous, current))) == (current,) |
75 | | - # Without a current CRC match, neither historical nor arbitrary padding wins. |
76 | | - tied = tuple(item.artifact for item in _best(candidates(other, previous))) |
77 | | - assert tied == tuple(sorted((other, previous), key=lambda secret: secret.text.lower())) |
78 | | - # The wallet hint can decide the tie without being overridden by historical padding. |
79 | | - hinted = _best(candidates(other, previous), fingerprint_match=lambda item: item.artifact == other) |
80 | | - assert tuple(item.artifact for item in hinted) == (other,) |
81 | | - |
82 | | - |
83 | 62 | def test_padding_acceptance_is_balanced_for_every_nonzero_lagrange_weight() -> None: |
84 | 63 | """A free GF(32) symbol leaves each permitted padding suffix equally likely.""" |
85 | 64 | for padding_bits in range(1, 5): |
|
0 commit comments