diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index 73d6aea..8332be9 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -50,10 +50,6 @@ jobs: test: name: Run Tests runs-on: ubuntu-latest - strategy: - matrix: - ci_test_mode: [0, 1] - steps: - uses: actions/checkout@v4 @@ -64,4 +60,4 @@ jobs: toolchain: stable - name: Run Cargo test - run: CI_TEST_MODE=${{ matrix.ci_test_mode }} cargo test + run: cargo test diff --git a/src/bitcoin.rs b/src/bitcoin.rs index 378244c..3ef09c5 100644 --- a/src/bitcoin.rs +++ b/src/bitcoin.rs @@ -24,7 +24,7 @@ use super::{ }; use crate::{log_provider::LogPathProvider, node::NodeKind}; -pub const FINALITY_DEPTH: u64 = 8; +pub const FINALITY_DEPTH: u64 = 30; pub struct BitcoinNode { spawn_output: SpawnOutput, diff --git a/src/citrea_config/batch_prover.rs b/src/citrea_config/batch_prover.rs index c72a86c..d198a50 100644 --- a/src/citrea_config/batch_prover.rs +++ b/src/citrea_config/batch_prover.rs @@ -39,6 +39,8 @@ pub struct BatchProverConfig { pub proof_sampling_number: usize, /// If true prover will try to recover ongoing proving sessions pub enable_recovery: bool, + /// Wether to always use the latest ELF or not + pub use_latest_elf: bool, } impl Default for BatchProverConfig { @@ -47,6 +49,7 @@ impl Default for BatchProverConfig { proving_mode: ProverGuestRunConfig::Execute, proof_sampling_number: 0, enable_recovery: true, + use_latest_elf: true, } } } @@ -97,6 +100,7 @@ mod tests { proving_mode: ProverGuestRunConfig::Skip, proof_sampling_number: 500, enable_recovery: true, + use_latest_elf: true, }; assert_eq!(config, expected); } diff --git a/src/citrea_config/light_client_prover.rs b/src/citrea_config/light_client_prover.rs index f4c225f..3ec134e 100644 --- a/src/citrea_config/light_client_prover.rs +++ b/src/citrea_config/light_client_prover.rs @@ -11,6 +11,8 @@ pub struct LightClientProverConfig { pub proof_sampling_number: usize, /// If true prover will try to recover ongoing proving sessions pub enable_recovery: bool, + /// The starting DA block to sync from + pub initial_da_height: u64, } impl Default for LightClientProverConfig { @@ -19,6 +21,7 @@ impl Default for LightClientProverConfig { proving_mode: ProverGuestRunConfig::Execute, proof_sampling_number: 0, enable_recovery: true, + initial_da_height: 1, } } } @@ -60,6 +63,7 @@ mod tests { proving_mode = "skip" proof_sampling_number = 500 enable_recovery = true + initial_da_height = 15 "#; let config_file = create_config_from(config); @@ -69,6 +73,7 @@ mod tests { proving_mode: ProverGuestRunConfig::Skip, proof_sampling_number: 500, enable_recovery: true, + initial_da_height: 15, }; assert_eq!(config, expected); } diff --git a/src/citrea_config/rollup.rs b/src/citrea_config/rollup.rs index 297aa73..b539a66 100644 --- a/src/citrea_config/rollup.rs +++ b/src/citrea_config/rollup.rs @@ -121,6 +121,8 @@ pub struct FullNodeConfig { pub da: BitcoinServiceConfig, /// Important pubkeys pub public_keys: RollupPublicKeys, + /// Telemetry config + pub telemetry: TelemetryConfig, } impl Default for FullNodeConfig { @@ -161,19 +163,38 @@ impl Default for FullNodeConfig { 32, 64, 64, 227, 100, 193, 15, 43, 236, 156, 31, 229, 0, 161, 205, 76, 36, 124, 137, 214, 80, 160, 30, 215, 232, 44, 171, 168, 103, 135, 124, 33, ], - // private key [4, 95, 252, 129, 163, 193, 253, 179, 175, 19, 89, 219, 242, 209, 20, 176, 179, 239, 191, 127, 41, 204, 156, 93, 160, 18, 103, 170, 57, 210, 199, 141] - // Private Key (WIF): KwNDSCvKqZqFWLWN1cUzvMiJQ7ck6ZKqR6XBqVKyftPZtvmbE6YD + // private key E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262 + // Private Key (WIF): 5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF sequencer_da_pub_key: vec![ - 3, 136, 195, 18, 11, 187, 25, 37, 38, 109, 184, 237, 247, 208, 131, 219, 162, - 70, 35, 174, 234, 47, 239, 247, 60, 51, 174, 242, 247, 112, 186, 222, 30, + 2, 88, 141, 32, 42, 252, 193, 238, 74, 181, 37, 76, 120, 71, 236, 37, 185, 161, + 53, 187, 218, 15, 43, 198, 158, 225, 167, 20, 116, 159, 215, 125, 201, ], - // private key [117, 186, 249, 100, 208, 116, 89, 70, 0, 54, 110, 91, 17, 26, 29, 168, 248, 107, 46, 254, 45, 34, 218, 81, 200, 216, 33, 38, 160, 252, 172, 114] - // Private Key (WIF): L1AZdJXzDGGENBBPZGSL7dKJnwn5xSKqzszgK6CDwiBGThYQEVTo + // private key 56D08C2DDE7F412F80EC99A0A328F76688C904BD4D1435281EFC9270EC8C8707 + // Private Key (WIF): 5JUX9MqyVroDAjP2itrbaenEKNTioGVnnDSYn3PmLgb23TCLWMs prover_da_pub_key: vec![ - 2, 138, 232, 157, 214, 46, 7, 210, 235, 33, 105, 239, 71, 169, 105, 233, 239, - 84, 172, 112, 13, 54, 9, 206, 106, 138, 251, 218, 15, 28, 137, 112, 127, + 3, 238, 218, 184, 136, 228, 95, 59, 220, 62, 201, 145, 140, 73, 28, 17, 229, + 207, 122, 240, 169, 31, 56, 185, 127, 188, 30, 19, 90, 228, 5, 102, 1, ], }, + telemetry: Default::default(), + } + } +} + +/// Telemetry configuration. +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct TelemetryConfig { + /// Server host. + pub bind_host: String, + /// Server port. + pub bind_port: u16, +} + +impl Default for TelemetryConfig { + fn default() -> Self { + Self { + bind_host: "0.0.0.0".to_owned(), + bind_port: 0, } } } diff --git a/src/config/docker.rs b/src/config/docker.rs index a3b614e..8feb488 100644 --- a/src/config/docker.rs +++ b/src/config/docker.rs @@ -12,7 +12,7 @@ use crate::{ const DEFAULT_BITCOIN_DOCKER_IMAGE: &str = "bitcoin/bitcoin:28.0"; const DEFAULT_CITREA_DOCKER_IMAGE: &str = - "chainwayxyz/citrea-test:c9fea47c64530dd68ba22faf1f4c70c0e0ea4ff3"; + "chainwayxyz/citrea-test:5310950a46d06d678d2c7bc75cfbe1b92c754de9"; #[derive(Debug)] pub struct VolumeConfig { @@ -74,13 +74,10 @@ where Self { ports: vec![config.rollup.rpc.bind_port], - image: config.docker_image.clone().unwrap_or_else(|| { - let base_img = DEFAULT_CITREA_DOCKER_IMAGE; - match std::env::var("CI_TEST_MODE") { - Ok(v) if v == "1" || v == "true" => format!("{base_img}-ci"), - _ => base_img.to_string(), - } - }), + image: config + .docker_image + .clone() + .unwrap_or(DEFAULT_CITREA_DOCKER_IMAGE.to_string()), cmd: args, log_path: config.dir.join("stdout.log"), volume: VolumeConfig { diff --git a/src/config/test_case.rs b/src/config/test_case.rs index aee3dd6..8e1e921 100644 --- a/src/config/test_case.rs +++ b/src/config/test_case.rs @@ -2,6 +2,8 @@ use std::{env, path::PathBuf, time::Duration}; use tempfile::TempDir; +use crate::utils::generate_test_id; + #[derive(Clone, Default)] pub struct TestCaseEnv { pub test: Vec<(&'static str, &'static str)>, @@ -57,10 +59,12 @@ pub struct TestCaseConfig { // Or an absolute path. // Defaults to resources/genesis/bitcoin-regtest pub genesis_dir: Option, + pub test_id: String, } impl Default for TestCaseConfig { fn default() -> Self { + let test_id = generate_test_id(); TestCaseConfig { n_nodes: 1, with_sequencer: true, @@ -68,11 +72,19 @@ impl Default for TestCaseConfig { with_light_client_prover: false, with_full_node: false, timeout: Duration::from_secs(60), - dir: TempDir::new() - .expect("Failed to create temporary directory") - .into_path(), + dir: std::env::var("TEST_OUT_DIR") + .map_or_else( + |_| { + TempDir::new() + .expect("Failed to create temporary directory") + .into_path() + }, + PathBuf::from, + ) + .join(test_id.clone()), docker: TestCaseDockerConfig::default(), genesis_dir: None, + test_id, } } } @@ -86,8 +98,8 @@ pub struct TestCaseDockerConfig { impl Default for TestCaseDockerConfig { fn default() -> Self { TestCaseDockerConfig { - bitcoin: parse_bool_env("TEST_BITCOIN_DOCKER"), - citrea: parse_bool_env("TEST_CITREA_DOCKER"), + bitcoin: parse_bool_env("TEST_BITCOIN_DOCKER").unwrap_or(true), + citrea: parse_bool_env("TEST_CITREA_DOCKER").unwrap_or(false), } } } @@ -98,8 +110,8 @@ impl TestCaseDockerConfig { } } -pub fn parse_bool_env(key: &str) -> bool { +pub fn parse_bool_env(key: &str) -> Option { env::var(key) + .ok() .map(|v| &v == "1" || &v.to_lowercase() == "true") - .unwrap_or(false) } diff --git a/src/framework.rs b/src/framework.rs index 948eb77..be315bf 100644 --- a/src/framework.rs +++ b/src/framework.rs @@ -328,7 +328,7 @@ fn generate_test_config( RollupConfig { da: BitcoinServiceConfig { da_private_key: Some( - "045FFC81A3C1FDB3AF1359DBF2D114B0B3EFBF7F29CC9C5DA01267AA39D2C78D".to_string(), + "E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262".to_string(), ), node_url: format!("http://{}/wallet/{}", da_config.node_url, node_kind), tx_backup_dir: tx_backup_dir.display().to_string(), @@ -363,7 +363,7 @@ fn generate_test_config( RollupConfig { da: BitcoinServiceConfig { da_private_key: Some( - "75BAF964D074594600366E5B111A1DA8F86B2EFE2D22DA51C8D82126A0FCAC72".to_string(), + "56D08C2DDE7F412F80EC99A0A328F76688C904BD4D1435281EFC9270EC8C8707".to_string(), ), node_url: format!("http://{}/wallet/{}", da_config.node_url, node_kind), tx_backup_dir: tx_backup_dir.display().to_string(), @@ -434,33 +434,34 @@ fn generate_test_config( } }; + let citrea_docker_image = std::env::var("CITREA_DOCKER_IMAGE").ok(); Ok(TestConfig { bitcoin: bitcoin_confs, sequencer: FullSequencerConfig::new( sequencer, sequencer_rollup, - None, + citrea_docker_image.clone(), sequencer_dir, env.sequencer(), )?, batch_prover: FullBatchProverConfig::new( batch_prover, batch_prover_rollup, - None, + citrea_docker_image.clone(), batch_prover_dir, env.batch_prover(), )?, light_client_prover: FullLightClientProverConfig::new( light_client_prover, light_client_prover_rollup, - None, + citrea_docker_image.clone(), light_client_prover_dir, env.light_client_prover(), )?, full_node: FullFullNodeConfig::new( (), full_node_rollup, - None, + citrea_docker_image, full_node_dir, env.full_node(), )?, diff --git a/src/node.rs b/src/node.rs index bc81b6b..0662002 100644 --- a/src/node.rs +++ b/src/node.rs @@ -284,6 +284,7 @@ where let rollup_config_args = config.get_rollup_config_args(); [ + vec!["--dev".to_string()], vec!["--da-layer".to_string(), config.da_layer().to_string()], node_config_args, rollup_config_args,