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).
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.
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.
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>
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>
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>
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`.