-
Couldn't load subscription status.
- Fork 81
Add fork mode support to test framework #2131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
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