Closed moda20 closed 2 years ago
Can you try starting ganache with an explicit fork block number that is at least a few blocks old and let me know if it works.
Are you using infura for the fork url?
Example:
ganache-cli --fork {FORK URL}@13551770
Hi, i am doing the forking programmatically, but I'll try the explicit block number. for forking i am using moralis nodes, it's free archival nodes. it always worked before so I have faith in it.
I've seen this issue occur when ganache requests the latest block number, then uses that block number to get the block data, but the node hasn't yet processed it, and instead returns a "header not found" error.
Well, that did it. it fixed a lot of the issues I had with the forking, it's weird that it requests block data before having the blocknumber.
It doesn't request the block data before the block number, it's just that the external node we interact with knows the block number of the block it is currently processing, but because it hasn't finished processing it yet when we request the block itself the node response like it doesn't know about it. It's very frustrating behavior, as you've seen!
An alternative approach for ganache is for us to automatically set the default fork block number to "latest" - n
, where n
is ~5 blocks
. That way we can:
"header not found"
errorAnother alternative, and the one I prefer, but haven't figured out how to fully implement, is to attempt a time-based approach, where we just want to make sure the blocks are at least t
seconds old. But this get complicated because the user's clock isn't always reliable! We'd need to sync with an authoritative time server, like pool.ntp.org, which requires an always-on internet connection. Additionally, block times themselves are permitted to be inaccurate to a certain degree (15 minutes!).
I'm going to close this issue, as it's really an issue with the node (though we are working on ways of minimizing the occurrence on start up)
I am having an error when forking using the programmable version of ganache (ganache-core version
2.13.2
). the error is 'header not found' :this is a very recurrent issue and breaks the usage of ganache forking.
my node version is v14.15.2.