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 encoding fails for specific type lengths #13

Open
TbLtzk opened this issue Jul 13, 2018 · 5 comments
Open

data encoding fails for specific type lengths #13

TbLtzk opened this issue Jul 13, 2018 · 5 comments

Comments

@TbLtzk
Copy link

TbLtzk commented Jul 13, 2018

while data encoding works fine for uint, it fails for uint256

The correct functionality is already there. It does just not trigger. Ill come up with a fix for this...

TbLtzk pushed a commit to TbLtzk/web3-arduino that referenced this issue Jul 13, 2018
@TbLtzk
Copy link
Author

TbLtzk commented Jul 13, 2018

The issue is that sizeof("uint") returns 5 and not 4 as you expected.

The sizeof operator for string literals counts the terminating \0

@JoaoCampos89
Copy link

@TbLtzk This fix worked! Before I cannot send data to the contract, now it works!

@phoax
Copy link

phoax commented Jul 24, 2018

It works with uint, but it still not works with string and address.
Any clue ?

@TbLtzk
Copy link
Author

TbLtzk commented Jul 24, 2018

This issue does not apply to string and address, because there are no variants of these types with specific length (there is no address32 or something).
However, with all my PRs combined, we managed to submit a transaction at least with address parameter to the kovan testnet.

@VDelport
Copy link

VDelport commented Dec 5, 2022

@phoax
@JoaoCampos89
@TbLtzk
I am currently having the same problem. I want to pass a parameter to a smart contract function and just set that parameter to 0 or 1 in the smart contract function. Unfortunately this doesn't work no matter what data type I give the parameter, i.e. H. it doesn't work for me either with uint.

Do you still have the smart contract and the ESP program and would you please only post the relevant source code lines of the smart contract function and the ESP32 program here?

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

4 participants