Commit Graph

302 Commits

Author SHA1 Message Date
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
Daira Hopwood 68e4ed1ee2 Change the seed used for Unified Address, IVK and FVK test vectors to be deterministic.
As of this commit, this only affects the Sapling test vectors (we still sample the same
randomness to avoid disturbing the others).

A "diversifier_index" field is added to the Unified Address test vectors. (This is not needed
for UIVKs/UFVKs since they do not depend on the diversifier index for any protocol.)

We also add an "account" field to make the account number explicit, even though it could be
inferred from the test vector index.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-11 16:29:14 +00:00
Daira Hopwood 060ea786f7 Refactor Zcash SLIP 44 coin type and the `hardened` function into a separate file,
since they are not specific to Sapling.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-11 16:29:14 +00:00
Daira Hopwood cc3376f37e
Merge pull request #80 from daira/reorg
Move remaining scripts out of the root directory
2022-02-11 16:27:39 +00:00
Daira Hopwood d6d69f8388 Merge files that were only separate in order to provide multiple entry points.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-08 15:11:15 +00:00
Daira Hopwood f07451a025 Move remaining scripts out of the root directory.
closes #79

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-08 13:53:57 +00:00
str4d c7f9463713
Merge pull request #77 from daira/fix-nested-byte-arrays
Fix JSON serialization of nested byte arrays and update JSON test vectors
2022-02-08 05:22:17 +00:00
Daira Hopwood 6b2009635d [GitHub Actions] Generate Bitcoin-flavoured test vectors with .json filetype.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-07 22:58:59 +00:00
Daira Hopwood b056349c8b [GitHub Actions] Show diff if test vectors generated by CI do not match.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-07 22:58:59 +00:00
Daira Hopwood ade6c0596a Commit all JSON and Zcash test vectors. fixes #64
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-07 22:58:59 +00:00
Daira Hopwood 823c8a54f4 Fix serialization of nested arrays in JSON.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-07 22:58:59 +00:00
Daira Hopwood bb67196aa5
Merge pull request #70 from zcash-hackworks/unified-ivks
Add test vectors for unified IVKs
2022-02-07 22:58:22 +00:00
Daira Hopwood 72aa4e9962 Reduce differences between unified_full_viewing_keys.py and unified_incoming_viewing_keys.py.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-07 20:30:01 +00:00
therealyingtong e193d8775a Add test vectors for unified IVKs.
Co-authored-by: Ying Tong Lai <yingtong@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-07 20:04:30 +00:00
str4d 5eb385fc3a
Merge pull request #73 from daira/remove-pyblake2
Remove dependency on pyblake2
2022-02-02 23:43:25 +00:00
Daira Hopwood 49a20a87d7 Remove dependency on pyblake2.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-02 02:44:40 +00:00
str4d df2a648ac4
Merge pull request #76 from nuttycom/derive_transparent_ovks
Add test vectors for transparent OVKs
2022-02-01 23:55:15 +00:00
Kris Nuttycombe b682f6f306 Use secp256k1 for generation of transparent OVK test vectors. 2022-02-01 16:12:22 -07:00
Daira Hopwood 3ef06e7ee3 Add zip_0316 (transparent ovk test vectors) to regenerate.sh and check in the Rust vectors.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-01 21:56:13 +00:00
Kris Nuttycombe b4ccca8d17 Add test vectors for transparent OVKs
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-02-01 14:35:46 -07:00