Skip to content
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

update finality depth #74

Merged
merged 1 commit into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use super::{
};
use crate::{log_provider::LogPathProvider, node::NodeKind};

pub const FINALITY_DEPTH: u64 = 30;
pub const DEFAULT_FINALITY_DEPTH: u64 = 5;

pub struct BitcoinNode {
spawn_output: SpawnOutput,
Expand Down Expand Up @@ -98,8 +98,8 @@ impl BitcoinNode {
Ok(())
}

pub async fn get_finalized_height(&self) -> Result<u64> {
Ok(self.get_block_count().await? - FINALITY_DEPTH + 1)
pub async fn get_finalized_height(&self, finality_depth: Option<u64>) -> Result<u64> {
Ok(self.get_block_count().await? - finality_depth.unwrap_or(DEFAULT_FINALITY_DEPTH) + 1)
}

async fn wait_for_shutdown(&self) -> Result<()> {
Expand Down
6 changes: 3 additions & 3 deletions tests/docker.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use bitcoincore_rpc::RpcApi;
use citrea_e2e::{
bitcoin::FINALITY_DEPTH,
bitcoin::DEFAULT_FINALITY_DEPTH,
config::{TestCaseConfig, TestCaseDockerConfig},
framework::TestFramework,
test_case::{TestCase, TestCaseRunner},
Expand Down Expand Up @@ -40,8 +40,8 @@ impl TestCase for DockerIntegrationTest {
// Wait for blob inscribe tx to be in mempool
da.wait_mempool_len(1, None).await?;

da.generate(FINALITY_DEPTH).await?;
let finalized_height = da.get_finalized_height().await?;
da.generate(DEFAULT_FINALITY_DEPTH).await?;
let finalized_height = da.get_finalized_height(None).await?;

batch_prover
.wait_for_l1_height(finalized_height, None)
Expand Down
Loading