Skip to content

Commit

Permalink
Using PocketIC
Browse files Browse the repository at this point in the history
  • Loading branch information
dskloetd committed Nov 13, 2024
1 parent 4bf12df commit fdfc60a
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 11 deletions.
4 changes: 3 additions & 1 deletion bin/dfx-mock-canister-install
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/dfx-network-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions bin/dfx-network-provider
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/dfx-nns-install
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions bin/dfx-snapshot-stock-make
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/dfx-sns-demo
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions bin/dfx-sns-propose
Original file line number Diff line number Diff line change
Expand Up @@ -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")"

Expand Down
2 changes: 1 addition & 1 deletion bin/versions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"packtool": ""
}
},
"dfx": "0.24.1",
"dfx": "0.24.2-beta.0+rev16.234c2a36",
"version": 1
}
2 changes: 1 addition & 1 deletion dfx.json.original
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"packtool": ""
}
},
"dfx": "0.24.1",
"dfx": "0.24.2-beta.0+rev16.234c2a36",
"version": 1
}

0 comments on commit fdfc60a

Please sign in to comment.