foundry-rs / foundry-toolchain

GitHub action to install Foundry
Apache License 2.0
225 stars 92 forks source link

Forked environment instantiation failing #31

Open spengrah opened 1 year ago

spengrah commented 1 year ago

Hello, I've been banging my head against the wall trying to get fork tests to run in ci. Everything works great for me locally, but I've tried multiple configurations of RPC provider API keys in github secrets, RPC providers (both infura and alchemy), foundry.toml, and ci.yml, and they all fail in ci.

I keep getting the same error message:

image

As far as I can tell, everything looks right, so either I'm missing something (the likeliest option) or there is a bug somewhere.

All configurations (other than github secrets) are publicly viewable in my repo: https://github.com/Hats-Protocol/season-toggle

Any help or guidance is much appreciated 🙏

mds1 commented 1 year ago

What if in the [rpc_endpoints] section of the config you try making the env var the full RPC URL instead of interpolating? Also, try vm.rpcUrl("mainnet") instead, which is what I usually do.

Assuming you do have the secrets in github setup correctly, things should work. Here's an example setup that uses forks in CI if it helps: config file, createSelectFork, ci

spengrah commented 1 year ago

aha, that worked! The issue was some combination of interpolating the url, not using vm.rpcUrl, and using quotes around the env value for the secret in github. By changing the latter two, I got it working for both interpolated and non-interpolated urls.

Thank you @mds1!