-
Notifications
You must be signed in to change notification settings - Fork 987
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
Show helpful error when node is run on a different network but with same network name #377
Comments
Detecting this isn't straightforward because we want to allow users to switch between Ethereum node addresses without resetting their database. A few ideas for detecting this on block ingestor start-up:
|
It looks like the "Key not found in database" error is Ganache-specific. The Eth RPC spec says that eth_getBlockByHash should return |
A combination of the first two checks could do it. Let's use the genesis block. Would we have to store that in the network entry in the database as well for comparison? |
Filed issue trufflesuite/ganache#906 about getting Key not found instead of null |
@Jannis Cool. Yup, I'm picturing that would go in the |
@timmclean Works for me! |
When the same network name (e.g.
--ethereum-rpc ganache:...
) is used with two different chains (e.g. two separate instances of Ganache; or one Ethereum mainnet and one testnet endpoint), the following warning will be logged:Doing this results in the Graph Node having an invalid latest block for this network. It will then get an error from Ethereum when calling
eth_getBlockByHash
with the hash of this block, which belongs to the previous chain but not the one in use at the time of the error.Discovered in #375 (comment)
Users shouldn't do this, but we should detect this mistake and show a more helpful error (and panic).
The text was updated successfully, but these errors were encountered: