You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current tests running against fork mode has some flakiness during initialization. We need an improved approach to test against fork mode without introducing inconsistent e2e tests. Example of such test:
#[tokio::test]
#[ignore]
// TODO: Investigate a better way to test against fork to avoid flakiness
async fn load_state_on_fork() -> anyhow::Result<()> {
let temp_dir = TempDir::new("load-state-fork-test").expect("failed creating temporary dir");
let dump_path = temp_dir.path().join("load_state_fork.json");
let provider = init_testing_provider(identity).await?;
let receipts = [
provider.tx().finalize().await?,
provider.tx().finalize().await?,
];
let blocks = provider.get_blocks_by_receipts(&receipts).await?;
let state_bytes = provider.anvil_dump_state().await?;
drop(provider);
let mut decoder = GzDecoder::new(&state_bytes.0[..]);
let mut json_str = String::new();
decoder.read_to_string(&mut json_str).unwrap();
let state: VersionedState = serde_json::from_str(&json_str).unwrap();
write_json_file(&dump_path, &state)?;
let dump_path_clone = dump_path.clone();
let new_provider = init_testing_provider(move |node| {
node.path(get_node_binary_path())
.arg("--state-interval")
.arg("1")
.arg("--load-state")
.arg(dump_path_clone.to_str().unwrap())
.fork("sepolia-testnet")
})
.await?;
new_provider.assert_has_receipts(&receipts).await?;
new_provider.assert_has_blocks(&blocks).await?;
new_provider
.assert_balance(receipts[0].sender()?, DEFAULT_TX_VALUE)
.await?;
new_provider
.assert_balance(receipts[1].sender()?, DEFAULT_TX_VALUE)
.await?;
drop(new_provider);
assert!(
dump_path.exists(),
"State dump file should still exist at {:?}",
dump_path
);
Ok(())
}
@itegulov has suggested the following to investigate:
To minimize flakiness we should set up a real local ZKsync enviornment and use as forking source in all of the fork e2e tests. For example we could spin up dockerized zksync-era node and then seal some blocks.
The text was updated successfully, but these errors were encountered:
Description
Current tests running against
fork
mode has some flakiness during initialization. We need an improved approach to test against fork mode without introducing inconsistent e2e tests. Example of such test:@itegulov has suggested the following to investigate:
The text was updated successfully, but these errors were encountered: