Apply rustfmt to test vectors and use static slices instead of vec#122
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Rust test-vector generation/CI pipeline to enforce consistent formatting and shifts generated Rust test-vector types from heap-allocated Vec to 'static slice references.
Changes:
- Switches several generator schemas from
Vec<...>/Option<Vec<...>>to&'static [...]/Option<&'static [...]. - Updates the Rust emission logic to print slice literals (
&[...]) and adds a slice-based bool emitter. - Runs
rustfmtduring Rust test-vector regeneration and adds Rust toolchain setup + a compile check in CI.
Reviewed changes
Copilot reviewed 34 out of 44 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| zcash_test_vectors/zip_0244.py | Updates Rust field types to 'static slices for ZIP-0244 vectors. |
| zcash_test_vectors/zip_0243.py | Updates Rust field types to 'static slices for ZIP-0243 vectors. |
| zcash_test_vectors/zip_0233.py | Updates Rust field types to 'static slices for ZIP-0233 vectors. |
| zcash_test_vectors/zip_0143.py | Updates Rust field types to 'static slices for ZIP-0143 vectors. |
| zcash_test_vectors/unified_incoming_viewing_keys.py | Converts bytes fields to Option<&'static [u8]> / &'static [u8]. |
| zcash_test_vectors/unified_full_viewing_keys.py | Converts bytes fields to Option<&'static [u8]> / &'static [u8]. |
| zcash_test_vectors/unified_address.py | Converts bytes fields to Option<&'static [u8]> / &'static [u8]. |
| zcash_test_vectors/output.py | Adjusts Rust emission to prefer slice literals and slice-bool formatting. |
| zcash_test_vectors/orchard/sinsemilla.py | Converts domain/msg types to slice-based Rust types (&[u8], &[bool]). |
| zcash_test_vectors/orchard/group_hash.py | Converts domain/msg Rust types to &'static [u8]. |
| zcash_test_vectors/f4jumble.py | Converts Rust types to &'static [u8]. |
| test-vectors/rust/zip_0320.rs | Rustfmt reflow of hard-coded test vectors. |
| test-vectors/rust/zip_0316.rs | Rustfmt reflow of hard-coded test vectors. |
| test-vectors/rust/zip_0032_registered.rs | Rustfmt reflow of hard-coded test vectors (incl. &[] cleanup). |
| test-vectors/rust/zip_0032_arbitrary.rs | Rustfmt reflow of hard-coded test vectors (incl. &[] cleanup). |
| test-vectors/rust/sapling_generators.rs | Rustfmt reflow of hard-coded test vectors. |
| test-vectors/rust/orchard_zip32.rs | Rustfmt reflow of hard-coded test vectors. |
| test-vectors/rust/orchard_poseidon_hash.rs | Rustfmt reflow of hard-coded test vectors. |
| test-vectors/rust/orchard_map_to_curve.rs | Rustfmt reflow of hard-coded test vectors. |
| test-vectors/rust/orchard_generators.rs | Rustfmt reflow of hard-coded test vectors. |
| test-vectors/rust/orchard_empty_roots.rs | Rustfmt reflow of hard-coded test vectors (multi-line array formatting). |
| test-vectors/rust/f4jumble_long.rs | Rustfmt reflow of hard-coded test vectors. |
| regenerate.sh | Pipes Rust generation through rustfmt when producing .rs vectors. |
| .github/workflows/test_vectors.yml | Installs rustfmt in the Rust matrix job and compiles generated Rust vector files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pipe Rust test vector output through rustfmt in regenerate.sh so that generated code follows standard Rust formatting conventions. Closes #66 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3a68209 to
bb569e4
Compare
Replace Vec<u8>, Vec<bool>, Vec<i64>, and Vec<Vec<u8>> with their static slice equivalents (&'static [u8], &'static [bool], etc.) in all generators and the output renderer. The use of vec![] was a holdover from a period where static slices weren't usable in const contexts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Install Rust toolchain in CI for rustfmt during regeneration. Add a compilation step that verifies all generated Rust test vectors compile successfully. Use a temp dir for rustc output since -o /dev/null creates temp files in the output directory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bb569e4 to
f0cfe15
Compare
nullcopy
approved these changes
Apr 2, 2026
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.
Fixes #66