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

"Data is invalid : Unexpected number of items" upon contract invoke #171

Open
disappearer opened this issue Oct 31, 2024 · 1 comment
Open

Comments

@disappearer
Copy link

disappearer commented Oct 31, 2024

I have a message that I'm trying to sign:

{
    "To": "t410fwx5uxybcgky3xjg4r6a5yjgcngan5hr4r77orhi",
    "From": "t1xqj6spbz6l6ds7kfue4i2flqcy3oq63fpqjr62y",
    "Nonce": 31,
    "Value": "305476283872472087",
    "GasPremium": "25153978000",
    "GasFeeCap": "25154083400",
    "GasLimit": 7266132800,
    "Method": 3844450837,
    "Params": "WQGE2ggcc94+/XqM/rOyruRF7fBrzoR6yE0Oq+9nDzIiS//85dKWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3gtrOnZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEPUUPy4ZsFwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQZXRoZXJldW0tc2Vwb2xpYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBFS6rxnRS05mzJhNp3NSI9CgM+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
}

and here is a message that I have signed with metamask, that has been successfully submitted:

{
  "jsonrpc": "2.0",
  "result": {
    "CID": {
      "/": "bafy2bzaced3gdziqstwtstzukqkh7yyjgtcdgrrqrlpmqsbscc42nzgdjzwok"
    },
    "From": "f410fcfjovpdhiuwttgzsme3j3tkir5bibt5qhhjclxy",
    "GasFeeCap": "199539",
    "GasLimit": 71513660,
    "GasPremium": "199539",
    "Method": 3844450837,
    "Nonce": 663,
    "Params": "WQGE2ggcc94+/XqM/rOyruRF7fBrzoR6yE0Oq+9nDzIiS//85dKWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3gtrOnZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB6xDtkXMgAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQZXRoZXJldW0tc2Vwb2xpYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBFS6rxnRS05mzJhNp3NSI9CgM+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
    "To": "f410fwx5uxybcgky3xjg4r6a5yjgcngan5hr4r77orhi",
    "Value": "138222826098466818",
    "Version": 0
  },
  "id": 1
}

The params are identical, but when I try signing with ledger I get the "Data is invalid : Unexpected number of items" error. I'm creating a Transaction from '@zondax/izari-filecoin' that I then serialize it and sign. Here's a snippet for demonstration purpose only:

  const tx = toIzariTransaction(message);
  const serialized = await tx.serialize();
  const path = this.ledgerProvider.getPath(this.address);
  const res = await new FilecoinApp(this.transport).sign(path, serialized);

The actual contract call looks like this with ethers:

contract.interchainTransfer(
     interchainTokenId,
     'ethereum-sepolia',
     destinationAddress,
     amount,
     '0x00',
     interchainFee,
     { value: interchainFee, gasLimit, maxFeePerGas },
   )

I'm using the same way for successfully signing a different contract call that has only one parameter, but for this particular call it doesn't work.

If I set the Params to an empty string, then signing works, so my guess is that it cannot handle the params of this size for some reason. I'm stuck and have no idea how to proceed.

🔗 zboto Link

@disappearer
Copy link
Author

Can't believe that I've missed it, but this seems like a duplicate or at least related to #166.

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

No branches or pull requests

1 participant