Merge branch 'master' into merge-develop

* master: (24 commits)
  Update location of archive
  update documentation
  renaming items to stacks-core
  remove comment in dockerfile
  address comments in 4079
  spelling error
  Update docker image name
  Add checks/trigger for next/fix typo
  set docker repo name and add tag arg for build
  (3847) - Adding new workflow files
  (3847) - Adding updated files
  (3847) - Removing files
  (3847) - Adding/updating Dockerfiles for ARM arch
  Update README.md
  Add new docker tag to address repo name change
  docs: fix invalid example in docs
  remove missing packags from ci
  fix: address issue in print eval
  fix: fix trait handler and cut release
  chore: add changelog entry for 3784 hotfix
  ...
This commit is contained in:
wileyj
2023-12-04 13:43:19 -08:00
36 changed files with 1540 additions and 1173 deletions

View File

@@ -3,17 +3,19 @@
Pull requests are ideal for making small changes to this project. However, they are NOT an appropriate venue to introducing non-trivial or breaking changes to the codebase.
For introducing non-trivial or breaking changes to the codebase, please follow the SIP (Stacks Improvement Proposal) process documented here:
https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-000-stacks-improvement-proposal-process.md.
https://github.com/stacksgov/sips/blob/main/sips/sip-000/sip-000-stacks-improvement-proposal-process.md.
-->
### Description
### Applicable issues
- fixes #
### Additional info (benefits, drawbacks, caveats)
### Checklist
- [ ] Test coverage for new or modified code paths
- [ ] Changelog is updated
- [ ] Required documentation changes (e.g., `docs/rpc/openapi.yaml` and `rpc-endpoints.md` for v2 endpoints, `event-dispatcher.md` for new events)

View File

@@ -7,11 +7,12 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
ARG REPO=stacks-network/stacks-blockchain
ARG REPO=stacks-network/stacks-core
RUN case ${TARGETARCH} in \
"amd64") BIN_ARCH=linux-musl-x64 ;; \
"arm64") BIN_ARCH=linux-musl-arm64 ;; \
"arm") BIN_ARCH=linux-musl-armv7 ;; \
"*") exit 1 ;; \
esac \
&& echo "wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip" \

View File

@@ -7,11 +7,12 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
ARG REPO=stacks-network/stacks-blockchain
ARG REPO=stacks-network/stacks-core
RUN case ${TARGETARCH} in \
"amd64") BIN_ARCH=linux-musl-x64 ;; \
"arm64") BIN_ARCH=linux-musl-arm64 ;; \
"arm") BIN_ARCH=linux-musl-armv7 ;; \
"*") exit 1 ;; \
esac \
&& echo "wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip" \

54
.github/workflows/atlas-tests.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
## Github workflow to run atlas tests
name: Tests::Atlas
on:
workflow_call:
## env vars are transferred to composite action steps
env:
BITCOIND_TEST: 1
RUST_BACKTRACE: full
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15
TEST_TIMEOUT: 30
concurrency:
group: atlas-tests-${{ github.head_ref || github.ref || github.run_id}}
## Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Atlas integration tests with code coverage
atlas-tests:
name: Atlas Test
runs-on: ubuntu-latest
strategy:
## Continue with the test matrix even if we've had a failure
fail-fast: false
## Run a maximum of 2 concurrent tests from the test matrix
max-parallel: 2
matrix:
test-name:
- tests::neon_integrations::atlas_integration_test
- tests::neon_integrations::atlas_stress_integration_test
steps:
## Setup test environment
- name: Setup Test Environment
id: setup_tests
uses: stacks-network/actions/stacks-core/testenv@main
## Run test matrix using restored cache of archive file
## - Test will timeout after env.TEST_TIMEOUT minutes
- name: Run Tests
id: run_tests
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
uses: stacks-network/actions/stacks-core/run-tests@main
with:
test-name: ${{ matrix.test-name }}
## Create and upload code coverage file
- name: Code Coverage
id: codecov
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}

View File

@@ -1,35 +0,0 @@
##
## Performs an audit for crate advisories against cargo dependencies
##
name: Security Audit
# Only run when:
# - workflow is manually triggered
# - Cargo.toml/lock is changed
# - Daily at 0330 UTC
# Note: this will create issues for any crate advisories unless they already exist
on:
workflow_dispatch:
push:
paths:
- "**/Cargo.toml"
- "**/Cargo.lock"
schedule:
- cron: 30 03 * * *
jobs:
security_audit:
if: ${{ false }}
name: Crate Vulnerability Check
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Rust Dependency Check
id: rust_dep_check
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,209 +1,93 @@
##
## Bitcoin Integration Tests
##
## Github workflow to run bitcoin tests
name: Bitcoin Integration Tests
# Only run when:
# - PRs are (re)opened against master branch
name: Tests::Bitcoin
on:
pull_request:
types:
- opened
- reopened
workflow_call:
## env vars are transferred to composite action steps
env:
BITCOIND_TEST: 1
RUST_BACKTRACE: full
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15
TEST_TIMEOUT: 30
concurrency:
group: stacks-bitcoin-integration-tests-${{ github.ref }}
# Only cancel in progress if this is for a PR
group: bitcoin-tests-${{ github.head_ref || github.ref || github.run_id}}
## Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Create bitcoin image used for later tests
build-integration-image:
name: Build Image
# Bitcoin integration tests with code coverage
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Reclaim disk space
id: cleanup
run: |
sudo apt-get update
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
sudo apt-get autoremove -y
sudo apt-get clean
docker system prune --force
- name: Build bitcoin integration testing image
id: build_docker_image
env:
DOCKER_BUILDKIT: 1
# Remove .dockerignore file so codecov has access to git info and build the image
run: |
rm .dockerignore
docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.generic.bitcoin-tests -t stacks-blockchain:integrations .
- name: Export docker image as tarball
id: export_docker_image
run: docker save stacks-blockchain:integrations | gzip > integration-image.tar.gz
- name: Upload built docker image
id: upload_docker_image
uses: actions/upload-artifact@v3
with:
name: integration-image.tar.gz
path: integration-image.tar.gz
# Run integration tests using sampled genesis block
sampled-genesis:
name: Sampled Genesis
runs-on: ubuntu-latest
needs:
- build-integration-image
strategy:
## Continue with the test matrix even if we've had a failure
fail-fast: false
## Run a maximum of 32 concurrent tests from the test matrix
max-parallel: 32
matrix:
test-name:
- tests::neon_integrations::miner_submit_twice
- tests::neon_integrations::microblock_integration_test
- tests::neon_integrations::microblock_fork_poison_integration_test
- tests::neon_integrations::size_check_integration_test
- tests::neon_integrations::cost_voting_integration
- tests::integrations::integration_test_get_info
- tests::neon_integrations::bitcoind_integration_test
- tests::neon_integrations::liquid_ustx_integration
- tests::neon_integrations::stx_transfer_btc_integration_test
- tests::neon_integrations::stx_delegate_btc_integration_test
- tests::neon_integrations::bitcoind_forking_test
- tests::neon_integrations::should_fix_2771
- tests::neon_integrations::pox_integration_test
- tests::neon_integrations::mining_events_integration_test
- tests::bitcoin_regtest::bitcoind_integration_test
- tests::should_succeed_handling_malformed_and_valid_txs
- tests::integrations::integration_test_get_info
- tests::neon_integrations::antientropy_integration_test ## forced failure
- tests::neon_integrations::bad_microblock_pubkey
- tests::neon_integrations::bitcoind_forking_test
- tests::neon_integrations::bitcoind_integration_test
- tests::neon_integrations::block_large_tx_integration_test
- tests::neon_integrations::block_limit_hit_integration_test
- tests::neon_integrations::cost_voting_integration
- tests::neon_integrations::filter_long_runtime_tx_integration_test
- tests::neon_integrations::filter_low_fee_tx_integration_test
- tests::neon_integrations::fuzzed_median_fee_rate_estimation_test_window10
- tests::neon_integrations::fuzzed_median_fee_rate_estimation_test_window5
- tests::neon_integrations::liquid_ustx_integration
- tests::neon_integrations::microblock_fork_poison_integration_test
- tests::neon_integrations::microblock_integration_test
- tests::neon_integrations::microblock_large_tx_integration_test_FLAKY
- tests::neon_integrations::microblock_limit_hit_integration_test
- tests::neon_integrations::miner_submit_twice
- tests::neon_integrations::mining_events_integration_test
- tests::neon_integrations::pox_integration_test
- tests::neon_integrations::push_boot_receipts
- tests::neon_integrations::runtime_overflow_unconfirmed_microblocks_integration_test
- tests::neon_integrations::should_fix_2771
- tests::neon_integrations::size_check_integration_test
- tests::neon_integrations::size_overflow_unconfirmed_invalid_stream_microblocks_integration_test
- tests::neon_integrations::size_overflow_unconfirmed_microblocks_integration_test
- tests::neon_integrations::size_overflow_unconfirmed_stream_microblocks_integration_test
- tests::neon_integrations::size_overflow_unconfirmed_invalid_stream_microblocks_integration_test
- tests::neon_integrations::runtime_overflow_unconfirmed_microblocks_integration_test
- tests::neon_integrations::antientropy_integration_test
- tests::neon_integrations::filter_low_fee_tx_integration_test
- tests::neon_integrations::filter_long_runtime_tx_integration_test
- tests::neon_integrations::microblock_large_tx_integration_test_FLAKY
- tests::neon_integrations::block_large_tx_integration_test
- tests::neon_integrations::microblock_limit_hit_integration_test
- tests::neon_integrations::block_limit_hit_integration_test
- tests::neon_integrations::fuzzed_median_fee_rate_estimation_test_window5
- tests::neon_integrations::fuzzed_median_fee_rate_estimation_test_window10
- tests::neon_integrations::use_latest_tip_integration_test
- tests::neon_integrations::test_flash_block_skip_tenure
- tests::neon_integrations::stx_delegate_btc_integration_test
- tests::neon_integrations::stx_transfer_btc_integration_test
- tests::neon_integrations::test_chainwork_first_intervals
- tests::neon_integrations::test_chainwork_partial_interval
- tests::neon_integrations::test_problematic_txs_are_not_stored
- tests::neon_integrations::test_flash_block_skip_tenure
- tests::neon_integrations::test_problematic_blocks_are_not_mined
- tests::neon_integrations::test_problematic_blocks_are_not_relayed_or_stored
- tests::neon_integrations::test_problematic_microblocks_are_not_mined
- tests::neon_integrations::test_problematic_microblocks_are_not_relayed_or_stored
- tests::neon_integrations::push_boot_receipts
- tests::epoch_205::test_dynamic_db_method_costs
- tests::epoch_205::transition_empty_blocks
- tests::epoch_205::test_cost_limit_switch_version205
- tests::epoch_205::test_exact_block_costs
- tests::epoch_205::bigger_microblock_streams_in_2_05
- tests::epoch_21::transition_adds_burn_block_height
- tests::epoch_21::transition_fixes_bitcoin_rigidity
- tests::epoch_21::transition_adds_pay_to_contract
- tests::epoch_21::transition_adds_get_pox_addr_recipients
- tests::epoch_21::transition_adds_mining_from_segwit
- tests::epoch_21::transition_removes_pox_sunset
- tests::epoch_21::transition_empty_blocks
- tests::epoch_21::test_pox_reorgs_three_flaps
- tests::epoch_21::test_pox_reorg_one_flap
- tests::epoch_21::test_pox_reorg_flap_duel
- tests::epoch_21::test_pox_reorg_flap_reward_cycles
- tests::epoch_21::test_pox_missing_five_anchor_blocks
- tests::epoch_21::test_sortition_divergence_pre_21
- tests::epoch_21::test_v1_unlock_height_with_current_stackers
- tests::epoch_21::test_v1_unlock_height_with_delay_and_current_stackers
- tests::epoch_21::trait_invocation_cross_epoch
- tests::epoch_22::pox_2_unlock_all
- tests::epoch_22::disable_pox
- tests::epoch_22::test_pox_reorg_one_flap
- tests::epoch_23::trait_invocation_behavior
- tests::neon_integrations::bad_microblock_pubkey
- tests::epoch_24::fix_to_pox_contract
- tests::epoch_24::verify_auto_unlock_behavior
- tests::signer::test_stackerdb_dkg
- tests::stackerdb::test_stackerdb_load_store
- tests::stackerdb::test_stackerdb_event_observer
- tests::neon_integrations::test_problematic_txs_are_not_stored
- tests::neon_integrations::use_latest_tip_integration_test
- tests::should_succeed_handling_malformed_and_valid_txs
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Download docker image
id: download_docker_image
uses: actions/download-artifact@v3
with:
name: integration-image.tar.gz
- name: Load docker image
id: load_docker_image
run: docker load -i integration-image.tar.gz && rm integration-image.tar.gz
- name: All integration tests with sampled genesis
id: bitcoin_integration_tests
timeout-minutes: 30
env:
DOCKER_BUILDKIT: 1
TEST_NAME: ${{ matrix.test-name }}
run: docker build -o coverage-output --build-arg test_name=${{ matrix.test-name }} -f ./.github/actions/bitcoin-int-tests/Dockerfile.bitcoin-tests .
- name: Code Coverage
id: code_coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage-output/lcov.info
name: ${{ matrix.test-name }}
fail_ci_if_error: false
## Setup test environment
- name: Setup Test Environment
id: setup_tests
uses: stacks-network/actions/stacks-core/testenv@main
# Run atlas integration tests
atlas-test:
name: Atlas Test
runs-on: ubuntu-latest
needs:
- build-integration-image
strategy:
fail-fast: false
matrix:
test-name:
- tests::neon_integrations::atlas_integration_test
- tests::neon_integrations::atlas_stress_integration_test
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Download docker image
id: download_docker_image
uses: actions/download-artifact@v3
## Run test matrix using restored cache of archive file
## - Test will timeout after env.TEST_TIMEOUT minutes
- name: Run Tests
id: run_tests
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
uses: stacks-network/actions/stacks-core/run-tests@main
with:
name: integration-image.tar.gz
- name: Load docker image
id: load_docker_image
run: docker load -i integration-image.tar.gz && rm integration-image.tar.gz
- name: Atlas integration tests
id: atlas_integration_tests
timeout-minutes: 40
env:
DOCKER_BUILDKIT: 1
TEST_NAME: ${{ matrix.test-name }}
run: docker build -o coverage-output --build-arg test_name=${{ matrix.test-name }} -f ./.github/actions/bitcoin-int-tests/Dockerfile.bitcoin-tests .
test-name: ${{ matrix.test-name }}
threads: 1
## Create and upload code coverage file
- name: Code Coverage
id: code_coverage
uses: codecov/codecov-action@v3
id: codecov
uses: stacks-network/actions/codecov@main
with:
files: ./coverage-output/lcov.info
name: ${{ matrix.test-name }}
fail_ci_if_error: false
test-name: ${{ matrix.test-name }}

View File

@@ -1,65 +0,0 @@
##
## Builds binary assets of stacks-blockchain and creates a named tag github (draft) release
##
name: Build Distributable Assets
# Only run when:
# - manually triggered via the ci.yml workflow with a provided input tag
on:
workflow_call:
inputs:
tag:
description: "Tag name of this release (x.y.z)"
required: true
type: string
parallel_jobs:
description: "Number of parallel binary builds"
required: false
type: number
default: 4
arch:
description: "Stringified JSON object listing of platform matrix"
required: true
type: string
jobs:
artifact:
if: ${{ inputs.tag != '' }}
name: Create Artifacts
runs-on: ubuntu-latest
strategy:
max-parallel: ${{ inputs.parallel_jobs }}
matrix:
platform: ${{ fromJson(inputs.arch) }}
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Set Vars
id: set_vars
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up Docker Buildx
id: setup_buildx
uses: docker/setup-buildx-action@v2
- name: Build Binaries
id: build_binaries
uses: docker/build-push-action@v3
with:
file: build-scripts/Dockerfile.${{ matrix.platform }}
outputs: type=local,dest=./release/${{ matrix.platform }}
build-args: |
OS_ARCH=${{ matrix.platform }}
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
- name: Compress artifact
id: compress_artifact
run: zip --junk-paths ${{ matrix.platform }} ./release/${{ matrix.platform }}/*
- name: Upload artifact
id: upload_artifact
uses: actions/upload-artifact@v3
with:
path: ${{ matrix.platform }}.zip

View File

@@ -1,180 +1,225 @@
## The main Github Actions workflow
name: CI
## Only run when:
## - manually triggered
## - PR's are (re)opened
## - push to master (i.e. merge develop -> master)
on:
push:
branches:
- master
pull_request:
- develop
- next
paths-ignore:
- "**.md"
- "**.yml"
workflow_dispatch:
inputs:
tag:
description: "The tag to create (optional)"
required: false
pull_request_target:
types:
- opened
- reopened
- synchronize
paths-ignore:
- "**.md"
- "**.yml"
## might be better to use inclusive v exclusive paths here, ex:
# paths:
# - "**.rs"
# - "**.clar"
pull_request_review:
types:
- submitted
defaults:
run:
shell: bash
concurrency:
group: ${{ github.head_ref || github.run_id }}
group: ci-${{ github.head_ref || github.ref || github.run_id }}
## Always cancel duplicate jobs
cancel-in-progress: true
run-name: ${{ inputs.tag }}
jobs:
## rust format: Execute on every run
##
## Jobs to execute everytime workflow runs
## do not run if the trigger is any of the following:
## - PR review submitted (not approved)
## and any of:
## - PR review comment
## - PR change is requested
rustfmt:
if: |
!(
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
(
github.event.review.state == 'commented' ||
github.event.review.state == 'changes_requested'
)
)
name: Rust Format
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Define Rust Toolchain
id: define_rust_toolchain
run: echo "RUST_TOOLCHAIN=$(cat ./rust-toolchain)" >> $GITHUB_ENV
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Rust Toolchain
id: setup_rust_toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@f3c84ee10bf5a86e7a5d607d487bf17d57670965 # v1.5.0
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt
- name: Rustfmt
cache: false
- name: Rustfmt
id: rustfmt
uses: actions-rust-lang/rustfmt@v1
uses: actions-rust-lang/rustfmt@2d1d4e9f72379428552fa1def0b898733fb8472d # v1.1.0
## Release tests: Execute on every run
release-tests:
name: Release Tests
uses: ./.github/workflows/stacks-blockchain-tests.yml
## Checked for leaked credentials: Execute on every run
leaked-cred-test:
name: Leaked Credential Test
runs-on: ubuntu-latest
steps:
- name: Extract branch name
id: extract_branch
if: ${{ github.event_name != 'pull_request' }}
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Extract branch name
id: extract_branch_pr
if: ${{ github.event_name == 'pull_request' }}
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV
- name: Branch name
run: echo running on branch ${{ env.BRANCH_NAME }}
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: TruffleHog Scan
id: trufflehog_check
uses: trufflesecurity/trufflehog@main
with:
path: ./
base: ${{ env.BRANCH_NAME }}
head: HEAD
###############################################
## Build Tagged Release
###############################################
## Build source binaries
## Only run if:
## - Tag is provided
## - OR
## - Not the default branch
## - AND
## - Not a PR
build-source:
if: ${{ inputs.tag != '' || (github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && !contains(github.ref, 'refs/pull')) }}
name: Build Binaries
uses: stacks-network/stacks-blockchain/.github/workflows/build-source-binary.yml@master
######################################################################################
## Create a tagged github release
##
## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
create-release:
if: |
inputs.tag != '' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
name: Create Release
needs:
- rustfmt
- release-tests
- leaked-cred-test
uses: ./.github/workflows/github-release.yml
with:
tag: ${{ inputs.tag }}
parallel_jobs: 4
arch: >-
["linux-glibc-x64", "linux-musl-x64", "linux-glibc-arm64", "linux-musl-arm64", "macos-x64", "macos-arm64", "windows-x64"]
secrets: inherit
## Create github release with binary archives
## Only run if:
## - Tag is provided
## - OR
## - Not the default branch
## - AND
## - Not a PR
github-release:
if: ${{ inputs.tag != '' || (github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && !contains(github.ref, 'refs/pull')) }}
name: Github Release
uses: stacks-network/stacks-blockchain/.github/workflows/github-release.yml@master
needs: build-source
with:
tag: ${{ inputs.tag }}
arch: >-
["linux-glibc-x64", "linux-musl-x64", "linux-glibc-arm64", "linux-musl-arm64", "macos-x64", "macos-arm64", "windows-x64"]
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
## Create docker alpine images
## Only run if:
## - Tag is provided
## - OR
## - Not the default branch
## - AND
## - Not a PR
docker-alpine:
if: ${{ inputs.tag != '' || (github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && !contains(github.ref, 'refs/pull')) }}
name: Docker Alpine (Binary)
uses: stacks-network/stacks-blockchain/.github/workflows/image-build-alpine-binary.yml@master
needs: github-release
with:
tag: ${{ inputs.tag }}
docker_platforms: linux/arm64, linux/amd64, linux/amd64/v2, linux/amd64/v3
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
## Create docker debian images
## Only run if:
## - Tag is provided
## - OR
## - Not the default branch
## - AND
## - Not a PR
docker-debian:
if: ${{ inputs.tag != '' || (github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && !contains(github.ref, 'refs/pull')) }}
name: Docker Debian (Binary)
uses: stacks-network/stacks-blockchain/.github/workflows/image-build-debian-binary.yml@master
needs: github-release
with:
tag: ${{ inputs.tag }}
docker_platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3
linux_version: debian
build_type: binary
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
###############################################
## Build Branch/PR
###############################################
## Create docker debian images
## Only run if:
## - Tag is *not* provided
build-branch:
if: ${{ inputs.tag == '' }}
name: Docker Debian (Source)
uses: stacks-network/stacks-blockchain/.github/workflows/image-build-debian-source.yml@master
## Build and push Debian image built from source
##
## Runs when:
## - tag is not provided
## and the following are not true:
## - PR review submitted (not approved)
## and any of:
## - PR review comment
## - PR change is requested
docker-image:
if: |
inputs.tag == '' &&
!(
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
(
github.event.review.state == 'commented' ||
github.event.review.state == 'changes_requested'
)
)
name: Docker Image (Source)
uses: ./.github/workflows/image-build-source.yml
needs:
- rustfmt
- leaked-cred-test
with:
docker_platforms: linux/amd64
linux_version: debian
build_type: source
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
secrets: inherit
## Create a reusable cache for tests
##
## Runs when:
## - tag is provided
## or:
## - no tag provided
## and any of:
## - PR is approved (any approval will trigger)
## - this workflow is called manually
## - PR is opened
## - commit to either (development, master) branch
create-cache:
if: |
inputs.tag != '' || (
inputs.tag == '' && (
(
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
github.event.review.state == 'approved'
) ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request_target' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
)
name: Create Test Cache
needs:
- rustfmt
uses: ./.github/workflows/create-cache.yml
## Tests to run regularly
##
## Runs when:
## - tag is provided
## either or of the following:
## - tag is not provided
## - PR is approved
stacks-core-tests:
if: |
inputs.tag != '' || (
inputs.tag == '' || (
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
github.event.review.state == 'approved'
)
)
name: Stacks Core Tests
needs:
- rustfmt
- create-cache
uses: ./.github/workflows/stacks-core-tests.yml
bitcoin-tests:
if: |
inputs.tag != '' || (
inputs.tag == '' || (
github.event_name == 'pull_request_review' &&
github.event.action == 'submitted' &&
github.event.review.state == 'approved'
)
)
name: Bitcoin Tests
needs:
- rustfmt
- create-cache
uses: ./.github/workflows/bitcoin-tests.yml
## Test to run on a tagged release
##
## Runs when:
## - tag is provided
atlas-tests:
if: inputs.tag != ''
name: Atlas Tests
needs:
- rustfmt
- create-cache
uses: ./.github/workflows/atlas-tests.yml
epoch-tests:
if: inputs.tag != ''
name: Epoch Tests
needs:
- rustfmt
- create-cache
uses: ./.github/workflows/epoch-tests.yml
slow-tests:
if: inputs.tag != ''
name: Slow Tests
needs:
- rustfmt
- create-cache
uses: ./.github/workflows/slow-tests.yml

View File

@@ -4,6 +4,10 @@
name: Open Clarity JS SDK PR
defaults:
run:
shell: bash
env:
CLARITY_JS_SDK_REPOSITORY: stacks-network/clarity-js-sdk
COMMIT_USER: Hiro DevOps
@@ -18,28 +22,31 @@ jobs:
run:
name: Open Clarity JS SDK PR
runs-on: ubuntu-latest
# This condition can be removed once the main `stacks-blockchain` workflow creates pre-releases
# This condition can be removed once the main `stacks-core` workflow creates pre-releases
# when appropriate, instead of full releases for every tag passed in.
if: "!contains(github.ref, '-rc')"
steps:
- name: Checkout latest clarity js sdk
id: git_checkout
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: ${{ secrets.GH_TOKEN }}
repository: ${{ env.CLARITY_JS_SDK_REPOSITORY }}
ref: master
- name: Determine Release Version
id: get_release_version
run: |
RELEASE_VERSION=$(echo ${GITHUB_REF#refs/*/} | tr / -)
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Update SDK Tag
id: update_sdk_tag
run: sed -i "s@CORE_SDK_TAG = \".*\"@CORE_SDK_TAG = \"$RELEASE_VERSION\"@g" packages/clarity-native-bin/src/index.ts
- name: Create Pull Request
id: create_pr
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
with:
token: ${{ secrets.GH_TOKEN }}
commit-message: "chore: update clarity-native-bin tag"
@@ -51,7 +58,7 @@ jobs:
labels: |
dependencies
body: |
:robot: This is an automated pull request created from a new release in [stacks-blockchain](https://github.com/stacks-network/stacks-blockchain/releases).
:robot: This is an automated pull request created from a new release in [stacks-core](https://github.com/stacks-network/stacks-core/releases).
Updates the clarity-native-bin tag.
assignees: zone117x

View File

@@ -1,42 +0,0 @@
## Perform Clippy checks - currently set to defaults
## https://github.com/rust-lang/rust-clippy#usage
## https://rust-lang.github.io/rust-clippy/master/index.html
##
name: Clippy Checks
# Only run when:
# - PRs are (re)opened against develop branch
on:
pull_request:
branches:
- develop
types:
- opened
- reopened
- synchronize
jobs:
clippy_check:
name: Clippy Check
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Define Rust Toolchain
id: define_rust_toolchain
run: echo "RUST_TOOLCHAIN=$(cat ./rust-toolchain)" >> $GITHUB_ENV
- name: Setup Rust Toolchain
id: setup_rust_toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: clippy
- name: Clippy
id: clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -p clarity -p libstackerdb -p pox-locking -p stacks-common --no-deps --tests --all-features -- -D warnings

59
.github/workflows/create-cache.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
## Github workflow to create reusable caches
name: Create Test Cache
on:
workflow_dispatch:
workflow_call:
## env vars are transferred to composite action steps
env:
RUSTFLAGS: "-Cinstrument-coverage -Awarnings"
LLVM_PROFILE_FILE: "stacks-core-%p-%m.profraw"
BTC_VERSION: "0.20.0"
##
## Cache will exist longer than workflow execution so other runners have access
## ex: a failed job should have access to the cache for however long `cleanup.yml` is set to delete old caches
## however, this is only relevant if the commit sha does not change between runs
concurrency:
group: create-cache-${{ github.head_ref || github.ref || github.run_id}}
## Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
## Cache cargo data
cargo:
name: Cargo
runs-on: ubuntu-latest
steps:
## Perform a lookup to check if the cache already exists
- name: Cargo Cache
id: cargo-cache
uses: stacks-network/actions/stacks-core/cache/cargo@main
with:
action: save
## Cache the bitcoin binary
bitcoin-binary:
name: Bitcoin Binary
runs-on: ubuntu-latest
steps:
- name: Bitcoin Cache
id: bitcoin-cache
uses: stacks-network/actions/stacks-core/cache/bitcoin@main
with:
action: save
## Cache nextest archives for tests
nextest-archive:
name: Test Archive
runs-on: ubuntu-latest
needs:
- cargo
steps:
- name: Build Nexttest Cache
id: nextest-cache
uses: stacks-network/actions/stacks-core/cache/build-cache@main
with:
genesis: true

View File

@@ -0,0 +1,70 @@
## Github workflow to create multiarch binaries from source
name: Create Binaries
on:
workflow_call:
inputs:
tag:
description: "Tag name of this release (x.y.z)"
required: true
type: string
arch:
description: "Stringified JSON object listing of platform matrix"
required: false
type: string
default: >-
["linux-glibc-x64", "linux-musl-x64", "linux-glibc-arm64", "linux-glibc-armv7", "linux-musl-arm64", "linux-musl-armv7", "macos-x64", "macos-arm64", "windows-x64"]
## change the display name to the tag being built
run-name: ${{ inputs.tag }}
concurrency:
group: create-binary-${{ github.head_ref || github.ref || github.run_id}}
## Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
artifact:
if: |
inputs.tag != '' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
name: Build Binaries
runs-on: ubuntu-latest
strategy:
## Run a maximum of 10 builds concurrently, using the matrix defined in inputs.arch
max-parallel: 10
matrix:
platform: ${{ fromJson(inputs.arch) }}
steps:
## Setup Docker for the builds
- name: Docker setup
uses: stacks-network/actions/docker@main
## Build the binaries using defined dockerfiles
- name: Build Binary (${{ matrix.platform }})
id: build_binaries
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # 5.0.0
with:
file: build-scripts/Dockerfile.${{ matrix.platform }}
outputs: type=local,dest=./release/${{ matrix.platform }}
build-args: |
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
OS_ARCH=${{ matrix.platform }}
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
## Compress the binary artifact
- name: Compress artifact
id: compress_artifact
run: zip --junk-paths ${{ matrix.platform }} ./release/${{ matrix.platform }}/*
## Upload the binary artifact to the github action (used in `github-release.yml` to create a release)
- name: Upload artifact
id: upload_artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
path: ${{ matrix.platform }}.zip

View File

@@ -9,6 +9,10 @@
name: Open Docs PR
defaults:
run:
shell: bash
env:
ROBOT_OWNER: kantai-robot
ROBOT_REPO: docs.blockstack
@@ -16,9 +20,8 @@ env:
TARGET_REPO: docs
TARGET_REPOSITORY: stacks-network/docs
# Only run when:
# - push to master
## Only run when:
## - push to master
on:
push:
branches:
@@ -33,19 +36,22 @@ jobs:
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Build docs
id: build_docs
env:
DOCKER_BUILDKIT: 1
run: rm -rf docs-output && docker build -o docs-output -f ./.github/actions/docsgen/Dockerfile.docsgen .
- name: Checkout latest docs
id: git_checkout_docs
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: ${{ secrets.DOCS_GITHUB_TOKEN }}
repository: ${{ env.TARGET_REPOSITORY }}
path: docs
- name: Branch and commit
id: push
run: |
@@ -63,14 +69,15 @@ jobs:
echo "::set-output name=open_pr::0"
else
git remote add robot https://github.com/$ROBOT_OWNER/$ROBOT_REPO
git commit -m "auto: update Clarity references JSONs from stacks-blockchain@${GITHUB_SHA}"
git commit -m "auto: update Clarity references JSONs from stacks-core@${GITHUB_SHA}"
git push robot $ROBOT_BRANCH
echo "::set-output name=open_pr::1"
fi
- name: Open PR
id: open_pr
if: ${{ steps.push.outputs.open_pr == '1' }}
uses: actions/github-script@v6
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
github-token: ${{ secrets.DOCS_GITHUB_TOKEN }}
script: |
@@ -102,6 +109,6 @@ jobs:
let result = await github.pulls.create({
owner, repo, head,
base: "master",
title: "Auto: Update API documentation from stacks-blockchain",
body: "Update API documentation from the latest in `stacks-blockchain`",
title: "Auto: Update API documentation from stacks-core",
body: "Update API documentation from the latest in `stacks-core`",
});

78
.github/workflows/epoch-tests.yml vendored Normal file
View File

@@ -0,0 +1,78 @@
## Github workflow to run epoch tests
name: Tests::Epoch
on:
workflow_call:
## env vars are transferred to composite action steps
env:
BITCOIND_TEST: 1
RUST_BACKTRACE: full
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15
TEST_TIMEOUT: 30
concurrency:
group: epoch-tests-${{ github.head_ref || github.ref || github.run_id }}
## Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Epoch integration tests with code coverage
epoch-tests:
name: Epoch Tests
runs-on: ubuntu-latest
strategy:
## Continue with the test matrix even if we've had a failure
fail-fast: false
## Run a maximum of 32 concurrent tests from the test matrix
max-parallel: 32
matrix:
test-name:
- tests::epoch_205::bigger_microblock_streams_in_2_05
- tests::epoch_205::test_cost_limit_switch_version205
- tests::epoch_205::test_dynamic_db_method_costs
- tests::epoch_205::test_exact_block_costs
- tests::epoch_205::transition_empty_blocks
- tests::epoch_21::test_pox_missing_five_anchor_blocks
- tests::epoch_21::test_pox_reorg_one_flap
- tests::epoch_21::test_pox_reorgs_three_flaps
- tests::epoch_21::test_sortition_divergence_pre_21
- tests::epoch_21::test_v1_unlock_height_with_current_stackers
- tests::epoch_21::test_v1_unlock_height_with_delay_and_current_stackers
- tests::epoch_21::trait_invocation_cross_epoch
- tests::epoch_21::transition_adds_burn_block_height
- tests::epoch_21::transition_adds_get_pox_addr_recipients
- tests::epoch_21::transition_adds_mining_from_segwit
- tests::epoch_21::transition_adds_pay_to_contract
- tests::epoch_21::transition_empty_blocks
- tests::epoch_21::transition_fixes_bitcoin_rigidity
- tests::epoch_21::transition_removes_pox_sunset
- tests::epoch_22::disable_pox
- tests::epoch_22::pox_2_unlock_all
- tests::epoch_22::test_pox_reorg_one_flap
- tests::epoch_23::trait_invocation_behavior
- tests::epoch_24::fix_to_pox_contract
- tests::epoch_24::verify_auto_unlock_behavior
steps:
## Setup test environment
- name: Setup Test Environment
id: setup_tests
uses: stacks-network/actions/stacks-core/testenv@main
## Run test matrix using restored cache of archive file
## - Test will timeout after env.TEST_TIMEOUT minutes
- name: Run Tests
id: run_tests
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
uses: stacks-network/actions/stacks-core/run-tests@main
with:
test-name: ${{ matrix.test-name }}
threads: 1
## Create and upload code coverage file
- name: Code Coverage
id: codecov
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}

View File

@@ -1,50 +1,75 @@
##
## Create the github release and store artifact files (with checksum)
##
## Github workflow to create a github release and upload binary artifacts
name: Github Release
# Only run when:
# - manually triggered via the ci.yml workflow
on:
workflow_call:
inputs:
tag:
required: true
type: string
arch:
description: "Stringified JSON object listing of platform matrix"
description: "Release Tag"
required: true
type: string
secrets:
GH_TOKEN:
required: true
concurrency:
group: github-release-${{ github.head_ref || github.ref }}
## Always cancel duplicate jobs
cancel-in-progress: true
run-name: ${{ inputs.tag }}
jobs:
## Build arch dependent binaries from source
##
## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
build-binaries:
if: |
inputs.tag != '' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
name: Build Binaries
uses: ./.github/workflows/create-source-binary.yml
with:
tag: ${{ inputs.tag }}
secrets: inherit
## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
create-release:
if: ${{ inputs.tag != '' }}
if: |
inputs.tag != '' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
name: Create Release
runs-on: ubuntu-latest
needs:
- build-binaries
steps:
## Downloads the artifacts built in `create-source-binary.yml`
- name: Download Artifacts
id: download_artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: artifact
path: release
# Generate a checksums file to be added to the release page
## Generate a checksums file to be added to the release page
- name: Generate Checksums
id: generate_checksum
uses: jmgilman/actions-generate-checksum@v1
uses: jmgilman/actions-generate-checksum@24a35957fba81c6cbaefeb1e3d59ee56e3db5077 # v1.0.0
with:
method: sha512
output: CHECKSUMS.txt
patterns: |
release/*.zip
# Upload the release archives with the checksums file
## Upload the release archives with the checksums file
- name: Upload Release
id: upload_release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 #v0.1.15
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
@@ -56,3 +81,21 @@ jobs:
files: |
release/*.zip
CHECKSUMS.txt
## Builds arch dependent Docker images from binaries
##
## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
docker-image:
if: |
inputs.tag != '' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
name: Docker Image (Binary)
uses: ./.github/workflows/image-build-binary.yml
needs:
- build-binaries
- create-release
with:
tag: ${{ inputs.tag }}
secrets: inherit

View File

@@ -1,84 +0,0 @@
##
## Build the Docker Alpine image from the pre-built downloaded binary asset
##
name: Build Alpine Binary Image
# Only run when:
# - manually triggered via the ci.yml workflow
on:
workflow_call:
inputs:
tag:
required: true
type: string
description: "semver tag for alpine images"
docker_platforms:
required: true
description: "Arch to buid alpine images"
type: string
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_PASSWORD:
required: true
jobs:
image:
# Only run if a tag is provided manually
if: ${{ inputs.tag != '' }}
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Set Vars
id: set_vars
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "DOCKER_PUSH=${{ (secrets.DOCKERHUB_USERNAME != '') && (secrets.DOCKERHUB_PASSWORD != '') }}" >> $GITHUB_ENV
- name: Set up QEMU
id: docker_qemu
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: docker_buildx
uses: docker/setup-buildx-action@v2
# tag image with:
# latest: `latest`
# input tag: `<input tag>`
# git tag: `1234`
- name: Docker Metadata
id: docker_metadata
uses: docker/metadata-action@v4
with:
images: |
blockstack/${{ github.event.repository.name }}
tags: |
type=raw,value=latest,enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) )}}
type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }}
type=ref,event=tag,enable=true
- name: Login to DockerHub
id: docker_login
uses: docker/login-action@v2
# Only attempt login and push if we have credentials
if: env.DOCKER_PUSH == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push
id: docker_build
uses: docker/build-push-action@v3
with:
file: ./.github/actions/dockerfiles/Dockerfile.alpine-binary
platforms: ${{ inputs.docker_platforms }}
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
build-args: |
TAG=${{ inputs.tag}}
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
push: ${{ env.DOCKER_PUSH }}

View File

@@ -0,0 +1,89 @@
## Github workflow to build a multiarch docker image from pre-built binaries
name: Docker Image (Binary)
on:
workflow_call:
inputs:
tag:
required: true
type: string
description: "Version tag for alpine images"
docker-org:
required: false
type: string
description: "Docker repo org for uploading images (defaults to github org)"
default: "${GITHUB_REPOSITORY_OWNER}"
## Define which docker arch to build for
env:
docker_platforms: "linux/arm64, linux/arm/v7, linux/amd64, linux/amd64/v2, linux/amd64/v3"
docker-org: blockstack
concurrency:
group: docker-image-binary-${{ github.head_ref || github.ref || github.run_id }}
## Always cancel duplicate jobs
cancel-in-progress: true
run-name: ${{ inputs.tag }}
jobs:
## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
image:
if: |
inputs.tag != '' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
name: Build Image
runs-on: ubuntu-latest
strategy:
fail-fast: false
## Build a maximum of 2 images concurrently based on matrix.dist
max-parallel: 2
matrix:
dist:
- alpine
- debian
steps:
## Setup Docker for the builds
- name: Docker setup
uses: stacks-network/actions/docker@main
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
## Set docker metatdata
## - depending on the matrix.dist, different tags will be enabled
## ex. alpine will have this tag: `type=ref,event=tag,enable=${{ matrix.dist == 'alpine' }}`
- name: Docker Metadata ( ${{matrix.dist}} )
id: docker_metadata
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 #v5.0.0
with:
images: |
${{env.docker-org}}/${{ github.event.repository.name }}
${{env.docker-org}}/stacks-blockchain
tags: |
type=raw,value=latest,enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'alpine' }}
type=raw,value=${{ inputs.tag }}-${{ matrix.dist }},enable=${{ inputs.tag != '' && matrix.dist == 'alpine'}}
type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' && matrix.dist == 'alpine' }}
type=ref,event=tag,enable=${{ matrix.dist == 'alpine' }}
type=raw,value=latest-${{ matrix.dist }},enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'debian' }}
type=raw,value=${{ inputs.tag }}-${{ matrix.dist }},enable=${{ inputs.tag != '' && matrix.dist == 'debian' }}
## Build docker image for release
- name: Build and Push ( ${{matrix.dist}} )
id: docker_build
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
file: ./.github/actions/dockerfiles/Dockerfile.${{ matrix.dist }}-binary
platforms: ${{ env.docker_platforms }}
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
build-args: |
TAG=${{ inputs.tag }}
REPO=${{ github.repository_owner }}/${{ github.event.repository.name }}
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
push: ${{ env.DOCKER_PUSH }}

View File

@@ -1,95 +0,0 @@
##
## Build the Docker Debian image from the pre-built downloaded binary asset
##
name: Build Linux Binary Image
# Only run when:
# - manually triggered via the ci.yml workflow
on:
workflow_call:
inputs:
tag:
required: true
type: string
description: "semver tag for linux images"
docker_platforms:
required: true
description: "Arch to buid linux images"
type: string
linux_version:
required: true
description: "Linux image to build"
type: string
default: debian
build_type:
required: true
description: Build type (source/binary)
type: string
default: binary
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_PASSWORD:
required: true
jobs:
image:
# Only run if a tag is provided manually
if: ${{ inputs.tag != '' }}
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Set Vars
id: set_vars
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "DOCKER_PUSH=${{ (secrets.DOCKERHUB_USERNAME != '') && (secrets.DOCKERHUB_PASSWORD != '') }}" >> $GITHUB_ENV
- name: Set up QEMU
id: docker_qemu
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: docker_buildx
uses: docker/setup-buildx-action@v2
- name: Extract branch name
id: extract_branch
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
# tag image with:
# branch name: `latest-<linux version>`
# input tag: `<input tag>-<linux version>`
- name: Docker Metadata
id: docker_metadata
uses: docker/metadata-action@v4
with:
images: |
blockstack/${{ github.event.repository.name }}
tags: |
type=raw,value=latest-${{ inputs.linux_version }},enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) )}}
type=raw,value=${{ inputs.tag }}-${{ inputs.linux_version }},enable=${{ inputs.tag != '' }}
- name: Login to DockerHub
id: docker_login
uses: docker/login-action@v2
# Only attempt login and push if we have credentials
if: env.DOCKER_PUSH == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push
id: docker_build
uses: docker/build-push-action@v3
with:
file: ./.github/actions/dockerfiles/Dockerfile.${{ inputs.linux_version }}-${{ inputs.build_type }}
platforms: ${{ inputs.docker_platforms }}
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
build-args: |
TAG=${{ inputs.tag}}
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
push: ${{ env.DOCKER_PUSH }}

View File

@@ -1,93 +0,0 @@
##
## Build the Docker Debian image from source
##
name: Build Linux Source Image
# Only run when:
# - workflow is manually triggered
# - manually triggered via the ci.yml workflow
on:
workflow_dispatch:
workflow_call:
inputs:
docker_platforms:
required: true
description: "Arch to buid images"
type: string
default: linux/amd64
linux_version:
required: true
description: "Linux image to build"
type: string
default: debian
build_type:
required: true
description: Build type (source/binary)
type: string
default: source
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_PASSWORD:
required: true
jobs:
image:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Set Vars
id: set_vars
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "DOCKER_PUSH=${{ (secrets.DOCKERHUB_USERNAME != '') && (secrets.DOCKERHUB_PASSWORD != '') }}" >> $GITHUB_ENV
- name: Set up QEMU
id: docker_qemu
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: docker_buildx
uses: docker/setup-buildx-action@v2
- name: Extract branch name
id: extract_branch
if: ${{ github.event_name != 'pull_request' }}
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Extract branch name (PR)
id: extract_branch_pr
if: ${{ github.event_name == 'pull_request' }}
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV
- name: Docker Metadata
id: docker_metadata
uses: docker/metadata-action@v4
with:
images: |
blockstack/${{ github.event.repository.name }}
tags: |
type=raw,value=${{ env.BRANCH_NAME }}
type=ref,event=pr
- name: Login to DockerHub
id: docker_login
uses: docker/login-action@v2
# Only attempt login and push if we have credentials
if: env.DOCKER_PUSH == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push
id: docker_build
uses: docker/build-push-action@v3
with:
file: ./.github/actions/dockerfiles/Dockerfile.${{ inputs.linux_version }}-${{ inputs.build_type }}
platforms: ${{ inputs.docker_platforms }}
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
build-args: |
STACKS_NODE_VERSION=${{ env.GITHUB_SHA_SHORT }}
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
push: ${{ env.DOCKER_PUSH }}

View File

@@ -0,0 +1,65 @@
## Github workflow to build a docker image from source
name: Docker Image (Source)
on:
workflow_dispatch:
workflow_call:
## Define which docker arch to build for
env:
docker_platforms: linux/amd64
docker-org: blockstack
concurrency:
group: docker-image-source-${{ github.head_ref || github.ref || github.run_id }}
## Always cancel duplicate jobs
cancel-in-progress: true
jobs:
## Runs anytime `ci.yml` runs or when manually called
image:
name: Build Image
runs-on: ubuntu-latest
strategy:
fail-fast: false
## Build a maximum of 2 images concurrently based on matrix.dist
max-parallel: 2
matrix:
dist:
- debian
steps:
## Setup Docker for the builds
- name: Docker setup
uses: stacks-network/actions/docker@main
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
## Set docker metatdata
- name: Docker Metadata ( ${{matrix.dist}} )
id: docker_metadata
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 #v5.0.0
with:
images: |
${{env.docker-org}}/${{ github.event.repository.name }}
${{env.docker-org}}/stacks-blockchain
tags: |
type=raw,value=${{ env.BRANCH_NAME }}
type=ref,event=pr
## Build docker image
- name: Build and Push ( ${{matrix.dist}} )
id: docker_build
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
file: ./.github/actions/dockerfiles/Dockerfile.${{matrix.dist}}-source
platforms: ${{ env.docker_platforms }}
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
build-args: |
REPO=${{ github.repository_owner }}/${{ github.event.repository.name }}
STACKS_NODE_VERSION=${{ env.GITHUB_SHA_SHORT }}
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
push: ${{ env.DOCKER_PUSH }}

56
.github/workflows/slow-tests.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
## Github workflow to run slow tests
name: Tests::Slow
on:
workflow_call:
## env vars are transferred to composite action steps
env:
BITCOIND_TEST: 1
RUST_BACKTRACE: full
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15
TEST_TIMEOUT: 30
concurrency:
group: slow-tests-${{ github.head_ref || github.ref || github.run_id }}
## Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Slow integration tests with code coverage
slow-tests:
name: Slow Tests
runs-on: ubuntu-latest
strategy:
## Continue with the test matrix even if we've had a failure
fail-fast: false
## Run a maximum of 2 concurrent tests from the test matrix
max-parallel: 2
matrix:
## Each of these tests should take ~20 minutes if they are successful
test-name:
- tests::epoch_21::test_pox_reorg_flap_duel
- tests::epoch_21::test_pox_reorg_flap_reward_cycles
steps:
## Setup test environment
- name: Setup Test Environment
id: setup_tests
uses: stacks-network/actions/stacks-core/testenv@main
## Run test matrix using restored cache of archive file
## - Test will timeout after env.TEST_TIMEOUT minutes
- name: Run Tests
id: run_tests
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
uses: stacks-network/actions/stacks-core/run-tests@main
with:
test-name: ${{ matrix.test-name }}
threads: 1
## Create and upload code coverage file
- name: Code Coverage
id: codecov
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}

View File

@@ -1,179 +0,0 @@
##
## Run tests for tagged releases
##
name: Tests
# Only run when:
# - manually triggered via the ci.yml workflow
on:
workflow_call:
jobs:
# Run full genesis test
full-genesis:
name: Full Genesis Test
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Reclaim disk space
id: cleanup
run: |
sudo apt-get update
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
sudo apt-get autoremove -y
sudo apt-get clean
docker system prune --force
- name: Single full genesis integration test
id: full_genesis_test
env:
DOCKER_BUILDKIT: 1
# Remove .dockerignore file so codecov has access to git info
run: |
rm .dockerignore
docker build -o coverage-output -f ./.github/actions/bitcoin-int-tests/Dockerfile.large-genesis .
- name: Large Genesis Codecov
id: full_genesis_codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage-output/lcov.info
name: large_genesis
fail_ci_if_error: false
# Run unit tests with code coverage
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Add code coverage tools
run: |
rustup component add llvm-tools-preview
cargo install grcov
- name: Add nextest
run: |
cargo install cargo-nextest
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Run units tests (with coverage)
id: unit_tests_codecov
# unset the coverage instrumentation flags.
# these slow tests down a lot locally (5-10x), and since
# grcov cannot collect this coverage data right now anyways,
# this is a speed win.
#env:
# RUSTFLAGS: -Cinstrument-coverage
# LLVM_PROFILE_FILE: stacks-blockchain-%p-%m.profraw
run: |
cargo nextest run --workspace
cargo nextest run --package clarity --features developer-mode
- name: Collate grcov
# grcov doesn't work with cargo nextest currently, getting
# that to work again will have to happen separately. Getting unit
# test run times below 2 hours is more important for now.
if: ${{ false }}
id: unit_tests_grcov
env:
RUSTFLAGS: -Cinstrument-coverage
LLVM_PROFILE_FILE: stacks-blockchain-%p-%m.profraw
run: |
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
- name: Upload codecov results
# grcov doesn't work with cargo nextest currently, getting
# that to work again will have to happen separately. Getting unit
# test run times below 2 hours is more important for now.
if: ${{ false }}
uses: codecov/codecov-action@v3
id: codedov
with:
files: ./lcov.info
name: unit_tests
fail_ci_if_error: false
open-api-validation:
name: OpenAPI Validation
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Run units tests (with coverage)
id: api_codecov
env:
DOCKER_BUILDKIT: 1
run: docker build -o dist/ -f .github/actions/open-api/Dockerfile.open-api-validate .
- name: Upload bundled html
id: upload_html_artifact
uses: actions/upload-artifact@v3
with:
name: open-api-bundle
path: |
dist
# Run net-tests
nettest:
# disable this job/test for now, since we haven't seen this pass
# on github actions in a while, and the failures can take > 4 hours
if: ${{ false }}
name: Net-Test
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Run network relay tests
id: nettest
env:
DOCKER_BUILDKIT: 1
run: docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.net-tests .
# Core contract tests
core-contracts-clarinet-test:
name: Core Contracts Test
defaults:
run:
working-directory: "./contrib/core-contract-tests/"
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Execute core contract unit tests with clarinet-sdk
id: clarinet_unit_test
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "npm"
cache-dependency-path: "./contrib/core-contract-tests/package-lock.json"
- run: npm ci
- run: npm test
- name: Export code coverage
id: clarinet_codecov
uses: codecov/codecov-action@v3
with:
files: ./lcov.info
verbose: true
# Core contract tests on Clarinet v1
# Check for false positives/negatives
# https://github.com/stacks-network/stacks-blockchain/pull/4031#pullrequestreview-1713341208
core-contracts-clarinet-test-clarinet-v1:
name: Core Contracts Test Clarinet V1
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Execute core contract unit tests in Clarinet
id: clarinet_unit_test_v1
uses: docker://hirosystems/clarinet:1.7.1
with:
args: test --manifest-path=./contrib/core-contract-tests/Clarinet.toml contrib/core-contract-tests/tests/bns/name_register_test.ts

159
.github/workflows/stacks-core-tests.yml vendored Normal file
View File

@@ -0,0 +1,159 @@
## Github workflow to run full genesis and unit tests
name: Tests::Stacks Core
on:
workflow_call:
## env vars are transferred to composite action steps
env:
BITCOIND_TEST: 1
RUST_BACKTRACE: full
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
TEST_TIMEOUT: 30
concurrency:
group: stacks-core-tests-${{ github.head_ref || github.ref || github.run_id }}
## Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Full genesis test with code coverage
full-genesis:
name: Full Genesis Test
runs-on: ubuntu-latest
strategy:
## Continue with the test matrix even if we've had a failure
fail-fast: false
## Run a maximum of 2 concurrent tests from the test matrix
max-parallel: 2
matrix:
test-name:
- neon_integrations::bitcoind_integration_test
steps:
## Setup test environment
- name: Setup Test Environment
id: setup_tests
uses: stacks-network/actions/stacks-core/testenv@main
with:
genesis: true
## Run test matrix using restored cache of archive file
## - Test will timeout after env.TEST_TIMEOUT minutes
- name: Run Tests
id: run_tests
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
uses: stacks-network/actions/stacks-core/run-tests@main
with:
test-name: ${{ matrix.test-name }}
threads: 1
archive-file: ~/genesis_archive.tar.zst
## Upload code coverage file
- name: Code Coverage
id: codecov
uses: stacks-network/actions/codecov@main
with:
test-name: large_genesis
filename: ./lcov.info
- name: Status Output
run: |
echo "run_tests: ${{ steps.run_tests.outputs.status }}"
echo "codecov: ${{ steps.codecov.outputs.status }}"
- name: Check Failures
if: steps.run_tests.outputs.status == 'failure' || steps.codecov.outputs.status == 'failure'
run: exit 1
# Unit tests with code coverage
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
## Continue the workflow in case a step fails (ex a single test fails)
continue-on-error: true
strategy:
## Continue the workflow in case a step fails (ex a single test fails)
fail-fast: false
matrix:
## Partition the tests into 8 jobs
## - This is used in a later step when running `cargo nextest run ... --partition count:num/8`
partition: [1, 2, 3, 4, 5, 6, 7, 8]
steps:
## Setup test environment
- name: Setup Test Environment
id: setup_tests
uses: stacks-network/actions/stacks-core/testenv@main
## Run test matrix using restored cache of archive file
## - Test will timeout after env.TEST_TIMEOUT minutes
- name: Run Tests
id: run_tests
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
uses: stacks-network/actions/stacks-core/run-tests/partition@main
with:
partition: ${{ matrix.partition }}
total-partitions: 8
## Create and upload code coverage file
- name: Code Coverage
id: codecov
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}
## Generate and upload openapi html artifact
open-api-validation:
name: OpenAPI Validation
runs-on: ubuntu-latest
steps:
- name: OpenAPI
id: openapi
uses: stacks-network/actions/openapi@main
with:
input: ./docs/rpc/openapi.yaml
output: ./open-api-docs.html
## Disabled
## - this test can take several hours to run
nettest:
if: ${{ false }}
name: Net-Test
runs-on: ubuntu-latest
steps:
## checkout the code
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run network relay tests
id: nettest
env:
DOCKER_BUILDKIT: 1
run: docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.net-tests .
# Core contract tests
core-contracts-clarinet-test:
name: Core Contracts Test
runs-on: ubuntu-latest
steps:
## Checkout the code
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
## Use Clarinet to run contract unit-tests and create code coverage file
- name: Execute core contract unit tests in Clarinet
id: clarinet_unit_test
uses: docker://hirosystems/clarinet:1.8.0
with:
args: test --coverage --manifest-path=./contrib/core-contract-tests/Clarinet.toml
## Upload code coverage file
- name: Code Coverage
id: codecov
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}
upload-only: true
filename: ./coverage.lcov

115
.github/workflows/standalone-tests.yml vendored Normal file
View File

@@ -0,0 +1,115 @@
## Github workflow to run specified tests on demand
name: Standalone Tests
on:
workflow_call:
inputs:
workflow:
description: "Tests to run (required)"
required: true
type: string
workflow_dispatch:
inputs:
workflow:
description: "Tests to run (required)"
required: true
type: choice
options:
- Release Tests
- CI Tests
- Atlas Tests
- Bitcoin Tests
- Epoch Tests
- Slow Tests
- Stacks-Core Tests
## Set the display name to the test being run
run-name: ${{ inputs.workflow }}
jobs:
## Runs every time to either create the required caches or confirm they already exist
create-cache:
name: Create Test Cache
uses: ./.github/workflows/create-cache.yml
#####################################################
## Runs when:
## either or of the following:
## - workflow is 'Release Tests'
## - workflow is 'CI Tests'
## - workflow is 'Stacks-Core Tests'
stacks-core-tests:
if: |
(
inputs.workflow == 'Release Tests' ||
inputs.workflow == 'CI Tests' ||
inputs.workflow == 'Stacks-Core Tests'
)
name: Stacks Core Tests
needs:
- create-cache
uses: ./.github/workflows/stacks-core-tests.yml
## Runs when:
## either or of the following:
## - workflow is 'Release Tests'
## - workflow is 'CI Tests'
## - workflow is 'Bitcoin Tests'
bitcoin-tests:
if: |
(
inputs.workflow == 'Release Tests' ||
inputs.workflow == 'CI Tests' ||
inputs.workflow == 'Bitcoin Tests'
)
name: Bitcoin Tests
needs:
- create-cache
uses: ./.github/workflows/bitcoin-tests.yml
#####################################################
## Runs when:
## either or of the following:
## - workflow is 'Release Tests'
## - workflow is 'Atlas Tests'
atlas-tests:
if: |
(
inputs.workflow == 'Release Tests' ||
inputs.workflow == 'Atlas Tests'
)
name: Atlas Tests
needs:
- create-cache
uses: ./.github/workflows/atlas-tests.yml
## Runs when:
## either or of the following:
## - workflow is 'Release Tests'
## - workflow is 'Epoch Tests'
epoch-tests:
if: |
(
inputs.workflow == 'Release Tests' ||
inputs.workflow == 'Epoch Tests'
)
name: Epoch Tests
needs:
- create-cache
uses: ./.github/workflows/epoch-tests.yml
## Runs when:
## either or of the following:
## - workflow is 'Release Tests'
## - workflow is 'Slow Tests'
slow-tests:
if: |
(
inputs.workflow == 'Release Tests' ||
inputs.workflow == 'Slow Tests'
)
name: Slow Tests
needs:
- create-cache
uses: ./.github/workflows/slow-tests.yml

47
.github/workflows/workflow-cleanup.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
## Github workflow to clean up old caches and workflow runs
name: Workflow Cleanup
on:
workflow_dispatch:
inputs:
cache-ttl:
description: "How many days to keep a cache (default: 7)"
required: false
default: "7"
workflow-ttl:
description: "How many days to keep a successful workflow (default: 30)"
required: false
default: "30"
failed-workflow-ttl:
description: "How many days to keep failed workflows (default: 15)"
required: false
default: "15"
schedule:
## Run every day at 00:00:00
- cron: "0 0 * * *"
## env vars are transferred to composite action steps
env:
CACHE_TTL: 7 ## number of days to keep a cache
WORKFLOW_TTL: 30 ## number of days to keep a successful workflow
FAILED_WORKFLOW_TTL: 15 ## number of days to keep a failed workflow
concurrency:
group: cleanup-${{ github.head_ref || github.ref }}
## Always cancel duplicate jobs
cancel-in-progress: true
jobs:
workflow-cleanup:
name: Workflow Cleanup
runs-on: ubuntu-latest
steps:
- name: Cleanup
id: cleanup
uses: stacks-network/actions/cleanup/workflows@main
with:
token: ${{ secrets.GH_TOKEN }}
cache-ttl: ${{ inputs.cache-ttl || env.CACHE_TTL}}
workflow-ttl: ${{ inputs.workflow-ttl || env.WORKFLOW_TTL}}
failed-workflow-ttl: ${{ inputs.failed-workflow-ttl || env.FAILED_WORKFLOW_TTL }}

View File

@@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
## [2.4.0.0.4]
This is a high-priority hotfix that addresses a bug in transaction processing which
could impact miner availability.
## [2.4.0.0.3]
This is a high-priority hotfix that addresses a bug in transaction processing which
could impact miner availability.
## [2.4.0.0.2]
This is a hotfix that changes the logging failure behavior from panicking to dropping
the log message (PR #3784).
## [2.4.0.0.4]
This is a high-priority hotfix that addresses a bug in transaction processing which
could impact miner availability.
## [2.4.0.0.3]
This is a high-priority hotfix that addresses a bug in transaction processing which
could impact miner availability.
## [2.4.0.0.2]
This is a hotfix that changes the logging failure behavior from panicking to dropping
the log message (PR #3784).
## [Unreleased]
### Added
@@ -16,8 +46,8 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
- New RPC endpoint at /v2/constant_val to fetch a constant from a contract.
- A new subsystem, called StackerDB, has been added, which allows a set of
Stacks nodes to store off-chain data on behalf of a specially-crafter smart
contract. This is an opt-in feature; Stacks nodes explicitly subscribe to
StackerDB replicas in their config files.
contract. This is an opt-in feature; Stacks nodes explicitly subscribe to
StackerDB replicas in their config files.
- Message definitions and codecs for Stacker DB, a replicated off-chain DB
hosted by subscribed Stacks nodes and controlled by smart contracts
- Added 3 new public and regionally diverse bootstrap nodes: est.stacksnodes.org, cet.stacksnodes.org, sgt.stacksnodes.org
@@ -34,10 +64,10 @@ StackerDB replicas in their config files.
a result of `(err none)` if the top-level code of the smart contract contained
runtime error and include details about the error in the `vm_error` field of
the receipt. Fixes issues #3154, #3328.
- Added config setting `burnchain.wallet_name` which addresses blank wallets no
- Added config setting `burnchain.wallet_name` which addresses blank wallets no
longer being created by default in recent bitcoin versions. Fixes issue #3596
- Use the current burnchain tip to lookup UTXOs (Issue #3733)
- The node now gracefully shuts down even if it is in the middle of a handshake with
- The node now gracefully shuts down even if it is in the middle of a handshake with
bitcoind. Fixes issue #3734.
## [2.4.0.0.1]
@@ -47,12 +77,14 @@ contract deploys. This will help tools (and users) more easily find the log
messages to determine what went wrong.
## [2.4.0.0.0]
This is a **consensus-breaking** release to revert consensus to PoX, and is the second fork proposed in SIP-022.
- [SIP-022](https://github.com/stacksgov/sips/blob/main/sips/sip-022/sip-022-emergency-pox-fix.md)
- [SIP-024](https://github.com/stacksgov/sips/blob/main/sips/sip-024/sip-024-least-supertype-fix.md)
### Fixed
- PoX is re-enabled and stacking resumes starting at Bitcoin block `791551`
- Peer network id is updated to `0x18000009`
- Adds the type sanitization described in SIP-024
@@ -69,6 +101,7 @@ This release is compatible with chainstate directories from 2.3.0.0.x and 2.1.0.
## [2.3.0.0.1]
This is a hotfix release to update:
- peer version identifier used by the stacks-node p2p network.
- yield interpreter errors in deser_hex
@@ -114,7 +147,7 @@ compatible with chainstate directories from 2.1.0.0.1.
- Handle the case where a bitcoin node returns zero headers (#3588)
- The default value for `always_use_affirmation_maps` is now set to `false`,
instead of `true`. This was preventing testnet nodes from reaching the chain
instead of `true`. This was preventing testnet nodes from reaching the chain
tip with the default configuration.
- Reduce default poll time of the `chain-liveness` thread which reduces the
possibility that a miner thread will get interrupted (#3610).
@@ -122,7 +155,7 @@ compatible with chainstate directories from 2.1.0.0.1.
## [2.1]
This is a **consensus-breaking** release that introduces a _lot_ of new
functionality. Details on the how and why can be found in [SIP-015](https://github.com/stacksgov/sips/blob/feat/sip-015/sips/sip-015/sip-015-network-upgrade.md),
functionality. Details on the how and why can be found in [SIP-015](https://github.com/stacksgov/sips/blob/feat/sip-015/sips/sip-015/sip-015-network-upgrade.md),
[SIP-018](https://github.com/MarvinJanssen/sips/blob/feat/signed-structured-data/sips/sip-018/sip-018-signed-structured-data.md),
and [SIP-20](https://github.com/obycode/sips/blob/bitwise-ops/sips/sip-020/sip-020-bitwise-ops.md).
@@ -130,24 +163,24 @@ The changelog for this release is a high-level summary of these SIPs.
### Added
- There is a new `.pox-2` contract for implementing proof-of-transfer. This PoX
- There is a new `.pox-2` contract for implementing proof-of-transfer. This PoX
contract enables re-stacking while the user's STX are locked, and incrementing
the amount stacked on top of a locked batch of STX.
the amount stacked on top of a locked batch of STX.
- The Clarity function `stx-account` has been added, which returns the account's
locked and unlocked balances.
- The Clarity functions `principal-destruct` and `principal-construct?`
functions have been added, which provide the means to convert between a
`principal` instance and the `buff`s and `string-ascii`s that constitute it.
`principal` instance and the `buff`s and `string-ascii`s that constitute it.
- The Clarity function `get-burn-block-info?` has been added to support
fetching the burnchain header hash of _any_ burnchain block starting from the
sortition height of the Stacks genesis block, and to support fetching the PoX
addresses and rewards paid by miners for a particular burnchain block height.
sortition height of the Stacks genesis block, and to support fetching the PoX
addresses and rewards paid by miners for a particular burnchain block height.
- The Clarity function `slice` has been added for obtaining a sub-sequence of a
`buff`, `string-ascii`, `string-utf8`, or `list`.
- Clarity functions for converting between `string-ascii`, `string-utf8`,
`uint`, and `int` have been added.
- Clarity functions for converting between big- and little-endian
`buff` representations of `int` and `uint` have been added.
`buff` representations of `int` and `uint` have been added.
- The Clarity function `stx-transfer-memo?` has been added, which behaves the
same as `stx-transfer?` but also takes a memo argument.
- The Clarity function `is-standard` has been added to identify whether or not a
@@ -164,16 +197,16 @@ addresses and rewards paid by miners for a particular burnchain block height.
Stacks 2.05.x.x.x.
- Clarity trait semantics have been refined and made more explicit, so as to
avoid certain corner cases where a trait reference might be downgraded to a
`principal` in Clarity 1.
* Trait values can be passed to compatible sub-trait types
* Traits can be embedded in compound types, e.g. `(optional <my-trait>)`
* Traits can be assigned to a let-variable
`principal` in Clarity 1.
- Trait values can be passed to compatible sub-trait types
- Traits can be embedded in compound types, e.g. `(optional <my-trait>)`
- Traits can be assigned to a let-variable
- Fixes to unexpected behavior in traits
* A trait with duplicate function names is now an error
* Aliased trait names do not interfere with local trait definitions
- A trait with duplicate function names is now an error
- Aliased trait names do not interfere with local trait definitions
- The comparison functions `<`, `<=`, `>`, and `>=` now work on `string-ascii`,
`string-utf8`, and `buff` based on byte-by-byte comparison (note that this is
_not_ lexicographic comparison).
_not_ lexicographic comparison).
- It is now possible to call `delegate-stx` from a burnchain transaction, just
as it is for `stack-stx` and `transfer-stx`.
@@ -183,30 +216,30 @@ _not_ lexicographic comparison).
locked.
- If a batch of STX is not enough to clinch even a single reward slot, then the
STX are automatically unlocked at the start of the reward cycle in which they
are rendered useless in this capacity.
- The PoX sunset has been removed. PoX rewards will continue in perpetuity.
are rendered useless in this capacity.
- The PoX sunset has been removed. PoX rewards will continue in perpetuity.
- Support for segwit and taproot addresses (v0 and v1 witness programs) has been
added for Stacking.
- The Clarity function `get-block-info?` now supports querying a block's total
burnchain spend by miners who tried to mine it, the spend by the winner, and
the total block reward (coinbase plus transaction fees).
the total block reward (coinbase plus transaction fees).
- A block's coinbase transaction may specify an alternative recipient principal,
which can be either a standard or contract principal.
- A smart contract transaction can specify which version of Clarity to use. If
- A smart contract transaction can specify which version of Clarity to use. If
no version is given, then the epoch-default version will be used (in Stacks
2.1, this is Clarity 2).
2.1, this is Clarity 2).
- The Stacks node now includes the number of PoX anchor blocks in its
fork-choice rules. The best Stacks fork is the fork that (1) is on the best
Bitcoin fork, (2) has the most PoX anchor blocks known, and (3) is the longest.
Bitcoin fork, (2) has the most PoX anchor blocks known, and (3) is the longest.
- On-burnchain operations -- `stack-stx`, `delegate-stx`, and `transfer-stx` --
can take effect within six (6) burnchain blocks in which they are mined,
instead of one.
instead of one.
- Transaction fees are debited from accounts _before_ the transaction is
processed.
- All smart contract analysis errors are now treated as runtime errors, meaning
that smart contract transactions which don't pass analysis will still be mined
(so miners get paid for partially validating them).
- The default Clarity version is now 2. Users can opt for version 1 by using
(so miners get paid for partially validating them).
- The default Clarity version is now 2. Users can opt for version 1 by using
the new smart contract transaction wire format and explicitly setting version
### Fixed
@@ -217,7 +250,7 @@ instead of one.
- One or more late block-commits no longer result in the miner losing its
sortition weight.
- Documentation will indicate explicitly which Clarity version introduced each
keyword or function.
keyword or function.
## [2.05.0.6.0]
@@ -227,21 +260,21 @@ instead of one.
nodes can find high-quality nodes to boot from (#3401)
- If there are two or more Stacks chain tips that are tied for the canonical
tip, the node deterministically chooses one _independent_ of the arrival order
(#3419).
(#3419).
- If Stacks blocks for a different fork arrive out-of-order and, in doing so,
constitute a better fork than the fork the node considers canonical, the node
will update the canonical Stacks tip pointer in the sortition DB before
processing the next sortition (#3419).
will update the canonical Stacks tip pointer in the sortition DB before
processing the next sortition (#3419).
### Fixed
- The node keychain no longer maintains any internal state, but instead derives
keys based on the chain tip the miner is building off of. This prevents the
node from accidentally producing an invalid block that reuses a microblock
public key hash (#3387).
keys based on the chain tip the miner is building off of. This prevents the
node from accidentally producing an invalid block that reuses a microblock
public key hash (#3387).
- If a node mines an invalid block for some reason, it will no longer stall
forever. Instead, it will detect that its last-mined block is not the chain
tip, and resume mining (#3406).
forever. Instead, it will detect that its last-mined block is not the chain
tip, and resume mining (#3406).
## [2.05.0.5.0]
@@ -250,19 +283,19 @@ tip, and resume mining (#3406).
- The new minimum Rust version is 1.61
- The act of walking the mempool will now cache address nonces in RAM and to a
temporary mempool table used for the purpose, instead of unconditionally
querying them from the chainstate MARF. This builds upon improvements to mempool
goodput over 2.05.0.4.0 (#3337).
querying them from the chainstate MARF. This builds upon improvements to mempool
goodput over 2.05.0.4.0 (#3337).
- The node and miner implementation has been refactored to remove write-lock
contention that can arise when the node's chains-coordinator thread attempts to store and
process newly-discovered (or newly-mined) blocks, and when the node's relayer
thread attempts to mine a new block. In addition, the miner logic has been
moved to a separate thread in order to avoid starving the relayer thread (which
must handle block and transaction propagation, as well as block-processing).
The refactored miner thread will be preemptively terminated and restarted
by the arrival of new Stacks blocks or burnchain blocks, which further
prevents the miner from holding open write-locks in the underlying
chainstate databases when there is new chain data to discover (which would
invalidate the miner's work anyway). (#3335).
process newly-discovered (or newly-mined) blocks, and when the node's relayer
thread attempts to mine a new block. In addition, the miner logic has been
moved to a separate thread in order to avoid starving the relayer thread (which
must handle block and transaction propagation, as well as block-processing).
The refactored miner thread will be preemptively terminated and restarted
by the arrival of new Stacks blocks or burnchain blocks, which further
prevents the miner from holding open write-locks in the underlying
chainstate databases when there is new chain data to discover (which would
invalidate the miner's work anyway). (#3335).
### Fixed
@@ -274,9 +307,8 @@ invalidate the miner's work anyway). (#3335).
### Fixed
- Denormalize the mempool database so as to remove a `LEFT JOIN` from the SQL
query for choosing transactions in order by estimated fee rate. This
drastically speeds up mempool transaction iteration in the miner (#3314)
query for choosing transactions in order by estimated fee rate. This
drastically speeds up mempool transaction iteration in the miner (#3314)
## [2.05.0.3.0]
@@ -312,12 +344,12 @@ drastically speeds up mempool transaction iteration in the miner (#3314)
- Drop well-formed "problematic" transactions that result in miner performance degradation (#3212)
- Ignore blocks that include problematic transactions
## [2.05.0.2.1]
### Fixed
- Fixed a security bug in the SPV client whereby the chain work was not being
considered at all when determining the canonical Bitcoin fork. The SPV client
considered at all when determining the canonical Bitcoin fork. The SPV client
now only accepts a new Bitcoin fork if it has a higher chain work than any other
previously-seen chain (#3152).
@@ -342,8 +374,9 @@ It is highly recommended that you **back up your chainstate** before running
this version of the software on it.
### Changed
- The MARF implementation will now defer calculating the root hash of a new trie
until the moment the trie is committed to disk. This avoids gratuitous hash
until the moment the trie is committed to disk. This avoids gratuitous hash
calculations, and yields a performance improvement of anywhere between 10x and
200x (#3041).
- The MARF implementation will now store tries to an external file for instances
@@ -354,8 +387,8 @@ this version of the software on it.
by an environment variable (#3042).
- Sortition processing performance has been improved by about an order of
magnitude, by avoiding a slew of expensive database reads (#3045).
- Updated chains coordinator so that before a Stacks block or a burn block is processed,
an event is sent through the event dispatcher. This fixes #3015.
- Updated chains coordinator so that before a Stacks block or a burn block is processed,
an event is sent through the event dispatcher. This fixes #3015.
- Expose a node's public key and public key hash160 (i.e. what appears in
/v2/neighbors) via the /v2/info API endpoint (#3046)
- Reduced the default subsequent block attempt timeout from 180 seconds to 30
@@ -365,12 +398,14 @@ this version of the software on it.
This binary provides CLI tools for chain and mempool inspection.
### Fixed
- The AtlasDB previously could lose `AttachmentInstance` data during shutdown
or crashes (#3082). This release resolves that.
## [2.05.0.1.0]
### Added
### Added
- A new fee estimator intended to produce fewer over-estimates, by having less
sensitivity to outliers. Its characteristic features are: 1) use a window to
forget past estimates instead of exponential averaging, 2) use weighted
@@ -378,46 +413,46 @@ this version of the software on it.
assess empty space in blocks as having paid the "minimum fee", so that empty
space is accounted for, 4) use random "fuzz" so that in busy times the fees can
change dynamically. (#2972)
- Implements anti-entropy protocol for querying transactions from other
- Implements anti-entropy protocol for querying transactions from other
nodes' mempools. Before, nodes wouldn't sync mempool contents with one another.
(#2884)
- Structured logging in the mining code paths. This will shine light
- Structured logging in the mining code paths. This will shine light
on what happens to transactions (successfully added, skipped or errored) that the
miner considers while buildings blocks. (#2975)
- Added the mined microblock event, which includes information on transaction
events that occurred in the course of mining (will provide insight
on whether a transaction was successfully added to the block,
skipped, or had a processing error). (#2975)
- For v2 endpoints, can now specify the `tip` parameter to `latest`. If
- For v2 endpoints, can now specify the `tip` parameter to `latest`. If
`tip=latest`, the node will try to run the query off of the latest tip. (#2778)
- Adds the /v2/headers endpoint, which returns a sequence of SIP-003-encoded
block headers and consensus hashes (see the ExtendedStacksHeader struct that
- Adds the /v2/headers endpoint, which returns a sequence of SIP-003-encoded
block headers and consensus hashes (see the ExtendedStacksHeader struct that
this PR adds to represent this data). (#2862)
- Adds the /v2/data_var endpoint, which returns a contract's data variable
- Adds the /v2/data_var endpoint, which returns a contract's data variable
value and a MARF proof of its existence. (#2862)
- Fixed a bug in the unconfirmed state processing logic that could lead to a
denial of service (node crash) for nodes that mine microblocks (#2970)
- Added prometheus metric that tracks block fullness by logging the percentage of each
cost dimension that is consumed in a given block (#3025).
cost dimension that is consumed in a given block (#3025).
### Changed
- Updated the mined block event. It now includes information on transaction
- Updated the mined block event. It now includes information on transaction
events that occurred in the course of mining (will provide insight
on whether a transaction was successfully added to the block,
on whether a transaction was successfully added to the block,
skipped, or had a processing error). (#2975)
- Updated some of the logic in the block assembly for the miner and the follower
to consolidate similar logic. Added functions `setup_block` and `finish_block`.
(#2946)
- Makes the p2p state machine more reactive to newly-arrived
`BlocksAvailable` and `MicroblocksAvailable` messages for block and microblock
streams that this node does not have. If such messages arrive during an inventory
sync, the p2p state machine will immediately transition from the inventory sync
work state to the block downloader work state, and immediately proceed to fetch
- Makes the p2p state machine more reactive to newly-arrived
`BlocksAvailable` and `MicroblocksAvailable` messages for block and microblock
streams that this node does not have. If such messages arrive during an inventory
sync, the p2p state machine will immediately transition from the inventory sync
work state to the block downloader work state, and immediately proceed to fetch
the available block or microblock stream. (#2862)
- Nodes will push recently-obtained blocks and microblock streams to outbound
neighbors if their cached inventories indicate that they do not yet have them
(#2986).
(#2986).
- Nodes will no longer perform full inventory scans on their peers, except
during boot-up, in a bid to minimize block-download stalls (#2986).
- Nodes will process sortitions in parallel to downloading the Stacks blocks for
@@ -426,19 +461,20 @@ this version of the software on it.
top of parent blocks that are no longer the chain tip (#2969).
- Several database indexes have been updated to avoid table scans, which
significantly improves most RPC endpoint speed and cuts node spin-up time in
half (#2989, #3005).
half (#2989, #3005).
- Fixed a rare denial-of-service bug whereby a node that processes a very deep
burnchain reorg can get stuck, and be rendered unable to process further
sortitions. This has never happened in production, but it can be replicated in
tests (#2989).
- Updated what indices are created, and ensures that indices are created even
sortitions. This has never happened in production, but it can be replicated in
tests (#2989).
- Updated what indices are created, and ensures that indices are created even
after the database is initialized (#3029).
### Fixed
### Fixed
- Updates the lookup key for contracts in the pessimistic cost estimator. Before, contracts
published by different principals with the same name would have had the same
published by different principals with the same name would have had the same
key in the cost estimator. (#2984)
- Fixed a few prometheus metrics to be more accurate compared to `/v2` endpoints
- Fixed a few prometheus metrics to be more accurate compared to `/v2` endpoints
when polling data (#2987)
- Fixed an error message from the type-checker that shows up when the type of a
parameter refers to a trait defined in the same contract (#3064).
@@ -498,7 +534,7 @@ compatible with chainstate directories from 2.0.11.3.0.
## [2.0.11.3.0]
This software update is a point-release to change the transaction selection
logic in the default miner to prioritize by fee instead of nonce sequence. This
logic in the default miner to prioritize by fee instead of nonce sequence. This
release's chainstate directory is compatible with chainstate directories from
2.0.11.2.0.
@@ -506,8 +542,8 @@ release's chainstate directory is compatible with chainstate directories from
- The node will enforce a soft deadline for mining a block, so that a node
operator can control how frequently their node attempts to mine a block
regardless of how congested the mempool is. The timeout parameters are
controlled in the `[miner]` section of the node's config file (#2823).
regardless of how congested the mempool is. The timeout parameters are
controlled in the `[miner]` section of the node's config file (#2823).
## Changed
@@ -552,11 +588,11 @@ to reset their chain states.
- Two bugs that caused problems syncing with the bitcoin chain during a
bitcoin reorg have been fixed (#2771, #2780).
- Documentation is fixed in cases where string and buffer types are allowed
but not covered in the documentation. (#2676)
but not covered in the documentation. (#2676)
## [2.0.11.1.0]
This software update is our monthly release. It introduces fixes and features for both developers and miners.
This software update is our monthly release. It introduces fixes and features for both developers and miners.
This release's chainstate directory is compatible with chainstate directories from 2.0.11.0.0.
## Added
@@ -575,14 +611,14 @@ This release's chainstate directory is compatible with chainstate directories fr
- Improved mempool walk order (#2514).
- Renamed database `tx_tracking.db` to `tx_tracking.sqlite` (#2666).
## Fixed
- Alter the miner to prioritize spending the most recent UTXO when building a transaction,
## Fixed
- Alter the miner to prioritize spending the most recent UTXO when building a transaction,
instead of the largest UTXO. In the event of a tie, it uses the smallest UTXO first (#2661).
- Fix trait rpc lookups for implicitly implemented traits (#2602).
- Fix `v2/pox` endpoint, broken on Mocknet (#2634).
- Align cost limits on mocknet, testnet and mainnet (#2660).
- Align cost limits on mocknet, testnet and mainnet (#2660).
- Log peer addresses in the HTTP server (#2667)
- Mine microblocks if there are no recent unprocessed Stacks blocks
@@ -601,7 +637,7 @@ compatible with prior chainstate directories.
- New prometheus metrics for mempool transaction processing times and
outstanding mempool transactions
- New RPC endpoint with path `/v2/traits/contractAddr/contractName/traitContractName
/traitContractAddr/traitName` to determine whether a given trait is implemented
/traitContractAddr/traitName` to determine whether a given trait is implemented
within the specified contract (either explicitly or implicitly).
- Re-activate the Atlas network for propagating and storing transaction
attachments. This re-enables off-chain BNS name storage.
@@ -615,8 +651,8 @@ compatible with prior chainstate directories.
- The `/v2/pox` RPC endpoint was updated to include more useful
information about the current and next PoX cycles. For details, see
`docs/rpc-endpoints.md`
## Fixed
## Fixed
- Fixed faulty logic in the mempool that was still treating the transaction fee
as a fee rate, which prevented replace-by-fee from working as expected.
@@ -645,7 +681,7 @@ node.
## [2.0.9]
This is a hotfix release for improved handling of arriving Stacks blocks through
both the RPC interface and the P2P ineterface. The chainstate directory of
both the RPC interface and the P2P ineterface. The chainstate directory of
2.0.9 is compatible with the 2.0.8 chainstate.
## Fixed
@@ -674,7 +710,6 @@ valid block data if its descendant microblock stream is invalid for some reason.
- Do not delete a valid parent Stacks block.
## [2.0.6] - 2021-02-15
The database schema has not changed since 2.0.5, so when spinning up a
@@ -743,9 +778,9 @@ node from an earlier chainstate, you must use a fresh working directory.
- Enabled WAL mode for the chainstate databases. This allows much more
concurrency in the `stacks-node`, and improves network performance
across the board. **NOTE:** *This changed the database schema, any
across the board. **NOTE:** _This changed the database schema, any
running node would need to re-initialize their nodes from a new chain
state when upgrading*.
state when upgrading_.
- Default value `wait_time_for_microblocks`: from 60s to 30s
- The mempool now performs more transfer semantics checks before admitting
a transaction (e.g., reject if origin = recipient): see issue #2354

View File

@@ -8,7 +8,7 @@
Reference implementation of the [Stacks blockchain](https://github.com/stacks-network/stacks) in Rust.
Stacks is a layer-1 blockchain that connects to Bitcoin for security and enables decentralized apps and predictable smart contracts using the [Clarity language](https://clarity-lang.org/). Stacks implements [Proof of Transfer (PoX)](https://community.stacks.org/pox) mining that anchors to Bitcoin security. Leader election happens at the Bitcoin blockchain and Stacks (STX) miners write new blocks on the separate Stacks blockchain. With PoX there is no need to modify Bitcoin to enable smart contracts and decentralized apps.
Stacks is a layer-2 blockchain that uses Bitcoin as a base layer for security and enables decentralized apps and predictable smart contracts using the [Clarity language](https://clarity-lang.org/). Stacks implements [Proof of Transfer (PoX)](https://community.stacks.org/pox) mining that anchors to Bitcoin security. Leader election happens at the Bitcoin blockchain and Stacks (STX) miners write new blocks on the separate Stacks blockchain. With PoX there is no need to modify Bitcoin to enable smart contracts and decentralized apps.
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg?style=flat)](https://www.gnu.org/licenses/gpl-3.0)
[![Release](https://img.shields.io/github/v/release/stacks-network/stacks-blockchain?style=flat)](https://github.com/stacks-network/stacks-blockchain/releases/latest)

View File

@@ -0,0 +1,26 @@
FROM rust:bullseye as build
ARG STACKS_NODE_VERSION="No Version Info"
ARG GIT_BRANCH='No Branch Info'
ARG GIT_COMMIT='No Commit Info'
ARG BUILD_DIR=/build
ARG TARGET=armv7-unknown-linux-gnueabihf
WORKDIR /src
COPY . .
RUN apt-get update && apt-get install -y git gcc-arm-linux-gnueabihf
# Run all the build steps in ramdisk in an attempt to speed things up
RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& CC=arm-linux-gnueabihf-gcc \
CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out
FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /

View File

@@ -0,0 +1,21 @@
FROM messense/rust-musl-cross:armv7-musleabihf as build
ARG STACKS_NODE_VERSION="No Version Info"
ARG GIT_BRANCH='No Branch Info'
ARG GIT_COMMIT='No Commit Info'
ARG BUILD_DIR=/build
ARG TARGET=armv7-unknown-linux-musleabihf
WORKDIR /src
COPY . .
# Run all the build steps in ramdisk in an attempt to speed things up
RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out
FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /

View File

@@ -17,8 +17,10 @@ case $DIST_TARGET_FILTER in
case $DIST_TARGET_FILTER in
linux-glibc-x64) build_platform linux-glibc-x64 ;;
linux-glibc-arm64) build_platform linux-glibc-arm64 ;;
linux-glibc-armv7) build_platform linux-glibc-armv7 ;;
linux-musl-x64) build_platform linux-musl-x64 ;;
linux-musl-arm64) build_platform linux-musl-arm64 ;;
linux-musl-armv7) build_platform linux-musl-armv7 ;;
windows-x64) build_platform windows-x64 ;;
macos-x64) build_platform macos-x64 ;;
macos-arm64) build_platform macos-arm64 ;;
@@ -32,8 +34,10 @@ case $DIST_TARGET_FILTER in
echo "Building distrubtions for all targets."
build_platform linux-glibc-x64
build_platform linux-glibc-arm64
build_platform linux-glibc-armv7
build_platform linux-musl-x64
build_platform linux-musl-arm64
build_platform linux-musl-armv7
build_platform windows-x64
build_platform macos-x64
build_platform macos-arm64

View File

@@ -1422,7 +1422,7 @@ The function returns the result of evaluating `expr`.
example: "
(define-data-var data int 1)
(at-block 0x0000000000000000000000000000000000000000000000000000000000000000 block-height) ;; Returns u0
(at-block (get-block-info? id-header-hash 0) (var-get data)) ;; Throws NoSuchDataVariable because `data` wasn't initialized at block height 0"
(at-block (unwrap-panic (get-block-info? id-header-hash u0)) (var-get data)) ;; Throws NoSuchDataVariable because `data` wasn't initialized at block height 0"
};
const AS_CONTRACT_API: SpecialAPI = SpecialAPI {

View File

@@ -66,6 +66,8 @@ macro_rules! switch_on_global_epoch {
use crate::vm::ClarityVersion;
use super::errors::InterpreterError;
mod arithmetic;
mod assets;
mod boolean;
@@ -604,7 +606,10 @@ fn special_print(
env: &mut Environment,
context: &LocalContext,
) -> Result<Value> {
let input = eval(&args[0], env, context)?;
let arg = args.get(0).ok_or_else(|| {
InterpreterError::BadSymbolicRepresentation("Print should have an argument".into())
})?;
let input = eval(arg, env, context)?;
runtime_cost(ClarityCostFunction::Print, env, input.size())?;

View File

@@ -337,7 +337,12 @@ pub fn eval(
let f = lookup_function(function_name, env)?;
apply(&f, rest, env, context)
}
TraitReference(_, _) | Field(_) => unreachable!("can't be evaluated"),
TraitReference(_, _) | Field(_) => {
return Err(InterpreterError::BadSymbolicRepresentation(
"Unexpected trait reference".into(),
)
.into())
}
};
if let Some(mut eval_hooks) = env.global_context.eval_hooks.take() {

View File

@@ -1,150 +1,231 @@
# Releases
All releases are built via a Github Actions workflow named `CI`, and is responsible for building binary archives, checksums, and resulting docker images.
This workflow will also trigger any tests that need to be run, like integration tests.
All releases are built via a Github Actions workflow named `CI` ([ci.yml](../.github/workflows/ci.yml)), and is responsible for:
1. Releases are only created if a tag is manually provided when the ci workflow is triggered.
2. Pushing a new feature branch: Nothing is triggered automatically. PR's are required, or the ci workflow can be triggered manually on a specific branch to build a docker image for the specified branch.
- Verifying code is formatted correctly
- Building binary archives and checksums
- Docker images
- Triggering tests conditionally (different tests run for a release vs a PR)
The following workflow steps are currently disabled:
- Clippy
- Net-test
- Crate audit
1. Releases are only created if a tag is **manually** provided when the [CI workflow](../.github/workflows/ci.yml) is triggered.
2. [Caching](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows) is used to speed up testing - a cache is created based on the type of data (i.e. cargo) and the commit sha. tests can be retried quickly since the cache will persist until the cleanup job is run.
3. [nextest](https://nexte.st/) is used to run the tests from an archived file that is cached (using commit sha as a key))
- Two [archives](https://nexte.st/book/reusing-builds.html) are created, one for genesis tests and one for generic tests (it is done this way to reduce the time spent building)
- Unit-tests are [partitioned](https://nexte.st/book/partitioning.html) and multi-threaded to speed up execution time
## TL;DR
1. A PR will produce a single image built from source on Debian with glibc with 2 tags:
- `stacks-blockchain:<branch-name>`
- `stacks-blockchain:<pr-number>`
2. A merged PR from `develop` to the default branch will produce a single image built from source on Debian with glibc:
- `stacks-blockchain:<default-branch-name>`
3. An untagged build of any branch will produce a single image built from source on Debian with glibc:
- `stacks-blockchain:<branch-name>`
4. A tagged release on a non-default branch will produce 2 versions of the docker image (along with all binary archives):
- An Alpine image for several architectures tagged with:
- `stacks-blockchain:<x.x.x.x.x>`
- An Debian image for several architectures tagged with:
- `stacks-blockchain:<x.x.x.x.x-debian>`
5. A tagged release on the default branch will produce 2 versions of the docker image (along with all binary archives):
- An Alpine image for several architectures tagged with:
- `stacks-blockchain:<x.x.x.x.x>`
- `stacks-blockchain:<latest>`
- An Debian image for several architectures tagged with:
- `stacks-blockchain:<x.x.x.x.x-debian>`
- `stacks-blockchain:<latest-debian>`
- Pushing a feature branch will not trigger a workflow
- An open/re-opened/synchronized PR will produce a single image built from source on Debian with glibc with 2 tags:
- `stacks-core:<branch-name>`
- `stacks-core:<pr-number>`
- A merged PR into `default-branch` from `develop` will produce a single image built from source on Debian with glibc:
- `stacks-core:<default-branch-name>`
- An untagged build of any branch will produce a single image built from source on Debian with glibc:
- `stacks-core:<branch-name>`
- A tagged release on a non-default branch will produces:
- Docker Alpine image for several architectures tagged with:
- `stacks-core:<x.x.x.x.x>`
- Docker Debian image for several architectures tagged with:
- `stacks-core:<x.x.x.x.x-debian>`
- A tagged release on the default branch will produce:
- Github Release of the specified tag with:
- Binary archives for several architectures
- Docker Alpine image for several architectures tagged with:
- `stacks-core:<x.x.x.x.x>`
- `stacks-core:<latest>`
- Docker Debian image for several architectures tagged with:
- `stacks-core:<x.x.x.x.x-debian>`
- `stacks-core:<latest-debian>`
## Release workflow:
## Release workflow
1. Create a feature branch: `feat/112-fix-something`
2. PR `feat/112-fix-something` to the `develop` branch
1. CI Workflow is automatically triggered, resulting in a pushed docker image tagged with the **branch name** and **PR number**
3. PR `develop` to the default branch
1. CI Workflow is automatically triggered, resulting in a pushed docker image tagged with the **branch name** and **PR number**
1. Create a feature branch: `feat/fix-something`
2. PR `feat/fix-something` to the `develop` branch where the PR is numbered `112`
1. Docker image tagged with the **branch name** and **PR number**
- ex:
- `stacks-core:feat-fix-something`
- `stacks-core:pr-112`
2. CI tests are run
3. PR `develop` to the default branch where the PR is numbered `112`
1. Docker image tagged with the **branch name** and **PR number**
- ex:
- `stacks-core:feat-fix-something`
- `stacks-core:pr-112`
2. CI tests are run
4. Merge `develop` branch to the default branch
1. CI Workflow is triggered, resulting in a pushed docker image tagged with the **default branch name**
1. Docker image is tagged with the **default branch** `master`
- ex:
- `stacks-core:master`
2. CI tests are run
5. CI workflow is manually triggered on **non-default branch** with a version, i.e. `2.1.0.0.0-rc0`
1. Github release for the manually input version is created with binaries
2. Docker image pushed with tags of the **input version** and **branch**
1. No Docker images/binaries are created
2. All release tests are run
6. CI workflow is manually triggered on **default branch** with a version, i.e. `2.1.0.0.0`
1. Github release for the manually input version is created with binaries
2. Docker image pushed with tags of the **input version** and **latest**
2. All release tests are run
3. Docker image pushed with tags of the **input version** and **latest**
- ex:
- `stacks-core:2.1.0.0.0-debian`
- `stacks-core:latest-debian`
- `stacks-core:2.1.0.0.0`
- `stacks-core:latest`
## PR a branch to develop:
## Tests
ex: Branch is named `feat/112-fix-something` and the PR is numbered `112`
Tests are separated into several different workflows, with the intention that they can be _conditionally_ run depending upon the triggering operation. For example, on a PR synchronize we don't want to run some identified "slow" tests, but we do want to run the [Stacks Blockchain Tests](../.github/workflows/stacks-blockchain-tests.yml) and [Bitcoin Tests](../.github/workflows/bitcoin-tests.yml).
- Steps executed:
- Rust Format
- Integration Tests
- Leaked credential test
- Docker image is built from source on a debian distribution and pushed with the branch name and PR number as tags
- ex:
- `stacks-blockchain:feat-112-fix-something`
- `stacks-blockchain:pr-112`
- Steps _not_ executed:
- No binaries are built
- No github release
- No docker images built from binary artifacts
There are also 2 different methods in use with regard to running tests:
## Merging a branch to develop:
1. [Github Actions matrix](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs)
2. [nextest partitioning](https://nexte.st/book/partitioning.html)
A matrix is used when there are several known tests that need to be run. Partitions (shards) are used when there is a large and unknown number of tests to run (ex: `cargo test` to run all tests).
There is also a workflow designed to run tests that are manually triggered: [Standalone Tests](../.github/workflows/standalone-tests.yml).
This workflow requires you to select which test(s) you want to run, which then triggers a reusbale workflow via conditional. For example, selecting "Epoch Tests" will run the tests defined in [Epoch Tests](../.github/workflows/epoch-tests.yml). Likewise, selecting `Release Tests` will run the same tests as a release workflow.
Files:
- [Standalone Tests](../.github/workflows/standalone-tests.yml)
- [Stacks Blockchain Tests](../.github/workflows/stacks-blockchain-tests.yml)
- [Bitcoin Tests](../.github/workflows/bitcoin-tests.yml)
- [Atlas Tests](../.github/workflows/atlas-tests.yml)
- [Epoch Tests](../.github/workflows/epoch-tests.yml)
- [Slow Tests](../.github/workflows/slow-tests.yml)
### Adding/changing tests
With the exception of `unit-tests` in [Stacks Blockchain Tests](../.github/workflows/stacks-blockchain-tests.yml), adding/removing a test requires a change to the workflow matrix. Example from [Atlas Tests](../.github/workflows/atlas-tests.yml):
```yaml
atlas-tests:
name: Atlas Test
runs-on: ubuntu-latest
strategy:
## Continue with the test matrix even if we've had a failure
fail-fast: false
## Run a maximum of 2 concurrent tests from the test matrix
max-parallel: 2
matrix:
test-name:
- tests::neon_integrations::atlas_integration_test
- tests::neon_integrations::atlas_stress_integration_test
```
Example of adding a new test `tests::neon_integrations::atlas_new_test`:
```yaml
...
matrix:
test-name:
- tests::neon_integrations::atlas_integration_test
- tests::neon_integrations::atlas_stress_integration_test
- tests::neon_integrations::atlas_new_test
```
The separation of tests (outside of [Slow Tests](../.github/workflows/slow-tests.yml)) is performed by creating a separate workflow for each _type_ of test that is being run. Using the example above, to add/remove any tests from being run - the `matrix` will need to be adjusted.
ex:
- `Atlas Tests`: Tests related to Atlas
- `Bitcoin Tests`: Tests relating to burnchain operations
- `Epoch Tests`: Tests related to epoch changes
- `Slow Tests`: These tests have been identified as taking longer than others. The threshold used is if a test takes longer than `10 minutes` to complete successfully (or times out semi-regularly), it should be added here.
- `Stacks Blockchain Tests`:
- `full-genesis`: Tests related to full genesis
## Triggering a workflow
### PR a branch to develop
ex: Branch is named `feat/fix-something` and the PR is numbered `112`
- [Rust format](../.github/workflows/ci.yml)
- [Create Test Cache](../.github/workflows/create-cache.yml)
- [Stacks Blockchain Tests](../.github/workflows/stacks-blockchain-tests.yml)
- [Bitcoin Tests](../.github/workflows/bitcoin-tests.yml)
- [Docker image](../.github/workflows/image-build-source.yml) is built from source on a debian distribution and pushed with the branch name and PR number as tags
- ex:
- `stacks-core:feat-fix-something`
- `stacks-core:pr-112`
---
### Merging a branch to develop
Nothing is triggered automatically
## PR develop to master branches:
---
### PR develop to master branches
ex: Branch is named `develop` and the PR is numbered `113`
- Steps executed:
- Rust format
- Integration tests
- Leaked credential test
- Docker image is built from source on a debian distribution and pushed with the branch name and PR number as tags
- ex:
- `stacks-blockchain:develop`
- `stacks-blockchain:pr-113`
- Steps _not_ executed:
- No binaries are built
- No github release
- No docker images built from binary artifacts
- [Rust format](../.github/workflows/ci.yml)
- [Create Test Cache](../.github/workflows/create-cache.yml)
- [Stacks Blockchain Tests](../.github/workflows/stacks-blockchain-tests.yml)
- [Bitcoin Tests](../.github/workflows/bitcoin-tests.yml)
- [Docker image](../.github/workflows/image-build-source.yml) is built from source on a debian distribution and pushed with the branch name and PR number as tags
- ex:
- `stacks-core:develop`
- `stacks-core:pr-113`
## Merging a PR from develop to master:
---
- Steps executed:
- Rust format
- Integration tests
- Leaked credential test
- Docker image is built from source on a debian distribution and pushed with the branch name as a tag
- ex:
- `stacks-blockchain:master`
- Steps _not_ executed:
- No binaries are built
- No github release
- No docker images built from binary artifacts
### Merging a PR from develop to master
## Manually triggering workflow without tag (any branch):
- [Rust format](../.github/workflows/ci.yml)
- [Create Test Cache](../.github/workflows/create-cache.yml)
- [Stacks Blockchain Tests](../.github/workflows/stacks-blockchain-tests.yml)
- [Bitcoin Tests](../.github/workflows/bitcoin-tests.yml)
- [Docker image](../.github/workflows/image-build-source.yml) is built from source on a debian distribution and pushed with the branch name as a tag
- ex:
- `stacks-core:master`
- Steps executed:
- Rust format
- Integration tests
- Leaked credential test
- Docker image is built from source on a debian distribution and pushed with the branch name as a tag
- ex:
- `stacks-blockchain:<branch name>`
- Steps _not_ executed:
- No binaries are built
- No github release
- No docker images built from binary artifacts
---
## Manually triggering workflow with tag on a non-default branch (i.e. tag of `2.1.0.0.0-rc0`):
### Manually triggering workflow without tag (any branch)
- Steps executed:
- Rust format
- Integration tests
- Leaked credential test
- Binaries built for specified architectures
- Archive and checksum files added to github release
- Github release (with artifacts/checksum) is created using the manually input tag
- Docker image built from binaries on debian/alpine distributions and pushed with the provided input tag and `latest`
- ex:
- `stacks-blockchain:2.1.0.0.0-rc0`
- Steps _not_ executed:
- No docker images built from source
- [Rust format](../.github/workflows/ci.yml)
- [Create Test Cache](../.github/workflows/create-cache.yml)
- [Stacks Blockchain Tests](../.github/workflows/stacks-blockchain-tests.yml)
- [Bitcoin Tests](../.github/workflows/bitcoin-tests.yml)
- [Docker image](../.github/workflows/image-build-source.yml) is built from source on a debian distribution and pushed with the branch name as a tag
- ex:
- `stacks-core:<branch name>`
## Manually triggering workflow with tag on default branch (i.e. tag of `2.1.0.0.0`):
---
- Steps executed:
- Rust format
- Integration tests
- Leaked credential test
- Binaries built for specified architectures
- Archive and checksum files added to github release
- Github release (with artifacts/checksum) is created using the manually input tag
- Docker image built from binaries on debian/alpine distributions and pushed with the provided input tag and `latest`
- ex:
- `stacks-blockchain:2.1.0.0.0-debian`
- `stacks-blockchain:latest-debian`
- `stacks-blockchain:2.1.0.0.0`
- `stacks-blockchain:latest`
- Steps _not_ executed:
- No docker images built from source
### Manually triggering workflow with tag on a non-default branch (i.e. tag of `2.1.0.0.0-rc0`)
- [Rust format](../.github/workflows/ci.yml)
- [Create Test Cache](../.github/workflows/create-cache.yml)
- [Stacks Blockchain Tests](../.github/workflows/stacks-blockchain-tests.yml)
- [Bitcoin Tests](../.github/workflows/bitcoin-tests.yml)
- [Atlas Tests](../.github/workflows/atlas-tests.yml)
- [Epoch Tests](../.github/workflows/epoch-tests.yml)
- [Slow Tests](../.github/workflows/slow-tests.yml)
---
### Manually triggering workflow with tag on default branch (i.e. tag of `2.1.0.0.0`)
- [Rust format](../.github/workflows/ci.yml)
- [Create Test Cache](../.github/workflows/create-cache.yml)
- [Stacks Blockchain Tests](../.github/workflows/stacks-blockchain-tests.yml)
- [Bitcoin Tests](../.github/workflows/bitcoin-tests.yml)
- [Atlas Tests](../.github/workflows/atlas-tests.yml)
- [Epoch Tests](../.github/workflows/epoch-tests.yml)
- [Slow Tests](../.github/workflows/slow-tests.yml)
- [Binaries built for specified architectures](../.github/workflows/create-source-binary.yml)
- Archive and checksum files added to github release
- [Github release](../.github/workflows/github-release.yml) (with artifacts/checksum) is created using the manually input tag
- [Docker image](../.github/workflows/image-build-binary.yml) built from binaries on debian/alpine distributions and pushed with the provided input tag and `latest`
- ex:
- `stacks-core:2.1.0.0.0-debian`
- `stacks-core:latest-debian`
- `stacks-core:2.1.0.0.0`
- `stacks-core:latest`
---

View File

@@ -238,7 +238,8 @@ fn make_logger() -> Logger {
let plain = slog_term::PlainSyncDecorator::new(slog_term::TestStdoutWriter);
let isatty = isatty(Stream::Stdout);
let drain = TermFormat::new(plain, false, debug, isatty);
Logger::root(drain.ignore_res(), o!())
let logger = Logger::root(drain.ignore_res(), o!());
logger
}
}

View File

@@ -992,7 +992,7 @@ impl NonceCache {
let should_store_again = match db_set_nonce(mempool_db, address, nonce) {
Ok(_) => false,
Err(e) => {
warn!("error caching nonce to sqlite: {}", e);
debug!("error caching nonce to sqlite: {}", e);
true
}
};