Skip to content

feat: support constants and map references in v2 schema fields#291

Draft
lcastillo-ledger wants to merge 1 commit intomainfrom
feat/v2-maps-and-constants-support
Draft

feat: support constants and map references in v2 schema fields#291
lcastillo-ledger wants to merge 1 commit intomainfrom
feat/v2-maps-and-constants-support

Conversation

@lcastillo-ledger
Copy link
Copy Markdown
Collaborator

Summary

  • Align v2 linter with updated ERC-7730 schema that widens many fields to accept constant references ($.metadata.constants.*) and map references alongside literal values
  • Add InputMapReference Pydantic model and update all relevant v2 input models (display, context, metadata) to accept map references in their type unions
  • Thread a strict_maps flag through the resolution pipeline: lint mode validates map references but drops them for resolution; calldata/convert modes produce errors since map resolution at conversion time is not yet supported
  • Validate map references: check map path exists in metadata.maps, check keyPath is a valid container/data/descriptor path
  • Reject structured data paths (#.) in keyPath for context/metadata sections (where they have no meaning)
  • Add @.chainId to the container path grammar per ERC-7730 spec
  • Handle empty resolved params dict after map reference values are dropped

Test plan

  • All 391 existing tests pass (3 pre-existing Etherscan API key failures unrelated)
  • All 39 v2-specific tests pass
  • Tested against canonical example-maps.json from ERC repo — lints cleanly
  • Tested invalid map path ($.metadata.maps.nonExistentMap) — correctly flagged
  • Tested invalid keyPath (@.foobar) — correctly flagged at parse time
  • Tested data path in metadata keyPath (#.someField) — correctly rejected

Made with Cursor

Align v2 linter with updated ERC-7730 schema that widens many fields to accept
constant references ($.metadata.constants.*) and map references alongside literal
values.

- Add InputMapReference model and update Pydantic input models for display,
  context and metadata fields (token, callee, selector, label, owner, etc.)
- Thread strict_maps flag through the resolution pipeline: lint mode validates
  map references but drops them for resolution, calldata/convert modes error
- Validate map references: check map path exists in metadata.maps, check keyPath
  is a valid container/data/descriptor path
- Reject structured data paths (#.) in keyPath for context/metadata sections
- Add @.chainId to container path grammar per spec
- Handle empty resolved params dict after map reference drop

Made-with: Cursor
@lcastillo-ledger lcastillo-ledger force-pushed the feat/v2-maps-and-constants-support branch from a6a40e5 to 06bcd36 Compare March 27, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant