Tuple with struct incorrectly parsed - always errors

Open
#701 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
solidity, typescript

Research direction

The payload names no source file; start by reviewing the tuple-related tests referenced in PR #402 and tracing the validation path for nested struct tuples. Reproduce the reported TypeError with the example input, then consider the issue done when the tuple validates successfully and regression coverage exists.

Written by the indexing model from the issue text.

Description

Description

Struct tuple incorrectly parsed, never passes validation:
image

Example tuple: (whitespace here for legibility)

[
  [{ "token": "0xSomeActualAddress", "id": "1000" }], 
  [{ "token": "0xSomeActualAddress", "id": "4000" }]
]

contract tuple:

StructType {
  address token;
  uint256 id;
}

function someContractFn(
        string memory stringParam,
        uint256[] calldata _unit256ArrayParam,
        StructType[][] calldata _tupleParam
    ) external { ... }

Running this on etherscan works fine. I checked the tests written in this PR, which addresses the original issue opened, but I don't see any tests for struct tuples

Environment

  • Browser: Brave
  • Wallet: Brave wallet
  • Safe:
  • Environment:
    • production (goerli)

Steps to reproduce

For reasons of security on our side I don't want to give our contract, but any other contract requiring a struct tuple as a param will encounter this problem.

Expected result

Passes validation

Obtained result

Invalidated with: format error. details: typeerror: cannot read properties of undefined (reading 'length')

Screenshots

image

Also hi to the Safe team!

Dominant language
TypeScript
Stars
116
Forks
84
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from safe-global/safe-react-apps

All issues in safe-global/safe-react-apps

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.