Skip to content

Commit

Permalink
make testnet4 reorg depth 30 (#1607)
Browse files Browse the repository at this point in the history
Co-authored-by: jfldde <[email protected]>
  • Loading branch information
eyusufatik and jfldde authored Dec 13, 2024
1 parent e9c5516 commit 5310950
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ tower-http = { version = "0.5.0", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }
hyper = { version = "1.4.0" }

citrea-e2e = { git = "https://github.com/chainwayxyz/citrea-e2e", rev = "423db61" }
citrea-e2e = { git = "https://github.com/chainwayxyz/citrea-e2e", rev = "6ba7230" }

[patch.crates-io]
bitcoincore-rpc = { version = "0.18.0", git = "https://github.com/chainwayxyz/rust-bitcoincore-rpc.git", rev = "ca3cfa2" }
22 changes: 6 additions & 16 deletions bin/citrea/tests/bitcoin_e2e/sequencer_commitments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ struct SequencerSendCommitmentsToDaTest;
impl TestCase for SequencerSendCommitmentsToDaTest {
fn sequencer_config() -> SequencerConfig {
SequencerConfig {
min_soft_confirmations_per_commitment: 12,
min_soft_confirmations_per_commitment: FINALITY_DEPTH * 2,
..Default::default()
}
}
Expand Down Expand Up @@ -246,13 +246,6 @@ impl TestCase for SequencerSendCommitmentsToDaTest {
// Publish one more L2 block and send commitment
sequencer.client.send_publish_batch_request().await?;

sequencer
.wait_for_l2_height(
min_soft_confirmations_per_commitment + FINALITY_DEPTH - 1,
None,
)
.await?;

// Wait for blob tx to hit the mempool
da.wait_mempool_len(2, None).await?;

Expand All @@ -261,28 +254,25 @@ impl TestCase for SequencerSendCommitmentsToDaTest {
tokio::time::sleep(std::time::Duration::from_millis(1000)).await;

let start_l2_block = 1;
let end_l2_block = 19;
let end_l2_block = sequencer
.client
.ledger_get_head_soft_confirmation_height()
.await?;

self.check_sequencer_commitment(sequencer, da, start_l2_block, end_l2_block)
.await?;

for _ in 0..min_soft_confirmations_per_commitment {
sequencer.client.send_publish_batch_request().await?;
}
sequencer
.wait_for_l2_height(
end_l2_block + min_soft_confirmations_per_commitment + FINALITY_DEPTH - 2,
None,
)
.await?;

// Wait for blob tx to hit the mempool
da.wait_mempool_len(2, None).await?;
// Include commitment in block and finalize it
da.generate(FINALITY_DEPTH).await?;

let start_l2_block = end_l2_block + 1;
let end_l2_block = end_l2_block + 12;
let end_l2_block = end_l2_block + min_soft_confirmations_per_commitment;

self.check_sequencer_commitment(sequencer, da, start_l2_block, end_l2_block)
.await?;
Expand Down
9 changes: 8 additions & 1 deletion bin/citrea/tests/bitcoin_e2e/tx_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bitcoin::{Amount, Transaction};
use bitcoin_da::REVEAL_OUTPUT_AMOUNT;
use bitcoincore_rpc::RpcApi;
use citrea_e2e::bitcoin::{BitcoinNode, FINALITY_DEPTH};
use citrea_e2e::config::TestCaseConfig;
use citrea_e2e::config::{SequencerConfig, TestCaseConfig};
use citrea_e2e::framework::TestFramework;
use citrea_e2e::sequencer::Sequencer;
use citrea_e2e::test_case::{TestCase, TestCaseRunner};
Expand Down Expand Up @@ -275,6 +275,13 @@ impl TestCase for TestProverTransactionChaining {
}
}

fn sequencer_config() -> SequencerConfig {
SequencerConfig {
min_soft_confirmations_per_commitment: FINALITY_DEPTH * 2,
..Default::default()
}
}

async fn run_test(&mut self, f: &mut TestFramework) -> Result<()> {
let sequencer = f.sequencer.as_mut().unwrap();
let batch_prover = f.batch_prover.as_mut().unwrap();
Expand Down
1 change: 1 addition & 0 deletions crates/batch-prover/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ where
// This block failed to process, add remaining L2 blocks to queue including this one.
let remaining_l2s = l2_blocks[index..].to_vec();
pending_l2_blocks.extend(remaining_l2s);
break;
}
}
continue;
Expand Down
2 changes: 1 addition & 1 deletion crates/bitcoin-da/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use crate::spec::{BitcoinSpec, RollupParams};
use crate::verifier::BitcoinVerifier;
use crate::REVEAL_OUTPUT_AMOUNT;

pub const FINALITY_DEPTH: u64 = 8; // blocks
pub const FINALITY_DEPTH: u64 = 30; // blocks
const POLLING_INTERVAL: u64 = 10; // seconds

/// Runtime configuration for the DA service
Expand Down

0 comments on commit 5310950

Please sign in to comment.