-
Notifications
You must be signed in to change notification settings - Fork 5k
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
coder decodeParams with empty string leads to BigNumber error #231
Comments
@debris i'm not 100% sure about this but the following code could fix it, can you take a look: SolidityType.prototype.formatOutput = function (param, arrayType) {
if (arrayType) {
// let's assume, that we solidity will never return long arrays :P
var result = [];
var paramSlice = param.dynamicPart().slice(0, 64);
var length = (paramSlice !== '') ? new BigNumber(paramSlice, 16) : 0; // <<---
for (var i = 0; i < length * 64; i += 64) {
result.push(this._outputFormatter(new SolidityParam(param.dynamicPart().substr(i + 64, 64))));
}
return result;
}
return this._outputFormatter(param);
}; |
this error probably occurred, cause empty array was not properly formatted by geth/cpp/python. There is a test for it here. I've checked how empty array is being returned in latest geth (0.9.39) and it's working as expected. |
using web3.js 0.5.0 via atmospherejs.com
when an eth_call returns 0x, SolidityFunction.unpackOutput slices it into "" which gets passed to decodeParams and an eventual error. Here's the trace:
The text was updated successfully, but these errors were encountered: