mhw0 / libethc

Open-source Ethereum C library
https://mhw0.github.io/libethc/
MIT License
48 stars 9 forks source link

abi: cannot encode/decode tuples #39

Open mhw0 opened 9 months ago

mhw0 commented 9 months ago

38

Possible fixes:

marcovc commented 7 months ago

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

mhw0 commented 7 months ago

Hello @marcovc! I'm working on it

mhw0 commented 7 months ago

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);
marcovc commented 7 months ago

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.