Skip to content

Commit b991d52

Browse files
authored
Merge pull request #1448 from hirosystems/master-develop
merge master into develop
2 parents 0203d36 + 20b75d4 commit b991d52

39 files changed

+2179
-1205
lines changed

.env

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ PG_SSL=false
99
# PG_IDLE_TIMEOUT=30
1010
# Max connection lifetime in seconds, defaults to 60
1111
# PG_MAX_LIFETIME=60
12+
# Seconds before force-ending running queries on connection close, defaults to 5
13+
# PG_CLOSE_TIMEOUT=5
1214

1315
# Can be any string, use to specify a use case specific to a deployment
1416
PG_APPLICATION_NAME=stacks-blockchain-api
@@ -33,6 +35,7 @@ PG_APPLICATION_NAME=stacks-blockchain-api
3335
# PG_PRIMARY_SSL=
3436
# PG_PRIMARY_IDLE_TIMEOUT=
3537
# PG_PRIMARY_MAX_LIFETIME=
38+
# PG_PRIMARY_CLOSE_TIMEOUT=
3639
# The connection URI below can be used in place of the PG variables above,
3740
# but if enabled it must be defined without others or omitted.
3841
# PG_PRIMARY_CONNECTION_URI=
@@ -84,14 +87,17 @@ STACKS_CORE_RPC_PORT=20443
8487
## configure the chainID/networkID; testnet: 0x80000000, mainnet: 0x00000001
8588
STACKS_CHAIN_ID=0x00000001
8689

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+
8793
BTC_RPC_HOST=http://127.0.0.1
8894
BTC_RPC_PORT=18443
8995
BTC_RPC_USER=btc
9096
BTC_RPC_PW=btc
9197
BTC_FAUCET_PK=29c028009a8331358adcc61bb6397377c995d327ac0343ed8e8f1d4d3ef85c27
9298

9399
# The contracts used to query for inbound transactions
94-
TESTNET_SEND_MANY_CONTRACT_ID=STR8P3RD1EHA8AA37ERSSSZSWKS9T2GYQFGXNA4C.send-many-memo
100+
TESTNET_SEND_MANY_CONTRACT_ID=ST3F1X4QGV2SM8XD96X45M6RTQXKA1PZJZZCQAB4B.send-many-memo
95101
MAINNET_SEND_MANY_CONTRACT_ID=SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-many-memo
96102

97103
# Enable debug logging
@@ -132,6 +138,22 @@ MAINNET_SEND_MANY_CONTRACT_ID=SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-man
132138
# IMGIX_DOMAIN=https://<your domain>.imgix.net
133139
# IMGIX_TOKEN=<your token>
134140

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+
135157
# Specify max number of STX address to store in an in-memory LRU cache (CPU optimization).
136158
# Defaults to 50,000, which should result in around 25 megabytes of additional memory usage.
137159
# STACKS_ADDRESS_CACHE_SIZE=10000

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,11 @@ jobs:
565565
uses: docker/build-push-action@v2
566566
with:
567567
context: .
568+
build-args: |
569+
STACKS_API_VERSION=${{ github.head_ref || github.ref_name }}
568570
file: docker/stx-rosetta.Dockerfile
569571
tags: ${{ steps.meta_standalone.outputs.tags }}
570572
labels: ${{ steps.meta_standalone.outputs.labels }}
571-
cache-from: type=gha
572-
cache-to: type=gha,mode=max
573573
# 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)
574574
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) }}
575575

CHANGELOG.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,90 @@
1+
## [6.2.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.2.0...v6.2.1) (2022-11-18)
2+
3+
4+
### Bug Fixes
5+
6+
* get rosetta latest block from chain_tip view ([#1445](https://github.com/hirosystems/stacks-blockchain-api/issues/1445)) ([ad386d3](https://github.com/hirosystems/stacks-blockchain-api/commit/ad386d30d18afcf22aba51f0c898f306eaaf5fdf))
7+
* handle postgres dns lookup error ([#1433](https://github.com/hirosystems/stacks-blockchain-api/issues/1433)) ([e00efd4](https://github.com/hirosystems/stacks-blockchain-api/commit/e00efd4e64a3f0072ffa103e9ec011e5a080e7ed))
8+
* handle websocket messages with a priority queue ([#1427](https://github.com/hirosystems/stacks-blockchain-api/issues/1427)) ([f0cb01c](https://github.com/hirosystems/stacks-blockchain-api/commit/f0cb01c0541496959b924b29b5962caf63099432))
9+
* revert to 404 error code on bns name errors ([#1440](https://github.com/hirosystems/stacks-blockchain-api/issues/1440)) ([cdc039c](https://github.com/hirosystems/stacks-blockchain-api/commit/cdc039cea88749103a48cfc66d55d3ba14b3c2a3))
10+
11+
## [6.2.0-beta.6](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.2.0-beta.5...v6.2.0-beta.6) (2022-11-18)
12+
13+
14+
### Bug Fixes
15+
16+
* get rosetta latest block from chain_tip view ([#1445](https://github.com/hirosystems/stacks-blockchain-api/issues/1445)) ([ad386d3](https://github.com/hirosystems/stacks-blockchain-api/commit/ad386d30d18afcf22aba51f0c898f306eaaf5fdf))
17+
18+
## [6.2.0-beta.5](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.2.0-beta.4...v6.2.0-beta.5) (2022-11-15)
19+
20+
21+
### Bug Fixes
22+
23+
* handle postgres dns lookup error ([#1433](https://github.com/hirosystems/stacks-blockchain-api/issues/1433)) ([e00efd4](https://github.com/hirosystems/stacks-blockchain-api/commit/e00efd4e64a3f0072ffa103e9ec011e5a080e7ed))
24+
* handle websocket messages with a priority queue ([#1427](https://github.com/hirosystems/stacks-blockchain-api/issues/1427)) ([f0cb01c](https://github.com/hirosystems/stacks-blockchain-api/commit/f0cb01c0541496959b924b29b5962caf63099432))
25+
* revert to 404 error code on bns name errors ([#1440](https://github.com/hirosystems/stacks-blockchain-api/issues/1440)) ([cdc039c](https://github.com/hirosystems/stacks-blockchain-api/commit/cdc039cea88749103a48cfc66d55d3ba14b3c2a3))
26+
27+
## [6.2.0](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.1.1...v6.2.0) (2022-11-15)
28+
29+
30+
### Features
31+
32+
* add ENV configs for DB close and API shutdown timeouts ([#1366](https://github.com/hirosystems/stacks-blockchain-api/issues/1366)) ([444f008](https://github.com/hirosystems/stacks-blockchain-api/commit/444f008fe2f188148ce14c519373a053a3fc8c89))
33+
* add memos to send-many-memo rosetta STX transfer operations ([#1389](https://github.com/hirosystems/stacks-blockchain-api/issues/1389)) ([0a552b8](https://github.com/hirosystems/stacks-blockchain-api/commit/0a552b8d8c193f64199e63b0956b1c070ce2c530))
34+
* catch cache controller db errors ([#1368](https://github.com/hirosystems/stacks-blockchain-api/issues/1368)) ([f15df41](https://github.com/hirosystems/stacks-blockchain-api/commit/f15df41fa98a171b5e20289240c391a847fd1460))
35+
* disable faucet endpoints on mainnet ([#1425](https://github.com/hirosystems/stacks-blockchain-api/issues/1425)) ([b79b9b4](https://github.com/hirosystems/stacks-blockchain-api/commit/b79b9b43d5bce5d65f5bc322589704e40de1ad55))
36+
* handle postgres.js connection timeouts ([#1424](https://github.com/hirosystems/stacks-blockchain-api/issues/1424)) ([4a2a342](https://github.com/hirosystems/stacks-blockchain-api/commit/4a2a342b56c24e9b27b37116960555a425a0eb42))
37+
* remove duplicate tx socket updates inside db transactions ([#1360](https://github.com/hirosystems/stacks-blockchain-api/issues/1360)) ([60c185d](https://github.com/hirosystems/stacks-blockchain-api/commit/60c185d83970fe7cf590075029cd5fd878da96fa))
38+
* sql transaction consistency ([#1410](https://github.com/hirosystems/stacks-blockchain-api/issues/1410)) ([01e26d9](https://github.com/hirosystems/stacks-blockchain-api/commit/01e26d9c89472c8e07ee9d44372d3de86ee0fdb0))
39+
* update testnet send-many-memo contract id ENV ([#1420](https://github.com/hirosystems/stacks-blockchain-api/issues/1420)) ([45ea24d](https://github.com/hirosystems/stacks-blockchain-api/commit/45ea24d9a2df96d582aaae70e433b0717a0e47cf))
40+
41+
42+
## [6.2.0-beta.4](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.2.0-beta.3...v6.2.0-beta.4) (2022-11-08)
43+
44+
45+
### Bug Fixes
46+
47+
* disable faucet endpoints on mainnet ([#1425](https://github.com/hirosystems/stacks-blockchain-api/issues/1425)) ([b79b9b4](https://github.com/hirosystems/stacks-blockchain-api/commit/b79b9b43d5bce5d65f5bc322589704e40de1ad55))
48+
* handle postgres.js connection timeouts ([#1424](https://github.com/hirosystems/stacks-blockchain-api/issues/1424)) ([4a2a342](https://github.com/hirosystems/stacks-blockchain-api/commit/4a2a342b56c24e9b27b37116960555a425a0eb42))
49+
50+
## [6.2.0-beta.3](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.2.0-beta.2...v6.2.0-beta.3) (2022-11-07)
51+
52+
53+
### Bug Fixes
54+
55+
* update testnet send-many-memo contract id ENV ([#1420](https://github.com/hirosystems/stacks-blockchain-api/issues/1420)) ([45ea24d](https://github.com/hirosystems/stacks-blockchain-api/commit/45ea24d9a2df96d582aaae70e433b0717a0e47cf))
56+
57+
## [6.2.0-beta.2](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.2.0-beta.1...v6.2.0-beta.2) (2022-11-04)
58+
59+
60+
### Bug Fixes
61+
62+
* log PoisonMicroblock tx instead rather than throwing ([#1379](https://github.com/hirosystems/stacks-blockchain-api/issues/1379)) ([cee6352](https://github.com/hirosystems/stacks-blockchain-api/commit/cee63529b4785d9bedc8fcfd568a27aedef0914d))
63+
64+
## [6.2.0-beta.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.1.0...v6.2.0-beta.1) (2022-11-03)
65+
66+
67+
### Features
68+
69+
* add ENV configs for DB close and API shutdown timeouts ([#1366](https://github.com/hirosystems/stacks-blockchain-api/issues/1366)) ([444f008](https://github.com/hirosystems/stacks-blockchain-api/commit/444f008fe2f188148ce14c519373a053a3fc8c89))
70+
71+
### Bug Fixes
72+
73+
* add memos to send-many-memo rosetta STX transfer operations ([#1389](https://github.com/hirosystems/stacks-blockchain-api/issues/1389)) ([0a552b8](https://github.com/hirosystems/stacks-blockchain-api/commit/0a552b8d8c193f64199e63b0956b1c070ce2c530))
74+
* catch cache controller db errors ([#1368](https://github.com/hirosystems/stacks-blockchain-api/issues/1368)) ([f15df41](https://github.com/hirosystems/stacks-blockchain-api/commit/f15df41fa98a171b5e20289240c391a847fd1460))
75+
* remove duplicate tx socket updates inside db transactions ([#1360](https://github.com/hirosystems/stacks-blockchain-api/issues/1360)) ([60c185d](https://github.com/hirosystems/stacks-blockchain-api/commit/60c185d83970fe7cf590075029cd5fd878da96fa))
76+
* sql transaction consistency ([#1410](https://github.com/hirosystems/stacks-blockchain-api/issues/1410)) ([01e26d9](https://github.com/hirosystems/stacks-blockchain-api/commit/01e26d9c89472c8e07ee9d44372d3de86ee0fdb0))
77+
78+
79+
180
## [6.1.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.1.0...v6.1.1) (2022-10-24)
281

382

483
### Bug Fixes
584

685
* log PoisonMicroblock tx instead rather than throwing ([#1379](https://github.com/hirosystems/stacks-blockchain-api/issues/1379)) ([cee6352](https://github.com/hirosystems/stacks-blockchain-api/commit/cee63529b4785d9bedc8fcfd568a27aedef0914d))
786

87+
888
## [6.1.0](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.0.4...v6.1.0) (2022-10-13)
989

1090

docker/stx-rosetta.Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
ARG STACKS_API_VERSION=v0.71.2
1+
ARG STACKS_API_VERSION
22
ARG STACKS_NODE_VERSION=2.05.0.4.0
3-
ARG STACKS_API_REPO=blockstack/stacks-blockchain-api
4-
ARG STACKS_NODE_REPO=blockstack/stacks-blockchain
5-
ARG PG_VERSION=12
3+
ARG STACKS_API_REPO=hirosystems/stacks-blockchain-api
4+
ARG STACKS_NODE_REPO=stacks-network/stacks-blockchain
5+
ARG PG_VERSION=14
66
ARG STACKS_NETWORK=mainnet
77
ARG STACKS_LOG_DIR=/var/log/stacks-node
88
ARG STACKS_SVC_DIR=/etc/service
@@ -30,7 +30,7 @@ RUN apt-get update -y \
3030
jq \
3131
openjdk-11-jre-headless \
3232
cmake \
33-
&& git clone -b ${STACKS_API_VERSION} --depth 1 https://github.com/${STACKS_API_REPO} . \
33+
&& git clone -b ${STACKS_API_VERSION} https://github.com/${STACKS_API_REPO} . \
3434
&& echo "GIT_TAG=$(git tag --points-at HEAD)" >> .env \
3535
&& npm config set unsafe-perm true \
3636
&& npm ci \

docs/openapi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ paths:
13921392
/extended/v1/address/{principal}/{tx_id}/with_transfers:
13931393
get:
13941394
summary: Get account transaction information for specific transaction
1395-
description: Retrieves transaction details for a given Transcation Id `tx_id`, for a given account or contract Identifier.
1395+
description: Retrieves transaction details for a given Transaction Id `tx_id`, for a given account or contract Identifier.
13961396
tags:
13971397
- Accounts
13981398
operationId: get_single_transaction_with_transfers
@@ -2149,7 +2149,7 @@ paths:
21492149
- Rosetta
21502150
summary: Get All Mempool Transactions
21512151
operationId: rosetta_mempool
2152-
description: Retrieves a list of transcations currently in the mempool for a given network.
2152+
description: Retrieves a list of transactions currently in the mempool for a given network.
21532153
responses:
21542154
200:
21552155
description: Success

docs/socket-io/index.d.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,38 @@ export type Topic =
2424
| NftAssetEventTopic
2525
| NftCollectionEventTopic;
2626

27+
// Allows timeout callbacks for messages. See
28+
// https://socket.io/docs/v4/typescript/#emitting-with-a-timeout
29+
type WithTimeoutAck<isSender extends boolean, args extends any[]> = isSender extends true ? [Error, ...args] : args;
30+
2731
export interface ClientToServerMessages {
2832
subscribe: (topic: Topic | Topic[], callback: (error: string | null) => void) => void;
2933
unsubscribe: (...topic: Topic[]) => void;
3034
}
3135

32-
export interface ServerToClientMessages {
33-
block: (block: Block) => void;
34-
microblock: (microblock: Microblock) => void;
35-
mempool: (transaction: MempoolTransaction) => void;
36-
transaction: (transaction: Transaction | MempoolTransaction) => void;
36+
export interface ServerToClientMessages<isSender extends boolean = false> {
37+
block: (block: Block, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
38+
microblock: (microblock: Microblock, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
39+
mempool: (transaction: MempoolTransaction, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
40+
transaction: (transaction: Transaction | MempoolTransaction, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
3741

3842
// @ts-ignore scheduled for support in TS v4.3 https://github.com/microsoft/TypeScript/pull/26797
39-
[key: 'nft-event']: (event: NftEvent) => void;
40-
'nft-event': (event: NftEvent) => void;
43+
[key: 'nft-event']: (event: NftEvent, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
44+
'nft-event': (event: NftEvent, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
4145

4246
// @ts-ignore scheduled for support in TS v4.3 https://github.com/microsoft/TypeScript/pull/26797
43-
[key: NftAssetEventTopic]: (assetIdentifier: string, value: string, event: NftEvent) => void;
44-
'nft-asset-event': (assetIdentifier: string, value: string, event: NftEvent) => void;
47+
[key: NftAssetEventTopic]: (assetIdentifier: string, value: string, event: NftEvent, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
48+
'nft-asset-event': (assetIdentifier: string, value: string, event: NftEvent, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
4549

4650
// @ts-ignore scheduled for support in TS v4.3 https://github.com/microsoft/TypeScript/pull/26797
47-
[key: NftCollectionEventTopic]: (assetIdentifier: string, event: NftEvent) => void;
48-
'nft-collection-event': (assetIdentifier: string, event: NftEvent) => void;
51+
[key: NftCollectionEventTopic]: (assetIdentifier: string, event: NftEvent, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
52+
'nft-collection-event': (assetIdentifier: string, event: NftEvent, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
4953

5054
// @ts-ignore scheduled for support in TS v4.3 https://github.com/microsoft/TypeScript/pull/26797
51-
[key: AddressTransactionTopic]: (address: string, stxBalance: AddressTransactionWithTransfers) => void;
52-
'address-transaction': (address: string, tx: AddressTransactionWithTransfers) => void;
55+
[key: AddressTransactionTopic]: (address: string, stxBalance: AddressTransactionWithTransfers, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
56+
'address-transaction': (address: string, tx: AddressTransactionWithTransfers, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
5357

5458
// @ts-ignore scheduled for support in TS v4.3 https://github.com/microsoft/TypeScript/pull/26797
55-
[key: AddressStxBalanceTopic]: (address: string, stxBalance: AddressStxBalanceResponse) => void;
56-
'address-stx-balance': (address: string, stxBalance: AddressStxBalanceResponse) => void;
59+
[key: AddressStxBalanceTopic]: (address: string, stxBalance: AddressStxBalanceResponse, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
60+
'address-stx-balance': (address: string, stxBalance: AddressStxBalanceResponse, callback: (...args: WithTimeoutAck<isSender, [string]>) => void) => void;
5761
}

package-lock.json

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

package.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,18 @@
5656
"engineStrict": true,
5757
"release": {
5858
"plugins": [
59-
["@semantic-release/commit-analyzer", {
60-
"preset": "conventionalcommits"
61-
}],
62-
["@semantic-release/release-notes-generator", {
63-
"preset": "conventionalcommits"
64-
}],
59+
[
60+
"@semantic-release/commit-analyzer",
61+
{
62+
"preset": "conventionalcommits"
63+
}
64+
],
65+
[
66+
"@semantic-release/release-notes-generator",
67+
{
68+
"preset": "conventionalcommits"
69+
}
70+
],
6571
[
6672
"@semantic-release/exec",
6773
{
@@ -137,7 +143,7 @@
137143
"pg": "8.7.1",
138144
"pg-copy-streams": "5.1.1",
139145
"pg-cursor": "2.7.1",
140-
"postgres": "3.2.4",
146+
"postgres": "3.3.1",
141147
"prom-client": "14.0.1",
142148
"rpc-bitcoin": "2.0.0",
143149
"socket.io": "4.4.0",

0 commit comments

Comments
 (0)