Skip to content

Commit 3d1b8f6

Browse files
authored
feat: [Stacks 2.1] Support new "block 0" boot events (#1476)
* chore: split up pox-2-rosetta tests * chore: split up pox-2-rosetta test suites into smaller units * feat: new regtest standalone image with 2.1 node * chore: store postgres data in same volume * chore: add configurable heights for each epoch * feat: arg to toggle if docker image is bootstraps the chainstate * chore: block height adjustments * chore: block heights that work with epoch 2.0 and 2.05 receipts * chore: fix bash script error * feat: store and forward boot events * chore: allow pg server connections * chore: do not error when skipping bootstrap * chore: update to latest stacks2.1 images * chore: add epoch config for mocknet node * ci: attempt fix for host.docker.internal for tests using stacks mocknet image * ci: fix tokens and rosetta mocknet mode tests * feat: finish ingesting "block 0" data once the first real block is received * test: implement test suite to ensure "block-zero" is ingested correctly * test: re-enable double-stacking test suite * ci: add workflow dispatch for standalone docker image build [skip ci] * ci: allow use of existing stacks-node binaries from docker context * ci: allow stacks-api version tag to be set, require git sha args * ci: add workflow dispatch for standalone docker image build [skip ci] * chore: bump to latest stacks-blockchain `next` branch
1 parent b28c744 commit 3d1b8f6

15 files changed

+850
-32
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ jobs:
405405
strategy:
406406
matrix:
407407
suite: [
408+
block-zero-handling,
408409
faucet-stx,
409410
pox-2-auto-unlock,
410411
pox-2-btc-address-formats,

.github/workflows/regtest-image.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: Publish standalone regtest image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
stacks_blockchain_commit:
7+
description: 'stacks-blockchain git commit'
8+
required: true
9+
type: string
10+
11+
env:
12+
STACKS_API_COMMIT: ${{ github.sha }}
13+
STACKS_BLOCKCHAIN_COMMIT: ${{ inputs.stacks_blockchain_commit }}
14+
15+
jobs:
16+
build-stacks-node:
17+
runs-on: ubuntu-20.04
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
- name: Cache stacks-node
22+
id: cache
23+
uses: actions/cache@v3
24+
with:
25+
path: bin
26+
key: cache-stacks-node-${{ env.STACKS_BLOCKCHAIN_COMMIT }}
27+
- name: Install Rust - linux/amd64
28+
if: steps.cache.outputs.cache-hit != 'true'
29+
uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: stable
32+
target: x86_64-unknown-linux-gnu
33+
- name: Install Rust - linux/arm64
34+
if: steps.cache.outputs.cache-hit != 'true'
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
toolchain: stable
38+
target: aarch64-unknown-linux-gnu
39+
- name: Install compilation tooling
40+
if: steps.cache.outputs.cache-hit != 'true'
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross gcc-aarch64-linux-gnu
44+
- name: Fetch Stacks node repo
45+
if: steps.cache.outputs.cache-hit != 'true'
46+
run: |
47+
echo "$PWD"
48+
mkdir stacks-blockchain-repo && cd stacks-blockchain-repo
49+
git init
50+
git remote add origin https://github.com/stacks-network/stacks-blockchain.git
51+
git -c protocol.version=2 fetch --depth=1 origin $STACKS_BLOCKCHAIN_COMMIT
52+
git reset --hard FETCH_HEAD
53+
- name: Rust cache
54+
if: steps.cache.outputs.cache-hit != 'true'
55+
uses: Swatinem/rust-cache@v2
56+
with:
57+
workspaces: "stacks-blockchain-repo"
58+
shared-key: rust-cache-stacks-node-${{ env.STACKS_BLOCKCHAIN_COMMIT }}
59+
- name: Cargo fetch
60+
if: steps.cache.outputs.cache-hit != 'true'
61+
working-directory: stacks-blockchain-repo
62+
run: |
63+
cargo fetch --manifest-path testnet/stacks-node/Cargo.toml --target x86_64-unknown-linux-gnu --target aarch64-unknown-linux-gnu
64+
- name: Build Stacks node
65+
if: steps.cache.outputs.cache-hit != 'true'
66+
working-directory: stacks-blockchain-repo
67+
env:
68+
CARGO_NET_GIT_FETCH_WITH_CLI: true
69+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
70+
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
71+
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
72+
AR_aarch64_unknown_linux_gnu: aarch64-linux-gnu-ar
73+
run: |
74+
cargo build --package stacks-node --bin stacks-node --release --target x86_64-unknown-linux-gnu --target aarch64-unknown-linux-gnu
75+
mkdir -p ../bin/x86_64-unknown-linux-gnu ../bin/aarch64-unknown-linux-gnu
76+
cp target/x86_64-unknown-linux-gnu/release/stacks-node ../bin/x86_64-unknown-linux-gnu
77+
cp target/aarch64-unknown-linux-gnu/release/stacks-node ../bin/aarch64-unknown-linux-gnu
78+
- uses: actions/upload-artifact@v3
79+
with:
80+
name: stacks-node-bin
81+
if-no-files-found: error
82+
path: |
83+
bin/*/stacks-node
84+
85+
build-push-docker:
86+
needs: build-stacks-node
87+
runs-on: ubuntu-20.04
88+
steps:
89+
- name: Checkout
90+
uses: actions/checkout@v3
91+
- uses: actions/download-artifact@v3
92+
with:
93+
name: stacks-node-bin
94+
path: docker/stacks-blockchain-binaries
95+
- name: Process of downloaded artifacts
96+
working-directory: docker/stacks-blockchain-binaries
97+
run: |
98+
ls -R
99+
chmod +x x86_64-unknown-linux-gnu/stacks-node
100+
chmod +x aarch64-unknown-linux-gnu/stacks-node
101+
- name: Create tag labels
102+
run: |
103+
api_short=$(head -c 7 <<< "$STACKS_API_COMMIT")
104+
blockchain_short=$(head -c 7 <<< "$STACKS_BLOCKCHAIN_COMMIT")
105+
echo "GIT_SHORTS=${api_short}-${blockchain_short}" >> $GITHUB_ENV
106+
- name: Docker meta
107+
id: meta
108+
uses: docker/metadata-action@v4
109+
with:
110+
images: hirosystems/${{ github.event.repository.name }}-standalone-regtest
111+
tags: |
112+
type=raw,value=latest,enable=false
113+
type=raw,value={{date 'YYYYMMDDHH'}}-${{ env.GIT_SHORTS }}
114+
- name: Set up QEMU
115+
uses: docker/setup-qemu-action@v2
116+
- name: Set up Docker Buildx
117+
uses: docker/setup-buildx-action@v2
118+
with:
119+
config-inline: |
120+
[worker.oci]
121+
max-parallelism = 1
122+
- name: Login to DockerHub
123+
uses: docker/login-action@v2
124+
with:
125+
username: ${{ secrets.DOCKERHUB_USERNAME }}
126+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
127+
- name: Build and push Docker image
128+
uses: docker/build-push-action@v3
129+
with:
130+
file: docker/standalone-regtest.Dockerfile
131+
context: ./docker
132+
push: true
133+
platforms: linux/amd64,linux/arm64
134+
tags: ${{ steps.meta.outputs.tags }}
135+
labels: ${{ steps.meta.outputs.labels }}
136+
cache-from: type=registry,ref=hirosystems/${{ github.event.repository.name }}-standalone-regtest
137+
cache-to: type=inline
138+
build-args: |
139+
STACKS_API_VERSION=${{ github.head_ref || github.ref_name }}
140+
API_GIT_COMMIT=${{ env.STACKS_API_COMMIT }}
141+
BLOCKCHAIN_GIT_COMMIT=${{ env.STACKS_BLOCKCHAIN_COMMIT }}

docker/docker-compose.dev.stacks-blockchain.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ services:
1515
volumes:
1616
- ../stacks-blockchain/:/app/config
1717
- ../stacks-blockchain/.chaindata:/tmp/stacks-blockchain-data
18+
extra_hosts:
19+
- "host.docker.internal:host-gateway" # fixes `host.docker.internal` on linux hosts

docker/docker-compose.dev.stacks-krypton-2.1-transition.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.7'
22
services:
33
stacks-blockchain:
4-
image: "zone117x/stacks-api-e2e:stacks2.1-transition-930b652"
4+
image: "zone117x/stacks-api-e2e:stacks2.1-transition-21295d3"
55
ports:
66
- "18443:18443" # bitcoin regtest JSON-RPC interface
77
- "18444:18444" # bitcoin regtest p2p

docker/docker-compose.dev.stacks-krypton.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.7'
22
services:
33
stacks-blockchain:
4-
image: "zone117x/stacks-api-e2e:stacks2.1-930b652"
4+
image: "zone117x/stacks-api-e2e:stacks2.1-21295d3"
55
ports:
66
- "18443:18443" # bitcoin regtest JSON-RPC interface
77
- "18444:18444" # bitcoin regtest p2p

0 commit comments

Comments
 (0)