diff --git a/scripts/proto_manager.sh b/scripts/proto_manager.sh index 00c5fd78f9b98d03a6247e48897ae17c4c1385f3..8b9ca0959eb55b0d8b4b802befd5d820eb4f57c4 100755 --- a/scripts/proto_manager.sh +++ b/scripts/proto_manager.sh @@ -1159,15 +1159,6 @@ function misc_updates() { log_blue "add octez-activate-${label} command to client sandbox" - if [[ ${is_snapshot} == true ]]; then - sed -e "s@${protocol_source}_parameters_file=.*@${label}_parameters_file=\"\$bin_dir/../../_build/default/src/proto_${version}_${short_hash}/lib_parameters/sandbox-parameters.json\"@" \ - -e "s/alias octez-activate-${protocol_source}=.*/alias octez-activate-${label}=\"\$client -block genesis activate protocol ${long_hash} with fitness 1 and key activator and parameters \$${label}_parameters_file\";/" -i src/bin_client/octez-init-sandboxed-client.sh - else - sed "/parameters_file=\"\$bin_dir.*/i \ ${label}_parameters_file=\"\$bin_dir/../../_build/default/src/proto_${label}/lib_parameters/sandbox-parameters.json\"" -i src/bin_client/octez-init-sandboxed-client.sh - sed "/alias octez-activate-${protocol_source}=.*/i \alias octez-activate-${label}=\"\$client -block genesis activate protocol ${long_hash} with fitness 1 and key activator and parameters \$${label}_parameters_file\";" -i src/bin_client/octez-init-sandboxed-client.sh - fi - commit_no_hooks "sandbox: add octez-activate-${label} command to client sandbox" - if [[ ${is_snapshot} == true ]]; then sed "/let protocol_${protocol_source}_parameters_template =/,/^$/d" -i devtools/testnet_experiment_tools/testnet_experiment_tools.ml sed -i.old -e "s/${capitalized_source}/${capitalized_label}/g" \ @@ -1513,9 +1504,6 @@ function misc_removals() { fi commit_if_changes "kaitai: update structs" - sed -i.old -e "/.*${source_label}.*/d" src/bin_client/octez-init-sandboxed-client.sh - commit_no_hooks "sandbox: remove ${source_label} from client sandbox" - #if deleting a protocol in stabilisation if [[ ${source_label} == "${protocol_source}" ]]; then sed "/| Tezt_tezos.Protocol.Beta -> */d" -i devtools/testnet_experiment_tools/testnet_experiment_tools.ml @@ -1980,9 +1968,6 @@ function hash() { commit_if_changes "kaitai: update structs" fi - update_files src/bin_client/octez-init-sandboxed-client.sh - commit_no_hooks_if_changes "sandbox: update octez-activate-${label} command to client sandbox" - update_files devtools/testnet_experiment_tools/testnet_experiment_tools.ml ocamlformat -i devtools/testnet_experiment_tools/testnet_experiment_tools.ml commit_if_changes "devtools: update testnet_experiment_tools" diff --git a/scripts/user_activated_upgrade.sh b/scripts/user_activated_upgrade.sh index a718e3f9505bae46f1922f20c4b7c5b3900c6a57..ee0b9ccfbeb539174bb5fcce1475bd0c0dacca94 100755 --- a/scripts/user_activated_upgrade.sh +++ b/scripts/user_activated_upgrade.sh @@ -9,17 +9,7 @@ Inserts a user-activated upgrade for the snapshot protocol with the given version number at the given level. When passing a low level (less or equal than 28082) it assumes that migration is -on the sandbox, and it renames the sandbox command octez-activate-alpha that -activates the Alpha protocol to the command - - octez-activate-_ - -which activates the predecessor of the Alpha protocol. The -coincides with minus one, and the -coincides with the short hash in the name of the folder that contains the -predecessor of the Alpha protocol in the ./src directory, i.e., the folder - - ./src/proto__ +on the sandbox. When passing a high level (greater than 28082), it assumes that migration is on a context imported from Mainnet." @@ -36,15 +26,11 @@ if [[ $1 =~ ^.*/proto_[0-9]{3}_.*$ ]]; then #shellcheck disable=SC2001 version=$(echo "$1" | sed 's/.*proto_\([0-9]\{3\}\)_.*/\1/') pred=$(printf "%03d" $((10#$version - 1))) - pred_full_hash=$(jq -r .hash < src/proto_"${pred}"_*/lib_protocol/TEZOS_PROTOCOL) - pred_short_hash=$(echo "$pred_full_hash" | head -c 8) full_hash=$(jq -r .hash < "$1/lib_protocol/TEZOS_PROTOCOL") else pred_version_dir=$(find src -regex "src/proto_[0-9][0-9][0-9]_[^/]*" -printf '%P\n' | sort -r | head -1) pred=$(echo "$pred_version_dir" | cut -d'_' -f2) - pred_full_hash=$(jq -r .hash < src/proto_"${pred}"_*/lib_protocol/TEZOS_PROTOCOL) - pred_short_hash=$(echo "$pred_full_hash" | head -c 8) version=$((10#$pred + 1)) @@ -67,9 +53,7 @@ else { else { if (!found){print}} }}' src/lib_node_config/config_file.ml > tmp_file - mv tmp_file src/lib_node_config/config_file.ml - echo "The sandbox will now switch to $full_hash at level $level." else # we are in sandbox # add upgrade to the sandbox (same awk script as for mainnet but with @@ -85,12 +69,8 @@ else { else { if (!found){print}} }}' src/lib_node_config/config_file.ml > tmp_file - mv tmp_file src/lib_node_config/config_file.ml - - sed -i.old "s/\$bin_dir\/..\/..\/_build\/default\/src\/proto_alpha\/lib_parameters\/sandbox-parameters.json/\$bin_dir\/..\/..\/_build\/default\/src\/proto_${pred}_${pred_short_hash}\/lib_parameters\/sandbox-parameters.json/" src/bin_client/octez-init-sandboxed-client.sh - sed -i.old "s/activate_alpha()/activate_${pred}_${pred_short_hash}()/" src/bin_client/octez-init-sandboxed-client.sh - sed -i.old "s/octez-activate-alpha/octez-activate-${pred}-${pred_short_hash}/" src/bin_client/octez-init-sandboxed-client.sh - sed -i.old "s/activate protocol ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK/activate protocol $pred_full_hash/" src/bin_client/octez-init-sandboxed-client.sh - rm src/bin_client/octez-init-sandboxed-client.sh.old - echo "The sandbox will now switch to $full_hash at level $level." fi + +mv tmp_file src/lib_node_config/config_file.ml + +echo "The sandbox will now switch to $full_hash at level $level." diff --git a/src/bin_client/octez-init-sandboxed-client.sh b/src/bin_client/octez-init-sandboxed-client.sh index 4ddab088c0d002cfd527ce4c2d8b0b8471599888..7b7b9461b474bc62235dbe3c95093af5ebb0f564 100755 --- a/src/bin_client/octez-init-sandboxed-client.sh +++ b/src/bin_client/octez-init-sandboxed-client.sh @@ -92,10 +92,6 @@ main() { local_admin_client="${local_admin_client:-$bin_dir/../../_build/default/src/bin_client/main_admin.exe}" local_signer="${local_signer:-$bin_dir/../../_build/default/src/bin_signer/main_signer.exe}" local_compiler="${local_compiler:-$bin_dir/../../_build/default/src/lib_protocol_compiler/bin/main_native.exe}" - - quebec_parameters_file="$bin_dir/../../_build/default/src/proto_021_PsQuebec/lib_parameters/sandbox-parameters.json" - parameters_file="$bin_dir/../../_build/default/src/proto_alpha/lib_parameters/sandbox-parameters.json" - else # we assume a clean install with octez-(admin-)client in the path local_client="${local_client:-$(which octez-client)}" @@ -135,6 +131,8 @@ main() { local_baker="$bin_dir/../../_build/default/src/proto_$protocol_underscore/bin_baker/main_baker_$protocol_underscore.exe" local_accuser="$bin_dir/../../_build/default/src/proto_$protocol_underscore/bin_accuser/main_accuser_$protocol_underscore.exe" local_sc_rollup_node="$bin_dir/../../_build/default/src/proto_$protocol_underscore/bin_sc_rollup_node/main_sc_rollup_node_$protocol_underscore.exe" + parameters_file="$bin_dir/../../_build/default/src/proto_$protocol_underscore/lib_parameters/sandbox-parameters.json" + hash="$(jq -r ".hash" "$bin_dir"/../../_build/default/src/proto_"$protocol_underscore"/lib_protocol/TEZOS_PROTOCOL)" if [ -n "$USE_TLS" ]; then endpoint="https://$host:$rpc" @@ -157,6 +155,12 @@ main() { echo '#!/bin/sh' > "$client_dir"/bin/octez-accuser-"$protocol_without_number" echo "exec $accuser \"\$@\"" >> "$client_dir"/bin/octez-accuser-"$protocol_without_number" chmod +x "$client_dir"/bin/octez-accuser-"$protocol_without_number" + + cat << EOF +alias octez-activate-$protocol="$client -block genesis activate protocol $hash with fitness 1 and key activator and parameters $parameters_file"; + +EOF + done < "$bin_dir"/../../script-inputs/active_protocol_versions echo '#!/bin/sh' > "$client_dir"/bin/octez-signer @@ -170,10 +174,8 @@ main() { cat << EOF if type octez-client-reset >/dev/null 2>&1 ; then octez-client-reset; fi ; PATH="$client_dir/bin:\$PATH" ; export PATH ; -alias octez-activate-quebec="$client -block genesis activate protocol PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg with fitness 1 and key activator and parameters $quebec_parameters_file"; -alias octez-activate-alpha="$client -block genesis activate protocol ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK with fitness 1 and key activator and parameters $parameters_file" ; -alias octez-client-reset="rm -rf \"$client_dir\"; unalias octez-activate-alpha octez-client-reset" ; alias octez-autocomplete="if [ \$ZSH_NAME ] ; then autoload bashcompinit ; bashcompinit ; fi ; source \"$bin_dir/bash-completion.sh\"" ; +alias octez-client-reset="rm -rf \"$client_dir\"; unalias \$(alias | sed 's/alias //g' | grep -o '^octez-[^=]*' | tr '\n' ' '); unalias octez-client-reset" ; trap octez-client-reset EXIT ; EOF