Skip to content

Commit 1aac509

Browse files
committed
Rough validation
1 parent efde07d commit 1aac509

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

src/citrea_config/sequencer.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
use anyhow::ensure;
12
use serde::{Deserialize, Serialize};
23

4+
use crate::{bitcoin::FINALITY_DEPTH, config::Validate};
5+
36
/// Rollup Configuration
47
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
58
pub struct SequencerConfig {
@@ -24,7 +27,7 @@ impl Default for SequencerConfig {
2427
SequencerConfig {
2528
private_key: "1212121212121212121212121212121212121212121212121212121212121212"
2629
.to_string(),
27-
min_soft_confirmations_per_commitment: 4,
30+
min_soft_confirmations_per_commitment: FINALITY_DEPTH * 2,
2831
test_mode: true,
2932
deposit_mempool_fetch_limit: 10,
3033
block_production_interval_ms: 100,
@@ -34,6 +37,17 @@ impl Default for SequencerConfig {
3437
}
3538
}
3639

40+
impl Validate for SequencerConfig {
41+
fn validate(&self) -> anyhow::Result<()> {
42+
ensure!(
43+
self.min_soft_confirmations_per_commitment >= FINALITY_DEPTH * 2,
44+
"min_soft_confirmations_per_commitment should be set higher than FINALITY_DEPTH * 2"
45+
);
46+
47+
Ok(())
48+
}
49+
}
50+
3751
/// Mempool Config for the sequencer
3852
/// Read: https://github.com/ledgerwatch/erigon/wiki/Transaction-Pool-Design
3953
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]

src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl Client {
3636
.request("citrea_testPublishBlock", rpc_params![])
3737
.await
3838
.map_err(Into::into);
39-
sleep(Duration::from_millis(100)).await;
39+
// sleep(Duration::from_millis(100)).await;
4040
r
4141
}
4242

src/config/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,7 @@ where
209209
self.dir().join("stderr.log")
210210
}
211211
}
212+
213+
pub trait Validate {
214+
fn validate(&self) -> Result<()>;
215+
}

src/framework.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use crate::{
2727
batch_prover::BatchProver,
2828
config::{
2929
BitcoinServiceConfig, FullLightClientProverConfig, RpcConfig, RunnerConfig, StorageConfig,
30+
Validate,
3031
},
3132
light_client_prover::LightClientProver,
3233
log_provider::{LogPathProvider, LogPathProviderErased},
@@ -276,6 +277,8 @@ fn generate_test_config<T: TestCase>(
276277
let batch_prover = T::batch_prover_config();
277278
let light_client_prover = T::light_client_prover_config();
278279
let sequencer = T::sequencer_config();
280+
sequencer.validate()?;
281+
279282
let sequencer_rollup = RollupConfig::default();
280283
let batch_prover_rollup = RollupConfig::default();
281284
let light_client_prover_rollup = RollupConfig::default();

0 commit comments

Comments
 (0)