Skip to content

Commit 26033a6

Browse files
authored
Merge pull request #1459 from hirosystems/chore/merge-dev-2.1
Merge `develop` into `stacks-2.1` branch
2 parents e467494 + a45b01c commit 26033a6

File tree

122 files changed

+6591
-4324
lines changed

Some content is hidden

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

122 files changed

+6591
-4324
lines changed

.env

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ PG_PASSWORD=postgres
55
PG_DATABASE=stacks_blockchain_api
66
PG_SCHEMA=public
77
PG_SSL=false
8+
# Idle connection timeout in seconds, defaults to 30
9+
# PG_IDLE_TIMEOUT=30
10+
# Max connection lifetime in seconds, defaults to 60
11+
# PG_MAX_LIFETIME=60
12+
# Seconds before force-ending running queries on connection close, defaults to 5
13+
# PG_CLOSE_TIMEOUT=5
814

915
# Can be any string, use to specify a use case specific to a deployment
1016
PG_APPLICATION_NAME=stacks-blockchain-api
@@ -27,17 +33,16 @@ PG_APPLICATION_NAME=stacks-blockchain-api
2733
# PG_PRIMARY_DATABASE=
2834
# PG_PRIMARY_SCHEMA=
2935
# PG_PRIMARY_SSL=
36+
# PG_PRIMARY_IDLE_TIMEOUT=
37+
# PG_PRIMARY_MAX_LIFETIME=
38+
# PG_PRIMARY_CLOSE_TIMEOUT=
3039
# The connection URI below can be used in place of the PG variables above,
3140
# but if enabled it must be defined without others or omitted.
3241
# PG_PRIMARY_CONNECTION_URI=
3342

3443
# Limit to how many concurrent connections can be created, defaults to 10
35-
# See https://node-postgres.com/api/pool
3644
# PG_CONNECTION_POOL_MAX=10
3745

38-
# Enable to have stacks-node events streamed to a file while the application is running
39-
# STACKS_EXPORT_EVENTS_FILE=/tmp/stacks-events.tsv
40-
4146
# If specified, controls the Stacks Blockchain API mode. The possible values are:
4247
# * `readonly`: Runs the API endpoints without an Event Server that listens to events from a node and
4348
# writes them to the local database. The API will only read data from the PG database
@@ -82,14 +87,17 @@ STACKS_CORE_RPC_PORT=20443
8287
## configure the chainID/networkID; testnet: 0x80000000, mainnet: 0x00000001
8388
STACKS_CHAIN_ID=0x00000001
8489

90+
# Seconds to allow API components to shut down gracefully before force-killing them, defaults to 60
91+
# STACKS_SHUTDOWN_FORCE_KILL_TIMEOUT=60
92+
8593
BTC_RPC_HOST=http://127.0.0.1
8694
BTC_RPC_PORT=18443
8795
BTC_RPC_USER=btc
8896
BTC_RPC_PW=btc
8997
BTC_FAUCET_PK=29c028009a8331358adcc61bb6397377c995d327ac0343ed8e8f1d4d3ef85c27
9098

9199
# The contracts used to query for inbound transactions
92-
TESTNET_SEND_MANY_CONTRACT_ID=STR8P3RD1EHA8AA37ERSSSZSWKS9T2GYQFGXNA4C.send-many-memo
100+
TESTNET_SEND_MANY_CONTRACT_ID=ST3F1X4QGV2SM8XD96X45M6RTQXKA1PZJZZCQAB4B.send-many-memo
93101
MAINNET_SEND_MANY_CONTRACT_ID=SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-many-memo
94102

95103
# Enable debug logging
@@ -130,6 +138,22 @@ MAINNET_SEND_MANY_CONTRACT_ID=SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-man
130138
# IMGIX_DOMAIN=https://<your domain>.imgix.net
131139
# IMGIX_TOKEN=<your token>
132140

141+
# Web Socket ping interval to determine client availability, in seconds.
142+
# STACKS_API_WS_PING_INTERVAL=5
143+
144+
# Web Socket ping timeout, in seconds. Clients will be dropped if they do not respond with a pong
145+
# after this time has elapsed.
146+
# STACKS_API_WS_PING_TIMEOUT=5
147+
148+
# Web Socket message timeout, in seconds. Clients will be dropped if they do not acknowledge a
149+
# message after this time has elapsed.
150+
# STACKS_API_WS_MESSAGE_TIMEOUT=5
151+
152+
# Web Socket update queue timeout, in seconds. When an update is scheduled (new block, tx update,
153+
# etc.), we will allow this number of seconds to elapse to allow all subscribed clients to receive
154+
# new data.
155+
# STACKS_API_WS_UPDATE_QUEUE_TIMEOUT=5
156+
133157
# Specify max number of STX address to store in an in-memory LRU cache (CPU optimization).
134158
# Defaults to 50,000, which should result in around 25 megabytes of additional memory usage.
135159
# STACKS_ADDRESS_CACHE_SIZE=10000

.github/workflows/ci.yml

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ jobs:
8686
- name: Build schema & docs
8787
run: npm run build
8888

89-
# - name: Validate generated types
90-
# run: npm run validate:types
89+
- name: Validate generated types
90+
run: tsc index.d.ts
9191

9292
- name: Lint JSON
9393
run: npm run lint:json
@@ -168,6 +168,62 @@ jobs:
168168
flag-name: run-${{ github.job }}
169169
parallel: true
170170

171+
test-event-replay:
172+
runs-on: ubuntu-latest
173+
steps:
174+
- uses: actions/checkout@v2
175+
176+
- name: Use Node.js
177+
uses: actions/setup-node@v2
178+
with:
179+
node-version-file: '.nvmrc'
180+
181+
- name: Cache node modules
182+
uses: actions/cache@v2
183+
env:
184+
cache-name: cache-node-modules
185+
with:
186+
path: |
187+
~/.npm
188+
**/node_modules
189+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
190+
restore-keys: |
191+
${{ runner.os }}-build-${{ env.cache-name }}-
192+
${{ runner.os }}-build-
193+
${{ runner.os }}-
194+
195+
- name: Install deps
196+
run: npm ci --audit=false
197+
198+
- name: Setup integration environment
199+
run: |
200+
sudo ufw disable
201+
docker compose -f docker/docker-compose.dev.postgres.yml up -d
202+
npm run devenv:logs -- --no-color &> docker-compose-logs.txt &
203+
204+
- name: Run RPC tests
205+
run: npm run test:event-replay
206+
207+
- name: Print integration environment logs
208+
run: cat docker-compose-logs.txt
209+
if: failure()
210+
211+
- name: Teardown integration environment
212+
run: npm run devenv:stop
213+
if: always()
214+
215+
- name: Upload coverage to Codecov
216+
uses: codecov/codecov-action@v2
217+
if: always()
218+
219+
- name: Upload coverage to Coveralls
220+
uses: coverallsapp/github-action@master
221+
if: always()
222+
with:
223+
github-token: ${{ secrets.github_token }}
224+
flag-name: run-${{ github.job }}
225+
parallel: true
226+
171227
test-rpc:
172228
runs-on: ubuntu-latest
173229
steps:
@@ -774,6 +830,7 @@ jobs:
774830
@semantic-release/changelog
775831
@semantic-release/git
776832
@semantic-release/exec
833+
conventional-changelog-conventionalcommits
777834
778835
- name: Set up Docker Buildx
779836
uses: docker/setup-buildx-action@v1
@@ -790,6 +847,7 @@ jobs:
790847
type=ref,event=pr
791848
type=semver,pattern={{version}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}
792849
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}
850+
type=raw,value=latest,enable={{is_default_branch}}
793851
794852
- name: Docker Standalone Meta
795853
id: meta_standalone
@@ -803,6 +861,7 @@ jobs:
803861
type=ref,event=pr
804862
type=semver,pattern={{version}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}
805863
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}
864+
type=raw,value=latest,enable={{is_default_branch}}
806865
807866
- name: Login to DockerHub
808867
uses: docker/login-action@v1
@@ -823,11 +882,11 @@ jobs:
823882
uses: docker/build-push-action@v2
824883
with:
825884
context: .
885+
build-args: |
886+
STACKS_API_VERSION=${{ github.head_ref || github.ref_name }}
826887
file: docker/stx-rosetta.Dockerfile
827888
tags: ${{ steps.meta_standalone.outputs.tags }}
828889
labels: ${{ steps.meta_standalone.outputs.labels }}
829-
cache-from: type=gha
830-
cache-to: type=gha,mode=max
831890
# Only push if (there's a new release on main branch, or if building a non-main branch) and (Only run on non-PR events or only PRs that aren't from forks)
832891
push: ${{ (github.ref != 'refs/heads/master' || steps.semantic.outputs.new_release_version != '') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
833892

.github/workflows/new-issues.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Add issues to API project
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
8+
jobs:
9+
add-to-project:
10+
name: Add issue to project
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/add-to-project@main
14+
with:
15+
project-url: https://github.com/orgs/hirosystems/projects/11
16+
github-token: ${{ secrets.GH_TOKEN }}

.gitpod.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM blockstack/stacks-blockchain:2.05.0.0.0-stretch as corenode
1+
FROM blockstack/stacks-blockchain:2.05.0.4.0 as corenode
22

33
FROM gitpod/workspace-postgres
44

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,23 @@
195195
"preLaunchTask": "stacks-node:deploy-dev",
196196
"postDebugTask": "stacks-node:stop-dev"
197197
},
198+
{
199+
"type": "node",
200+
"request": "launch",
201+
"name": "Jest: Event Replay",
202+
"program": "${workspaceFolder}/node_modules/.bin/jest",
203+
"args": [
204+
"--testTimeout=3600000",
205+
"--runInBand",
206+
"--no-cache",
207+
"--config",
208+
"${workspaceRoot}/jest.config.event-replay.js"
209+
],
210+
"outputCapture": "std",
211+
"console": "integratedTerminal",
212+
"preLaunchTask": "stacks-node:deploy-dev",
213+
"postDebugTask": "stacks-node:stop-dev"
214+
},
198215
{
199216
"type": "node",
200217
"request": "launch",

0 commit comments

Comments
 (0)