Skip to content

Commit

Permalink
Update extra nctl scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek-casper committed Jan 10, 2024
1 parent 5f74a05 commit 14a4f4b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion utils/nctl/sh/assets/upgrade_from_stage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")" \
Expand Down
23 changes: 18 additions & 5 deletions utils/nctl/sh/staging/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
}

#######################################
Expand All @@ -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
Expand All @@ -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" \
Expand All @@ -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

Expand Down Expand Up @@ -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"
}

Expand Down
7 changes: 5 additions & 2 deletions utils/nctl/sh/staging/set_from_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

#######################################
Expand Down
4 changes: 2 additions & 2 deletions utils/nctl/sh/staging/set_from_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

# ----------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions utils/nctl/sh/staging/settings-template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
# )

0 comments on commit 14a4f4b

Please sign in to comment.