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

Calldata encoding fails for tuple params #321

Open
Romsters opened this issue Nov 21, 2024 · 0 comments
Open

Calldata encoding fails for tuple params #321

Romsters opened this issue Nov 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Romsters
Copy link
Collaborator

Romsters commented Nov 21, 2024

🐛 Bug Report

📝 Description

BE doesn’t properly parse tuple param with nested tuples in it. For example

https://explorer.zksync.io/tx/0xc014b81191eb39e669e5f7356615957a935091979af8e78b48dd8b1b6661602c shows Unable to decode input data (data_decode_failed) even though the contract is verified and has an ABI. The following function was called:

swap(((address,bytes,address,bytes)[],address,uint256)[],uint256,uint256)

and internally the next error is thrown:

{
    "reason": "types/value length mismatch",
    "code": "INVALID_ARGUMENT",
    "argument": "tuple",
    "value": [
        [
            [
                "0x80115c708E12eDd42E504c1cD52Aea96C547c05c",
                "0x0000000000000000000000003355df6d4c9c3035724fd0e3914de96a5a83aaf40000000000000000000000009a2c5b73c0b8a4caccee4829f41855d918bb626f0000000000000000000000000000000000000000000000000000000000000001",
                "0x0000000000000000000000000000000000000000",
                "0x"
            ]
        ],
        "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4",
        {
            "type": "BigNumber",
            "hex": "0x028e1df9"
        }
    ]
}

which lead to an error message on UI.

The problem is in how tuple is encoded. Current implementation tries to encode it as tuple[] and when I manually changed it to decode as tuple(tuple(address,bytes,address,bytes)[],address,uint256)[] it worked.

@Romsters Romsters added the bug Something isn't working label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant