From 2514ac296ccdb07ea4b20b69045a974b5241a877 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 6 Dec 2024 10:32:00 +0000 Subject: [PATCH] feat(jstzd): serialize rollup config --- crates/jstzd/src/task/jstzd.rs | 2 +- crates/jstzd/tests/jstzd_test.rs | 4 ++++ crates/octez/src/async/rollup.rs | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/jstzd/src/task/jstzd.rs b/crates/jstzd/src/task/jstzd.rs index 71e2423d5..a59b03ade 100644 --- a/crates/jstzd/src/task/jstzd.rs +++ b/crates/jstzd/src/task/jstzd.rs @@ -63,7 +63,7 @@ pub struct JstzdConfig { baker_config: OctezBakerConfig, #[serde(rename(serialize = "octez-client"))] octez_client_config: OctezClientConfig, - #[serde(skip_serializing)] + #[serde(rename(serialize = "octez-rollup"))] octez_rollup_config: OctezRollupConfig, #[serde(skip_serializing)] jstz_node_config: JstzNodeConfig, diff --git a/crates/jstzd/tests/jstzd_test.rs b/crates/jstzd/tests/jstzd_test.rs index a87a5251e..0f9cd46ed 100644 --- a/crates/jstzd/tests/jstzd_test.rs +++ b/crates/jstzd/tests/jstzd_test.rs @@ -255,6 +255,10 @@ async fn fetch_config_test(jstzd_config: JstzdConfig, jstzd_port: u16) { "octez-baker", serde_json::to_value(jstzd_config.baker_config()).unwrap(), ), + ( + "octez-rollup", + serde_json::to_value(jstzd_config.octez_rollup_config()).unwrap(), + ), ] { let res = reqwest::get(&format!("http://localhost:{}/config/{}", jstzd_port, key)) diff --git a/crates/octez/src/async/rollup.rs b/crates/octez/src/async/rollup.rs index 9c18cc356..503b27a86 100644 --- a/crates/octez/src/async/rollup.rs +++ b/crates/octez/src/async/rollup.rs @@ -3,7 +3,7 @@ use crate::unused_port; use super::{bootstrap::SmartRollupPvmKind, endpoint::Endpoint}; use anyhow::Result; use http::Uri; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use std::{ path::{Path, PathBuf}, str::FromStr, @@ -13,7 +13,7 @@ use tokio::process::{Child, Command}; const DEFAULT_BINARY_PATH: &str = "octez-smart-rollup-node"; -#[derive(Clone, PartialEq, Debug, Deserialize)] +#[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] pub enum RollupDataDir { /// Path to the rollup data directory. This directory /// should contain the kernel pre image files under `wasm_2_0_0/` @@ -119,7 +119,7 @@ impl OctezRollupConfigBuilder { } } -#[derive(Clone)] +#[derive(Clone, Serialize)] pub struct OctezRollupConfig { pub binary_path: PathBuf, pub octez_client_base_dir: PathBuf,