-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
82 additions
and
482 deletions.
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 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,80 @@ | ||
use async_trait::async_trait; | ||
use citrea_e2e::config::TestCaseConfig; | ||
use citrea_e2e::framework::TestFramework; | ||
use citrea_e2e::test_case::{TestCase, TestCaseRunner}; | ||
use citrea_e2e::traits::Restart; | ||
use citrea_e2e::Result; | ||
use sov_ledger_rpc::client::RpcClient; | ||
|
||
use super::get_citrea_path; | ||
|
||
struct FullNodeRestartTest; | ||
|
||
#[async_trait] | ||
impl TestCase for FullNodeRestartTest { | ||
fn test_config() -> TestCaseConfig { | ||
TestCaseConfig { | ||
with_sequencer: true, | ||
with_full_node: true, | ||
..Default::default() | ||
} | ||
} | ||
|
||
async fn run_test(&mut self, f: &mut TestFramework) -> Result<()> { | ||
let sequencer = f.sequencer.as_ref().unwrap(); | ||
let full_node = f.full_node.as_mut().unwrap(); | ||
|
||
let genesis_state_root = full_node | ||
.client | ||
.http_client() | ||
.get_l2_genesis_state_root() | ||
.await? | ||
.unwrap(); | ||
|
||
full_node.restart(None).await?; | ||
|
||
let genesis_state_root_after = full_node | ||
.client | ||
.http_client() | ||
.get_l2_genesis_state_root() | ||
.await? | ||
.unwrap(); | ||
|
||
// Verify genesis is not reprocessed | ||
assert_eq!(genesis_state_root, genesis_state_root_after); | ||
|
||
sequencer.client.send_publish_batch_request().await?; | ||
full_node.wait_for_l2_height(1, None).await?; | ||
|
||
let state_root_before = full_node | ||
.client | ||
.http_client() | ||
.get_head_soft_confirmation() | ||
.await? | ||
.unwrap() | ||
.state_root; | ||
|
||
full_node.restart(None).await?; | ||
|
||
let state_root_after = full_node | ||
.client | ||
.http_client() | ||
.get_head_soft_confirmation() | ||
.await? | ||
.unwrap() | ||
.state_root; | ||
|
||
// Verify state root persists across restarts | ||
assert_eq!(state_root_before, state_root_after); | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_full_node_restart() -> Result<()> { | ||
TestCaseRunner::new(FullNodeRestartTest) | ||
.set_citrea_path(get_citrea_path()) | ||
.run() | ||
.await | ||
} |
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
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
Oops, something went wrong.