forked from foundry-rs/foundry
-
Notifications
You must be signed in to change notification settings - Fork 7
Add State snapshotting cheats support #424
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
Merged
Merged
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
2146fc5
add vm.prank/startPrank/stopPrank support
alexggh 51804f5
add prank testsuite
alexggh ad700fb
mocked functions working something
alexggh 08e63fd
add support for mocks
alexggh aaa472f
add mock
alexggh f7145b4
remove unneeded changes
alexggh 8608a99
remove unneeded file
alexggh 50e8f43
compile against latest branch
alexggh 0b39a22
rebased on master
alexggh 4158429
Merge remote-tracking branch 'origin/master' into re_merge_prank
alexggh effbecb
add cheatcode testsuite
alexggh b005fa0
prank latest
alexggh 80fa8d8
Merge remote-tracking branch 'origin/master' into alexggh/review_pran…
alexggh e15127f
fixup migration
alexggh ad1253d
fix build
alexggh f515d42
add more tests
alexggh 4d1f528
Merge remote-tracking branch 'origin/master' into alexggh/review_pran…
alexggh 3cb2315
fixup tests
alexggh a629145
switch to master
alexggh 676b2f8
make cargo fmt happy
alexggh 681472c
make clippy happy
alexggh ed7b936
make forge fmt happy
alexggh e29737b
fix prank calls
alexggh 9d35e48
Merge remote-tracking branch 'origin/master' into alexggh/review_pran…
alexggh fedcc8e
Merge remote-tracking branch 'origin/master' into alexggh/review_pran…
alexggh ee9c3d3
replace with template
alexggh 8d11b21
fixup typo
alexggh d0a562d
fix extra
alexggh 1da5f68
make tests consume less resources
alexggh 5855f2b
refactor externalities usage
pkhry 5b0c610
Merge remote-tracking branch 'origin/master' into pkhry/refactor_exte…
pkhry 6ea0776
fix beforeTestSetups
pkhry 0707b67
accidental changes
pkhry 5b25129
Merge remote-tracking branch 'origin/master' into pkhry/refactor_exte…
pkhry 998fccf
add invariant test
pkhry 821791e
Merge remote-tracking branch 'origin/master' into pkhry/refactor_exte…
pkhry c8b6d02
fixup merge
pkhry 08c99c4
opt
pkhry 0da1fe5
Merge remote-tracking branch 'origin/master' into pkhry/refactor_exte…
pkhry 0662bd4
upd tests
pkhry 9c4facb
remove revive_call_end as redundant
pkhry 01f9d8e
caching fix (#207)
pkhry bbc4cb2
tests fixup
pkhry 52a37e6
commit suggestions
pkhry 48ccc2f
review comment
pkhry cf0f776
fix storage migration
pkhry 1908168
uncommit lockfile
pkhry 3886d81
add extra clause to test
pkhry fa3018b
gitignore
pkhry 8dc7d09
Merge branch 'master' into pkhry/refactor_externalities_usage
pkhry 05b0a46
fix select_evm()
pkhry 493e263
update compilers
pkhry d7eaf3b
ci checks
pkhry 9c87260
merge branch origin/main
pkhry cb04fdf
clippy
pkhry 62205eb
fixup merge
pkhry b153c11
revert removal of call_end
pkhry ce46d9a
snapshotting cheats
pkhry bb6f468
refactor transactions
pkhry 70e30d9
clippy
pkhry f01d036
merge branch "origin/master"
pkhry f872f78
fmt
pkhry 253ba1f
Merge branch 'master' into pkhry/snapshotting_cheats
pkhry ca7a009
Merge remote-tracking branch 'origin/master' into pkhry/snapshotting_…
pkhry f59d42d
Merge branch 'master' into pkhry/snapshotting_cheats
pkhry 002f2c8
fixup tests
pkhry f824d00
Merge branch 'master' into pkhry/snapshotting_cheats
pkhry fb0c5a5
rm accidental change
pkhry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| use crate::{config::*, test_helpers::TEST_DATA_REVIVE}; | ||
| use foundry_test_utils::Filter; | ||
| use revive_strategy::ReviveRuntimeMode; | ||
| use revm::primitives::hardfork::SpecId; | ||
| use rstest::rstest; | ||
|
|
||
| #[rstest] | ||
| #[case::pvm(ReviveRuntimeMode::Pvm)] | ||
| #[case::evm(ReviveRuntimeMode::Evm)] | ||
| #[tokio::test(flavor = "multi_thread")] | ||
| async fn test_snapshot_cheats(#[case] runtime_mode: ReviveRuntimeMode) { | ||
| let runner: forge::MultiContractRunner = TEST_DATA_REVIVE.runner_revive(runtime_mode); | ||
| let filter = Filter::new(".*", "StateSnapshotTest", ".*/revive/.*"); | ||
|
|
||
| TestConfig::with_filter(runner, filter).spec_id(SpecId::PRAGUE).run().await; | ||
| } |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
why you have not decided to just copy backend like this:
And revert it like this
Of course this implementation is based on old code base, but when I have implemented it the changes were very minimal.
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.
transaction commit and rollback are much more faster
Uh oh!
There was an error while loading. Please reload this page.
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.
why? It is mem swap/copy, Rollbacks you are doing in loops. Do you have any numbers?
I see that as_backend could be slow, is there an option to use
into_raw_snapshotThere 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.
yeah, i'll post the comparative changes today. for fuzz tests for example
executor.clonewas very much noticeable in the.traceoutput compared totransaction_startandtransaction_rollbackThere 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.
it was even slower than as_backend(), in the thread local impl but i'll add benches today to an issue and tag you so that it's more visible