Add fork mode support to test framework#2131
Merged
Conversation
4154f6f to
69edcec
Compare
3f7a239 to
fdaa0bf
Compare
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
c265c1f to
22132d8
Compare
chasefleming
approved these changes
Oct 28, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR adds fork mode support to the test framework, enabling tests to run against forked state from mainnet or testnet. The implementation includes automatic chain ID detection via the access node's GetNetworkParameters endpoint and resolves contract aliases from the specified network instead of the default 'testing' network.
Key Changes:
- Added
--fork,--fork-host, and--fork-heightCLI flags for fork mode configuration - Implemented automatic chain ID detection from remote networks
- Modified contract alias resolution to use fork network when specified
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/util/util.go | Added GetNetworkChainID function to query chain ID from access nodes |
| internal/test/test.go | Integrated fork mode configuration and network-based alias resolution |
| internal/test/test_test.go | Added tests for fork mode alias resolution and refactored assertion error checks |
| go.mod | Updated dependencies for cadence-tools/test and flow-emulator |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
This PR/issue depends on: |
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.
Closes #2164
Description
This adds
--fork,--fork-host, and--fork-heightflags to the test command,allowing tests to be run against forked state from mainnet or testnet.
The
--forkflag accepts a network name (e.g. mainnet/testnet) and resolves it fromflow.json. The fork mode automatically detects the chain ID by querying the
access node's GetNetworkParameters endpoint.
When in fork mode, contract aliases are resolved using the specified network
instead of the default 'testing' network.
Depends on onflow/cadence-tools#517
For contributor use:
masterbranchFiles changedin the Github PR explorer