Skip to content

fix: support fixed-size array dimensions in signature parser#277

Closed
Maroutis wants to merge 1 commit intoLedgerHQ:mainfrom
Maroutis:fix/fixed-size-array-parsing
Closed

fix: support fixed-size array dimensions in signature parser#277
Maroutis wants to merge 1 commit intoLedgerHQ:mainfrom
Maroutis:fix/fixed-size-array-parsing

Conversation

@Maroutis
Copy link
Collaborator

@Maroutis Maroutis commented Mar 17, 2026

Summary

The Lark grammar in the ABI signature parser only handled dynamic arrays ([]) but rejected fixed-size arrays ([N]), causing Invalid signature errors when linting valid Solidity/ABI types such as address[11], uint256[5][5], or address[5].

Changes (3 lines in src/erc7730/common/abi.py):

  • Grammar rule: array: "[]"array: "[]" | "[" /[0-9]+/ "]" to accept both [] and [N]
  • array transformer: preserve the size dimension instead of always returning "[]"
  • named_tuple filter: match array suffixes by startswith("[") instead of == "[]" so fixed-size arrays on tuples are correctly identified

Test plan

  • 5 new parametrized test cases added covering: single fixed-size (uint256[3]), multi-dimensional fixed-size (uint256[5][5], uint256[2][3][4]), mixed fixed/dynamic (bytes32[2][]), and fixed-size tuple arrays ((uint256,address)[3])
  • All 22 tests pass (17 existing + 5 new), no regressions

Made with Cursor

The Lark grammar only handled dynamic arrays (`[]`) but rejected
fixed-size arrays (`[N]`), causing lint failures on valid Solidity
types like `address[11]` and `uint256[5][5]`.

Made-with: Cursor
@Maroutis Maroutis requested a review from a team as a code owner March 17, 2026 10:15
@Maroutis Maroutis closed this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant