diff --git a/crates/jstzd/src/config.rs b/crates/jstzd/src/config.rs index 512da5b85..24bbf3d52 100644 --- a/crates/jstzd/src/config.rs +++ b/crates/jstzd/src/config.rs @@ -1,5 +1,6 @@ +use octez::unused_port; use rust_embed::Embed; -use std::path::{Path, PathBuf}; +use std::path::Path; use crate::task::jstzd::JstzdConfig; use crate::{ @@ -83,6 +84,7 @@ pub(crate) async fn build_config( &octez_client_config, )?; + let kernel_debug_file = Path::new(KERNEL_DEBUG_FILE); let octez_node_endpoint = octez_node_config.rpc_endpoint.clone(); let octez_rollup_config = OctezRollupConfigBuilder::new( octez_node_endpoint, @@ -94,16 +96,15 @@ pub(crate) async fn build_config( .set_data_dir(RollupDataDir::TempWithPreImages { preimages_dir: jstz_rollup_path::preimages_path(), }) - .set_kernel_debug_file(Path::new(KERNEL_DEBUG_FILE)) + .set_kernel_debug_file(kernel_debug_file) .build() .unwrap(); - // TODO: https://linear.app/tezos/issue/JSTZ-240/add-jstz-node-config-builder - // Dummy jstz node config for now + let jstz_node_rpc_endpoint = Endpoint::localhost(unused_port()); let jstz_node_config = JstzNodeConfig::new( - &Endpoint::localhost(8000), - &Endpoint::localhost(8000), - &PathBuf::from("dummy-kernel-log-file"), + &jstz_node_rpc_endpoint, + &octez_rollup_config.rpc_endpoint, + kernel_debug_file, ); let protocol_params = build_protocol_params(config.protocol).await?; let server_port = config.server_port.unwrap_or(DEFAULT_JSTZD_SERVER_PORT); @@ -488,6 +489,15 @@ mod tests { config.octez_rollup_config().boot_sector_file, jstz_rollup_path::kernel_installer_path() ); + assert_eq!( + config.jstz_node_config().kernel_log_file.to_str().unwrap(), + KERNEL_DEBUG_FILE + ); + + assert_eq!( + config.jstz_node_config().rollup_endpoint, + config.octez_rollup_config().rpc_endpoint + ); } #[tokio::test] diff --git a/crates/jstzd/src/task/jstzd.rs b/crates/jstzd/src/task/jstzd.rs index e843dd9cf..71e2423d5 100644 --- a/crates/jstzd/src/task/jstzd.rs +++ b/crates/jstzd/src/task/jstzd.rs @@ -106,6 +106,10 @@ impl JstzdConfig { &self.octez_rollup_config } + pub fn jstz_node_config(&self) -> &JstzNodeConfig { + &self.jstz_node_config + } + pub fn protocol_params(&self) -> &ProtocolParameter { &self.protocol_params }