Commit Graph

321 Commits

Author SHA1 Message Date
Jack Grigg ba707b10f5
Merge pull request #105 from daira/add-registered-test-vectors
Add test vectors for ZIP 32 registered key derivation
2025-02-20 10:21:19 +00:00
Daira-Emma Hopwood cbfe5ed828 Add test vectors for `zip_0032_registered`.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2025-02-20 05:36:35 +00:00
Daira-Emma Hopwood 0f20d79f3d Update `CKDh` to match ZIP 32 changes.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2025-02-20 05:34:38 +00:00
Daira-Emma Hopwood 7de2348010 Use `&'static` arrays in `zip_0032_arbitrary` Rust test vectors.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2025-02-20 05:10:10 +00:00
Daira-Emma Hopwood 92f2ff2b2f Refactor output to allow (but not yet use) `&'static [T]` and the case of
pairs that will be used in the `zip_0032_registered` test vectors. This
should not change any of the generated vectors.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2025-02-20 05:00:35 +00:00
Daira-Emma Hopwood 9dc587dee8 Update Rust output to use `const`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2025-02-17 18:41:08 +00:00
Daira-Emma Hopwood ced24bce69 Update authors.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2025-02-17 16:29:03 +00:00
Jack Grigg 1ac6808080
Merge pull request #104 from zcash/improve-arbitrary-key-tvs
Improve the ZIP 32 arbitrary key derivation test vectors
2024-11-16 12:32:58 +13:00
Jack Grigg 2a08204b62 Add ZIP 32 arbitrary key derivation test vector to ZIP 32 account 2024-11-13 10:43:05 +00:00
Jack Grigg 4505cb8438 Improve the ZIP 32 arbitrary key derivation test vectors
When using them, I forgot that `bytes(range(32))` doesn't generate an
all-zeroes seed of length 32, so I was using the wrong seed with the
test vectors and they were failing. We now embed that seed in the test
vectors, along with the context string (to make it clear that there is
no trailing null byte) and the IKM (which is what clued me into the seed
being wrong).
2024-11-13 07:14:35 +00:00
Jack Grigg 53cc8e25ea
Merge pull request #103 from zcash/arbitrary-key-derivation
Test vectors for ZIP 32 arbitrary key derivation
2024-11-13 04:39:46 +00:00
Jack Grigg f80ca40016 Add test vectors for ZIP 32 arbitrary key derivation 2024-11-02 05:15:28 +00:00
Jack Grigg ff8eb510c7 Extract ZIP 32 hardened-only key derivation from Orchard 2024-11-02 05:00:38 +00:00
Kris Nuttycombe 5b76d4bba0
Merge pull request #102 from zcash/orchard-zip32
Add Orchard ZIP 32 test vectors
2024-10-24 13:14:43 -06:00
Kris Nuttycombe bff71ae1a8 Generate test vectors for orchard_zip32 2024-10-02 16:32:26 +01:00
Kris Nuttycombe 346740a680 Modify the `regenerate` script to be more user-friendly.
This now takes the generation type or 'all' as the first argument,
and then the generator or 'all' as the second argument. File extensions
are detemined automatically from the generation type.
2024-10-02 16:32:26 +01:00
Jack Grigg 580dc95437 Add Orchard ZIP 32 test vectors 2024-10-02 16:32:26 +01:00
Kris Nuttycombe db9c9b9519
Merge pull request #99 from nuttycom/zip_0320_testnet_tv
Make it possible to generate testnet test vectors for ZIP 320 addresses.
2024-07-22 08:01:37 -06:00
Kris Nuttycombe 73409919f5 Make it possible to generate testnet test vectors for ZIP 320 addresses. 2024-05-15 22:32:36 -06:00
Kris Nuttycombe 2badedaee3
Merge pull request #97 from nuttycom/zip_0320
Add ZIP 320 test vectors.
2024-04-24 13:30:06 -06:00
Kris Nuttycombe 4c82764cd2 Fix generation of source path metadata in zip_0320 test vectors. 2024-04-24 13:08:16 -06:00
Kris Nuttycombe 439d5a3e12 Add ZIP 320 test vectors. 2024-04-23 12:51:23 -06:00
str4d ddb3397f5e
Merge pull request #94 from zcash/zip32-sapling-hard
Generate hardened-only Sapling ZIP 32 test vectors
2023-12-01 11:01:30 +00:00
Jack Grigg 13ea1ab387 Generate hardened-only Sapling ZIP 32 test vectors 2023-11-22 02:59:04 +00:00
Jack Grigg 86e88c5348 Migrate to ripemd-hash dependency
RIPEMD support was removed from OpenSSL by default, and thus hashlib.
2023-11-22 02:59:02 +00:00
Daira Hopwood 7a55b39524
Merge pull request #90 from nuttycom/diversified_ua_sequences
Ensure that successive diversified UAs have the same structure.
2022-10-12 02:13:24 +01:00
Kris Nuttycombe 20d7cc6f54 Regenerate test vectors. 2022-10-07 19:47:22 -06:00
Kris Nuttycombe e454065250 Remove spurious rng argument to encode_unified. 2022-10-07 19:17:38 -06:00
Kris Nuttycombe 97f9fbb44c Generate predictable UA structure for the first 3 test vectors.
This makes the first few test vectors easier to use by wallet
implementers. The generated UAs now have the following structure:

* Account 0: P2PKH + Sapling
* Account 1: P2PKH + Sapling + Orchard
* Account 2: Sapling + Orchard

The remainder are randomly generated as before.
2022-10-07 19:17:35 -06:00
Kris Nuttycombe c14646f236 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-10-07 19:17:26 -06:00
Kris Nuttycombe fb5f931e5f Ensure that successive diversified UAs have the same structure.
In 23321662d1, the unified address
test vectors were modified to include multiple addresses for each
account at successive diversifier indices. However, the generation
process resulted in such diversified addresses having varying sets
of typecodes within a single account; in particular, p2sh and p2pkh
addresses were interleaved in a manner that made testing transparent
functionality using the resulting test vectors more difficult.

In the process of this fix, it was also noted that the handling of
unknown typecodes was inconsistent, with the unknown typecode always
being included in the resulting test vector even if no data
corresponding to that typecode was present. This has also been
modified such that if an unknown typecode is present, data is present,
and vice versa.
2022-10-07 19:17:23 -06:00
Kris Nuttycombe ac92513d4e Fix derivation of transparent UA parts. 2022-10-07 19:13:53 -06:00
Kris Nuttycombe d98b63da5c
Merge pull request #89 from nuttycom/diversified_ua_sequences
Provide UA test vectors for the first 3 valid diversifier indices for each account
2022-09-23 12:20:16 -06:00
Kris Nuttycombe 73ced0f5c9 Update dependency versions. 2022-09-19 15:36:15 -06:00
Kris Nuttycombe 8f18c764d6 Use unified addresse strings in test vectors rather than byte vectors. 2022-09-19 13:59:00 -06:00
Kris Nuttycombe 23321662d1 Provide UA test vectors for the first 3 valid diversifier indices for each account. 2022-09-15 15:18:20 -06:00
Daira Hopwood 0cbb8200b0
Merge pull request #50 from zcash-hackworks/orchard-vesta
orchard_vesta.py: Add constants for Vesta curve.
2022-03-28 20:19:05 +01:00
str4d d56a9cdc45
Merge pull request #88 from zcash-hackworks/update-nu5-branch-id
Update NU5 consensus branch ID in ZIP 244 test vectors
2022-03-23 19:04:09 +00:00
Jack Grigg 423d323728 Update NU5 consensus branch ID in ZIP 244 test vectors 2022-03-23 00:27:32 +00:00
Daira Hopwood fe7ed09c6c
Merge pull request #82 from daira/ua-unknowns
Ensure that unknown items are included in Unified Address test vectors
2022-02-14 15:11:17 +00:00
Daira Hopwood ccf1e5d7df Ensure that unknown items are included in Unified Address test vectors.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-14 02:52:28 +00:00
Kris Nuttycombe 68760fb07d
Merge pull request #81 from daira/orchard-zip32
ZIP 32 test vectors for Orchard and BIP 32 test vectors for transparent
2022-02-12 15:07:42 -07:00
Daira Hopwood 3872f29af5 Change the order of arguments to the bip_0032.Extended{Secret,Public}Key constructors
to be (chaincode, sk), for consistency with the orchard.key_components.ExtendedSpendingKey
constructor and with the serialization order.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-12 21:42:32 +00:00
Daira Hopwood 2e99fdefc7 Fix endianness of the child index in bip_0032 derivation.
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-12 21:15:25 +00:00
Daira Hopwood 1c10ad5f4a Avoid the need to specify a `rust_fmt` function for Options.
This does not change test vectors.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-12 20:57:37 +00:00
Daira Hopwood 54f168a30b Include the seed used for derivation in UA/UIVK/UFVK test vectors.
Also change variable-length vectors to use 'bitcoin_flavoured': False.

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-12 17:31:25 +00:00
Daira Hopwood 189cadb357 Reduce run times of unified_{address, incoming_viewing_keys, full_viewing_keys}.py by over half
by avoiding duplicated work in deriving levels of the key hierarchy above the account level.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-11 16:29:14 +00:00
Daira Hopwood f8a462d859 Make the test vectors for UAs, UIVKs, and UFVKs match up, and allow unknown items for UAs.
Also increase the number of test vectors to 20 (10 might be insufficient to see some corner cases).

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-11 16:29:14 +00:00
Daira Hopwood 3477c241aa Add BIP 32 key derivation and test vectors.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-11 16:29:14 +00:00
Daira Hopwood e5d31fea89 Implement ZIP 32 derivation for Orchard and use it for the Unified Address, IVK and FVK test vectors.
This commit only affects the Orchard test vectors.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-11 16:29:14 +00:00