flashbots / mev-inspect-py

🔎 an MEV inspector for Ethereum 🔎
MIT License
826 stars 258 forks source link

ValueError: {'code': -32601, 'message': 'the method trace_block does not exist/is not available'} #319

Open jerryleooo opened 1 year ago

jerryleooo commented 1 year ago

I am using an endpoint from pokt.network: https://eth-mainnet.gateway.pokt.network/v1/lb/xxxx

I have done all steps mentioned in the README, while got following error:

➜  mev-inspect-py git:(main) ./mev inspect 12914944

Inspecting block 12914944
Skipping virtualenv creation, as specified in config file.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/flashbot/.local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/flashbot/.local/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/flashbot/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/flashbot/.local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/app/mev_inspect/concurrency.py", line 18, in wrapper
    loop.run_until_complete(f(*args, **kwargs))
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/app/cli.py", line 45, in inspect_block_command
    await inspector.inspect_single_block(
  File "/app/mev_inspect/inspector.py", line 56, in inspect_single_block
    return await inspect_block(
  File "/app/mev_inspect/inspect_block.py", line 68, in inspect_block
    await inspect_many_blocks(
  File "/app/mev_inspect/inspect_block.py", line 105, in inspect_many_blocks
    block = await create_from_block_number(
  File "/app/mev_inspect/block.py", line 31, in create_from_block_number
    block_timestamp, receipts, traces, base_fee_per_gas = await asyncio.gather(
  File "/app/mev_inspect/block.py", line 86, in _find_or_fetch_block_traces
    return await _fetch_block_traces(w3, block_number)
  File "/app/mev_inspect/block.py", line 115, in _fetch_block_traces
    traces_json = await w3.eth.trace_block(block_number)
  File "/home/flashbot/.local/lib/python3.9/site-packages/web3/module.py", line 72, in caller
    result = await w3.manager.coro_request(method_str,
  File "/home/flashbot/.local/lib/python3.9/site-packages/web3/manager.py", line 203, in coro_request
    return self.formatted_response(response,
  File "/home/flashbot/.local/lib/python3.9/site-packages/web3/manager.py", line 168, in formatted_response
    raise ValueError(response["error"])
ValueError: {'code': -32601, 'message': 'the method trace_block does not exist/is not available'}
command terminated with exit code 1
fafrd commented 1 year ago

Did you use pokt's "Ethereum Mainnet Archival with trace calls" as described in the readme? trace_block isn't enabled for most eth endpoints by default.

AmbitionCX commented 1 year ago

Hello, I'm having the same issue, even though I'm using the right pokt's endpoint: https://eth-trace.gateway.pokt.network/v1/lb/<id>

I'm still getting error messages such as the method trace_block does not exist/is not available or the method eth_getBlockReceipts does not exist/is not available

I can successfully get the result simply by repeating the command ./mev inspect <block number> several times.

adibhanna commented 1 year ago

Having the same issue. Did anyone manage to solve this?

AmbitionCX commented 1 year ago

I did not resolve this issue; it appears that the endpoint is busy; it will return an error under high workload.

I write a script that calls the endpoint repeatedly until it returns without error. It output the error message to call_endpoint.log, If there is no error log, it will request the next block number.

#!/bin/bash

START=<start_block_number>
END=<end_block_number>

for i in $(eval echo "{$START..$END}"); do
        until [ ! -s ./call_endpoint.log ]; do
                ./mev-inspect-py/mev inspect $i 2>./call_endpoint.log
                sleep 1
        done
        echo "task finished" >> ./call_endpoint.log
done
ibadullaev-inc4 commented 1 year ago

same problem

gityumin commented 1 year ago

Why isn't it fixed? I used pokt's archival node. However, I still encounter this error.

zerak commented 1 year ago

Common RPC node service providers, such as Infura/alchemy, generally do not open this method

0xr3x commented 1 year ago

I have investgated and spoken to POKT about this issue.

Pokt as a network aims to be node-agnostic; and it is unable to tell which calls are Erigon specific. Hence, any Erigon-specific calls are sometimes sent to Erigon, but other times sent to a Geth node (in which case, they fail with the errors above).

This issue imo requires changing the docs to reccomend a different RPC rather than any code changes.

0xr3x commented 1 year ago

I have tested an ANKR RPC, which is working as expected.