fix(config): let config-only chains load without an RPC endpoint - #903
Open
zexoverz wants to merge 1 commit into
Open
fix(config): let config-only chains load without an RPC endpoint#903zexoverz wants to merge 1 commit into
zexoverz wants to merge 1 commit into
Conversation
The StdConfig constructor resolved an RPC endpoint for every chain section and failed the whole load when neither endpoint_url nor [rpc_endpoints] supplied one. _rpcOf is only read by getRpcUrl, and getRpcUrl is only called by _loadConfigAndForks when it creates forks, so a chain section that exists purely to carry config values was rejected for lacking something nothing would read. Resolution is now deferred. Loading such a chain succeeds and its values stay readable; asking for its endpoint reverts with MissingRpcEndpoint, which names the chain instead of the previous 'invalid rpc url'. Reported as foundry-rs/foundry#13119, though the premise there does not reproduce: the config in that issue loads fine, empty sections are already skipped and missing type sub-sections are already tolerated. This is the adjacent gap that is real.
zexoverz
requested review from
0xrusowsky,
DaniPopes,
grandizzy,
mattsse and
onbjerg
as code owners
August 22, 2026 10:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
StdConfigconstructor resolves an RPC endpoint for every chain section, and fails the whole load when neitherendpoint_urlnor[rpc_endpoints]supplies one:_rpcOfis only read bygetRpcUrl, andgetRpcUrlis only called by_loadConfigAndForkswhen it creates forks. So a chain section that exists purely to carry config values is rejected for lacking something nothing on that path would ever read:This defers the resolution. Loading such a chain now succeeds and its values stay readable. Asking for the endpoint reverts with
MissingRpcEndpoint(chainId).Behaviour change worth flagging
getRpcUrlpreviously returned an empty string for a chain with no endpoint, and now reverts. That is deliberate, since a caller asking for an endpoint that does not exist is better off knowing than receiving"", and it gives_loadConfigAndForksa failure that names the chain rather than the previousinvalid rpc url. Nothing changes for a chain that has an endpoint configured. Happy to return the empty string instead if you would rather keep it non-reverting.Tests
Two cases in
test/Config.t.sol, following the temp-fixture pattern already used by thetestRevert_tests:test_loadConfigWithoutRpcEndpointloads a config with one endpoint-less chain, asserts both chains load, that the config values are readable, and that a configured endpoint still resolves.testRevert_MissingRpcEndpointasserts the endpoint lookup reverts for that chain.Negative control: reverting only the constructor change, leaving the new error declared so it still compiles, makes both new tests fail with
invalid rpc url: optimismwhile the other nine in the file are unaffected.Context
Reported as foundry-rs/foundry#13119. The premise there does not reproduce on current
master: the config in that issue loads fine, empty chain sections are already skipped atStdConfig.sol:100, and a missing type sub-section is already tolerated by the surroundingtry ... catch {}. This is the adjacent gap that is real.