You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Converts v2 EIP-712 descriptors into calldata descriptors: message info, struct/field schema, fields, enums and maps.
Addressing: message info, enums and map entries are addressed by DOMAIN_SEPARATOR + PRIMARY_TYPE_HASH (no more CONTRACT_ADDR/CHAIN_ID/SELECTOR).
Domain separator: computed per EIP-712 from the domain and deployment (checked against the spec's Ether Mail vector), or given by the descriptor. A given one has to be the one of the declared domain: the converter rejects the descriptor otherwise, and the lint rule ValidateEIP712DomainSeparatorLinter reports it. A domain declaring a chain id or verifying contract that conflicts with the deployment is rejected.
Paths: EIP-712 path encoding, including EIP712_LEAF_SLICE and the 17-element limit. ARRAY_DIM is encoded minimally.
Maps supported for EIP-712, with key encoding and validation. Visibility constraints are normalized to the leaf encoding.
Contract-less descriptors: network, chain_id and address are optional on EIP-712 calldata descriptors (still required for transactions, and for enums/maps using a selector). Chain and contract come from the domain (chainId, verifyingContract) when present.
TLV tag/length encoded as multi-byte DER to support payloads over 255 bytes.
Decisions / out of scope
PARAM_GROUP nesting is still flattened (as in v1).
@.value is rejected for EIP-712; GATING_DESCRIPTOR and PROXY_INFO are not handled.
domainSeparator or deployments is still required in the input model.
Tests
Unit tests for EIP-712 conversion, maps, contract-less descriptors and the new lint rule.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved EIP-712 defects can produce incorrect type hashes, emit incomplete domain schemas, and bind domain separators to values that conflict with explicit inputs.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved conversion defects can emit invalid EIP-712 schemas, reject valid inputs, or discard converted formats, while existing registry tests can miss partial failures.
This copies the display name into CREATOR_LEGAL_NAME instead of using info.legalName, so generated message metadata contains the wrong legal name whenever the two differ. Use descriptor.metadata.info.legalName, leaving the optional tag unset when that field is absent.
Report unrepresentable path bounds instead of raising
The source path model accepts index 32767, but translating values.[32767] on a dynamic array produces an exclusive end of 32768, which violates the new slice model's signed-16-bit limit. Its validation exception escapes this function and the outer converter discards all previously converted formats; the map-key linter can likewise abort. Check representability and report the unsupported path through out instead; apply the same check to explicit slice bounds.
Selecting field index 256 of a 257-member struct raises here instead of reporting an unsupported path. The exception reaches the descriptor-wide handler and drops formats already converted; the map-key linter can also abort. Check the index against the device limit and report it through out before constructing the element.
For a fixed bytes32 leaf, key.[32:40] (or key.[-1:0]) is statically empty, but _leaf_slice_width returns None, which is treated as an unknown width. Conversion therefore succeeds, and an EIP-712 map using this path even accepts nonempty keys although none can ever match. Reject statically empty fixed-size leaf slices before emitting the path.
Reject invalid integer widths before schema conversion
For Msg(uint9 value), dividing the width by eight produces a one-byte UINT schema while primary_type_hash still hashes uint9, so the emitted schema and addressing hash disagree. Conversion does not run the key linter that rejects invalid integer types. Reject aliases and noncanonical or out-of-range widths before converting them to bytes.
When a message references EIP712Domain, such as Msg(EIP712Domain d)EIP712Domain(string name), these lines append that struct twice even if it matches the declared domain. The duplicate-struct validation then aborts conversion and discards other formats. Reuse a matching definition and report an error only when the domain definitions disagree.
Msg(uint256 value,Missing other) can emit a schema referencing an undefined Missing struct when only value is displayed. The device cannot resolve that schema, and conversion does not run the key linter that would reject it. Check that every referenced struct is defined before returning the schema.
Fail tests when conversion returns partial results
The converter returns partial results when a format or deployment fails, so assert descriptors can pass while some messages are omitted and conversion errors remain. Collect diagnostics with a ListOutputAdder and assert that it has no errors, so the existing expected-failure markers also detect partial failures.
- bind EIP712_MESSAGE_INFO, ENUM_VALUE and MAP_ENTRY with DOMAIN_SEPARATOR and PRIMARY_TYPE_HASH
- compute the domain separator per deployment (or use the given one)
- struct/field versions set to 1, add EIP712_LEAF_SLICE and 17 elements path limit
- support map lookups and key encoding for EIP-712
- validate EIP-712 schema, normalize constraints, reject @.value
- fix map keys linter path converter
- add tests
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
An EIP-712 descriptor is addressed by its domain separator and primary type hash: the verifying contract is optional.
- chain id, address and network are optional for EIP-712 descriptors, message info, enums and map entries
- emit a descriptor when no deployment is declared, taking the chain and contract from the domain if it has them
- compute the domain separator from the domain fields only, and check the separator given by the descriptor
- add domain separator tests (salt, no verifying contract)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The converter uses a domainSeparator given by the descriptor as is, as the declared domain may be partial. A new linter recomputes the separator from the domain and deployments, and warns when none matches.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore the resolution registry test and mark the EIP-712 files the converter does not support yet as expected failures.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rsion
- bind the domain chain id and verifying contract to the deployment once, reject conflicts, and carry them
independently to maps, enums and token checks
- reject a given domain separator that is not the one of the declared domain
- keep descriptors on networks unknown to Ledger, and isolate schema errors to the failing format
- check fixed array indexes, keep the width of a sliced bytesN leaf, pad int constraints only when negative
- lint EIP-712 map keys, require 32 bytes hashes, accept $ in struct names
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- filter deployments by the requested chain before binding them to the domain
- report path bounds, struct field indices and statically empty leaf slices the device cannot represent
- reject non canonical integer and bytesN widths, undefined referenced structs and conflicting EIP712Domain
- use the legal name of the owner info when set
- fail the registry test on any conversion error, not only on empty output
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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
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.
Generate calldata (generic parser) descriptors for ERC-7730 v2 EIP-712 messages, following the EIP-712 V2 spec.
Specs
doc/eip712.md)doc/tlv_structs.md):OPERATION_INFO,ENUM_VALUE,MAP_ENTRY,EIP712_STRUCT,EIP712_FIELDWhat this does
DOMAIN_SEPARATOR+PRIMARY_TYPE_HASH(no moreCONTRACT_ADDR/CHAIN_ID/SELECTOR).ValidateEIP712DomainSeparatorLinterreports it. A domain declaring a chain id or verifying contract that conflicts with the deployment is rejected.EIP712_LEAF_SLICEand the 17-element limit.ARRAY_DIMis encoded minimally.network,chain_idandaddressare optional on EIP-712 calldata descriptors (still required for transactions, and for enums/maps using a selector). Chain and contract come from the domain (chainId,verifyingContract) when present.Decisions / out of scope
PARAM_GROUPnesting is still flattened (as in v1).@.valueis rejected for EIP-712;GATING_DESCRIPTORandPROXY_INFOare not handled.domainSeparatorordeploymentsis still required in the input model.Tests
--run-integration) converting every registry EIP-712 descriptor. 9 files that hit existing converter gaps (e.g. visibility conditions on non-raw formats from feat(v2): update spec and add support for visibility rules and constraints #335) are listed as expected failures intests/files.py.