libethc icon indicating copy to clipboard operation
libethc copied to clipboard

abi: cannot encode/decode tuples

Open mhw0 opened this issue 2 years ago • 4 comments

#38

Possible fixes:

  • do not ignore thelen parameter of eth_abi_array on encode. If it's set, just accept it as the actual length.

mhw0 avatar Dec 15 '23 12:12 mhw0

Hi! I am looking for a way to encode tuples. Not sure if this is possible with a simple workaround?

marcovc avatar Feb 11 '24 22:02 marcovc

Hello @marcovc! I'm working on it

mhw0 avatar Feb 12 '24 04:02 mhw0

Sorry for the delay. Have you tried encoding it like this? If we had (uint256,uint256,uint256):

eth_abi_uint256(&abi, &uint0);
eth_abi_uint256(&abi, &uint1);
eth_abi_uint256(&abi, &uint2);

mhw0 avatar Feb 14 '24 06:02 mhw0

I am not sure that leads to a valid encoding, since if I understand correctly the specificattion, a tuple with at least one dynamic element is considered dynamic. This means the entire tuple needs to be encoded differently, and not just the dynamic element.

marcovc avatar Feb 14 '24 20:02 marcovc