From fdfc60aefc39ad2e1e4e491a236640d7f66cb1cd Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Wed, 13 Nov 2024 11:07:54 +0100 Subject: [PATCH] Using PocketIC --- bin/dfx-mock-canister-install | 4 +++- bin/dfx-network-deploy | 2 +- bin/dfx-network-provider | 4 ++-- bin/dfx-nns-install | 2 +- bin/dfx-snapshot-stock-make | 4 ++-- bin/dfx-sns-demo | 2 +- bin/dfx-sns-propose | 2 ++ bin/versions.bash | 2 +- dfx.json | 2 +- dfx.json.original | 2 +- 10 files changed, 15 insertions(+), 11 deletions(-) diff --git a/bin/dfx-mock-canister-install b/bin/dfx-mock-canister-install index b2be9b1c..abe2312a 100755 --- a/bin/dfx-mock-canister-install +++ b/bin/dfx-mock-canister-install @@ -24,6 +24,8 @@ clap.define long=canister_arg desc="Candid argument to pass to dfx install" vari # Source the output file ---------------------------------------------------------- source "$(clap.build)" +set -x + if [[ -z "${WASM_URL:-}" ]]; then echo "The --wasm_url option is required." >&2 exit 1 @@ -55,7 +57,7 @@ if [[ -n "${SPECIFIED_CANISTER_ID:-}" ]]; then DFX_CANISTER_CREATE_ARGS=("--specified-id" "$SPECIFIED_CANISTER_ID") fi -if ! dfx canister create "$CANISTER_NAME" --network "${DFX_NETWORK}" "${DFX_CANISTER_CREATE_ARGS[@]}"; then +if ! dfx canister create "$CANISTER_NAME" --no-wallet --network "${DFX_NETWORK}" "${DFX_CANISTER_CREATE_ARGS[@]}"; then echo "Failed to create $CANISTER_NAME canister." >&2 exit 1 fi diff --git a/bin/dfx-network-deploy b/bin/dfx-network-deploy index e3c5f967..683a6dc7 100755 --- a/bin/dfx-network-deploy +++ b/bin/dfx-network-deploy @@ -54,7 +54,7 @@ if [[ "$DFX_NETWORK" == "local" ]]; then tput setaf 0 )" export NORMAL="$(tput sgr0)" - dfx start --clean --background 2>&1 | sed -e "s@.*@${DARK}&${NORMAL}@" & + dfx start --clean --pocketic --background 2>&1 | sed -e "s@.*@${DARK}&${NORMAL}@" & dfx-nns-install --ic_commit "$DFX_IC_COMMIT" dfx-nns-import --network "$DFX_NETWORK" diff --git a/bin/dfx-network-provider b/bin/dfx-network-provider index 1e2f4473..8bcdb2c1 100755 --- a/bin/dfx-network-provider +++ b/bin/dfx-network-provider @@ -30,12 +30,12 @@ get_home() { case "${FORMAT}" in url) if [[ "$DFX_NETWORK" == "local" ]]; then - REPLICA_PORT="$(dfx info replica-port 2>/dev/null || true)" + REPLICA_PORT="$(dfx info webserver-port 2>/dev/null || true)" [[ "${REPLICA_PORT:-}" != "" ]] || { # The above command can fail if not run in the same directory as the replica working directory. DFX_EXEC_DIR="$(lsof -p $(pgrep pocket-ic) | grep cwd | awk '{print $NF}')" cd "$DFX_EXEC_DIR" - REPLICA_PORT="$(HOME="$(get_home)" dfx info replica-port)" + REPLICA_PORT="$(HOME="$(get_home)" dfx info webserver-port)" } echo "http://localhost:$REPLICA_PORT" elif [[ "${DFX_NETWORK:-}" =~ mainnet|ic ]]; then diff --git a/bin/dfx-nns-install b/bin/dfx-nns-install index 8a1f5b6f..6a4ee7e5 100755 --- a/bin/dfx-nns-install +++ b/bin/dfx-nns-install @@ -25,7 +25,7 @@ clap.define short=c long=ic_commit desc="The IC commit of the wasms" variable=DF # Source the output file ---------------------------------------------------------- source "$(clap.build)" -"$SOURCE_DIR/dfx-software-dfx-extension-nns-install" --if-not-installed +"$SOURCE_DIR/dfx-software-dfx-extension-nns-install" WASMS_DIR="$(dfx cache show)/wasms" mkdir -p "$WASMS_DIR" diff --git a/bin/dfx-snapshot-stock-make b/bin/dfx-snapshot-stock-make index 7e67ff30..8115df79 100755 --- a/bin/dfx-snapshot-stock-make +++ b/bin/dfx-snapshot-stock-make @@ -38,7 +38,7 @@ onSetupFailure() { trap onSetupFailure EXIT : "Make sure the snapshot is used with the same version of dfx that created it." -dfxvm default "$(jq -r .dfx dfx.json)" +#dfxvm default "$(jq -r .dfx dfx.json)" : Create stock state dfx-stock-deploy --ic_commit "$DFX_IC_COMMIT" --ic_dir "$IC_REPO_DIR" --parallel_sns_count "$PARALLEL_SNS_COUNT" --unique_logo "$UNIQUE_LOGO" @@ -48,7 +48,7 @@ dfx-stock-deploy --ic_commit "$DFX_IC_COMMIT" --ic_dir "$IC_REPO_DIR" --parallel dfx-sns-aggregator-wait : "Wait for a checkpoint" -dfx-network-wait-for-checkpoint --timeout 600 +dfx-network-wait-for-checkpoint --timeout 6 : "Stop the replica gently but forcefully. It must be stopped and should ideally have a clean state." dfx-network-stop diff --git a/bin/dfx-sns-demo b/bin/dfx-sns-demo index 99651f00..b1ccead4 100755 --- a/bin/dfx-sns-demo +++ b/bin/dfx-sns-demo @@ -61,7 +61,7 @@ dfx identity use snsdemo8 sleep 1 dfx-nns-import --network "$DFX_NETWORK" sleep 1 -dfx-software-dfx-extension-sns-install --if-not-installed +dfx-software-dfx-extension-sns-install sleep 1 bin/dfx-ledger-get-icp --icp 900000000 --network "$DFX_NETWORK" diff --git a/bin/dfx-sns-propose b/bin/dfx-sns-propose index 2a5f3267..ce296b79 100755 --- a/bin/dfx-sns-propose +++ b/bin/dfx-sns-propose @@ -21,6 +21,8 @@ clap.define long=save-proposal-id-to desc="Passed to sns propose --save-to" vari # Source the output file ---------------------------------------------------------- source "$(clap.build)" +set -x + DFX_NEURON_ID="${DFX_NEURON_ID:-$(dfx-neuron-id --identity "$DFX_IDENTITY" --network "$DFX_NETWORK")}" DFX_NNS_URL="$(dfx-network-provider --network "$DFX_NETWORK")" diff --git a/bin/versions.bash b/bin/versions.bash index 3230bd93..cbae7563 100644 --- a/bin/versions.bash +++ b/bin/versions.bash @@ -10,6 +10,6 @@ QUILL_VERSION=0.4.0 IDL2JSON_VERSION=0.8.5 BINSTALL_VERSION=1.3.0 IC_WASM_VERSION=0.6.0 -DFX_NNS_EXTENSION_VERSION=0.4.3 +DFX_NNS_EXTENSION_VERSION=0.4.7 DFX_SNS_EXTENSION_VERSION=0.4.3 EXCHANGE_RATE_CANISTER_RELEASE=2024.09.05 diff --git a/dfx.json b/dfx.json index a1b5ae1a..323d0047 100644 --- a/dfx.json +++ b/dfx.json @@ -6,6 +6,6 @@ "packtool": "" } }, - "dfx": "0.24.1", + "dfx": "0.24.2-beta.0+rev16.234c2a36", "version": 1 } diff --git a/dfx.json.original b/dfx.json.original index a1b5ae1a..323d0047 100644 --- a/dfx.json.original +++ b/dfx.json.original @@ -6,6 +6,6 @@ "packtool": "" } }, - "dfx": "0.24.1", + "dfx": "0.24.2-beta.0+rev16.234c2a36", "version": 1 }