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

[Bug] Decode the input data of tx #5643

Open
2 of 3 tasks
MHarisAshfaq opened this issue Sep 12, 2024 · 1 comment
Open
2 of 3 tasks

[Bug] Decode the input data of tx #5643

MHarisAshfaq opened this issue Sep 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@MHarisAshfaq
Copy link

MHarisAshfaq commented Sep 12, 2024

Bug report

I am trying to debug the input data from tx https://arbiscan.io/tx/0x005bc2cc2715a77d8ac20524789a99bc05ca4048a3c9d78c5ad525c7139df9cf

This is my input data which I am using to decode
00000000000000000000000000000000000000000000000000000000000065f40000000000000000000000000000000000000000000000000000000000000276000000000000000000000000000000000000000000000000000000000000010016e3850080805d39bdb096fc08bf0041480292473fadfb4c72009291f11eb15f00000000000000000000000000000000000000000000000000000000000001202beda7a630edebbcad1bc24cd1f90a077ec6cda82c3771a387de0a7d903198da0000000000000000000000000000000000000000000000000000000066e0863d00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000603d4f93a04a08ef38ccafd24c35084ecd0007810c986f677c6631b39c871ff0284c3ce5c5e58d837242f1bac4ad70fc63a378a98b69d24aadf3f44b4fc3dabcfd1b00000000000000000000000000000000000000000000000000000000000000

let decoded = ethereum.decode(
        "(uint256,uint256,uint256[],bytes32,address[],bytes32,uint64,bytes)",
        tx.input
      );

And here is the abi of function

{
    "inputs": [
      { "internalType": "uint256", "name": "remoteChainId", "type": "uint256" },
      { "internalType": "uint256", "name": "blockNonce", "type": "uint256" },
      {
        "internalType": "uint256[]",
        "name": "invalidBlockNonces",
        "type": "uint256[]"
      },
      {
        "internalType": "bytes32",
        "name": "finalizersHash",
        "type": "bytes32"
      },
      {
        "internalType": "address[]",
        "name": "finalizers",
        "type": "address[]"
      },
      { "internalType": "bytes32", "name": "salt", "type": "bytes32" },
      { "internalType": "uint64", "name": "expiry", "type": "uint64" },
      { "internalType": "bytes", "name": "multiSignature", "type": "bytes" }
    ],
    "name": "finalize",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  }

It seems decoding is not working.

Relevant log output

No response

IPFS hash

0x005bc2cc2715a77d8ac20524789a99bc05ca4048a3c9d78c5ad525c7139df9cf

Subgraph name or link to explorer

https://api.studio.thegraph.com/query/79955/test/v0.0.61

Some information to help us out

  • Tick this box if this bug is caused by a regression found in the latest release.
  • Tick this box if this bug is specific to the hosted service.
  • I have searched the issue tracker to make sure this issue is not a duplicate.

OS information

macOS

Tasks

No tasks being tracked yet.
@MHarisAshfaq MHarisAshfaq added the bug Something isn't working label Sep 12, 2024
@encalypto
Copy link
Contributor

encalypto commented Oct 16, 2024

Thanks for opening an issue @MHarisAshfaq!

In this case, the type string you're specifying:

"(uint256,uint256,uint256[],bytes32,address[],bytes32,uint64,bytes)"

is for a tuple which contains dynamically sized array/bytes elements (uint256[], bytes, etc). Dynamic tuples like this expect the input data to be prepended with a 32 byte offset representing where the inner data begins.

You can try prepending the block with 0000000000000000000000000000000000000000000000000000000000000020; the number 32 itself encoded as a 32-byte hex string. This should result in a valid block:

000000000000000000000000000000000000000000000000000000000000020 <-- Note this extra 32 byte offset
000000000000000000000000000000000000000000000000000000000000065
f40000000000000000000000000000000000000000000000000000000000000
276000000000000000000000000000000000000000000000000000000000000
010016e3850080805d39bdb096fc08bf0041480292473fadfb4c72009291f11
eb15f0000000000000000000000000000000000000000000000000000000000
0001202beda7a630edebbcad1bc24cd1f90a077ec6cda82c3771a387de0a7d9
03198da00000000000000000000000000000000000000000000000000000000
66e0863d0000000000000000000000000000000000000000000000000000000
000000140000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000
0000000000603d4f93a04a08ef38ccafd24c35084ecd0007810c986f677c663
1b39c871ff0284c3ce5c5e58d837242f1bac4ad70fc63a378a98b69d24aadf3
f44b4fc3dabcfd1b00000000000000000000000000000000000000000000000
000000000000000

This should successfully decode.

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
Status: Bug
Development

No branches or pull requests

2 participants