Feat/wholefield#10
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new domain type called .whole_values to constrain entire field instances (including all inner array dimensions) to fixed byte patterns, rather than choosing each element independently. This is useful when a field array must match one of a few complete patterns.
Changes:
- Added
.whole_valuesdomain variant to allow fixed byte-blob constraints on entire array-shaped fields - Implemented validation functions to ensure candidate blob lengths match the field's total byte span
- Updated seed byte calculation to charge only one selector byte per field instance (global array instances only), not per field element
- Added code generation for sampling and validation of whole_values domains
- Comprehensive test coverage including integration and unit tests
- Documentation updates explaining the new domain type, when to use it vs
.values, and fuzzer byte accounting
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| USAGE.md | Documentation of .whole_values domain with examples and guidance on when to use it |
| src/cgen/ir.zig | New domain type, validation functions, and helper functions for byte calculations |
| src/cgen/emit.zig | Code generation for static domain tables, sampler, and checker for .whole_values |
| src/seed.zig | Updated byte calculation logic for new domain type with comprehensive tests |
| src/main.zig | Call to validate domains before code generation |
| src/Invariant.zig | Test for applying .whole_values domains to globals |
| src/root.zig | Export ir module for use in main |
| tests/whole_field_byte_array_invariant/ | New integration test files for the feature |
| README.md & CONTRIBUTING.md | Documentation updates mentioning the new domain type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
|
@N3ur0sis You go ahead with your review, the issue you found should be fixed 🙏 |
Signed-off-by: Francisco Freitas <francisco.freitas@ledger.fr>
Contributor
Everything looks good to me, thanks ! |
N3ur0sis
approved these changes
Apr 9, 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.
@N3ur0sis can you have a look at this 🙏
Hoping you can still get the same coverage with this version.
Would interested to have tests you can think of 🙏
Open to any suggestion