-
Notifications
You must be signed in to change notification settings - Fork 6
Implement forking support with lazy loading backend #426
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: feature/forking
Are you sure you want to change the base?
Conversation
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.
Looking good. Let's bring in the latest changes from the feature branch
crates/anvil-polkadot/src/substrate_node/lazy_loading/backend/mod.rs
Outdated
Show resolved
Hide resolved
52d3c29 to
04279c8
Compare
| /// Tests that forking preserves contract state from source chain and that multiple contract | ||
| /// instances maintain independent storage | ||
| #[tokio::test(flavor = "multi_thread")] | ||
| async fn test_fork_with_contract_deployment() { |
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.
not neccessarily for this PR, but have a look at what other forking-related test scenarios regular anvil has. We should mirror them where it makes sense
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.
as an example, what we discussed earlier in the call, using calls which mutate the state on top of a forked network (anvil_setBalance, etc)
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.
But we are already doing that with test_fork_preserves_state_and_allows_modifications right?
Description
This PR implements forking functionality for anvil-polkadot, allowing users to fork from a remote Substrate/Polkadot node and run local tests against live network state.
Adds the ability to fork from a running anvil-polkadot node (or compatible Substrate node) using the
--fork-urlflag. The implementation uses a lazy-loading approach to fetch state from the remote node on-demand, caching values locally for performanceManual testing
After compiling the entire project using
cargo build --release1. Start base node
2. Modify state on base node
3. Verify modified balance
4. Start fork node (inherits modified state)
5. Verify fork inherited state
6. Make changes on fork (doesn't affect base)
7. Verify isolation
Integration tests
Closes: ChainSafe/gossamer-parity#52, ChainSafe/gossamer-parity#58, ChainSafe/gossamer-parity#65, ChainSafe/gossamer-parity#84