Skip to content

Commit

Permalink
feat(jstzd): use jstz node config
Browse files Browse the repository at this point in the history
  • Loading branch information
ryutamago committed Dec 6, 2024
1 parent 30a052e commit 4fed084
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
24 changes: 17 additions & 7 deletions crates/jstzd/src/config.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions crates/jstzd/src/task/jstzd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 4fed084

Please sign in to comment.