Ganache-cli --fork support?

Hey there,

Does Infura support the use of ganache-cli --fork from a specific block number? When I attempt to call it, ganache-cli simply forks from block 0…

Can you provide us with information about the specific request being made to Infura and the code generating that request?

Absolutely - the command is ganache-cli --fork<MY_API_KEY>@7559773. Looking into the internals a bit further, ganache-cli is using ganache-core for the heavy lifting here. This is a link to the main bit of code governing the fork behavior and the calls being made to the node to facilitate it:

I’m not too familiar with how ganache constructs the rpc calls under the hood - if you have a tool you could recommend for intercepting the requests it’s making, I’d be happy to investigate further and provide you with the raw requests.

I’ve been chatting with the Truffle team, they’ve opened a new issue to look closer on this. It could be that ganache-core doesn’t support the new Infura auth mechanism.

1 Like

Thanks for looking into this - I’ll keep an eye on the issue (and let me know if there’s anything I can do to assist!)

To follow up on this issue, it turns out that by disabling “Require project secret for all requests” in the project, ganache-cli can successfully fork against the Infura endpoint. However, the output of ganache-cli fails to show the block number correctly, and just reads “block 0”, but upon interacting with ganache-cli it does indeed utilize the forked chain.

Was there any resolution to this? I also tried just adding the @blockNumber, so it’s like --fork[my-key]@10986001, but it doesn’t seem to work.

Hi @mpy - welcome to the Infura community! Just confirming - do you have the “Require project secret for all requests” disabled? Per the above answer, it looks like the data that comes through if you do that is correct, even though the block number reads 0.

OK I did not have that, but I just checked again, and it actually gives me a sensible error message now:
Returned error: project ID does not have access to archive state

Guess I need to pay for that access.