Skip to content

Commit 1aac0f1

Browse files
authored
Merge pull request #700 from hirosystems/stacks-signers
merge stacks signers into develop
2 parents 99e5a61 + 7b7cdf9 commit 1aac0f1

File tree

49 files changed

+2596
-368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2596
-368
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[alias]
22
chainhook-install = "install --path components/chainhook-cli --locked --force --features cli --features debug --no-default-features"
3+
4+
[env]
5+
RUST_TEST_THREADS = "1"

.github/workflows/ci.yaml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
push:
55
branches:
66
- main
7+
- beta
78
- develop
9+
- stacks-signers
810
paths-ignore:
911
- '**/CHANGELOG.md'
1012
pull_request:
@@ -20,7 +22,11 @@ jobs:
2022
strategy:
2123
fail-fast: false
2224
matrix:
23-
suite: [cli, sdk]
25+
include:
26+
- suite: cli
27+
features: redis_tests
28+
- suite: sdk
29+
features: stacks-signers
2430
defaults:
2531
run:
2632
working-directory: ./components/chainhook-${{ matrix.suite }}
@@ -35,12 +41,6 @@ jobs:
3541
rustup toolchain install stable --profile minimal
3642
echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV
3743
38-
- name: Install redis
39-
if: matrix.suite == 'cli'
40-
run: |
41-
sudo apt-get install -y redis-server
42-
echo "TARPAULIN_FLAGS=--features redis_tests" >> $GITHUB_ENV
43-
4444
- name: Cache cargo
4545
uses: actions/cache@v4
4646
with:
@@ -59,16 +59,31 @@ jobs:
5959
run: |
6060
cargo install cargo-tarpaulin
6161
62+
- name: Setup integration environment
63+
run: |
64+
sudo ufw disable
65+
docker compose -f ../../dockerfiles/docker-compose.dev.yml up -d
66+
docker compose -f ../../dockerfiles/docker-compose.dev.yml logs -t -f --no-color &> docker-compose-logs.txt &
67+
if: matrix.suite == 'cli'
68+
6269
- name: Run tests
6370
run: |
64-
cargo tarpaulin --skip-clean --out lcov ${{ env.TARPAULIN_FLAGS }} -- --test-threads=1
71+
cargo tarpaulin --skip-clean --out lcov --features ${{ matrix.features }} -- --test-threads=1
6572
6673
- name: Upload coverage reports to Codecov
6774
uses: codecov/codecov-action@v4
6875
env:
6976
token: ${{ secrets.CODECOV_TOKEN }}
7077
codecov_yml_path: .github/codecov.yml
7178

79+
- name: Print integration environment logs
80+
run: cat docker-compose-logs.txt
81+
if: matrix.suite == 'cli' && failure()
82+
83+
- name: Teardown integration environment
84+
run: docker compose -f ../../dockerfiles/docker-compose.dev.yml down -v -t 0
85+
if: matrix.suite == 'cli' && always()
86+
7287
distributions:
7388
runs-on: ${{ matrix.os }}
7489

@@ -270,6 +285,7 @@ jobs:
270285
- distributions
271286
outputs:
272287
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
288+
new_release_git_tag: ${{ steps.semantic.outputs.new_release_git_tag }}
273289
steps:
274290
- uses: actions/checkout@v4
275291
with:
@@ -325,7 +341,7 @@ jobs:
325341
uses: actions/checkout@v4
326342
with:
327343
persist-credentials: false
328-
ref: ${{ needs.semantic-release.outputs.new_release_version }}
344+
ref: ${{ needs.semantic-release.outputs.new_release_git_tag }}
329345

330346
- name: Set up Docker Buildx
331347
uses: docker/setup-buildx-action@v3

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ components/chainhook-types-js/dist
1919
*.redb
2020
cache/
2121
Chainhook.toml
22-
23-
components/chainhook-cli/src/service/tests/fixtures/tmp
24-
components/chainhook-cli/src/archive/tests/fixtures/tmp
22+
**/src/service/tests/fixtures/tmp
23+
**/src/archive/tests/fixtures/tmp

.releaserc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{
22
"branches": [
3-
"main"
3+
"main",
4+
{
5+
"name": "beta",
6+
"channel": "beta",
7+
"prerelease": true
8+
},
9+
{
10+
"name": "stacks-signers",
11+
"channel": "stacks-signers",
12+
"prerelease": true
13+
}
414
],
515
"plugins": [
616
[

.vscode/chainhook.toml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[storage]
2+
working_dir = "cache"
3+
4+
# The HTTP API allows you to register / deregister
5+
# predicates dynamically.
6+
# This is disabled by default.
7+
#
8+
[http_api]
9+
http_port = 20456
10+
database_uri = "redis://localhost:6379/"
11+
12+
[network]
13+
mode = "testnet"
14+
bitcoind_rpc_url = "http://localhost:18443"
15+
bitcoind_rpc_username = "btc"
16+
bitcoind_rpc_password = "btc"
17+
18+
# Chainhook must be able to receive Bitcoin block events.
19+
# These events can originate from either a Stacks node or a Bitcoin node's ZeroMQ interface.
20+
21+
# By default, the service is set to receive Bitcoin block events from the Stacks node:
22+
stacks_node_rpc_url = "http://localhost:20443"
23+
stacks_events_ingestion_port = 20455
24+
25+
# However, events can also be received directly from a Bitcoin node.
26+
# To achieve this, comment out the `stacks_node_rpc_url` line and uncomment the following line:
27+
# bitcoind_zmq_url = "tcp://0.0.0.0:18543"
28+
29+
[limits]
30+
max_number_of_bitcoin_predicates = 100
31+
max_number_of_concurrent_bitcoin_scans = 100
32+
max_number_of_stacks_predicates = 10
33+
max_number_of_concurrent_stacks_scans = 10
34+
max_number_of_processing_threads = 16
35+
max_number_of_networking_threads = 16
36+
max_caching_memory_size_mb = 32000
37+
38+
# The TSV file is required for downloading historical data for your predicates.
39+
# If this is not a requirement, you can comment out the `tsv_file_url` line.
40+
# [[event_source]]
41+
# tsv_file_url = "https://archive.hiro.so/regtest/stacks-blockchain-api/regtest-stacks-blockchain-api-latest"
42+
43+
# Enables a server that provides metrics that can be scraped by Prometheus.
44+
# This is disabled by default.
45+
# [monitoring]
46+
# prometheus_monitoring_port = 20457

.vscode/launch.json

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,76 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"type": "lldb",
6+
"request": "launch",
7+
"name": "Debug executable 'chainhook'",
8+
"cargo": {
9+
"args": [
10+
"build",
11+
"--bin=chainhook",
12+
"--package=chainhook"
13+
],
14+
"filter": {
15+
"name": "chainhook",
16+
"kind": "bin"
17+
}
18+
},
19+
"args": [
20+
"service",
21+
"start",
22+
"--config-path=${workspaceFolder}/.vscode/chainhook.toml",
23+
],
24+
"cwd": "${workspaceFolder}",
25+
"preLaunchTask": "redis:start",
26+
"postDebugTask": "redis:stop"
27+
},
28+
{
29+
"type": "lldb",
30+
"request": "launch",
31+
"name": "test: chainhook-sdk",
32+
"cargo": {
33+
"args": ["test", "--no-run", "--lib", "--package=chainhook-sdk"],
34+
"filter": {
35+
"name": "chainhook_sdk",
36+
"kind": "lib"
37+
}
38+
},
39+
"args": [],
40+
"env": {
41+
"RUST_TEST_THREADS": "1"
42+
},
43+
"cwd": "${workspaceFolder}"
44+
},
45+
{
46+
"type": "lldb",
47+
"request": "launch",
48+
"name": "test: chainhook-cli",
49+
"cargo": {
50+
"args": [
51+
"test",
52+
"--no-run",
53+
"--bin=chainhook",
54+
"--package=chainhook",
55+
"--features=redis_tests"
56+
],
57+
"filter": {
58+
"name": "chainhook",
59+
"kind": "bin"
60+
}
61+
},
62+
"args": [],
63+
"env": {
64+
"RUST_TEST_THREADS": "1"
65+
},
66+
"cwd": "${workspaceFolder}",
67+
"preLaunchTask": "redis:start",
68+
"postDebugTask": "redis:stop"
69+
},
470
{
571
"type": "node",
672
"request": "launch",
7-
"name": "ts client: jest",
73+
"name": "test: typescript client",
874
"localRoot": "${workspaceFolder}/components/client/typescript",
975
"program": "${workspaceFolder}/components/client/typescript/node_modules/jest/bin/jest",
1076
"args": [

.vscode/tasks.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "redis:start",
6+
"type": "shell",
7+
"command": "docker compose -f dockerfiles/docker-compose.dev.yml up --force-recreate -V",
8+
"isBackground": true,
9+
"problemMatcher": {
10+
"pattern": { "regexp": ".", "file": 1, "location": 2, "message": 3 },
11+
"background": {
12+
"activeOnStart": true,
13+
"beginsPattern": ".",
14+
"endsPattern": "."
15+
}
16+
},
17+
"presentation": {
18+
"echo": true,
19+
"reveal": "always",
20+
"focus": false,
21+
"panel": "dedicated",
22+
"clear": false
23+
}
24+
},
25+
{
26+
"label": "redis:stop",
27+
"type": "shell",
28+
"command": "docker compose -f dockerfiles/docker-compose.dev.yml down -v -t 0",
29+
"isBackground": true,
30+
"problemMatcher": {
31+
"pattern": { "regexp": ".", "file": 1, "location": 2, "message": 3 },
32+
"background": {
33+
"activeOnStart": true,
34+
"beginsPattern": ".",
35+
"endsPattern": "."
36+
}
37+
},
38+
"presentation": {
39+
"echo": true,
40+
"reveal": "always",
41+
"focus": false,
42+
"panel": "dedicated",
43+
"clear": false
44+
}
45+
}
46+
]
47+
}

CHANGELOG.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,76 @@
1+
## [1.9.0-stacks-signers.8](https://github.com/hirosystems/chainhook/compare/v1.9.0-stacks-signers.7...v1.9.0-stacks-signers.8) (2024-11-12)
2+
3+
4+
### Bug Fixes
5+
6+
* only import stacks tsv if chainstate is empty ([#684](https://github.com/hirosystems/chainhook/issues/684)) ([1f9f37e](https://github.com/hirosystems/chainhook/commit/1f9f37ee8c9afa864fc618b761195b0d0711dfbe)), closes [#677](https://github.com/hirosystems/chainhook/issues/677)
7+
8+
## [1.9.0-stacks-signers.7](https://github.com/hirosystems/chainhook/compare/v1.9.0-stacks-signers.6...v1.9.0-stacks-signers.7) (2024-11-07)
9+
10+
11+
### Bug Fixes
12+
13+
* propagate error when trying to store peer info ([1bc949a](https://github.com/hirosystems/chainhook/commit/1bc949a6ce17ab67c2c1af2d21fe330461689f49))
14+
15+
## [1.9.0-stacks-signers.6](https://github.com/hirosystems/chainhook/compare/v1.9.0-stacks-signers.5...v1.9.0-stacks-signers.6) (2024-10-31)
16+
17+
18+
### Bug Fixes
19+
20+
* read stacks-core http event POST payloads for ignored events ([#673](https://github.com/hirosystems/chainhook/issues/673)) ([a01470e](https://github.com/hirosystems/chainhook/commit/a01470e34876dcf67969063e1fc900ae947a0a54))
21+
22+
## [1.9.0-stacks-signers.5](https://github.com/hirosystems/chainhook/compare/v1.9.0-stacks-signers.4...v1.9.0-stacks-signers.5) (2024-10-25)
23+
24+
25+
### Bug Fixes
26+
27+
* mock signature retrieval ([#671](https://github.com/hirosystems/chainhook/issues/671)) ([8bb59c1](https://github.com/hirosystems/chainhook/commit/8bb59c1b4727a37df47e08b7a31456bcb6528289))
28+
29+
## [1.9.0-stacks-signers.4](https://github.com/hirosystems/chainhook/compare/v1.9.0-stacks-signers.3...v1.9.0-stacks-signers.4) (2024-10-25)
30+
31+
32+
### Bug Fixes
33+
34+
* bump stacks codec ([3c117b5](https://github.com/hirosystems/chainhook/commit/3c117b562d02b8b5379fd4b0f3187567d7f5289b))
35+
36+
## [1.9.0-stacks-signers.3](https://github.com/hirosystems/chainhook/compare/v1.9.0-stacks-signers.2...v1.9.0-stacks-signers.3) (2024-10-25)
37+
38+
39+
### Features
40+
41+
* add mock signature pubkey ([#670](https://github.com/hirosystems/chainhook/issues/670)) ([c414d79](https://github.com/hirosystems/chainhook/commit/c414d793e9a25c1b541914fee256d98d53bc08a3))
42+
43+
## [1.9.0-stacks-signers.2](https://github.com/hirosystems/chainhook/compare/v1.9.0-stacks-signers.1...v1.9.0-stacks-signers.2) (2024-10-25)
44+
45+
46+
### Features
47+
48+
* add mock signer message support ([#669](https://github.com/hirosystems/chainhook/issues/669)) ([ad5fd54](https://github.com/hirosystems/chainhook/commit/ad5fd54b3d1d8f638fa44a531bca71306fbb8c6f))
49+
50+
## [1.9.0-stacks-signers.1](https://github.com/hirosystems/chainhook/compare/v1.8.0...v1.9.0-stacks-signers.1) (2024-10-25)
51+
52+
53+
### Features
54+
55+
* add various new nakamoto block fields to `/new_block` ingestion and `StacksPayload` ([#659](https://github.com/hirosystems/chainhook/issues/659)) ([f48cda5](https://github.com/hirosystems/chainhook/commit/f48cda533dfc58bb630737fb29cf1bc9c966a638))
56+
* include recovered signer pubkeys in new block payload ([#662](https://github.com/hirosystems/chainhook/issues/662)) ([b5ad4ba](https://github.com/hirosystems/chainhook/commit/b5ad4ba11dd72722bb6cbe936ec29411cde9a606))
57+
* include signer messages in Stacks predicate payloads ([#656](https://github.com/hirosystems/chainhook/issues/656)) ([aee14bc](https://github.com/hirosystems/chainhook/commit/aee14bc693573f403f8a6d8eafe7b30d2ca76b54))
58+
* parse `/stackerdb_chunks` Stacks node event ([#653](https://github.com/hirosystems/chainhook/issues/653)) ([e44d84a](https://github.com/hirosystems/chainhook/commit/e44d84a0d739921a5a3ccae6e9643bdb85005f71))
59+
* store signer messages in local sqlite database ([#664](https://github.com/hirosystems/chainhook/issues/664)) ([d12acd9](https://github.com/hirosystems/chainhook/commit/d12acd9c99ce0d0721dfcb853e5cb236e45925b7))
60+
* support tenure-height in block messages ([#661](https://github.com/hirosystems/chainhook/issues/661)) ([99e5a61](https://github.com/hirosystems/chainhook/commit/99e5a6119fb8e87e1e14d789fdb866eae230e8e8))
61+
* **ts-client:** add persisted predicates and periodic health check ([#658](https://github.com/hirosystems/chainhook/issues/658)) ([535226a](https://github.com/hirosystems/chainhook/commit/535226a80480585aabfcf89d68b21d2ada1c50c1))
62+
* **ts-client:** add signer messages to stacks payloads ([#657](https://github.com/hirosystems/chainhook/issues/657)) ([ff66bb2](https://github.com/hirosystems/chainhook/commit/ff66bb2eab771c16fead154607a280664eb6be4e))
63+
64+
65+
### Bug Fixes
66+
67+
* add a configurable max timeout for outgoing predicate payload requests ([#642](https://github.com/hirosystems/chainhook/issues/642)) ([6c1dfa9](https://github.com/hirosystems/chainhook/commit/6c1dfa9f741041d0fac32e2a89c04a71b4a485cd)), closes [#643](https://github.com/hirosystems/chainhook/issues/643)
68+
* increase stacks event server body size limit to 500MB ([#660](https://github.com/hirosystems/chainhook/issues/660)) ([21234c9](https://github.com/hirosystems/chainhook/commit/21234c978d4c49ea5526c2cf1f74d42a645a68c8))
69+
* return 500 status code to Stacks node when event ingestion fails ([#648](https://github.com/hirosystems/chainhook/issues/648)) ([63c753c](https://github.com/hirosystems/chainhook/commit/63c753c1a1b043e271d1ebca1f90f154030a89e8)), closes [#646](https://github.com/hirosystems/chainhook/issues/646)
70+
* signer pubkey calculation ([#665](https://github.com/hirosystems/chainhook/issues/665)) ([cc93873](https://github.com/hirosystems/chainhook/commit/cc93873dacc88e5df97d1006394b99744e63009b))
71+
* update SignerMessage deserializing ([#663](https://github.com/hirosystems/chainhook/issues/663)) ([71364c1](https://github.com/hirosystems/chainhook/commit/71364c15a88a06d5c71b3f3d3c88c489ff4733d1))
72+
* validate ts client predicates before registering ([#639](https://github.com/hirosystems/chainhook/issues/639)) ([2d08f72](https://github.com/hirosystems/chainhook/commit/2d08f72e44446e9c311f8a64f992e103f17a4ae7))
73+
174
## [1.8.0](https://github.com/hirosystems/chainhook/compare/v1.7.0...v1.8.0) (2024-08-12)
275

376
### New Features

Cargo.lock

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)