feat(v2): update spec and add support for visibility rules and constraints - #335
Open
paoun-ledger wants to merge 1 commit into
Open
feat(v2): update spec and add support for visibility rules and constraints#335paoun-ledger wants to merge 1 commit into
paoun-ledger wants to merge 1 commit into
Conversation
paoun-ledger
force-pushed
the
fix/v2-visibility-mustmatch
branch
from
August 27, 2026 16:55
e3a029f to
b50a462
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the repository’s ERC-7730 v2 implementation with the latest registry V2 spec by adding first-class support for visibility rules/constraints and tightening parts of the v2 input/resolved models to use explicit enums.
Changes:
- Added v2 model-level enums for simple visibility rules and array iteration strategy, and applied them to input/resolved models.
- Implemented calldata v1 conversion support for v2 visibility conditions by mapping them to FIELD
VISIBLE/CONSTRAINTtags and validating constraint payloads. - Updated the v2 JSON schema and expanded test coverage to pin enum/constraint validation and conversion behavior.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/v2/model/test_enum_constraints.py | Adds tests to enforce schema/model enum constraints (iteration strategy and address-name types). |
| tests/v2/model/init.py | Test package marker (no behavioral change). |
| tests/v2/convert/resolved/test_convert_input_to_resolved.py | Updates test case descriptions to reflect mustMatch naming. |
| tests/v2/convert/resolved/data/field_with_visibility_conditions_resolved.json | Renames visibility condition key to mustMatch in resolved fixture. |
| tests/v2/convert/resolved/data/field_with_visibility_conditions_input.json | Renames visibility condition key to mustMatch in input fixture. |
| tests/v2/convert/resolved/data/definition_no_label_visible_must_be_resolved.json | Renames visibility condition key to mustMatch in resolved fixture. |
| tests/v2/convert/resolved/data/definition_no_label_visible_must_be_input.json | Renames visibility condition key to mustMatch in input fixture. |
| tests/v2/convert/calldata/test_convert_fields.py | Adds conversion/serialization tests for visibility conditions and constraints in calldata output. |
| src/erc7730/model/resolved/v2/display.py | Types visibility/iteration and address-name types with explicit enums; renames mustBe→mustMatch. |
| src/erc7730/model/input/v2/unions.py | Updates discriminator to detect mustMatch condition objects. |
| src/erc7730/model/input/v2/format.py | Introduces VisibilityRule and IterationStrategy enums for v2. |
| src/erc7730/model/input/v2/display.py | Applies new enums to v2 input models and renames mustBe→mustMatch. |
| src/erc7730/model/calldata/v1/instruction.py | Adds FIELD visibility/constraint modeling and validation (max constraints, required constraints, size checks). |
| src/erc7730/convert/resolved/v2/references.py | Updates hidden-field detection and visibility resolution for mustMatch. |
| src/erc7730/convert/resolved/v2/convert_erc7730_input_to_resolved.py | Updates visibility resolution to emit mustMatch. |
| src/erc7730/convert/calldata/v1/tlv.py | Adds TLV tags for FIELD visibility/constraint emission in FIELD serialization. |
| src/erc7730/convert/calldata/convert_erc7730_v2_input_to_calldata.py | Maps v2 visibility conditions into calldata FIELD visibility/constraints and encodes constraint values. |
| specs/erc7730-v2.schema.json | Updates schema draft/version and adds/adjusts visibility + reference override capabilities. |
| pyproject.toml | Excludes schema JSONs from codespell scanning. |
Suppressed comments (1)
specs/erc7730-v2.schema.json:325
- "unresolvedProperties" is not a JSON Schema keyword (draft 2020-12). Validators will ignore it, so extra keys inside a map entry will be accepted unintentionally.
"additionalProperties": {
"type": ["string", "integer", "number", "boolean", "null"]
}
},
"unresolvedProperties": false
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
paoun-ledger
force-pushed
the
fix/v2-visibility-mustmatch
branch
from
August 27, 2026 17:02
b50a462 to
d59a7b3
Compare
5 tasks
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.
Align spec with latest V2 from the registry.
Add support for visibility and constraints, already supported by the device and needed by LedgerHQ/internal-erc7730-registry#28