Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: epoch 2.5 with pox-4 #26

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5f09fff
feat: stacks 3.0
zone117x Dec 9, 2023
d118d29
ci: attempt to fix build
zone117x Dec 9, 2023
37144c3
ci: attempt build fix
zone117x Dec 9, 2023
0bc97e2
ci: attempt build fix 2
zone117x Dec 9, 2023
a4cea3e
chore: update nodejs install script from deprecated version
zone117x Dec 9, 2023
3ff52f0
chore: bump docker e2e file from bullseye to bookworm
zone117x Dec 9, 2023
7114a1b
chore: fix curl install
zone117x Dec 9, 2023
61ff03a
fix: add new dependencies to Dockerfile.e2e for building stacks-node …
zone117x Dec 10, 2023
d90e0cb
chore: bump stacks-node to wip nakamoto branch
zone117x Dec 10, 2023
800259e
ci: remove deprecated `actions-rs/toolchain`
zone117x Dec 10, 2023
71cfeb5
ci: use built-in cancel-in-progress
zone117x Dec 10, 2023
4b7ea50
chore: bump to latest next branch
zone117x Jan 16, 2024
e6330cf
fix: update bitcoin core
zone117x Jan 16, 2024
204ab4c
chore: bump stacks-node next branch
zone117x Jan 23, 2024
5e7e4a1
fix: specify wallet name in bitcoin conf
zone117x Jan 25, 2024
1d675fd
fix: load btc wallet on startup
zone117x Jan 25, 2024
457f270
chore: bump stacks-node
zone117x Feb 2, 2024
8b2307a
chore: bump stacks-node
zone117x Feb 21, 2024
1600447
fix: update --config arg usage
zone117x Feb 21, 2024
bc92aad
chore: bump to latest stacks-node next
zone117x Apr 4, 2024
76f0557
fix: create portable stacks-node binary builds
zone117x Apr 4, 2024
56671c3
chore: fix build ci syntax
zone117x Apr 4, 2024
16a6c3d
fix: build directory and epoch heights
zone117x Apr 4, 2024
1360a17
remove broken .cargo/config file before build
zone117x Apr 4, 2024
b48ac43
fix: bump reward cycle length from 5 (default) to 10
zone117x Apr 9, 2024
8e54b29
fix: upgrade to latest rc
rafaelcr Apr 10, 2024
4d11d85
fix: try removing portable feature
rafaelcr Apr 10, 2024
0a2c0e2
fix: use ipv4 localhost to fix docker defaulting to ipv6 and breaking…
zone117x Apr 12, 2024
7898fdf
Merge pull request #37 from hirosystems/feat/epoch25-longer-reward-cycle
zone117x May 7, 2024
9acadb9
fix: Remove `portable` feature flag from build
jbencin Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 21 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@ on:
push:

env:
STACKS_BLOCKCHAIN_COMMIT: "feat/epoch-2.4"
STACKS_BLOCKCHAIN_COMMIT: e14022aa7e2eb82714c2ccaa3b8f2ed0f5568f8e

jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-stacks-node:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -28,21 +24,15 @@ jobs:
key: cache-stacks-node-${{ env.STACKS_BLOCKCHAIN_COMMIT }}
- name: Install Rust - linux/amd64
if: steps.cache.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
run: rustup toolchain install stable
- name: Install Rust - linux/arm64
if: steps.cache.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-unknown-linux-gnu
run: rustup target add aarch64-unknown-linux-gnu
- name: Install compilation tooling
if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross gcc-aarch64-linux-gnu
sudo apt-get install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu libgcc-11-dev-arm64-cross
- name: Fetch Stacks node repo
if: steps.cache.outputs.cache-hit != 'true'
env:
Expand Down Expand Up @@ -81,10 +71,11 @@ jobs:
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
AR_aarch64_unknown_linux_gnu: aarch64-linux-gnu-ar
run: |
cargo build --package stacks-node --bin stacks-node --release --target x86_64-unknown-linux-gnu --target aarch64-unknown-linux-gnu
rm ".cargo/config"
cargo build --package stacks-node --bin stacks-node --profile release-lite --target x86_64-unknown-linux-gnu --target aarch64-unknown-linux-gnu
mkdir -p ../bin/x86_64-unknown-linux-gnu ../bin/aarch64-unknown-linux-gnu
cp target/x86_64-unknown-linux-gnu/release/stacks-node ../bin/x86_64-unknown-linux-gnu
cp target/aarch64-unknown-linux-gnu/release/stacks-node ../bin/aarch64-unknown-linux-gnu
cp target/x86_64-unknown-linux-gnu/release-lite/stacks-node ../bin/x86_64-unknown-linux-gnu
cp target/aarch64-unknown-linux-gnu/release-lite/stacks-node ../bin/aarch64-unknown-linux-gnu
- uses: actions/upload-artifact@v3
with:
name: stacks-node-bin
Expand All @@ -94,7 +85,7 @@ jobs:

build-push-docker:
needs: build-stacks-node
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -115,13 +106,13 @@ jobs:
images: hirosystems/stacks-api-e2e
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=stacks2.4,enable={{is_default_branch}}
type=raw,value=stacks2.4-{{branch}}-{{sha}}
type=ref,event=branch,prefix=stacks2.4-
type=ref,event=pr,prefix=stacks2.4-
type=semver,pattern={{version}},prefix=stacks2.4-
type=semver,pattern={{major}}.{{minor}},prefix=stacks2.4-
type=sha,prefix=stacks2.4-
type=raw,value=stacks3.0,enable={{is_default_branch}}
type=raw,value=stacks3.0-{{branch}}-{{sha}}
type=ref,event=branch,prefix=stacks3.0-
type=ref,event=pr,prefix=stacks3.0-
type=semver,pattern={{version}},prefix=stacks3.0-
type=semver,pattern={{major}}.{{minor}},prefix=stacks3.0-
type=sha,prefix=stacks3.0-
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down
58 changes: 37 additions & 21 deletions Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# syntax=docker/dockerfile:1

FROM rust:bullseye as builder
FROM rust:bookworm as builder

# A commit hash, tag, or branch
ARG GIT_COMMIT=feat/epoch-2.4
ARG GIT_COMMIT=e14022aa7e2eb82714c2ccaa3b8f2ed0f5568f8e
ARG BLOCKCHAIN_REPO=https://github.com/stacks-network/stacks-blockchain.git

ARG TARGETPLATFORM
Expand All @@ -19,11 +19,11 @@ RUN <<EOF
STACKS_NODE_BIN_AMD64=/stacks-blockchain-binaries/x86_64-unknown-linux-gnu/stacks-node
if [ "$TARGETPLATFORM" = "linux/arm64" ] && [ -f "$STACKS_NODE_BIN_ARM64" ]; then
echo "Using existing stacks-node binary: $STACKS_NODE_BIN_ARM64"
mkdir -p target/release && mv "$STACKS_NODE_BIN_ARM64" target/release/stacks-node
mkdir -p target/release-lite && mv "$STACKS_NODE_BIN_ARM64" target/release-lite/stacks-node
exit 0
elif [ "$TARGETPLATFORM" = "linux/amd64" ] && [ -f "$STACKS_NODE_BIN_AMD64" ]; then
echo "Using existing stacks-node binary: $STACKS_NODE_BIN_AMD64"
mkdir -p target/release && mv "$STACKS_NODE_BIN_AMD64" target/release/stacks-node
mkdir -p target/release-lite && mv "$STACKS_NODE_BIN_AMD64" target/release-lite/stacks-node
exit 0
fi

Expand All @@ -38,17 +38,20 @@ RUN <<EOF
git reset --hard FETCH_HEAD
fi

CARGO_NET_GIT_FETCH_WITH_CLI=true cargo build --package stacks-node --bin stacks-node --release
apt-get update && apt-get install -y libclang-dev
rustup toolchain install stable
rustup component add rustfmt --toolchain stable
CARGO_NET_GIT_FETCH_WITH_CLI=true cargo build --package stacks-node --bin stacks-node --profile release-lite
EOF

FROM debian:bullseye-backports
FROM debian:bookworm-backports

COPY --from=builder /stacks/target/release/stacks-node /usr/local/bin/
COPY --from=ruimarinho/bitcoin-core:0.21.1 /opt/bitcoin-*/bin /usr/local/bin
COPY --from=builder /stacks/target/release-lite/stacks-node /usr/local/bin/
COPY --from=dobtc/bitcoin:25.1 /opt/bitcoin-*/bin /usr/local/bin

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y curl/bullseye-backports gettext-base jq
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
RUN apt-get update && apt-get install -y curl gettext-base jq
RUN curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh && chmod 500 nsolid_setup_deb.sh && ./nsolid_setup_deb.sh 20 && apt-get install nodejs -y
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

VOLUME /chainstate
Expand All @@ -64,7 +67,7 @@ ENV DATA_DIR=/chainstate/stacks-blockchain-data
ENV BTC_ADDR=miEJtNKa3ASpA19v5ZhvbKTEieYjLpzCYT
ENV BTC_ADDR_WIF=cStMQXkK5yTFGP3KbNXYQ3sJf2qwQiKrZwR9QJnksp32eKzef1za
ENV MINER_SEED=9e446f6b0c6a96cf2190e54bcd5a8569c3e386f091605499464389b8d4e0bfc201
ENV BITCOIN_PEER_HOST=localhost
ENV BITCOIN_PEER_HOST=127.0.0.1
ENV BITCOIN_PEER_PORT=18444
ENV BITCOIN_RPC_PORT=18443
ENV BITCOIN_RPC_USER=btc
Expand All @@ -73,7 +76,13 @@ ENV BITCOIN_RPC_PASS=btc
ARG MINE_INTERVAL=5s
ENV MINE_INTERVAL=$MINE_INTERVAL

ARG STACKS_20_HEIGHT=103
ARG POX_REWARD_LENGTH=10
ENV POX_REWARD_LENGTH=$POX_REWARD_LENGTH

ARG POX_PREPARE_LENGTH=5
ENV POX_PREPARE_LENGTH=$POX_PREPARE_LENGTH

ARG STACKS_20_HEIGHT=0
ENV STACKS_20_HEIGHT=$STACKS_20_HEIGHT

ARG STACKS_2_05_HEIGHT=104
Expand All @@ -94,6 +103,13 @@ ENV STACKS_23_HEIGHT=$STACKS_23_HEIGHT
ARG STACKS_24_HEIGHT=111
ENV STACKS_24_HEIGHT=$STACKS_24_HEIGHT

ARG STACKS_25_HEIGHT=112
ENV STACKS_25_HEIGHT=$STACKS_25_HEIGHT

# do not boot into epoch3.0 for now (it doesn't work yet)
ARG STACKS_30_HEIGHT=9999995
ENV STACKS_30_HEIGHT=$STACKS_30_HEIGHT

# priv: 6ad9cadb42d4edbfbe0c5bfb3b8a4125ddced021c4174f829b714ccbf527f02001
# ARG REWARD_RECIPIENT=STQM73RQC4EX0A07KWG1J5ECZJYBZS4SJ4ERC6WN
ARG REWARD_RECIPIENT
Expand Down Expand Up @@ -135,8 +151,8 @@ RUN <<EOF
bitcoind &
BTCD_PID=$!
bitcoin-cli -rpcwait getmininginfo
bitcoin-cli createwallet ""
bitcoin-cli importprivkey $BTC_ADDR_WIF "" false
bitcoin-cli -named createwallet wallet_name=main descriptors=false load_on_startup=true
bitcoin-cli -rpcwallet=main importprivkey $BTC_ADDR_WIF "" false
bitcoin-cli generatetoaddress 101 $BTC_ADDR

node event-observer.js &
Expand All @@ -145,11 +161,11 @@ RUN <<EOF
export STACKS_EVENT_OBSERVER="127.0.0.1:3998"
mkdir -p /chainstate/stacks-blockchain-data
envsubst < config.toml.in > config.toml
stacks-node start --config=config.toml &
stacks-node start --config config.toml &
STACKS_PID=$!

while true; do
HEIGHT=$(curl -s localhost:20443/v2/info | jq '.burn_block_height')
HEIGHT=$(curl -s 127.0.0.1:20443/v2/info | jq '.burn_block_height')
if [ "$HEIGHT" = "101" ]; then
echo "Stacks node caught up to Bitcoin block $HEIGHT"
break
Expand All @@ -158,7 +174,7 @@ RUN <<EOF
done

while true; do
TX=$(bitcoin-cli listtransactions '*' 1 0 true)
TX=$(bitcoin-cli -rpcwallet=main listtransactions '*' 1 0 true)
CONFS=$(echo "$TX" | jq '.[].confirmations')
if [ "$CONFS" = "0" ]; then
echo "Detected Stacks mining mempool tx, mining btc block..."
Expand All @@ -167,7 +183,7 @@ RUN <<EOF
echo "Current Bitcoin chain height: $chain_height"

while true; do
HEIGHT=$(curl -s localhost:20443/v2/info | jq '.burn_block_height')
HEIGHT=$(curl -s 127.0.0.1:20443/v2/info | jq '.burn_block_height')
if [ "$HEIGHT" = "$chain_height" ]; then
echo "Stacks node caught up to Bitcoin block $HEIGHT"
break
Expand All @@ -177,7 +193,7 @@ RUN <<EOF
sleep 0.1s
done

if [ "$chain_height" = "$STACKS_24_HEIGHT" ]; then
if [ "$chain_height" = "$STACKS_25_HEIGHT" ]; then
break
fi

Expand Down Expand Up @@ -223,12 +239,12 @@ cat > run.sh <<'EOM'
bitcoin-cli -rpcwait generatetoaddress 1 $BTC_ADDR

envsubst < config.toml.in > config.toml
stacks-node start --config=config.toml &
stacks-node start --config config.toml &
STACKS_PID=$!

function start_miner() {
while true; do
TX=$(bitcoin-cli listtransactions '*' 1 0 true)
TX=$(bitcoin-cli -rpcwallet=main listtransactions '*' 1 0 true)
CONFS=$(echo "$TX" | jq '.[].confirmations')
if [ "$CONFS" = "0" ]; then
echo "Detected Stacks mining mempool tx, mining btc block..."
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile.stacks-node
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ RUN test -n "$GIT_COMMIT" || (echo "GIT_COMMIT not set" && false)

RUN echo "Building stacks-node from commit: https://github.com/stacks-network/stacks-blockchain/commit/$GIT_COMMIT"

RUN apt-get update && apt-get install -y libclang-dev
RUN rustup toolchain install stable
RUN rustup component add rustfmt --toolchain stable

WORKDIR /stacks
RUN git init && \
git remote add origin https://github.com/stacks-network/stacks-blockchain.git && \
git -c protocol.version=2 fetch --depth=1 origin "$GIT_COMMIT" && \
git reset --hard FETCH_HEAD

RUN cargo build --package stacks-node --bin stacks-node --release
RUN cargo build --package stacks-node --bin stacks-node --profile release-lite

FROM debian:bullseye-backports

COPY --from=builder /stacks/target/release/stacks-node /usr/local/bin/
COPY --from=builder /stacks/target/release-lite/stacks-node /usr/local/bin/

COPY --from=ruimarinho/bitcoin-core:0.21.1 /opt/bitcoin-*/bin /usr/local/bin

Expand Down
4 changes: 2 additions & 2 deletions docker-compose-follower.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"

x-common-vars:
- &STACKS_BLOCKCHAIN_COMMIT master
- &STACKS_BLOCKCHAIN_COMMIT e14022aa7e2eb82714c2ccaa3b8f2ed0f5568f8e
- &MINER_PUB_KEY 035379aa40c02890d253cfa577964116eb5295570ae9f7287cbae5f2585f5b2c7c
- &BITCOIN_PEER_PORT 18444
- &BITCOIN_RPC_PORT 18443
Expand Down Expand Up @@ -60,7 +60,7 @@ services:
until $(curl -o /dev/null -s stacks-node-miner:20443); do
sleep 5
done
exec stacks-node start --config=config.toml
exec stacks-node start --config config.toml

networks:
stacks:
Expand Down
8 changes: 6 additions & 2 deletions docker-compose-miner.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"

x-common-vars:
- &STACKS_BLOCKCHAIN_COMMIT master
- &STACKS_BLOCKCHAIN_COMMIT e14022aa7e2eb82714c2ccaa3b8f2ed0f5568f8e
- &BTC_ADDR miEJtNKa3ASpA19v5ZhvbKTEieYjLpzCYT
- &MINER_SEED 9e446f6b0c6a96cf2190e54bcd5a8569c3e386f091605499464389b8d4e0bfc201 # stx: STEW4ZNT093ZHK4NEQKX8QJGM2Y7WWJ2FQQS5C19, btc: miEJtNKa3ASpA19v5ZhvbKTEieYjLpzCYT, pub_key: 035379aa40c02890d253cfa577964116eb5295570ae9f7287cbae5f2585f5b2c7c, wif: cStMQXkK5yTFGP3KbNXYQ3sJf2qwQiKrZwR9QJnksp32eKzef1za
- &BITCOIN_PEER_PORT 18444
Expand All @@ -16,6 +16,8 @@ x-common-vars:
- &STACKS_22_HEIGHT ${STACKS_22_HEIGHT:-105}
- &STACKS_23_HEIGHT ${STACKS_23_HEIGHT:-106}
- &STACKS_24_HEIGHT ${STACKS_24_HEIGHT:-107}
- &STACKS_25_HEIGHT ${STACKS_25_HEIGHT:-108}
- &STACKS_30_HEIGHT ${STACKS_30_HEIGHT:-999999} # do not boot into epoch3.0 for now (it doesn't work yet)
- &REWARD_RECIPIENT ${REWARD_RECIPIENT:-STQM73RQC4EX0A07KWG1J5ECZJYBZS4SJ4ERC6WN} # priv: 6ad9cadb42d4edbfbe0c5bfb3b8a4125ddced021c4174f829b714ccbf527f02001

services:
Expand Down Expand Up @@ -116,6 +118,8 @@ services:
STACKS_22_HEIGHT: *STACKS_22_HEIGHT
STACKS_23_HEIGHT: *STACKS_23_HEIGHT
STACKS_24_HEIGHT: *STACKS_24_HEIGHT
STACKS_25_HEIGHT: *STACKS_25_HEIGHT
STACKS_30_HEIGHT: *STACKS_30_HEIGHT
REWARD_RECIPIENT: *REWARD_RECIPIENT
entrypoint:
- /bin/bash
Expand All @@ -129,7 +133,7 @@ services:
rm -rf $${DATA_DIR}/*
envsubst < config.toml.in > config.toml
# bitcoin-cli -rpcwait -rpcconnect=bitcoind getmininginfo
exec stacks-node start --config=config.toml
exec stacks-node start --config config.toml

##################################
##### UNCOMMENT IF USING API #####
Expand Down
14 changes: 13 additions & 1 deletion stacks-krypton-miner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ public_ip_address = "1.1.1.1:1234"

[burnchain]
chain = "bitcoin"
mode = "krypton"
mode = "neon"
poll_time_secs = 1
pox_2_activation = $STACKS_POX2_HEIGHT
pox_reward_length = $POX_REWARD_LENGTH
pox_prepare_length = $POX_PREPARE_LENGTH

### bitcoind-regtest connection info
peer_host = "$BITCOIN_PEER_HOST"
Expand All @@ -44,6 +46,7 @@ rpc_ssl = false
username = "$BITCOIN_RPC_USER"
password = "$BITCOIN_RPC_PASS"
timeout = 30
wallet_name = "main"

[[burnchain.epochs]]
epoch_name = "1.0"
Expand Down Expand Up @@ -73,6 +76,15 @@ start_height = $STACKS_23_HEIGHT
epoch_name = "2.4"
start_height = $STACKS_24_HEIGHT

[[burnchain.epochs]]
epoch_name = "2.5"
start_height = $STACKS_25_HEIGHT

[[burnchain.epochs]]
epoch_name = "3.0"
start_height = $STACKS_30_HEIGHT


[[ustx_balance]]
address = "STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6"
amount = 10000000000000000
Expand Down
Loading