Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Arbitrary Txs] Array encoding issue #4124

Open
jakubcolony opened this issue Jan 15, 2025 · 0 comments · May be fixed by #4126
Open

[Arbitrary Txs] Array encoding issue #4124

jakubcolony opened this issue Jan 15, 2025 · 0 comments · May be fixed by #4126
Assignees

Comments

@jakubcolony
Copy link
Collaborator

Steps to reproduce

Reproducing this is kinda cumbersome, with the easiest way being deploying our own test contract.

Follow steps 1-5 from #3966, but replace the contents of TestContract.sol with the following:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract TestContract {
    function testFunction(uint256[] memory numbers) public {}
}

Once the contract is deployed, add a transaction with its address and the following JSON ABI:

[
  {
    "inputs": [
      {
        "internalType": "uint256[]",
        "name": "numbers",
        "type": "uint256[]"
      }
    ],
    "name": "testFunction",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

Select the testFunction and enter any value that is a valid array of integers ([], [1, 2, 3], and so on).

Submit the form.

Expected behaviour

The transaction goes through successfully.

Actual behaviour

The saga throws an error and silently fails. This is because ethers' encodeFunctionData is expecting a first-class array but it is passed the string representation instead.

@jakubcolony jakubcolony self-assigned this Jan 15, 2025
@jakubcolony jakubcolony linked a pull request Jan 15, 2025 that will close this issue
@jakubcolony jakubcolony linked a pull request Jan 19, 2025 that will close this issue
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 a pull request may close this issue.

1 participant