question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ganache-core 'header not found' error when forking on node 14

See original GitHub issue

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’ :

Error: Returned error: header not found
    at Object.ErrorResponse (/node_modules/ganache-core/node_modules/web3-core-helpers/src/errors.js:30:19)
    at onJsonrpcResult (node_modules/ganache-core/node_modules/web3-core-requestmanager/src/index.js:172:36)
    at node_modules/ganache-core/lib/forking/forked_blockchain.js:136:11
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

this is a very recurrent issue and breaks the usage of ganache forking.

my node version is v14.15.2.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
davidmurdochcommented, Nov 4, 2021

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:

  • be confident that the node won’t return a "header not found" error
  • be reasonably sure that a reorg won’t change the fork block

Another 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)

0reactions
moda20commented, Nov 4, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ganache - npm
A tool for creating a local blockchain for fast Ethereum development. Features • Getting Started • Documentation • Community • Docker ...
Read more >
Ganache-cli Not Working properly WSL 2
I installed npm install -g ganache-cli on my WSL, but when I entered ganache-cli , it is showing me this error. Error: error:0308010C:digital...
Read more >
Compiling your contracts... - ConsenSys/truffle - Gitter
Error : Cannot destructure property body of 'undefined' or 'null'. ... "^1.0.0-beta.0", "ganache-cli": "^6.9.1", "truffle": "^5.1.26" node v14.2.0
Read more >
Paradigm CTF 2021 比赛环境- ripwu's blog - godorz.info
ValueError: {'message': 'Returned error: header not found', ... /node_modules/ganache-cli/build/ganache-core.node.cli.js:55:2110625)\n at .
Read more >
Node-gyp fetches headers from internet - Stack Overflow
In that installation of ibm_db, node-gyp wants to download headers file from the internet which is not allowed under company firewall rule.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found