From 29328a71685b8ae16258de7b20ab2c0bd44f1624 Mon Sep 17 00:00:00 2001 From: Shunkichi Sato <49983831+s8sato@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:54:32 +0900 Subject: [PATCH] fix: test environments inherit and modify local `genesis.json` Signed-off-by: Shunkichi Sato <49983831+s8sato@users.noreply.github.com> --- crates/iroha_genesis/src/lib.rs | 2 +- crates/iroha_swarm/src/lib.rs | 56 ++++++++++++++++++++++++------ crates/iroha_swarm/src/schema.rs | 30 +++++++++++----- defaults/docker-compose.local.yml | 13 +++++-- defaults/docker-compose.single.yml | 10 ++++-- defaults/docker-compose.yml | 13 +++++-- scripts/build_wasm.sh | 8 ++--- scripts/test_env.py | 34 ++++++++---------- 8 files changed, 117 insertions(+), 49 deletions(-) diff --git a/crates/iroha_genesis/src/lib.rs b/crates/iroha_genesis/src/lib.rs index 26b1a6c4ab..c868995e40 100644 --- a/crates/iroha_genesis/src/lib.rs +++ b/crates/iroha_genesis/src/lib.rs @@ -433,7 +433,7 @@ impl TryFrom for WasmSmartContract { impl WasmPath { /// Resolve `self` to `here/self`, /// assuming `self` is an unresolved relative path to `here`. - /// Must be applied once. + /// In case `self` is absolute, it replaces `here` i.e. this method mutates nothing. fn resolve(&mut self, here: impl AsRef) { self.0 = here.as_ref().join(&self.0) } diff --git a/crates/iroha_swarm/src/lib.rs b/crates/iroha_swarm/src/lib.rs index 5515c3d337..1c7053a986 100644 --- a/crates/iroha_swarm/src/lib.rs +++ b/crates/iroha_swarm/src/lib.rs @@ -196,14 +196,20 @@ mod tests { - 1337:1337 - 8080:8080 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true command: |- /bin/bash -c " - kagami genesis generate --executor ../config/executor.wasm --wasm-dir ../config/libs --genesis-public-key $$GENESIS_PUBLIC_KEY > /tmp/genesis.default.json + EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\ + EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\ + WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\ + WASM_DIR_ABSOLUTE_PATH=$(realpath \"/config/$$WASM_DIR_RELATIVE_PATH\") && \\ jq \\ + --arg executor \"$$EXECUTOR_ABSOLUTE_PATH\" \\ + --arg wasm_dir \"$$WASM_DIR_ABSOLUTE_PATH\" \\ --argjson topology \"$$TOPOLOGY\" \\ - '.topology = $$topology' /tmp/genesis.default.json \\ + '.executor = $$executor | .wasm_dir = $$wasm_dir | .topology = $$topology' /config/genesis.json \\ >/tmp/genesis.json && \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ @@ -246,14 +252,20 @@ mod tests { - 1337:1337 - 8080:8080 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true command: |- /bin/bash -c " - kagami genesis generate --executor ../config/executor.wasm --wasm-dir ../config/libs --genesis-public-key $$GENESIS_PUBLIC_KEY > /tmp/genesis.default.json + EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\ + EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\ + WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\ + WASM_DIR_ABSOLUTE_PATH=$(realpath \"/config/$$WASM_DIR_RELATIVE_PATH\") && \\ jq \\ + --arg executor \"$$EXECUTOR_ABSOLUTE_PATH\" \\ + --arg wasm_dir \"$$WASM_DIR_ABSOLUTE_PATH\" \\ --argjson topology \"$$TOPOLOGY\" \\ - '.topology = $$topology' /tmp/genesis.default.json \\ + '.executor = $$executor | .wasm_dir = $$wasm_dir | .topology = $$topology' /config/genesis.json \\ >/tmp/genesis.json && \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ @@ -296,14 +308,20 @@ mod tests { - 1337:1337 - 8080:8080 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true command: |- /bin/bash -c " - kagami genesis generate --executor ../config/executor.wasm --wasm-dir ../config/libs --genesis-public-key $$GENESIS_PUBLIC_KEY > /tmp/genesis.default.json + EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\ + EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\ + WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\ + WASM_DIR_ABSOLUTE_PATH=$(realpath \"/config/$$WASM_DIR_RELATIVE_PATH\") && \\ jq \\ + --arg executor \"$$EXECUTOR_ABSOLUTE_PATH\" \\ + --arg wasm_dir \"$$WASM_DIR_ABSOLUTE_PATH\" \\ --argjson topology \"$$TOPOLOGY\" \\ - '.topology = $$topology' /tmp/genesis.default.json \\ + '.executor = $$executor | .wasm_dir = $$wasm_dir | .topology = $$topology' /config/genesis.json \\ >/tmp/genesis.json && \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ @@ -329,6 +347,7 @@ mod tests { - 1338:1338 - 8081:8081 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true irohad2: @@ -348,6 +367,7 @@ mod tests { - 1339:1339 - 8082:8082 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true irohad3: @@ -367,6 +387,7 @@ mod tests { - 1340:1340 - 8083:8083 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true "##]).assert_eq(&build_as_string( @@ -398,6 +419,7 @@ mod tests { - 1337:1337 - 8080:8080 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -408,10 +430,15 @@ mod tests { start_period: 4s command: |- /bin/bash -c " - kagami genesis generate --executor ../config/executor.wasm --wasm-dir ../config/libs --genesis-public-key $$GENESIS_PUBLIC_KEY > /tmp/genesis.default.json + EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\ + EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\ + WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\ + WASM_DIR_ABSOLUTE_PATH=$(realpath \"/config/$$WASM_DIR_RELATIVE_PATH\") && \\ jq \\ + --arg executor \"$$EXECUTOR_ABSOLUTE_PATH\" \\ + --arg wasm_dir \"$$WASM_DIR_ABSOLUTE_PATH\" \\ --argjson topology \"$$TOPOLOGY\" \\ - '.topology = $$topology' /tmp/genesis.default.json \\ + '.executor = $$executor | .wasm_dir = $$wasm_dir | .topology = $$topology' /config/genesis.json \\ >/tmp/genesis.json && \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ @@ -451,6 +478,7 @@ mod tests { - 1337:1337 - 8080:8080 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -461,10 +489,15 @@ mod tests { start_period: 4s command: |- /bin/bash -c " - kagami genesis generate --executor ../config/executor.wasm --wasm-dir ../config/libs --genesis-public-key $$GENESIS_PUBLIC_KEY > /tmp/genesis.default.json + EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\ + EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\ + WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\ + WASM_DIR_ABSOLUTE_PATH=$(realpath \"/config/$$WASM_DIR_RELATIVE_PATH\") && \\ jq \\ + --arg executor \"$$EXECUTOR_ABSOLUTE_PATH\" \\ + --arg wasm_dir \"$$WASM_DIR_ABSOLUTE_PATH\" \\ --argjson topology \"$$TOPOLOGY\" \\ - '.topology = $$topology' /tmp/genesis.default.json \\ + '.executor = $$executor | .wasm_dir = $$wasm_dir | .topology = $$topology' /config/genesis.json \\ >/tmp/genesis.json && \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ @@ -488,6 +521,7 @@ mod tests { - 1338:1338 - 8081:8081 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -511,6 +545,7 @@ mod tests { - 1339:1339 - 8082:8082 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -534,6 +569,7 @@ mod tests { - 1340:1340 - 8083:8083 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: diff --git a/crates/iroha_swarm/src/schema.rs b/crates/iroha_swarm/src/schema.rs index e8dc1b101a..1384f285d2 100644 --- a/crates/iroha_swarm/src/schema.rs +++ b/crates/iroha_swarm/src/schema.rs @@ -243,12 +243,14 @@ impl std::fmt::Display for ContainerFile<'_> { } } +const GENESIS_FILE: Filename = Filename("genesis.json"); const CONFIG_FILE: Filename = Filename("client.toml"); const GENESIS_SIGNED_SCALE: Filename = Filename("genesis.signed.scale"); const CONTAINER_CONFIG_DIR: ContainerPath = ContainerPath("/config/"); const CONTAINER_TMP_DIR: ContainerPath = ContainerPath("/tmp/"); +const CONTAINER_GENESIS_CONFIG: ContainerFile = ContainerFile(CONTAINER_CONFIG_DIR, GENESIS_FILE); const CONTAINER_CLIENT_CONFIG: ContainerFile = ContainerFile(CONTAINER_CONFIG_DIR, CONFIG_FILE); const CONTAINER_SIGNED_GENESIS: ContainerFile = ContainerFile(CONTAINER_TMP_DIR, GENESIS_SIGNED_SCALE); @@ -261,7 +263,7 @@ struct ReadOnly; struct PathMapping<'a>(HostFile<'a>, ContainerFile<'a>, ReadOnly); /// Mapping between host and container paths. -type Volumes<'a> = [PathMapping<'a>; 1]; +type Volumes<'a> = [PathMapping<'a>; 2]; /// Healthcheck parameters. #[derive(Debug)] @@ -326,10 +328,15 @@ where struct SignAndSubmitGenesis; const SIGN_AND_SUBMIT_GENESIS: &str = r#"/bin/bash -c " - kagami genesis generate --executor ../config/executor.wasm --wasm-dir ../config/libs --genesis-public-key $$GENESIS_PUBLIC_KEY > /tmp/genesis.default.json + EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\ + EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\ + WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\ + WASM_DIR_ABSOLUTE_PATH=$(realpath \"/config/$$WASM_DIR_RELATIVE_PATH\") && \\ jq \\ + --arg executor \"$$EXECUTOR_ABSOLUTE_PATH\" \\ + --arg wasm_dir \"$$WASM_DIR_ABSOLUTE_PATH\" \\ --argjson topology \"$$TOPOLOGY\" \\ - '.topology = $$topology' /tmp/genesis.default.json \\ + '.executor = $$executor | .wasm_dir = $$wasm_dir | .topology = $$topology' /config/genesis.json \\ >/tmp/genesis.json && \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ @@ -528,11 +535,18 @@ impl<'a> DockerCompose<'a> { }: &'a PeerSettings, ) -> Self { let image = ImageId(name); - let volumes = [PathMapping( - HostFile(config_dir, CONFIG_FILE), - CONTAINER_CLIENT_CONFIG, - ReadOnly, - )]; + let volumes = [ + PathMapping( + HostFile(config_dir, GENESIS_FILE), + CONTAINER_GENESIS_CONFIG, + ReadOnly, + ), + PathMapping( + HostFile(config_dir, CONFIG_FILE), + CONTAINER_CLIENT_CONFIG, + ReadOnly, + ), + ]; Self { services: build_dir.as_ref().map_or_else( || { diff --git a/defaults/docker-compose.local.yml b/defaults/docker-compose.local.yml index af3765933e..2667e84ff2 100644 --- a/defaults/docker-compose.local.yml +++ b/defaults/docker-compose.local.yml @@ -22,6 +22,7 @@ services: - 1337:1337 - 8080:8080 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -32,10 +33,15 @@ services: start_period: 4s command: |- /bin/bash -c " - kagami genesis generate --executor ../config/executor.wasm --wasm-dir ../config/libs --genesis-public-key $$GENESIS_PUBLIC_KEY > /tmp/genesis.default.json + EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\ + EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\ + WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\ + WASM_DIR_ABSOLUTE_PATH=$(realpath \"/config/$$WASM_DIR_RELATIVE_PATH\") && \\ jq \\ + --arg executor \"$$EXECUTOR_ABSOLUTE_PATH\" \\ + --arg wasm_dir \"$$WASM_DIR_ABSOLUTE_PATH\" \\ --argjson topology \"$$TOPOLOGY\" \\ - '.topology = $$topology' /tmp/genesis.default.json \\ + '.executor = $$executor | .wasm_dir = $$wasm_dir | .topology = $$topology' /config/genesis.json \\ >/tmp/genesis.json && \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ @@ -61,6 +67,7 @@ services: - 1338:1338 - 8081:8081 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -86,6 +93,7 @@ services: - 1339:1339 - 8082:8082 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -111,6 +119,7 @@ services: - 1340:1340 - 8083:8083 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: diff --git a/defaults/docker-compose.single.yml b/defaults/docker-compose.single.yml index 7fd50586d5..1f200380e4 100644 --- a/defaults/docker-compose.single.yml +++ b/defaults/docker-compose.single.yml @@ -21,6 +21,7 @@ services: - 1337:1337 - 8080:8080 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -31,10 +32,15 @@ services: start_period: 4s command: |- /bin/bash -c " - kagami genesis generate --executor ../config/executor.wasm --wasm-dir ../config/libs --genesis-public-key $$GENESIS_PUBLIC_KEY > /tmp/genesis.default.json + EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\ + EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\ + WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\ + WASM_DIR_ABSOLUTE_PATH=$(realpath \"/config/$$WASM_DIR_RELATIVE_PATH\") && \\ jq \\ + --arg executor \"$$EXECUTOR_ABSOLUTE_PATH\" \\ + --arg wasm_dir \"$$WASM_DIR_ABSOLUTE_PATH\" \\ --argjson topology \"$$TOPOLOGY\" \\ - '.topology = $$topology' /tmp/genesis.default.json \\ + '.executor = $$executor | .wasm_dir = $$wasm_dir | .topology = $$topology' /config/genesis.json \\ >/tmp/genesis.json && \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ diff --git a/defaults/docker-compose.yml b/defaults/docker-compose.yml index 053434933e..026a7013e2 100644 --- a/defaults/docker-compose.yml +++ b/defaults/docker-compose.yml @@ -20,6 +20,7 @@ services: - 1337:1337 - 8080:8080 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -30,10 +31,15 @@ services: start_period: 4s command: |- /bin/bash -c " - kagami genesis generate --executor ../config/executor.wasm --wasm-dir ../config/libs --genesis-public-key $$GENESIS_PUBLIC_KEY > /tmp/genesis.default.json + EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\ + EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\ + WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\ + WASM_DIR_ABSOLUTE_PATH=$(realpath \"/config/$$WASM_DIR_RELATIVE_PATH\") && \\ jq \\ + --arg executor \"$$EXECUTOR_ABSOLUTE_PATH\" \\ + --arg wasm_dir \"$$WASM_DIR_ABSOLUTE_PATH\" \\ --argjson topology \"$$TOPOLOGY\" \\ - '.topology = $$topology' /tmp/genesis.default.json \\ + '.executor = $$executor | .wasm_dir = $$wasm_dir | .topology = $$topology' /config/genesis.json \\ >/tmp/genesis.json && \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ @@ -56,6 +62,7 @@ services: - 1338:1338 - 8081:8081 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -78,6 +85,7 @@ services: - 1339:1339 - 8082:8082 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: @@ -100,6 +108,7 @@ services: - 1340:1340 - 8083:8083 volumes: + - ./genesis.json:/config/genesis.json:ro - ./client.toml:/config/client.toml:ro init: true healthcheck: diff --git a/scripts/build_wasm.sh b/scripts/build_wasm.sh index ef95f6fbfc..f9bb3db5a6 100755 --- a/scripts/build_wasm.sh +++ b/scripts/build_wasm.sh @@ -2,8 +2,8 @@ set -e; DEFAULTS_DIR="defaults" -CRATES_DIR="wasm" -TARGET_DIR="wasm/target/prebuilt" +CARGO_DIR="wasm" +TARGET_DIR="$CARGO_DIR/target/prebuilt" build() { case $1 in @@ -18,7 +18,7 @@ build() { ;; "samples") NAMES=($( - cargo metadata --no-deps --manifest-path "$CRATES_DIR/Cargo.toml" --format-version=1 | + cargo metadata --no-deps --manifest-path "$CARGO_DIR/Cargo.toml" --format-version=1 | jq '.packages | map(select(.targets[].kind | contains(["cdylib"]))) | map(.manifest_path | split("/")) | map(select(.[-3] == "samples")) | map(.[-2]) | .[]' -r )) esac @@ -26,7 +26,7 @@ build() { mkdir -p "$TARGET_DIR/$1" for name in ${NAMES[@]}; do out_file="$TARGET_DIR/$1/$name.wasm" - cargo run --bin iroha_wasm_builder -- build "$CRATES_DIR/$1/$name" --optimize --out-file "$out_file" + cargo run --bin iroha_wasm_builder -- build "$CARGO_DIR/$1/$name" --optimize --out-file "$out_file" done echo "info: WASM $1 build complete" echo "artifacts written to $TARGET_DIR/$1/" diff --git a/scripts/test_env.py b/scripts/test_env.py index 3dd1e98e5b..ed9cfb351a 100755 --- a/scripts/test_env.py +++ b/scripts/test_env.py @@ -58,7 +58,7 @@ def __init__(self, args: argparse.Namespace): tomli_w.dump(shared_config, f) copy_or_prompt_build_bin("irohad", args.root_dir, peers_dir) - generate_genesis_json_and_change_topology(args, genesis_path, genesis_public_key, trusted_peers) + copy_genesis_json_and_change_topology(args, genesis_path, trusted_peers) sign_genesis_with_kagami(args, genesis_path, genesis_public_key, genesis_private_key) @@ -194,28 +194,22 @@ def kagami_generate_key_pair(out_dir: pathlib.Path, seed: str = None): # dict with `{ public_key: string, private_key: string }` return json.loads(kagami.stdout) -def generate_genesis_json_and_change_topology(args: argparse.Namespace, genesis_path, genesis_public_key, topology): - genesis_dir_abs = genesis_path.parent.resolve() - executor_abs = (args.root_dir / SWARM_CONFIGS_DIRECTORY / "executor.wasm").resolve() - wasm_dir_abs = (args.root_dir / SWARM_CONFIGS_DIRECTORY / "libs").resolve() - executor_rel = executor_abs.relative_to(genesis_dir_abs, walk_up=True) - wasm_dir_rel = wasm_dir_abs.relative_to(genesis_dir_abs, walk_up=True) - - command = [ - args.out_dir / "kagami", - "genesis", - "generate", - "--executor", executor_rel, - "--wasm-dir", wasm_dir_rel, - "--genesis-public-key", genesis_public_key - ] - kagami = subprocess.run(command, capture_output=True) - if kagami.returncode: - logging.error("Kagami failed to generate genesis.json") +def copy_genesis_json_and_change_topology(args: argparse.Namespace, genesis_path, topology): + source_path = args.root_dir / SWARM_CONFIGS_DIRECTORY / "genesis.json" + try: + with open(source_path, 'r') as f: + genesis = json.load(f) + except FileNotFoundError: + logging.error(f"genesis config not found at {source_path}") sys.exit(1) - genesis = json.loads(kagami.stdout) + # Early resolution to absolute paths: + # When the resulting genesis.json parsed, the second resolution doesn't affect them + executor_abs = (args.root_dir / SWARM_CONFIGS_DIRECTORY / genesis["executor"]).resolve() + wasm_dir_abs = (args.root_dir / SWARM_CONFIGS_DIRECTORY / genesis["wasm_dir"]).resolve() + genesis["executor"] = str(executor_abs) + genesis["wasm_dir"] = str(wasm_dir_abs) genesis["topology"] = topology with open(genesis_path, 'w') as f: