feat: multi-evm support for multi-chain scripts #751
  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.
  
    
  
    
Motivation
closes foundry-rs/foundry#9840
requires foundry-rs/foundry#12150, which introduces introduced
getProfile()cheatcodes that provide profile metadata (artifacts path and EVM version) to enable multi-chain deployments with different EVM versions in a single script.this PR completes the multi-EVM support story by refactoring the
Configabstract to leverage these new cheatcodes, providing users with an ergonomic and safe multi-chain scripting experience.Solution
refactor the
Configabstract to support multi-EVM, multi-chain scripts with profile-aware artifact loading:StdConfiginstance deployed from the corresponding profile's artifact directory. Multiple chains sharing the same EVM version reuse the same instance.selectFork()handles both fork selection and EVM version switching in one call.deployCode()methods automatically locate and deploy contracts from the correct profile artifacts based on the active evm version of the active chain.ConfigViewstruct (viaconfigOf(chainId)) provides a clea API for reading/writing config vars without repeating the chain id.Safety Guards
this impl includes several safety mechanisms to prevent common multi-chain deployment errors:
loadConfig()reverts if multiple chains are detected, forcing explicit use ofloadConfigAndForks()for multi-chain setupsisCachedmodifier ensures chain IDs are loaded before use, preventing operations on uninitialized forksisActivemodifier ondeployCode()ensures deployments only occur on the active fork, preventing wrong-chain deploymentsAPI and example usage
PR Checklist