-
Notifications
You must be signed in to change notification settings - Fork 676
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
Add test_long_chain_with_restart_from_snapshot #10193
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
de14f33
add test_long_chain
posvyatokum 9864fc1
avoid cache during gc
posvyatokum 4ab66b0
Merge branch 'master' into long_chain_test
posvyatokum 4b4bdb3
add comment
posvyatokum 8847752
Merge branch 'master' into long_chain_test
posvyatokum 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
This file contains 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 |
---|---|---|
|
@@ -3431,6 +3431,49 @@ fn test_catchup_no_sharding_change() { | |
} | ||
} | ||
|
||
/// Run `gc_num_epochs_to_keep` epochs + several blocks. | ||
/// Start a second env from the "snapshot" of the first. | ||
/// Run one more epoch. | ||
/// "Restart from the snapshot" is to ensure that we can continue producing blocks without relying on caches. | ||
#[test] | ||
fn test_long_chain_with_restart_from_snapshot() { | ||
init_test_logger(); | ||
|
||
let epoch_length = 25; | ||
|
||
let mut genesis = Genesis::test(vec!["test0".parse().unwrap()], 1); | ||
|
||
genesis.config.epoch_length = epoch_length; | ||
let mut chain_genesis = ChainGenesis::test(); | ||
chain_genesis.epoch_length = epoch_length; | ||
let mut env1 = TestEnv::builder(chain_genesis.clone()) | ||
.real_epoch_managers(&genesis.config) | ||
.nightshade_runtimes(&genesis) | ||
.archive(false) | ||
.build(); | ||
|
||
env1.clients[0].config.gc.gc_blocks_limit = 2; | ||
|
||
let max_height = epoch_length * env1.clients[0].config.gc.gc_num_epochs_to_keep + 3; | ||
|
||
for h in 1..max_height { | ||
let block = env1.clients[0].produce_block(h).unwrap().unwrap(); | ||
env1.process_block(0, block.clone(), Provenance::PRODUCED); | ||
} | ||
|
||
let mut env2 = TestEnv::builder(chain_genesis) | ||
.stores(vec![env1.clients[0].chain.store().store().clone()]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. neat! |
||
.real_epoch_managers(&genesis.config) | ||
.nightshade_runtimes(&genesis) | ||
.archive(false) | ||
.build(); | ||
|
||
for h in max_height..(max_height + epoch_length) { | ||
let block = env2.clients[0].produce_block(h).unwrap().unwrap(); | ||
env2.process_block(0, block.clone(), Provenance::PRODUCED); | ||
} | ||
} | ||
|
||
/// These tests fail on aarch because the WasmtimeVM::precompile method doesn't populate the cache. | ||
mod contract_precompilation_tests { | ||
use super::*; | ||
|
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.
nit: Can you add a small comment on why this is needed?