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

RPC call: the method debug_traceBlockByNumber does not exist/is not available #1147

Closed
PinkFromTheFuture opened this issue Apr 12, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@PinkFromTheFuture
Copy link

Describe the bug
Editing the config file of the chain appears to have no effect.

In this case, setting the value of eth-apis to include debug-tracer does nothing.

Here is the file configs/chains/ourChainName/config.json:

{
    "eth-apis": [
        "eth",
        "eth-filter",
        "net",
        "web3",
        "internal-eth",
        "internal-blockchain",
        "internal-transaction",
        "debug-tracer"
    ],
    "http-host": "",
    "http-port": 9123,
    "network-id": "fuji",
    "public-ip": "ommited",
    "staking-port": 9122,
    "state-sync-enabled": true,
    "track-subnets": "ommited"
}

Here is an example, when running:

curl http://127.0.0.1:9123/ext/bc/23SUgLgnzQcai7ceCSnKcWQieQwkUsUpM8HrfSVG4Mk5tof8Tp/rpc \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"debug_traceTransaction","params":["0x154bbe502added59dd0dfc4198fe584a85abdfcc7a0c842aa43b9b75cb62b154", {}],"id":1,"jsonrpc":"2.0"}'

outputs, on any node (all of them have debug-tracer on the config):

{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"the method debug_traceTransaction does not exist/is not available"}}

another example:

curl http://127.0.0.1:9123/ext/bc/23SUgLgnzQcai7ceCSnKcWQieQwkUsUpM8HrfSVG4Mk5tof8Tp/rpc \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"debug_traceBlockByNumber","params":["0xc", {}],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"the method debug_traceBlockByNumber does not exist/is not available"}}

Another piece of information is:

I removed the API internal-blockchain from the config and restarted the node.

Then I called the method eth_getBlockByNumber of this API:
curl http :// 127 . 0 . 0 . 1:9123/ext/bc/23SUgLgnzQcai7ceCSnKcWQieQwkUsUpM8HrfSVG4Mk5tof8Tp/rpc -X POST -H "Content-Type: application/json" --data '{"method":"eth_getBlockByNumber","params":["0xc",false],"id":1,"jsonrpc":"2.0"}'

And it gave me an answer. But it was not supposed to give me an answer: it was supposed to say the method eth_getBlockByNumber was not availalbe because I disabled its API.

So it seems that:

  1. there is an issue with the config file
  2. the value is not being taken
  3. the value is being overwritten

Additional context

OS: ubuntu
Version avalanchego/1.11.3
@ceyonur
Copy link
Collaborator

ceyonur commented Apr 12, 2024

this config seems to be a mixture of avalanchego configs + subnet-evm configs. Also it should be under configs/chains/yourChainID/config.json not yourChainName/config.json. Could you recheck your config files and directories? I just tested on my local and it seems working/disabling as expected.

See https://docs.avax.network/nodes/configure/chain-configs/chain-config-flags

@PinkFromTheFuture
Copy link
Author

Thanks for the reply @ceyonur !

I would like to clarify something: is there more than 1 config.json file?
So the chain config should be at $dataDir/yourChainName/config.json?
And the file configs/chains/yourChainID/config.json is for the avalanchego config?

This one, is being used when launching the node, with
avalanchego --config-file ".avalanchego/configs/chains/T RIZE Test Chain/config.json"
Maybe I am not launching the node correctly?

I can confirm that it is being read, because I am setting the RPC port to 9123 and it is taking effect.

So it should not matter that it's using yourChainName instead of yourChainID, as long as it is being referenced when launching the node, no?
I'm not sure why ours is named after our chain and not the chain ID, as we just followed the documentation on https://docs.avax.network/build/subnet/deploy/fuji-testnet-subnet

The URL you gave me gives a 404 - https://docs.avax.network/nodes/configure/chain-configs/chain-config-flags

@ceyonur
Copy link
Collaborator

ceyonur commented Apr 12, 2024

Yes, there is a config for avalanchego, and there are different config files for each chains. So in your case there should be 2 different configs.
You're referencing the config file directory with --config-file for avalanchego. It does not do anything for subnet-evm and your chain. Chain-specific configs are under their chain IDs.
This part belong to avalanchego config:

   "http-host": "",
    "http-port": 9123,
    "network-id": "fuji",
    "public-ip": "ommited",
    "staking-port": 9122,
    "state-sync-enabled": true,
    "track-subnets": "ommited"

but eth apis part should be in a separate config.

You can create a new config.json under configs/chains/yourChainID/config.json (not yourChainName) with eth Apis configuration part and it should be automatically captured.

See this page and other related pages https://docs.avax.network/nodes/configure/avalanchego-config-flags#chain-configs

@PinkFromTheFuture
Copy link
Author

I am happy to follow up to say that all is good and working wonderfully.

There is no bug, it was just me not doing the right thing!

I would like to note that I believe the source of the issue is that both configs have the same name, and they are also documented in the same page of the documentation. I would split the documentation into two different pages, to avoid confusion.

@ceyonur , once again, thank you very much for helping and for your time.
Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants