-
Notifications
You must be signed in to change notification settings - Fork 5.4k
feat: forc-node local contract state forking #7478
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
base: master
Are you sure you want to change the base?
Conversation
6fef5a7 to
5593f9b
Compare
CodSpeed Performance ReportMerging #7478 will not alter performanceComparing Summary
|
|
|
||
| [[package]] | ||
| name = "std" | ||
| version = "0.69.1" |
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.
seem to be using outdated version of forc
|
Nice, this is looking really promising. It'd be great to also write up some documentation to include with this PR, stepping through an example use case of when and how to use this feature. Maybe in the same sort of vein as what we have written up for forc debug. |
6a1d2a5 to
07eecf9
Compare
Description
Addresses #7448
This pull request introduces state forking support to the local node in
forc-node, allowing developers to run a local node that mirrors the contract state from a remote node at latest block height (currently only latest is supported).The contract bytecode and state is fetched dynamically (at runtime - from specified forked url) as the state is requested.
State Forking Feature
fork_urlandfork_block_numbertoforc-node local, enabling users to specify a remote node and block height for state forking (it must supporthistorical execution).local/mod.rsto support state forking by integrating a newforkmodule, which handles fetching state from the remote node and merging it with local storage. The node now conditionally initializes with forking logic based on user input.Dependency and Build Updates
Cargo.tomlandforc-node/Cargo.tomlto use patched versions offuel-corecrates from a specific branchdatasourcein the combined database; the datasource attributes are private; the fuel-corev0.46.0patch simply updates the visibility of the relevant attributes so that they can be overriden to provide fork functionalityblock_on_any_runtimefunction inforc-pkg/src/source/reg/mod.rspublic, allowing it to be used outside its original moduleTesting and Examples
forkandfork-caller) to demonstrate and validate the state forking capability.These updates collectively enable local development nodes to fork contract state from a remote node, greatly enhancing testing flexibility and realism for smart contract developers.
Related PR: FuelLabs/fuel-core#3134
Checklist
Breaking*orNew Featurelabels where relevant.