Closed dynalz closed 1 year ago
Hey @dynalz, I'm not seeing the same result. What eth-abi's encode
returns is the same as Solidity. Please see this contract example:
contract Contract {
uint256[] list_example = [0, 0, 1000000000000000, 0];
function encodeExample() public view returns (bytes memory) {
return abi.encode(list_example, false);
}
}
If you deploy this contract in, say, remix, with the latest Solidity version, and run the encodeExample()
method... you will get the same output as eth-abi.
I did not test out your steps to reproduce with scope.klaytn.com (not familiar with this), but since the Solidity matches it seems safe to say this isn't a bug with eth-abi. I'm going to close this but feel free to re-open if there's a misjudgement on my part.
If this is a bug report, please fill in the following sections. If this is a feature request, delete and describe what you would like with examples.
What was wrong?
Issues encoding uint256[] property. Not sure what's wrong. I am currently on version 2.1.1 and this issue happens, updated to latest version to see if issue is fixed but still persists
Code that produced the error
Full error output (Not error, just wrong output)
Expected Result
This section may be deleted if the expectation is "don't crash".
Where I found the issue: 1) https://scope.klaytn.com/account/0x5b4ed8321ea13047195104037798f29257eac28c?tabId=contractCode 2) Click "Change ABI" tab 3) Paste the following abi:
4) Click "Read Contract" tab 5) Click "calculateTokenAmount" function 6) Paste
[0, 0, 1000000000000000, 0]
andfalse
to params 7) You can see the query works and returns a valid value, while using eth_abi lib fails (RPC returnsexecution reverted
) due to the enconding result above not matching the expected encoded value.