Skip to content

Commit 19e7678

Browse files
marc0oloclaude
andcommitted
revert(basic_bitcoin): drop changes — pre-existing icp-cli 1.0.0 regression, tracked separately
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3de6cfd commit 19e7678

3 files changed

Lines changed: 64 additions & 5 deletions

File tree

.github/workflows/basic_bitcoin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2525
- name: Install icp-cli, ic-wasm and mops
26-
run: npm install -g @icp-sdk/icp-cli@1.0.0 @icp-sdk/ic-wasm@0.9.11 ic-mops@2.14.1
26+
run: npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm ic-mops
2727
- name: Set up Docker Buildx
2828
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
2929
- name: Build network launcher image
@@ -40,4 +40,4 @@ jobs:
4040
run: |
4141
icp network start -d
4242
icp deploy --cycles 30t
43-
bash test.sh
43+
make test

motoko/basic_bitcoin/Makefile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
IMAGE_NAME = icp-cli-network-launcher-bitcoin
2+
# Find the running container built from our custom image
3+
BITCOIN_CONTAINER = $(shell docker ps --filter "ancestor=$(IMAGE_NAME)" --format "{{.ID}}" | head -1)
4+
5+
.PHONY: build-image test topup
6+
7+
build-image:
8+
# Because we're building off of :latest, use --pull to fetch the latest image.
9+
# Remove `--pull` if the Dockerfile is updated to pin the base image version.
10+
docker build --pull -t $(IMAGE_NAME) .
11+
12+
topup:
13+
icp canister top-up --amount 30t backend
14+
15+
test:
16+
@echo "=== Test 1: get_p2pkh_address returns a valid Bitcoin address ==="
17+
@result=$$(icp canister call backend get_p2pkh_address '()') && \
18+
echo "$$result" && \
19+
echo "$$result" | grep -q '"' && \
20+
echo "PASS" || (echo "FAIL" && exit 1)
21+
22+
@echo "=== Test 2: get_p2tr_key_only_address returns a valid Bitcoin address ==="
23+
@result=$$(icp canister call backend get_p2tr_key_only_address '()') && \
24+
echo "$$result" && \
25+
echo "$$result" | grep -q '"' && \
26+
echo "PASS" || (echo "FAIL" && exit 1)
27+
28+
@echo "=== Test 3: get_p2tr_address returns a valid Bitcoin address ==="
29+
@result=$$(icp canister call backend get_p2tr_address '()') && \
30+
echo "$$result" && \
31+
echo "$$result" | grep -q '"' && \
32+
echo "PASS" || (echo "FAIL" && exit 1)
33+
34+
@echo "=== Test 4: get_current_fee_percentiles returns a vec ==="
35+
@result=$$(icp canister call backend get_current_fee_percentiles '()') && \
36+
echo "$$result" && \
37+
echo "PASS" || (echo "FAIL" && exit 1)
38+
39+
@echo "=== Mining 101 blocks to fund test address ==="
40+
@[ -n "$(BITCOIN_CONTAINER)" ] || (echo "ERROR: network launcher container not running — run 'icp network start -d' first" && exit 1)
41+
@addr=$$(icp canister call backend get_p2pkh_address '()' | grep -o '"[^"]*"' | tr -d '"') && \
42+
docker exec $(BITCOIN_CONTAINER) bitcoin-cli -regtest \
43+
-rpcuser=ic-btc-integration -rpcpassword=ic-btc-integration \
44+
generatetoaddress 101 "$$addr" > /dev/null && \
45+
echo "mined 101 blocks to $$addr"
46+
47+
@echo "=== Waiting for IC to sync Bitcoin blocks ==="
48+
@sleep 5
49+
50+
@echo "=== Test 5: get_balance returns non-zero after mining ==="
51+
@addr=$$(icp canister call backend get_p2pkh_address '()' | grep -o '"[^"]*"' | tr -d '"') && \
52+
result=$$(icp canister call backend get_balance "(\"$$addr\")") && \
53+
echo "$$result" && \
54+
echo "$$result" | grep -qE '[1-9]' && \
55+
echo "PASS" || (echo "FAIL" && exit 1)
56+
57+
@echo "=== Test 6: get_utxos returns synced chain state after mining ==="
58+
@addr=$$(icp canister call backend get_p2pkh_address '()' | grep -o '"[^"]*"' | tr -d '"') && \
59+
result=$$(icp canister call backend get_utxos "(\"$$addr\")") && \
60+
echo "$$result" && \
61+
echo "$$result" | grep -q 'tip_height = 101' && \
62+
echo "PASS" || (echo "FAIL" && exit 1)

motoko/basic_bitcoin/icp.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ canisters:
22
- name: backend
33
recipe:
44
type: "@dfinity/motoko@v5.0.0"
5-
configuration:
6-
shrink: true
7-
compress: true
85

96
networks:
107
- name: local

0 commit comments

Comments
 (0)