Skip to content

Commit

Permalink
Merge branch 'main' of github.com:chainwayxyz/citrea-e2e into fee_config
Browse files Browse the repository at this point in the history
  • Loading branch information
jfldde committed Jan 8, 2025
2 parents 44f4582 + f75fe92 commit 06394fb
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 35 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -64,4 +60,4 @@ jobs:
toolchain: stable

- name: Run Cargo test
run: CI_TEST_MODE=${{ matrix.ci_test_mode }} cargo test
run: cargo test
2 changes: 1 addition & 1 deletion 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 = 8;
pub const FINALITY_DEPTH: u64 = 30;

pub struct BitcoinNode {
spawn_output: SpawnOutput,
Expand Down
4 changes: 4 additions & 0 deletions src/citrea_config/batch_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -47,6 +49,7 @@ impl Default for BatchProverConfig {
proving_mode: ProverGuestRunConfig::Execute,
proof_sampling_number: 0,
enable_recovery: true,
use_latest_elf: true,
}
}
}
Expand Down Expand Up @@ -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);
}
Expand Down
5 changes: 5 additions & 0 deletions src/citrea_config/light_client_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -19,6 +21,7 @@ impl Default for LightClientProverConfig {
proving_mode: ProverGuestRunConfig::Execute,
proof_sampling_number: 0,
enable_recovery: true,
initial_da_height: 1,
}
}
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down
37 changes: 29 additions & 8 deletions src/citrea_config/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ pub struct FullNodeConfig<BitcoinServiceConfig> {
pub da: BitcoinServiceConfig,
/// Important pubkeys
pub public_keys: RollupPublicKeys,
/// Telemetry config
pub telemetry: TelemetryConfig,
}

impl Default for FullNodeConfig<BitcoinServiceConfig> {
Expand Down Expand Up @@ -161,19 +163,38 @@ impl Default for FullNodeConfig<BitcoinServiceConfig> {
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,
}
}
}
Expand Down
13 changes: 5 additions & 8 deletions src/config/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
26 changes: 19 additions & 7 deletions src/config/test_case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)>,
Expand Down Expand Up @@ -57,22 +59,32 @@ pub struct TestCaseConfig {
// Or an absolute path.
// Defaults to resources/genesis/bitcoin-regtest
pub genesis_dir: Option<String>,
pub test_id: String,
}

impl Default for TestCaseConfig {
fn default() -> Self {
let test_id = generate_test_id();
TestCaseConfig {
n_nodes: 1,
with_sequencer: true,
with_batch_prover: false,
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,
}
}
}
Expand All @@ -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),
}
}
}
Expand All @@ -98,8 +110,8 @@ impl TestCaseDockerConfig {
}
}

pub fn parse_bool_env(key: &str) -> bool {
pub fn parse_bool_env(key: &str) -> Option<bool> {
env::var(key)
.ok()
.map(|v| &v == "1" || &v.to_lowercase() == "true")
.unwrap_or(false)
}
13 changes: 7 additions & 6 deletions src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ fn generate_test_config<T: TestCase>(
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(),
Expand Down Expand Up @@ -363,7 +363,7 @@ fn generate_test_config<T: TestCase>(
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(),
Expand Down Expand Up @@ -434,33 +434,34 @@ fn generate_test_config<T: TestCase>(
}
};

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(),
)?,
Expand Down
1 change: 1 addition & 0 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 06394fb

Please sign in to comment.