Getting web3.exceptions.BadFunctionCallOutput on simple function call
See original GitHub issue- Version: 3.8.0
- Python: 2.7
- OS: linux
What was wrong?
I have a very simple contract in which I store a struct map
contract A
{
struct B
{
bool set;
}
mapping (uint56 => B) myMap;
function isIn(uint56 _id) constant returns (bool)
{
return (myMap[_id].set);
}
}
In another contract, I have an array of A contracts
function isIn(uint56 _id) constant returns (bool)
{
uint i = 0;
while (arrayOfContractA[i] != 0)
{
if (A(arrayOfContractA[i]).isIn(_id))
return (true);
i += 1;
}
return (false);
}
When testing with truffle console, I’m getting normal return values like true
of false
.
When I call the second isIn
method from web3.py and I enter and _id
that is registered, everything works well and I get True
returned.
But when I ask for an _id
I didn’t registered, I get this :
web3.exceptions.BadFunctionCallOutput: Could not decode contract function call isIn return data 0x for output_types [u'bool']
I don’t understand how It could send someting different on false ?!
Why do I have true
and false
in truffle (so web3.js), but not in web.py ?
Is 0x
returned when trying to return an uninitialised entry of a map ?
I compiled my contract with solidity 0.4.4
Did this in web3.py
self._compiled = solc.compile_files([contractDir + "/A.sol", contractDir + "/B.sol", contractDir + "/B.sol"])
self._coreKey = contractDir + "/A.sol:A"
[...]
self._Core = self._web3.eth.contract(
abi=self._compiled[str(self._coreKey)]['abi'],
bytecode=self._compiled[str(self._coreKey)]['bin'],
bytecode_runtime=self._compiled[str(self._coreKey)]['bin-runtime'],
address=self._address)
[...]
self._Core.call().isIn(123)
and It crashes on the last line 😕
Thanks !
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Could not transact with/call contract function, is contract ...
*** web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function, is contract deployed correctly and chain synced?
Read more >Could not decode contract function call getEvidence return ...
web3.exceptions.BadFunctionCallOutput: Could not decode contract function call getEvidence return data b'' for output_types ['string'].
Read more >ethereum/web3.py - Gitter
I start to get error message as follows: *** web3.exceptions.BadFunctionCallOutput: Could not decode contract function call getReceivedStorageDeposit return ...
Read more >Troubleshooting — NuCypher 6.2.0 documentation
web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function, is contract deployed correctly and chain synced? ValueError: {'code': - ...
Read more >Populus Documentation - Web3.py
you can use the ContractFunction.call method, or the more concise ... contract function call decoding exception to facilitate extracting a.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok so I had to use
transact
instead ofcall
, my bad again !Ok so I just added a
return (false)
at the beginning of my function and It’s working. I was doing something wrong by iterating through an array, uninitialised values inside it aren’t initialised to 0 as a map, my bad ! Now I have another problem where any method call that requires a transaction isn’t doing anything and I get no errors. Any hints on that ? 😕