Skip to content

fix: support prefix matching in v2 display field validation#284

Merged
ckorchane-ledger merged 2 commits intomainfrom
fix/v2-display-field-prefix-matching
Mar 26, 2026
Merged

fix: support prefix matching in v2 display field validation#284
ckorchane-ledger merged 2 commits intomainfrom
fix/v2-display-field-prefix-matching

Conversation

@lcastillo-ledger
Copy link
Copy Markdown
Collaborator

Summary

  • Fix false positive errors/warnings in v2 display field validation when descriptors use array root paths
  • Use data_path_starts_with prefix matching instead of strict set equality when comparing format paths against ABI paths

Context

The v2 display field linter validates that format paths correspond to actual ABI paths and vice versa. It was using strict set difference, which fails when a descriptor defines a display field for an array root (e.g. entries.[]) while the ABI expands into individual leaf paths (e.g. entries.[].alias, entries.[].address).

This caused:

  • Spurious "Invalid display field" errors for format paths like entries.[] that don't exist as exact ABI paths but are valid prefixes
  • Spurious "Missing display field" warnings for ABI leaf paths like entries.[].alias that are already covered by a parent format path

With prefix matching:

  • A format path is valid if it matches an ABI path exactly or is a prefix of one
  • An ABI path is considered covered if a format path matches it exactly or is a prefix of it

Test plan

  • Lint a descriptor with array root display fields (e.g. Safe AddAddressBookEntry with entries.[].alias) → no false positive errors
  • Lint a descriptor with exact leaf paths → behavior unchanged
  • Lint a descriptor with a truly invalid path → still reports error correctly

Made with Cursor

The display field linter was using strict set comparison between format
paths and ABI paths. This caused false positives when a descriptor
defines a display field for an array root (e.g. `entries.[]`) while
the ABI expands to individual leaf paths (e.g. `entries.[].alias`,
`entries.[].address`).

Use `data_path_starts_with` for prefix matching so that:
- A format path is valid if it matches an ABI path or is a prefix of one
- An ABI path is considered covered if a format path is a prefix of it

Made-with: Cursor
@ckorchane-ledger ckorchane-ledger enabled auto-merge (squash) March 26, 2026 14:15
@ckorchane-ledger ckorchane-ledger merged commit 7dcf3bf into main Mar 26, 2026
10 checks passed
@ckorchane-ledger ckorchane-ledger deleted the fix/v2-display-field-prefix-matching branch March 26, 2026 14:21
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.

2 participants