Skip to content
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

forge script: "Could not instantiate forked environment with fork url" --rpc-url to local anvil chain #7952

Open
2 tasks done
Tenari opened this issue May 20, 2024 · 2 comments
Labels
T-bug Type: bug

Comments

@Tenari
Copy link

Tenari commented May 20, 2024

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (54d8510 2024-05-20T00:19:01.949744889Z)

What command(s) is the bug in?

forge script

Operating System

Windows

Describe the bug

fresh install on new(to me) setup. using WSL ubuntu. do foundryup, everything is good. start an anvil local chain, it spins up nicely.

Genesis Timestamp
==================

1716225685

Listening on 127.0.0.1:8545
eth_blockNumber
Anvil is ready on port 8545.

then I go to run my deploy script with forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545

get strange error I have never seen before when running this same script against local anvil on a different computer I have.

[⠊] Compiling...
[⠔] Compiling 35 files with Solc 0.8.25
[⠒] Solc 0.8.25 finished in 1.37s
Compiler run successful!
2024-05-20T17:21:29.426517Z ERROR foundry_evm_core::fork::init: It looks like you're trying to fork from an older block with a non-archive node which is not supported. Please try to change your RPC url to an archive node if the issue persists.
Error:
Could not instantiate forked environment with fork url: http://localhost:8545

Context:
- Failed to get block for block number: 12
latest block number: 12

I am not sure what an "archive node" is, and didn't see any mention of it on https://book.getfoundry.sh/reference/anvil/
tried explicitly passing various --fork-block-number, which didn't really change much. tried googling, and looked through the issues here. I see nothing. tried installing an earlier commit of foundry with foundryup -C 63fff3510408b552f11efb8196f48cfe6c1da664 and got same results. tried logging within my Deploy.s.sol, but none of the logs were ever hit, which leads me to believe it is happening at some earlier layer of code I didn't write. perhaps something in here?

import { Script } from "forge-std/Script.sol";

I'm happy to provide more information if needed.

@Tenari Tenari added the T-bug Type: bug label May 20, 2024
@Tenari
Copy link
Author

Tenari commented May 20, 2024

more digging seems to show that it's from anvil being started with --load-state option which seems to fail on the particular serialized state I'm using

@bitful-pannul
Copy link

bump, I think related to this: #7502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

2 participants