-
Notifications
You must be signed in to change notification settings - Fork 2
Remove Python wallet test dependencies #7
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
base: reviewability-v1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| """Bitcoin Core-derived public wallet fixtures used by tests and integration checks. | ||
|
|
||
| Everything here is a BIP32 master fingerprint, which is a wallet property and not a | ||
| codex32 one. Some seeds below also appear as BIP93 test vectors, but only as convenient | ||
| public seed material: BIP93 assigns those vectors identifiers of its own (``test``, | ||
| ``name``, ``cash``) that have nothing to do with these fingerprints. An identifier | ||
| derived from a fingerprint is therefore never a BIP93-specified value, so assert such | ||
| identifiers against ``FIXTURE_SEED`` rather than against vector material. | ||
|
|
||
| ``tools/bitcoin_core_regtest.py`` verifies every fingerprint below against real Core. | ||
| """ | ||
|
|
||
| import hashlib | ||
|
|
||
| # BIP93 vector seeds, reused here only as wallet fixtures. | ||
| _VECTOR_FINGERPRINTS = { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The newly added seed/fingerprint maps are frozen Bitcoin Core-derived test vectors, but they are stored in an executable helper under AGENTS.md reference: AGENTS.md:L23-L24 Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch, consider opening another PR to check all the tests for this sort of data storage issue. |
||
| bytes.fromhex("318c6318c6318c6318c6318c6318c631"): bytes.fromhex("3f3521a6"), | ||
| bytes.fromhex("d1808e096b35b209ca12132b264662a5"): bytes.fromhex("fab6868a"), | ||
| bytes.fromhex("ffeeddccbbaa99887766554433221100"): bytes.fromhex("1e50c111"), | ||
| } | ||
|
|
||
| # Arbitrary fixtures, one per BIP93 seed length, carrying no test-vector meaning. | ||
| _FIXTURE_FINGERPRINTS = { | ||
| bytes.fromhex("107dea57c4319e0b78e552bf2c990673"): bytes.fromhex("8ed1dab8"), | ||
| bytes.fromhex("1481ee5bc835a20f7ce956c3309d0a77e451be2b"): bytes.fromhex("c9a9f9c8"), | ||
| bytes.fromhex("1885f25fcc39a61380ed5ac734a10e7be855c22f9c0976e3"): bytes.fromhex("4dc66f0e"), | ||
| bytes.fromhex("1c89f663d03daa1784f15ecb38a5127fec59c633a00d7ae754c12e9b"): bytes.fromhex("a5f9e972"), | ||
| bytes.fromhex("208dfa67d441ae1b88f562cf3ca91683f05dca37a4117eeb58c5329f0c79e653"): bytes.fromhex( | ||
| "9653e4ec" | ||
| ), | ||
| bytes.fromhex( | ||
| "40ad1a87f461ce3ba81582ef5cc936a3107dea57c4319e0b78e552bf2c990673" | ||
| "e04dba2794016edb48b5228ffc69d643b01d8af764d13eab1885f25fcc39a613" | ||
| ): bytes.fromhex("a9da6294"), | ||
| } | ||
|
|
||
| CORE_FINGERPRINTS = _VECTOR_FINGERPRINTS | _FIXTURE_FINGERPRINTS | ||
|
|
||
| # Arbitrary fixture seed by byte length; excludes vector material by construction. | ||
| FIXTURE_SEED = {len(seed): seed for seed in _FIXTURE_FINGERPRINTS} | ||
|
|
||
| # Stands in where the fingerprint value itself is irrelevant to the test. | ||
| STUB_FINGERPRINT = b"\x00\x00\x00\x01" | ||
|
|
||
|
|
||
| def core_fingerprint(seed: bytes) -> bytes: | ||
| """Return a frozen fingerprint that the real-Core regtest verifies.""" | ||
| try: | ||
| return CORE_FINGERPRINTS[seed] | ||
| except KeyError as error: | ||
| raise AssertionError("missing Bitcoin Core fingerprint fixture") from error | ||
|
|
||
|
|
||
| def stub_fingerprint(seed: bytes) -> bytes: | ||
| """Return real fixture data when known, otherwise a seed-sensitive test double.""" | ||
| fixture = CORE_FINGERPRINTS.get(seed) | ||
| if fixture is not None: | ||
| return fixture | ||
| return hashlib.sha256(b"codex32 test fingerprint\0" + seed).digest()[:4] | ||
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.
In the only push/PR workflow, removing the wallet differential leaves both replacement real-Core checks (
bitcoin_core_regtest.pyandbitcoin_core_main_smoke.py) uninvoked; a repo-wide search finds them referenced only by documentation. The remaining Core unit fake exercises public derivation only for mainnet account 0, whereas the removed differential covered arbitrary accounts and both network key versions, so regressions in those wallet paths can now merge without external verification; add a Core integration job or retain an offline independent check.AGENTS.md reference: AGENTS.md:L68-L73
Useful? React with 👍 / 👎.
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.
Keeping this PR focused on removing the Python wallet test dependencies. Restoring real-Bitcoin-Core CI would add a new integration job and runner dependency; that follow-up is tracked explicitly in #9. The offline unit coverage here remains seed-sensitive, and the frozen real-Core fixtures can be verified with tools/bitcoin_core_regtest.py.