diff --git a/fendermint/testing/materializer/manifests/root-only.yaml b/fendermint/testing/materializer/manifests/root-only.yaml new file mode 100644 index 000000000..811919428 --- /dev/null +++ b/fendermint/testing/materializer/manifests/root-only.yaml @@ -0,0 +1,25 @@ +accounts: + alice: {} + bob: {} + charlie: {} +rootnet: + type: New + validators: + alice: '100' + balances: + alice: '1000000000000000000' + bob: '2000000000000000000' + charlie: '3000000000000000000' + nodes: + node-1: + mode: + type: Validator + validator: alice + ethapi: true + + node-2: + mode: + type: Full + ethapi: false + seed_nodes: + - node-1 diff --git a/fendermint/testing/materializer/src/manifest.rs b/fendermint/testing/materializer/src/manifest.rs index b8a6e9005..e74863a31 100644 --- a/fendermint/testing/materializer/src/manifest.rs +++ b/fendermint/testing/materializer/src/manifest.rs @@ -39,6 +39,7 @@ pub struct Manifest { pub rootnet: Rootnet, /// Subnets created on the rootnet. + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] pub subnets: SubnetMap, } @@ -131,6 +132,7 @@ pub struct Subnet { /// Child subnets under this parent. /// /// The subnet ID exists so we can find the outcome of existing deployments in the log. + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] pub subnets: SubnetMap, } @@ -141,9 +143,11 @@ pub struct Node { /// Indicate whether to run the Ethereum API. pub ethapi: bool, /// The nodes from which CometBFT should bootstrap itself. + #[serde(default, skip_serializing_if = "Vec::is_empty")] pub seed_nodes: Vec, /// The parent node that the top-down syncer follows; /// or leave it empty if node is on the rootnet. + #[serde(default, skip_serializing_if = "Option::is_none")] pub parent_node: Option, } diff --git a/fendermint/testing/materializer/tests/docker.rs b/fendermint/testing/materializer/tests/docker.rs new file mode 100644 index 000000000..606528bfc --- /dev/null +++ b/fendermint/testing/materializer/tests/docker.rs @@ -0,0 +1,22 @@ +// Copyright 2022-2024 Protocol Labs +// SPDX-License-Identifier: Apache-2.0, MIT + +use fendermint_testing_materializer::{ + docker::DockerMaterializer, + manifest::{self, Manifest}, +}; + +mod manifests { + use fendermint_testing_materializer::manifest::Manifest; + + pub const ROOT_ONLY: &str = include_str!("../manifests/root-only.yaml"); + + pub fn parse_yaml(yaml: &str) -> Manifest { + serde_yaml::from_str(yaml).expect("failed to parse manifest") + } +} + +#[tokio::test] +async fn test_root_only() { + let _manifest = manifests::parse_yaml(manifests::ROOT_ONLY); +}