-
Notifications
You must be signed in to change notification settings - Fork 84
/
update-nns.bash
executable file
·66 lines (57 loc) · 1.9 KB
/
update-nns.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /bin/bash
set -euo pipefail
cd "$(dirname "$0")/.."
# Download NNS artifacts
IC_COMMIT=${1:-"$(jq -r '."replica-x86_64-linux".rev' nix/sources.json)"}
NNS_ARTIFACTS=${NNS_ARTIFACTS:-"$PWD/e2e/assets/ledger"}
mkdir -p $NNS_ARTIFACTS
export NNS_ARTIFACTS
get_binary() {
local FILENAME
FILENAME="$1"
if [ -e "$NNS_ARTIFACTS/${FILENAME}_linux" ] && [ -e "$NNS_ARTIFACTS/${FILENAME}_macos" ] && [ -n "${NO_CLOBBER:-}" ]; then
return
fi
local TMP_FILE
TMP_FILE="$(mktemp)"
curl -s "https://download.dfinity.systems/ic/${IC_COMMIT}/nix-release/x86_64-darwin/${FILENAME}.gz" | gunzip >"$TMP_FILE"
install -m 755 "$TMP_FILE" "$NNS_ARTIFACTS/${FILENAME}_macos"
curl -s "https://download.dfinity.systems/ic/${IC_COMMIT}/release/${FILENAME}.gz" | gunzip >"$TMP_FILE"
install -m 755 "$TMP_FILE" "$NNS_ARTIFACTS/${FILENAME}_linux"
rm "$TMP_FILE"
}
get_wasm() {
local FILENAME
FILENAME="$1"
if test -e "$NNS_ARTIFACTS/$FILENAME" && test -n "${NO_CLOBBER:-}"; then
return
fi
local TMP_FILE
TMP_FILE="$(mktemp)"
curl -s "https://download.dfinity.systems/ic/${IC_COMMIT}/canisters/${FILENAME}.gz" | gunzip >"$TMP_FILE"
install -m 644 "$TMP_FILE" "$NNS_ARTIFACTS/$FILENAME"
rm "$TMP_FILE"
}
get_binary ic-nns-init
get_wasm registry-canister.wasm
get_wasm governance-canister.wasm
get_wasm governance-canister_test.wasm
get_wasm ic-ckbtc-minter.wasm
get_wasm ledger-canister_notify-method.wasm
get_wasm root-canister.wasm
get_wasm cycles-minting-canister.wasm
get_wasm lifeline.wasm
get_wasm genesis-token-canister.wasm
get_wasm identity-canister.wasm
get_wasm nns-ui-canister.wasm
get_wasm sns-wasm-canister.wasm
get_wasm ic-icrc1-ledger.wasm
# Patch NNS canisters so the conversion rate can be set in the CMC
pushd "$(dirname "$0")"
DOCKER_BUILDKIT=1 docker build \
--target scratch \
-t "ledger" \
-f nns-canister.Dockerfile \
--build-arg=IC_COMMIT="$IC_COMMIT" \
-o "$NNS_ARTIFACTS" .
popd