Run each generator once when regenerating all formats, and fix source file URLs#126
Draft
daira wants to merge 17 commits into
Draft
Run each generator once when regenerating all formats, and fix source file URLs#126daira wants to merge 17 commits into
daira wants to merge 17 commits into
Conversation
… unknown items Add EXPIRY_HEIGHT_ITEM (0xE0) and EXPIRY_TIME_ITEM (0xE1) constants. Change decode_unified to accumulate unknown items as a list instead of asserting on duplicates, since R2 encodings can contain multiple metadata typecodes. Update R0 generator assertions accordingly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generate test vectors for R2 Unified Addresses with zu (shielded-only) and tu (transparent-enabled) HRPs, and optional address expiry metadata (typecodes 0xE0 and 0xE1). Produces 60 vectors covering Sapling-only, Orchard-only, mixed shielded, and transparent+shielded combinations with various expiry configurations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generate test vectors demonstrating the full UFVK (uvf) -> UIVK (uvi) -> UA (zu/tu) derivation chain for Revision 2 unified viewing keys. Each of the 20 vectors includes: - R2 UFVK with P2PKH, P2SH (ZIP 48 2-of-3 sortedmulti), Sapling, and Orchard FVK items, plus optional expiry metadata - Derived R2 UIVK with template transformation (/** -> /*), key derivation at non-hardened index 0, and metadata retention - Derived R2 UA with P2SH address computation via BIP 67 sorted redeem script and expiry propagation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract derive_sapling_fvk, derive_sapling_ivk, derive_orchard_fvk, and derive_orchard_ivk into viewing_key_derivation.py. These were duplicated across unified_full_viewing_keys.py, unified_incoming_viewing_keys.py, and unified_viewing_keys_r2.py. Each function returns the serialized bytes along with intermediate key objects needed by callers for further derivation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The UFVK and UIVK bech32m strings were being stored via .encode() as hex-encoded UTF-8 bytes (Vec<u8>), while unified addresses were already stored as plain strings (&'static str). Change all viewing key generators to store the bech32m string directly, consistent with how addresses are stored. Affects: unified_full_viewing_keys, unified_incoming_viewing_keys, unified_viewing_keys_r2. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Per ZIP 316: "A Unified Address or Unified Viewing Key MUST contain at least one non-metadata Item." Metadata is typecodes 0xC0..=0xFC. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verify that expiry height and time metadata survive encode/decode in the R2 viewing key generator, matching the existing assertions in the R2 address generator. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generate the random bool before checking the condition, so that changes to the condition don't disrupt the RNG stream for subsequent test vectors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sapling needs the account_key for diversifier derivation (find_j, diversifier, pk_d), unlike Orchard where the FVK has those methods. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update each generator's filename argument to render_tv to use the correct path relative to the repo root, so the URLs in generated test vectors point to the actual source files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The parameter now holds a module path (e.g. zcash_test_vectors/orchard/key_components) rather than a bare filename. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
As suggested by @vivek-arte in zcash#112. This does not change the output with the current version of rustfmt but is good practice for forward compatibility. Co-Authored-By: Vivek Arte <46618816+vivek-arte@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
This needs a change to the repo configuration in order to change the required check to "Verify test vectors". I'll wait until it's been reviewed before doing that. |
9754803 to
b0fac1d
Compare
Contributor
Author
|
Blocked-by #119. |
Add -o/--output-dir and -n/--name options to the test vector generators. When -o is given, all three output formats (rust, json, zcash) are written in a single run, avoiding redundant computation. The -t and -o flags are mutually exclusive. Update regenerate.sh to use this mode when the first argument is "all", reducing total generation time by ~3x. Fixes zcash#125. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of three parallel jobs each regenerating one format, run a single job that generates all formats in one pass per generator. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b0fac1d to
7b9e3a9
Compare
Addresses CodeQL warning about unrestricted token permissions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-o/--output-dirand-n/--nameoptions to test vector generators. When-ois given, all three output formats (rust, json, zcash) are written in a single run, avoiding redundant computation.rustfmtinvocation fromregenerate.shintooutput.pyso it is applied consistently regardless of how generators are invoked.regenerate.shto use the new mode when the first argument isall, reducing total generation time by ~3x.Fixes #125.
🤖 Generated with Claude Code