Skip to content

Conversation

CodeSandwich
Copy link
Contributor

Motivation

Currently commands like forge script don't read the ETH_RPC_URL env variable, you need to to forge script --rpc-url "$ETH_RPC_URL" (or --fork-url or -f, --rpc-url is just one of the aliases). This is unlike all other commands like forge create, which accept ETH_RPC_URL as the --rpc-url alternative.

Solution

Add support for ETH_RPC_URL wherever --fork-url is accepted.

@CodeSandwich
Copy link
Contributor Author

The integration tests are a rabbit hole to fix. This PR isn't as simple as I was expecting and currently I don't have time to fix everything, so I'll return to it in a few days.

@CodeSandwich CodeSandwich marked this pull request as draft September 27, 2024 11:57
@klkvr
Copy link
Member

klkvr commented Sep 27, 2024

related: #7755

@yash-atreya
Copy link
Member

@CodeSandwich thanks for your contribution. Do you still have the bandwidth to work on this?

@yash-atreya yash-atreya changed the title (feat): accept ETH_RPC_URL env as fork-url alias feat: accept ETH_RPC_URL env as fork-url alias Nov 29, 2024
@CodeSandwich
Copy link
Contributor Author

@yash-atreya Thanks for the reminder, TBH I forgot about this PR. I think that I may be able to take another stab this weekend unless somebody wants to take it over.

@CodeSandwich
Copy link
Contributor Author

@yash-atreya I'm giving up on this PR, feel free to pass it to somebody else or close it for good.

I'm simply unable to work with the integration tests. Running them on my local machine with (make test-foundry with --no-fail-fast added) yields dozens if not hundreds of failing tests, most of which seem to be working on the CI. It smells like an environment mismatch but I have no idea how to prepare my machine to properly run the tests, I haven't found any documentation for it. OTOH the CI seems to be hard failing on tests that are reliably passing on my machine. There's a ton of flaky tests that are adding a lot of noise and I'm not sure if the hard failing ones are actually indicating broken cases or bad luck and flaking 3 times in a row.

I wish all the best to Foundry, I like this tool very much and I want it to succeed. I think that the developer experience may be harming the project, for example I as of now can't see myself contributing to its codebase and probably other outside contributors are facing a similar barrier. I hope that at least the core contributors manage to achieve a good experience and aren't slowed down by issues around the test suite.

@yash-atreya
Copy link
Member

@yash-atreya I'm giving up on this PR, feel free to pass it to somebody else or close it for good.

I'm simply unable to work with the integration tests. Running them on my local machine with (make test-foundry with --no-fail-fast added) yields dozens if not hundreds of failing tests, most of which seem to be working on the CI. It smells like an environment mismatch but I have no idea how to prepare my machine to properly run the tests, I haven't found any documentation for it. OTOH the CI seems to be hard failing on tests that are reliably passing on my machine. There's a ton of flaky tests that are adding a lot of noise and I'm not sure if the hard failing ones are actually indicating broken cases or bad luck and flaking 3 times in a row.

I wish all the best to Foundry, I like this tool very much and I want it to succeed. I think that the developer experience may be harming the project, for example I as of now can't see myself contributing to its codebase and probably other outside contributors are facing a similar barrier. I hope that at least the core contributors manage to achieve a good experience and aren't slowed down by issues around the test suite.

Thank you for the contribution and much-needed feedback on local testing for contributors. Will keep this in mind going forward.

@yash-atreya yash-atreya self-assigned this Dec 2, 2024
@yash-atreya yash-atreya removed their assignment Jan 13, 2025
@DaniPopes DaniPopes marked this pull request as ready for review August 12, 2025 15:16
@DaniPopes
Copy link
Member

It looks like ETH_RPC_URL env var has priority over the CLI flag, cc @mattsse

Tests now pass because we don't need to use this env var anymore

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense but this could be breaking for some setups

@mattsse mattsse added C-forge Command: forge T-likely-breaking Type: requires changes that can be breaking labels Aug 12, 2025
@DaniPopes DaniPopes merged commit 5314461 into foundry-rs:master Aug 12, 2025
22 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Aug 12, 2025
DaniPopes added a commit that referenced this pull request Aug 18, 2025
DaniPopes added a commit that referenced this pull request Aug 18, 2025
Revert "feat: accept ETH_RPC_URL env as fork-url alias (#8972)"

This reverts commit 5314461.
Ectario pushed a commit to Ectario/foundry that referenced this pull request Sep 16, 2025
* (feat): accept ETH_RPC_URL env as fork-url alias

* Fix tests

* Fix formatting

* Fix whitespaces

* Fix tests

* Fix tests

* chore: fix ETH_RPC_URL in CI

---------

Co-authored-by: DaniPopes <[email protected]>
Ectario pushed a commit to Ectario/foundry that referenced this pull request Sep 16, 2025
…1335)

Revert "feat: accept ETH_RPC_URL env as fork-url alias (foundry-rs#8972)"

This reverts commit 5314461.
MerkleBoy pushed a commit to MerkleBoy/foundry that referenced this pull request Sep 17, 2025
* (feat): accept ETH_RPC_URL env as fork-url alias

* Fix tests

* Fix formatting

* Fix whitespaces

* Fix tests

* Fix tests

* chore: fix ETH_RPC_URL in CI

---------

Co-authored-by: DaniPopes <[email protected]>
MerkleBoy pushed a commit to MerkleBoy/foundry that referenced this pull request Sep 17, 2025
…1335)

Revert "feat: accept ETH_RPC_URL env as fork-url alias (foundry-rs#8972)"

This reverts commit 5314461.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge T-likely-breaking Type: requires changes that can be breaking
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants