Skip to content

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

Merged
Maroutis merged 1 commit intomainfrom
fix/fixed-size-array-parsing
Mar 17, 2026
Merged

fix: support fixed-size array dimensions in signature parser#278
Maroutis merged 1 commit intomainfrom
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:20
@Maroutis Maroutis merged commit 194db7f into main Mar 17, 2026
11 of 12 checks passed
@Maroutis Maroutis deleted the fix/fixed-size-array-parsing branch March 17, 2026 10:41
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