From 14a4f4b36cef267fd39317b59697bdabc2bd9afa Mon Sep 17 00:00:00 2001 From: Jacek Malec <145967538+jacek-casper@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:21:23 +0000 Subject: [PATCH] Update extra nctl scripts --- utils/nctl/sh/assets/upgrade_from_stage.sh | 2 +- utils/nctl/sh/staging/build.sh | 23 ++++++++++++++++----- utils/nctl/sh/staging/set_from_commit.sh | 7 +++++-- utils/nctl/sh/staging/set_from_local.sh | 4 ++-- utils/nctl/sh/staging/settings-template.txt | 14 ++++++------- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/utils/nctl/sh/assets/upgrade_from_stage.sh b/utils/nctl/sh/assets/upgrade_from_stage.sh index 64a147d52c..f62ca8f9d8 100644 --- a/utils/nctl/sh/assets/upgrade_from_stage.sh +++ b/utils/nctl/sh/assets/upgrade_from_stage.sh @@ -108,7 +108,7 @@ function _main() "$NCTL_CASPER_CLIENT_HOME/target/$NCTL_COMPILE_TARGET/casper-client" \ "$PATH_TO_STAGE/$PROTOCOL_VERSION/casper-node" \ "$PATH_TO_STAGE/$PROTOCOL_VERSION/casper-node-launcher" \ - "$PATH_TO_STAGE/$PROTOCOL_VERSION/casper-rpc-sidecar" \ + "$NCTL_CASPER_SIDECAR_HOME/target/$NCTL_COMPILE_TARGET/casper-rpc-sidecar" \ "$PATH_TO_STAGE/$PROTOCOL_VERSION" setup_asset_chainspec "$COUNT_NODES" \ "$(get_protocol_version_for_chainspec "$PROTOCOL_VERSION")" \ diff --git a/utils/nctl/sh/staging/build.sh b/utils/nctl/sh/staging/build.sh index c470a4d9db..98cdffa686 100644 --- a/utils/nctl/sh/staging/build.sh +++ b/utils/nctl/sh/staging/build.sh @@ -10,7 +10,7 @@ source "$NCTL/sh/utils/main.sh" # Builds assets for staging. # Arguments: # Stage ordinal identifier. -# Stage source (local | remote | node_commit-client_commit). +# Stage source (local | remote | node_commit-client_commit-sidecar_commit). # Scenario protocol version. ####################################### function _main() @@ -47,6 +47,7 @@ function set_stage_binaries() { local PATH_TO_NODE_SOURCE=${1} local PATH_TO_CLIENT_SOURCE=${2} + local PATH_TO_SIDECAR_SOURCE=${3} pushd "$PATH_TO_NODE_SOURCE" || exit @@ -78,6 +79,17 @@ function set_stage_binaries() fi popd || exit + + # Set sidecar binary. + pushd "$PATH_TO_SIDECAR_SOURCE" || exit + + if [ "$NCTL_COMPILE_TARGET" = "debug" ]; then + cargo build + else + cargo build --release + fi + + popd || exit } ####################################### @@ -91,7 +103,8 @@ function set_stage_files_from_repo() { local PATH_TO_NODE_SOURCE=${1} local PATH_TO_CLIENT_SOURCE=${2} - local PATH_TO_STAGE=${3} + local PATH_TO_SIDECAR_SOURCE=${3} + local PATH_TO_STAGE=${4} # Stage binaries. if [ "$NCTL_COMPILE_TARGET" = "debug" ]; then @@ -101,7 +114,7 @@ function set_stage_files_from_repo() "$PATH_TO_STAGE" cp "$NCTL_CASPER_NODE_LAUNCHER_HOME/target/debug/casper-node-launcher" \ "$PATH_TO_STAGE" - cp "$PATH_TO_NODE_SOURCE/target/debug/casper-rpc-sidecar" \ + cp "$PATH_TO_SIDECAR_SOURCE/target/debug/casper-rpc-sidecar" \ "$PATH_TO_STAGE" else cp "$PATH_TO_CLIENT_SOURCE/target/release/casper-client" \ @@ -110,7 +123,7 @@ function set_stage_files_from_repo() "$PATH_TO_STAGE" cp "$NCTL_CASPER_NODE_LAUNCHER_HOME/target/release/casper-node-launcher" \ "$PATH_TO_STAGE" - cp "$PATH_TO_NODE_SOURCE/target/release/casper-rpc-sidecar" \ + cp "$PATH_TO_SIDECAR_SOURCE/target/release/casper-rpc-sidecar" \ "$PATH_TO_STAGE" fi @@ -140,7 +153,7 @@ function set_stage_files_from_repo() "$PATH_TO_STAGE" # Stage sidecar config. - cp "${NCTL_CASPER_SIDECAR_HOME}/resources/example_configs/rpc_sidecar/sidecar.toml" \ + cp "$PATH_TO_SIDECAR_SOURCE/resources/example_configs/rpc_sidecar/sidecar.toml" \ "$PATH_TO_STAGE" } diff --git a/utils/nctl/sh/staging/set_from_commit.sh b/utils/nctl/sh/staging/set_from_commit.sh index 55913a03be..fe32722450 100644 --- a/utils/nctl/sh/staging/set_from_commit.sh +++ b/utils/nctl/sh/staging/set_from_commit.sh @@ -34,15 +34,18 @@ function _main() IFS='-' read -ra COMMIT_HASHES_ARRAY <<< "$COMMIT_HASHES" NODE_COMMIT_HASH="${COMMIT_HASHES_ARRAY[0]}" CLIENT_COMMIT_HASH="${COMMIT_HASHES_ARRAY[1]}" + SIDECAR_COMMIT_HASH="${COMMIT_HASHES_ARRAY[2]}" PATH_TO_NODE_REPO="$(get_path_to_remotes)/casper-node" PATH_TO_CLIENT_REPO="$(get_path_to_remotes)/casper-client-rs" + PATH_TO_SIDECAR_REPO="$(get_path_to_remotes)/event-sidecar" PATH_TO_STAGE="$(get_path_to_stage "$STAGE_ID")/$PROTOCOL_VERSION" _set_repo "https://github.com/casper-network/casper-node.git" "$PATH_TO_NODE_REPO" "$NODE_COMMIT_HASH" _set_repo "https://github.com/casper-ecosystem/casper-client-rs" "$PATH_TO_CLIENT_REPO" "$CLIENT_COMMIT_HASH" - set_stage_binaries "$PATH_TO_NODE_REPO" "$PATH_TO_CLIENT_REPO" - set_stage_files_from_repo "$PATH_TO_NODE_REPO" "$PATH_TO_CLIENT_REPO" "$PATH_TO_STAGE" + _set_repo "https://github.com/CasperLabs/event-sidecar" "$PATH_TO_SIDECAR_REPO" "$SIDECAR_COMMIT_HASH" + set_stage_binaries "$PATH_TO_NODE_REPO" "$PATH_TO_CLIENT_REPO" "$PATH_TO_SIDECAR_REPO" + set_stage_files_from_repo "$PATH_TO_NODE_REPO" "$PATH_TO_CLIENT_REPO" "$PATH_TO_SIDECAR_REPO" "$PATH_TO_STAGE" } ####################################### diff --git a/utils/nctl/sh/staging/set_from_local.sh b/utils/nctl/sh/staging/set_from_local.sh index b34381f226..7b95b3362d 100644 --- a/utils/nctl/sh/staging/set_from_local.sh +++ b/utils/nctl/sh/staging/set_from_local.sh @@ -19,8 +19,8 @@ function _main() local PATH_TO_STAGE PATH_TO_STAGE="$(get_path_to_stage "$STAGE_ID")/$PROTOCOL_VERSION" - set_stage_binaries "$NCTL_CASPER_HOME" "$NCTL_CASPER_CLIENT_HOME" - set_stage_files_from_repo "$NCTL_CASPER_HOME" "$NCTL_CASPER_CLIENT_HOME" "$PATH_TO_STAGE" + set_stage_binaries "$NCTL_CASPER_HOME" "$NCTL_CASPER_CLIENT_HOME" "$NCTL_CASPER_SIDECAR_HOME" + set_stage_files_from_repo "$NCTL_CASPER_HOME" "$NCTL_CASPER_CLIENT_HOME" "$NCTL_CASPER_SIDECAR_HOME" "$PATH_TO_STAGE" } # ---------------------------------------------------------------- diff --git a/utils/nctl/sh/staging/settings-template.txt b/utils/nctl/sh/staging/settings-template.txt index ebb0f9e911..dbb670b890 100644 --- a/utils/nctl/sh/staging/settings-template.txt +++ b/utils/nctl/sh/staging/settings-template.txt @@ -6,17 +6,17 @@ export NCTL_STAGE_DESCRIPTION="YOUR-DESCRIPTION" # Map: version <-> commit hash. export NCTL_STAGE_TARGETS=( - "1_0_0:local|remote|YOUR_NODE_COMMIT_HASH_1-YOUR_CLIENT_COMMIT_HASH_1" - "1_0_1:local|remote|YOUR_NODE_COMMIT_HASH_2-YOUR_CLIENT_COMMIT_HASH_2" - "1_1_0:local|remote|YOUR_NODE_COMMIT_HASH_3-YOUR_CLIENT_COMMIT_HASH_3" - "2_0_0:local|remote|YOUR_NODE_COMMIT_HASH_4-YOUR_CLIENT_COMMIT_HASH_4" + "1_0_0:local|remote|YOUR_NODE_COMMIT_HASH_1-YOUR_CLIENT_COMMIT_HASH_1-YOUR_SIDECAR_COMMIT_HASH_1" + "1_0_1:local|remote|YOUR_NODE_COMMIT_HASH_2-YOUR_CLIENT_COMMIT_HASH_2-YOUR_SIDECAR_COMMIT_HASH_2" + "1_1_0:local|remote|YOUR_NODE_COMMIT_HASH_3-YOUR_CLIENT_COMMIT_HASH_3-YOUR_SIDECAR_COMMIT_HASH_3" + "2_0_0:local|remote|YOUR_NODE_COMMIT_HASH_4-YOUR_CLIENT_COMMIT_HASH_4-YOUR_SIDECAR_COMMIT_HASH_4" ) # EXAMPLE # export NCTL_STAGE_SHORT_NAME="gslade-01" # export NCTL_STAGE_DESCRIPTION="Testing upgrade in response to a prickly consensus fault" # export NCTL_STAGE_TARGETS=( -# "1_0_0:remote" # will be pulled from remotely hosted files -# "1_0_1:874c2db40-047b4bc46a" # will be pulled from a specific commit hash in the node and client repos respectively -# "1_1_0:local" # will be pulled from local +# "1_0_0:remote" # will be pulled from remotely hosted files +# "1_0_1:874c2db40-047b4bc46a-d6e99f1" # will be pulled from a specific commit hash in the node, client and sidecar repos respectively +# "1_1_0:local" # will be pulled from local # )