Closed RZeynalov closed 3 years ago
Confirming that I can reproduce this, not sure why it is happening yet.
The raw data returned by the call is:
0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d496e76616c696420737461746500000000000000000000000000000000000000
The expected return type is (uint256[], uint256[])
Some brief futzing didn't yield any valid way to manually decode this return value.
Alright, I think I "some" of what is going on here:
The returned "data" from the call is
0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d496e76616c696420737461746500000000000000000000000000000000000000
This looks a lot like a transaction with a 4byte prefix. Lookup up this 4byte prefix we get a revers map to Error(string)
as the ABI.
Decoding the data, stripping off the first 4 bytes gives us:
In [27]: w3.codec.decode_single('(string)', decode_hex(data)[4:])
Out[27]: ('Invalid state',)
So it appears that this call is throwing an error (revert?), but that web3 is trying to decode this as the return data for the call.
A little more digging:
Removing all of the contract mechanisms and doing this call directly using w3.eth.call
:
In [31]: w3.eth.call({'to': address_set_CHADLINK, 'data': decode_hex('0x9b013aee0000000000000000000000000000000000000000000000000000000000000001')})
Out[31]: HexBytes('0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d496e76616c696420737461746500000000000000000000000000000000000000')
Little more digging. This is using the websockets infura provider. Here is the raw JSON returned by the response:
In [4]: w3.eth.call({'to': address_set_CHADLINK, 'data': decode_hex('0x9b013aee0000000000000000000000000000000000000000000000000000000000000001')})
Out[4]: HexBytes('0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d496e76616c696420737461746500000000000000000000000000000000000000')
In [5]: w3.manager.provider._last_response
Out[5]: '{"jsonrpc":"2.0","id":0,"result":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d496e76616c696420737461746500000000000000000000000000000000000000"}'
So the JSON-RPC isn't giving us any indication that this call causes a revert. I think we need to do some digging to understand why this is happening and whether the behavior here is defined anywhere since it appears that internally the transaction actually fails, but that something is catching the REVERT message and transmitting it as the result of the eth_call
And one more bit of information.
Using the etherscan web-based contract interface, this is the response I get from whatever API they hit.
{"jsonrpc":"2.0","error":{"code":-32015,"message":"VM execution error.","data":"Reverted 0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d496e76616c696420737461746500000000000000000000000000000000000000"},"id":4}
Which suggests that either they are using a custom JSON-RPC backend, or that the infura endpoint we are hitting is returning a non-standard response. I'm in the process of re-syncing my geth node after which I'll experiment with whether it provides any different response than infura.
Geth (1.9.15) returns an empty response to this call: aka it returns 0x
update: this may not be accurate, my geth node was not fully synced.
This should be closed via #1585. Please re-open if not @RZeynalov!
pip freeze
outputWhat was wrong?
Hi Guyz,
i am trying to run getBidPrice (_quantity) function of setrebalance contract (https://etherscan.io/address/0x19f4a2f8e21915376f1429c26a3a9b9b1db5ff5a#code ) to get bids flow, but i get an error (OverflowError: Python int too large to convert to C ssize_t), i ve tried to modify this function output in ABI in different ways, but with no success. Here the post where there were discussion on this theme: https://github.com/ethereum/web3.py/issues/1634 - but it did not help to fix the issue.
Is anybody know hot to fix this ? Thank you in advance!!!!!
Please include any of the following that are applicable:
How can it be fixed?
Fill this section in if you know how this could or should be fixed.