checkthechain / checkthechain

ctc is a tool for collecting and analyzing historical data of Ethereum and other EVM chains
Apache License 2.0
819 stars 92 forks source link

`ctc config file does not exist` even after running `ctc setup` #45

Open sjkelleyjr opened 1 year ago

sjkelleyjr commented 1 year ago

I've run ctc setup with all defaults, once after initial install, and once again when I saw the above warning. However, the warning doesn't seem to go away.

I thought maybe it was an errant warning, so I tried tracing a tx hash and got this

Task exception was never retrieved
future: <Task finished name='Task-2' coro=<async_eth_get_transaction_receipt() done, defined at /Library/Python/3.8/site-packages/ctc/rpc/rpc_executors/rpc_transaction_executors.py:90> exception=ConfigInvalid("provider should have keys: {'convert_reverts_to_none', 'session_kwargs', 'network', 'chunk_size', 'name', 'url', 'protocol'}")>
Traceback (most recent call last):
  File "/Library/Python/3.8/site-packages/ctc/rpc/rpc_executors/rpc_transaction_executors.py", line 100, in async_eth_get_transaction_receipt
    response = await rpc_request.async_send(request, provider=provider)
  File "/Library/Python/3.8/site-packages/ctc/rpc/rpc_request.py", line 102, in async_send
    full_provider = rpc_provider.get_provider(provider)
  File "/Library/Python/3.8/site-packages/ctc/rpc/rpc_provider.py", line 15, in get_provider
    return ctc.config.get_default_provider()
  File "/Library/Python/3.8/site-packages/ctc/config/config_values.py", line 143, in get_default_provider
    network = get_default_network()
  File "/Library/Python/3.8/site-packages/ctc/config/config_values.py", line 44, in get_default_network
    return config_read.get_config().get('default_network')
  File "/Library/Python/3.8/site-packages/ctc/config/config_read.py", line 111, in get_config
    config_validate.validate_config(config)
  File "/Library/Python/3.8/site-packages/ctc/config/config_validate.py", line 68, in validate_config
    key_validator(value=value, config=config)
  File "/Library/Python/3.8/site-packages/ctc/config/config_validate.py", line 142, in validate_providers
    raise spec.ConfigInvalid(
ctc.spec.exceptions.config_exceptions.ConfigInvalid: provider should have keys: {'convert_reverts_to_none', 'session_kwargs', 'network', 'chunk_size', 'name', 'url', 'protocol'
sslivkoff commented 1 year ago

is a config.json file generated in the ~/.config/ctc dir? if so can you post the config here (with provider url removed)?

sjkelleyjr commented 1 year ago

nope

detroitcoder commented 1 year ago

Did you specify a custom ctc_data location? If so, try using the default. I saw a similar error at the end of ctc setup in one of my variations of debugging an issue.

sjkelleyjr commented 1 year ago

I ran ctc setup with all defaults, including ctc_data, which it looks like defaults to my home directory, as expected Continue using data directory /Users/jackson/ctc_data?

sjkelleyjr commented 1 year ago

In the short term, is there a default config file I can just copy/paste to the ~/.config/ctc directory?

sslivkoff commented 1 year ago

pasting a config file won't work on it's own because the setup process needs to initiate the filesystem.

it's complaining that the rpc provider is ill formatted. can you run ctc setup --debug, and then in this issue paste the output of print(provider) (omit your private provider url)

also, from the path format it looks like youre using a mac. is this correct?

sjkelleyjr commented 1 year ago

also, from the path format it looks like youre using a mac. is this correct?

yep

Here's the output from print(provider), with my API key substituted out.

{'name': 'ETH_RPC_URL', 'network': 1, 'protocol': 'http', 'url': 'https://eth-mainnet.alchemyapi.io/v2/MY_API_KEY', 'session_kwargs': {}, 'chunk_size': None}
sjkelleyjr commented 1 year ago

I don't think the provider error is related to the config problem. It occurred after I tried to just trace a tx in case the warning was errant. My guess is, the first error you hit when you don't have a config file is about the provider when tracing a tx.

emo-eth commented 1 year ago

I am running into this same error, also on macOS - I've tried with both Alchemy and Infura provider URLs.

Here is the output of print(provider) in PDB for me:

{'name': 'ETH_RPC_URL', 'network': 1, 'protocol': 'http', 'url': 'https://mainnet.infura.io/v3/MY_API_KEY', 'session_kwargs': {}, 'chunk_size': None}
trangnv commented 1 year ago

I also use macOS, ran into the same problem when I change the recommended data_dir. It worked fine when I let it as default value

Poor4ever commented 9 months ago

same problem,if environment variable has ETH_RPC_URL,ctc setup doesn't work,

temporary methods to make it work properly: delete the ETH_RPC_URL environment variable or add 'convert_reverts_to_none': False in the add_env_var_rpc_provider function of config_defaults.py under default_config['providers'][provider_name].

sjkelleyjr commented 9 months ago

I haven't tried it yet, but I'm about 99% sure this was my problem since I have that same environment variable. Ty!