Repository navigation
Fix five registry bugs: nested interpolatedIntent, chain names, wide chain IDs, byte slices, map references - #27
Merged
llbartekll merged 6 commits intoOct 29, 2026
Conversation
Clippy 1.95 reports collapsible_match in safe_integration.rs on main, so cargo clippy -D warnings fails before any other change.
The v2 test schema allows interpolatedIntent in a nested rendered output (definitions.renderedOutput), and the Sourcify runner requires it. The engine did not render it for a nested call, and cs-test rejected a test file that had it (NestedExpected has deny_unknown_fields). - DisplayEntry::Nested has a new interpolated_intent field. Calldata and EIP-712 containers render the inner format's interpolatedIntent with the same rules as the top level. - NestedExpected accepts interpolatedIntent. compare.rs compares it when the expected output has it, and the mismatch names the nested path. - results.json emits the nested interpolatedIntent. - Swift bindings, React Native TS bindings and the wallet app follow the new enum field. Tests: the 23 cases of docs/top-contracts/nested-tests/ in manuelwedler/clear-signing-erc7730-registry@21a929d (base, blast, pendle, with their descriptors) are vendored as cs-test registry regressions.
chain_name() had a hand-written table of 16 chains, so every other chain rendered as "Chain <id>". The spec converts the value "to a Blockchain name using EIP-155 reference values". Generate the full table from the name fields of https://chainid.network/chains.json with scripts/generate_chain_names.py (same pattern as the native currency table). An unknown chain ID still renders as "Chain <id>". Test: 999 renders "Wanchain Testnet", 81457 "Blast", 59144 "Linea".
A chainId value above u64 rendered as "Chain 0", and a tokenAmount or
tokenTicker whose chainIdPath held such a value looked up the token on
the signing chain, so a wrong token could be shown.
- chainId format: parse the value as an unsigned 256-bit integer. An ID
above u64 is not in the EIP-155 list and renders as "Chain <decimal>".
- tokenAmount / tokenTicker: when chainIdPath holds an ID above u64, do
not resolve the token. Show the raw value and emit
token_metadata_not_found / token_ticker_not_found.
EIP-712 had the same input fail the whole render ("does not fit into
u64"); it now follows the calldata rules. A spec-compliance parity test
covers both.
A field path with a byte slice, for example "_extraData.[0:32]", rendered "<unresolved>" when the bytes were empty or shorter than the slice. The Sourcify runner renders the empty slice as 0 for a tokenAmount. The spec does not define this case. Proposed rule (aligned with the Sourcify runner and Python slicing), for byte slices only: - A negative bound counts from the end of the bytes. - Each bound is limited to 0..=len. - start >= end gives empty bytes. - Empty bytes decode as 0 for integer formats. An index out of range, and array slices, still resolve to nothing. Calldata and EIP-712 paths use the same rule. Test: registry/blast/calldata-L1BlastBridge.json with its testsv2 file from manuelwedler/clear-signing-erc7730-registry@21a929d; the cases "bridgeERC20 - chain 1" and "bridgeERC20-steth - chain 1" render "0 DAI".
The spec (metadata.maps) lets a parameter that takes a constant be a map
reference {"map": "$.metadata.maps.<name>", "keyPath": "<path>"}, where
a map is {"$keyType": ..., "values": {...}}. The SDK expected a string
in FormatParams.token and had its own map model ("entries" +
"mapReference"), so the spec form did not parse.
- MapDefinition reads $keyType and values. "entries" stays an alias, so
the old mapReference value maps keep working.
- FormatParams moves a map reference given for token, chainId, callee,
selector, amount, spender or collection into map_refs. Rendering
(calldata and EIP-712, also nested calldata and interpolatedIntent)
and the nested-descriptor resolver replace it with the map value for
the key read at keyPath.
- A key that is not in the map is an invalid-descriptor error, as the
spec requires ("the wallet MUST consider the 7730 file invalid for the
transaction").
Spec ambiguities, handled leniently:
- The ERC example files write "key" in place of "keyPath"; both work.
- The inline example in the spec text writes the map path as a plain
string and puts keyPath on the map; that form works too.
- Key match: exact, then case-insensitive (hex), then equal integer.
Tests: assets/erc-7730/example-maps.json and example-maps-pools.json of
the ERC (vendored verbatim), a calldata/EIP-712 parity test, a resolver
test and parser tests.
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 five bugs in the SDK and the
cs-testrunner that the ERC-7730 registry hits with the runner pinned at65af228. Each fix is its own commit with a test, so the PR can be reviewed one commit at a time. I can split it into five PRs if you prefer.All checks pass:
cargo fmt --check,cargo clippy --workspace --all-targets [--features uniffi,github-registry] -D warnings,cargo test --workspace(480 tests).Registry check: I ran this branch and
65af228on everytestsv2file of manuelwedler/clear-signing-erc7730-registry@21a929d (2988 cases, with--registry). Two cases go from fail to pass (blast L1BlastBridge, bug 4). No case regresses. The one case that still fails (raribleMeta Transaction, EIP-712 owner) also fails on65af228and is not part of this PR.1. Nested
interpolatedIntent(c6dd9bd)The test schema allows
interpolatedIntentin a nested rendered output (definitions.renderedOutput).cs-testrejected such a test file (NestedExpectedhasdeny_unknown_fields), and the engine did not render the string for a nested call.DisplayEntry::Nestedhas a newinterpolated_intentfield. Calldata and EIP-712 containers render the inner format'sinterpolatedIntentwith the same rules as the top level.NestedExpectedacceptsinterpolatedIntent.compare.rscompares it when the expected output has it, and the mismatch names the nested path.results.jsonemits it. (ownerwas already inNestedExpectedand compared.)Nestedvariant has one more field. I regeneratedbindings/swift/clear_signing.swift, updated the React Native TS bindings in the generator's own style (nonpm cihere, so please let the release drift guard confirm), and updated the three.nested(...)patterns in the wallet app.Test: the 23 cases of
docs/top-contracts/nested-tests/from the registry commit above, with their descriptors, are vendored as cs-test regressions (base, blast, pendle). There is also a spec-compliance parity test.2. Chain names (f11ff3c)
chain_name()had 16 chains. The table is now generated from thenamefields of https://chainid.network/chains.json byscripts/generate_chain_names.py, in the same way as the native currency table. An unknown chain ID still renders asChain <id>.Test: 999 →
Wanchain Testnet, 81457 →Blast, 59144 →Linea.3. Chain IDs above 64 bits (b495ff3)
chainIdformat: the value is parsed as an unsigned 256-bit integer. An ID aboveu64renders asChain <decimal>(it wasChain 0).tokenAmount/tokenTickerwith achainIdPaththat holds such an ID: the token is not looked up on the signing chain any more. The raw value is shown andtoken_metadata_not_found/token_ticker_not_foundis emitted.4. Byte slice past the end of the data (9f5c075)
"_extraData.[0:32]"rendered<unresolved>when the bytes were empty or shorter than the slice. The spec does not define this case. This PR uses the Sourcify runner's behavior. Proposed rule for the spec:An index out of range, and array slices, still resolve to nothing. Calldata and EIP-712 paths use the same rule (
path::apply_byte_access).Test:
registry/blast/calldata-L1BlastBridge.jsonwith its testsv2 file. "bridgeERC20 - chain 1" and "bridgeERC20-steth - chain 1" render0 DAI. There is also a parity test.5. Spec map references (bf5f6ab)
The spec form is now supported: a parameter
{"map": "$.metadata.maps.<name>", "keyPath": "<path>"}and a map{"$keyType": ..., "values": {...}}.token,chainId,callee,selector,amount,spender,collection. This covers calldata and EIP-712 rendering, nested calldata,interpolatedIntent, and the nested-descriptor resolver.FormatFailure::InvalidDescriptor), because the spec says "the wallet MUST consider the 7730 file invalid for the transaction".FormatParamskeeps its field types. A map reference goes into a newmap_refsfield, through a manual serde impl (remote = "Self"). The oldentries/mapReferencevalue maps still work (entriesis an alias ofvalues).The spec is ambiguous here. These forms are all accepted:
keywhere the spec text writeskeyPath."token": "$.metadata.maps.underlyingToken"and putskeyPathon the map itself."1"="0x01").Test:
assets/erc-7730/example-maps.jsonandexample-maps-pools.jsonof the ERC, vendored verbatim, on chains 1, 137 and 42161. A key that is not in the map gives an invalid-descriptor error. There are also a parity test fortoken/chainId/ nestedcallee, a resolver test and parser tests.Other
collapsible_matchintests/safe_integration.rsonmain. This commit fixes it so that-D warningspasses.chainIdPathaboveu64still falls back to the signing chain inresolve_nested_chain_idand in the resolver.🤖 Generated with Claude Code