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

Couldn't decode bytes32 from ABI: 0x The size doesn't match. #1840

Closed
ghost opened this issue Aug 4, 2018 · 1 comment
Closed

Couldn't decode bytes32 from ABI: 0x The size doesn't match. #1840

ghost opened this issue Aug 4, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 4, 2018

I am querying a mapping via a web3 call like this:

var Web3 = require('web3'); 
const web3 = new Web3(new Web3.providers.HttpProvider('https://kovan.infura.io/key...'));
var contractABI = new web3.eth.Contract([...abi...], contractAddress);
var orderValue = '15';
contractABI.methods.orders(web3.utils.toHex(orderValue)).call(function(err, result) {
        if (!err) {
            callback(result);
        } else {
            callback(err);
        }
    });

If orderValue is > 15 then I get the following error:

Error: Couldn't decode bytes32 from ABI: 0x The size doesn't match.

If orderValue is <= 15 (e.g. 10) then I get the following error:

Error: Given parameter bytes has an invalid length: "0xa"

the mapping in the smart contract looks as follows:

struct Order {
    bytes32 orderId;
    uint32 orderAmount;
}
mapping(bytes32 => Order) public orders;
@ghost
Copy link
Author

ghost commented Aug 7, 2018

The answer here is, that the contract was deployed, but empty!

Section 7.1 of the yellow paper it states that "while the initialisation code is executing, the newly created address exists but with no intrinsic body code. For a normal STOP code, or if the code returned is otherwise empty, then the state is left with a zombie account, and any remaining balance will be locked into the account forever"

The thing that was confusing me was that Parity could do queries on it, even though it returned 0x000 values (web3 didn't return anything but errors). So I thought the contract wasn't empty!

Maybe web3 can give a better error message like: contract is empty or function doesn't exist

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

1 participant