You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when using and deploying contracts on hardhat, mythril tries to call eth_getStorageAt it returns an exception as it is calling a storage slot with less than 66 bytes in the rpc call. Example:
mythril.ethereum.interface.rpc.client [DEBUG]: rpc send: {"jsonrpc": "2.0", "method": "eth_getStorageAt", "params": ["0xE7F1725E7734CE288F8367E1BB143E90BB3F0512", **"0x7",** "latest"], "id": 1} urllib3.connectionpool [DEBUG]: http://localhost:8545 "POST / HTTP/1.1" 200 335 mythril.ethereum.interface.rpc.client [DEBUG]: rpc response: {'jsonrpc': '2.0', 'id': 1, 'error': {'code': -32602, 'message': 'Errors encountered in param 1: **Storage slot argument must have a length of 66 ("0x" + 32 bytes), but \'0x7\' has a length of 3', 'data':** {'message': 'Errors encountered in param 1: Storage slot argument must have a length of 66 ("0x" + 32 bytes), but \'0x7\' has a length of 3'}}} mythril.mythril.mythril_analyzer [CRITICAL]: Exception occurred, aborting analysis. Please report this issue to the Mythril GitHub page. Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/mythril/ethereum/interface/rpc/client.py", line 82, in _call return response["result"] KeyError: 'result'
This Exception is raised in File "/usr/local/lib/python3.9/dist-packages/mythril/ethereum/interface/rpc/client.py", line 90
As seen above the data sent was 0x7 but it should 0x000000000000000000000000000000000000000000000000000000007
Testing a solution by modifying the client.py:
def _call(self, method, params=None, _id=1):
params = params or []
print(f"params is: {params}")
if len(params) > 2 :
params[1] = "0x"+str(params[1]).replace("0x",'').rjust(67-len(params[1]),"0")
print(f"params is: {params}")`
How to Reproduce
launch a contract on hardhat and the exception will be raised.
$ myth -v4 analyze --solver-timeout 90000 --rpc localhost:8545 -a 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
The hardhat version you are using is not compliant with the eth RPC standard (ethers-io/ethers.js#2982).
Since eth_getStorageAt takes its second value as an int.
Try switching to a different hardhat version.
Description:
when using and deploying contracts on hardhat, mythril tries to call
eth_getStorageAt
it returns an exception as it is calling a storage slot with less than 66 bytes in the rpc call. Example:mythril.ethereum.interface.rpc.client [DEBUG]: rpc send: {"jsonrpc": "2.0", "method": "eth_getStorageAt", "params": ["0xE7F1725E7734CE288F8367E1BB143E90BB3F0512", **"0x7",** "latest"], "id": 1} urllib3.connectionpool [DEBUG]: http://localhost:8545 "POST / HTTP/1.1" 200 335 mythril.ethereum.interface.rpc.client [DEBUG]: rpc response: {'jsonrpc': '2.0', 'id': 1, 'error': {'code': -32602, 'message': 'Errors encountered in param 1: **Storage slot argument must have a length of 66 ("0x" + 32 bytes), but \'0x7\' has a length of 3', 'data':** {'message': 'Errors encountered in param 1: Storage slot argument must have a length of 66 ("0x" + 32 bytes), but \'0x7\' has a length of 3'}}} mythril.mythril.mythril_analyzer [CRITICAL]: Exception occurred, aborting analysis. Please report this issue to the Mythril GitHub page. Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/mythril/ethereum/interface/rpc/client.py", line 82, in _call return response["result"] KeyError: 'result'
This Exception is raised in
File "/usr/local/lib/python3.9/dist-packages/mythril/ethereum/interface/rpc/client.py", line 90
As seen above the data sent was
0x7
but it should0x000000000000000000000000000000000000000000000000000000007
Testing a solution by modifying the client.py:
How to Reproduce
launch a contract on hardhat and the exception will be raised.
$ myth -v4 analyze --solver-timeout 90000 --rpc localhost:8545 -a 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
Expected behavior
return a successful response with the value
Environment
The text was updated successfully, but these errors were encountered: