Commit Graph

274 Commits

Author SHA1 Message Date
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
Daira Hopwood ae7b8a1038
Merge pull request #75 from daira/internal-derivation
Add test vectors for internal key derivation
2022-02-01 20:47:04 +00:00
Daira Hopwood 674dc7c054 Cosmetics.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-01 20:29:09 +00:00
Daira Hopwood f7f726bf0d Add `internal_ivk` and `internal_fp` to Sapling internal key test vector fields.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-01 20:29:09 +00:00
Daira Hopwood b955625f52 Calls to `self.tag()` in Sapling internal key derivation should have been to `self.parent_tag()`
Co-authored-by: Ying Tong Lai <yingtong@z.cash>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-01 20:29:09 +00:00
Daira Hopwood 2234fa1242 Refactor the Orchard FullViewingKey constructor by adding FullViewingKey.from_spending_key.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-01 20:29:09 +00:00
Daira Hopwood 6c2bac7b73 Add test vectors for Orchard internal key derivation.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-01 20:29:09 +00:00
Daira Hopwood b10115d363 Add test vectors for Sapling internal key derivation.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-01 20:29:09 +00:00
str4d 5d6b92cd5c
Merge pull request #72 from zcash-hackworks/zip_244_coinbase
Update ZIP 244 test vectors to reflect changes in coinbase transaction signatures.
2022-01-31 21:55:04 +00:00
Daira Hopwood f81796c12a Coinbase scripts generated by zcashd have an extra OP_0, and nSequence == 0xFFFFFFFF.
Also, the height in coinbase needs to match nExpiryHeight.

Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-01-31 21:38:31 +00:00
Daira Hopwood 60faf1c2c5 Generate some v5 coinbase transactions.
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-01-27 23:43:29 +00:00
Daira Hopwood ff9e171ff3 Update the computation of ZIP 244 test vectors to match https://github.com/zcash/zips/pull/587 .
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-01-27 23:34:40 +00:00
Kris Nuttycombe 0afbd1f240 Correct the types of variable-length fields for ZIP 244 test vectors.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-01-27 22:52:50 +00:00
Kris Nuttycombe 74747238b4
Merge pull request #62 from zcash-hackworks/refactor-into-package
Refactor test vectors into package
2022-01-12 21:00:13 -07:00
Jack Grigg 2093b309f4 Refactor test vectors into package
Scripts that were previously run via:
    poetry run python ./SCRIPT_NAME.py

and have been moved, can now be run as:
    poetry run SCRIPT_NAME

Some top-level scripts remain, where they only generate test vectors and
do not contain any Zcash logic. These now use the `zcash_test_vectors`
package, and can't be run directly unless this package is made available
in `PYTHONPATH`.
2022-01-13 02:46:20 +00:00
str4d 69dd363272
Merge pull request #67 from nuttycom/fix_zip0244_field_names
Rename scriptCode -> scriptPubKey & add zip244 test vectors.
2022-01-13 02:45:08 +00:00
Kris Nuttycombe e3959621fd Add zip244 test vectors. 2022-01-12 19:27:28 -07:00
Kris Nuttycombe 0a6297335f Rename scriptCode -> scriptPubKey 2022-01-12 19:26:12 -07:00
str4d 1ce0af7cd3
Merge pull request #68 from nuttycom/add_missing_test_vectors
Add test vectors for ZIPs 143, 243, 244, and 316
2022-01-13 02:09:47 +00:00
Kris Nuttycombe cbb71f6a9a Add generated test vectors for zip_143, zip_243, zip_244, unified addresses, and ufvks 2022-01-12 18:50:18 -07:00
str4d db01d4e23b
Merge pull request #63 from zcash-hackworks/ci-check-test-vectors
CI: Add workflow to verify test vectors are up-to-date
2022-01-10 16:36:00 +00:00
Jack Grigg 13b0cb1d92 CI: Ensure that all test vector variants are always checked
If one fails, we still want to check the others, because it can easily
be an output-specific issue.
2022-01-08 00:45:22 +00:00
Jack Grigg 053edd9e33 CI: Use `git status --porcelain` to verify no changes
`git diff -s --exit-code` will detect changes to tracked files, but
doesn't detect untracked files.
2022-01-07 23:55:40 +00:00
Jack Grigg 3174db5d00 Commit generated test vectors 2022-01-07 22:57:23 +00:00
Jack Grigg ffd11d94ec CI: Add workflow to verify test vectors are up-to-date
It will also help us to avoid unintentional modifications to existing
test vectors.
2022-01-07 22:57:23 +00:00
str4d 290218811f
Merge pull request #60 from daira/license-contribution-text
Revert a change made in #53, so that the license and contribution preamble is visible in `README.md`
2022-01-07 15:04:44 +00:00