Skip to content

Commit c856133

Browse files
authored
Merge pull request #1432 from hirosystems/beta
release v6.2.0
2 parents 93d572e + e23963f commit c856133

34 files changed

+1776
-1121
lines changed

.env

Lines changed: 7 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

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,11 @@ jobs:
563563
uses: docker/build-push-action@v2
564564
with:
565565
context: .
566+
build-args: |
567+
STACKS_API_VERSION=${{ github.head_ref || github.ref_name }}
566568
file: docker/stx-rosetta.Dockerfile
567569
tags: ${{ steps.meta_standalone.outputs.tags }}
568570
labels: ${{ steps.meta_standalone.outputs.labels }}
569-
cache-from: type=gha
570-
cache-to: type=gha,mode=max
571571
# 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)
572572
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) }}
573573

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,48 @@
1+
## [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)
2+
3+
4+
### Bug Fixes
5+
6+
* 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))
7+
* 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))
8+
9+
## [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)
10+
11+
12+
### Bug Fixes
13+
14+
* 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))
15+
16+
## [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)
17+
18+
19+
### Bug Fixes
20+
21+
* 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))
22+
23+
## [6.2.0-beta.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.1.0...v6.2.0-beta.1) (2022-11-03)
24+
25+
26+
### Features
27+
28+
* 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))
29+
30+
### Bug Fixes
31+
32+
* 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))
33+
* 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))
34+
* 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))
35+
* sql transaction consistency ([#1410](https://github.com/hirosystems/stacks-blockchain-api/issues/1410)) ([01e26d9](https://github.com/hirosystems/stacks-blockchain-api/commit/01e26d9c89472c8e07ee9d44372d3de86ee0fdb0))
36+
37+
138
## [6.1.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v6.1.0...v6.1.1) (2022-10-24)
239

340

441
### Bug Fixes
542

643
* 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))
744

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

1048

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 \

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",

src/api/controllers/cache-controller.ts

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -249,41 +249,58 @@ async function calculateETag(
249249
): Promise<ETag | undefined> {
250250
switch (etagType) {
251251
case ETagType.chainTip:
252-
const chainTip = await db.getUnanchoredChainTip();
253-
if (!chainTip.found) {
254-
// This should never happen unless the API is serving requests before it has synced any blocks.
252+
try {
253+
const chainTip = await db.getUnanchoredChainTip();
254+
if (!chainTip.found) {
255+
// This should never happen unless the API is serving requests before it has synced any
256+
// blocks.
257+
return;
258+
}
259+
return chainTip.result.microblockHash ?? chainTip.result.indexBlockHash;
260+
} catch (error) {
261+
logger.error(`Unable to calculate chain_tip ETag: ${error}`);
255262
return;
256263
}
257-
return chainTip.result.microblockHash ?? chainTip.result.indexBlockHash;
258264

259265
case ETagType.mempool:
260-
const digest = await db.getMempoolTxDigest();
261-
if (!digest.found) {
262-
// This should never happen unless the API is serving requests before it has synced any blocks.
266+
try {
267+
const digest = await db.getMempoolTxDigest();
268+
if (!digest.found) {
269+
// This should never happen unless the API is serving requests before it has synced any
270+
// blocks.
271+
return;
272+
}
273+
if (digest.result.digest === null) {
274+
// A `null` mempool digest means the `bit_xor` postgres function is unavailable.
275+
return ETAG_EMPTY;
276+
}
277+
return digest.result.digest;
278+
} catch (error) {
279+
logger.error(`Unable to calculate mempool ETag: ${error}`);
263280
return;
264281
}
265-
if (digest.result.digest === null) {
266-
// A `null` mempool digest means the `bit_xor` postgres function is unavailable.
267-
return ETAG_EMPTY;
268-
}
269-
return digest.result.digest;
270282

271283
case ETagType.transaction:
272-
const { tx_id } = req.params;
273-
const normalizedTxId = normalizeHashString(tx_id);
274-
if (normalizedTxId === false) {
275-
return ETAG_EMPTY;
276-
}
277-
const status = await db.getTxStatus(normalizedTxId);
278-
if (!status.found) {
279-
return ETAG_EMPTY;
284+
try {
285+
const { tx_id } = req.params;
286+
const normalizedTxId = normalizeHashString(tx_id);
287+
if (normalizedTxId === false) {
288+
return ETAG_EMPTY;
289+
}
290+
const status = await db.getTxStatus(normalizedTxId);
291+
if (!status.found) {
292+
return ETAG_EMPTY;
293+
}
294+
const elements: string[] = [
295+
normalizedTxId,
296+
status.result.index_block_hash ?? '',
297+
status.result.microblock_hash ?? '',
298+
status.result.status.toString(),
299+
];
300+
return elements.join(':');
301+
} catch (error) {
302+
logger.error(`Unable to calculate transaction ETag: ${error}`);
303+
return;
280304
}
281-
const elements: string[] = [
282-
normalizedTxId,
283-
status.result.index_block_hash ?? '',
284-
status.result.microblock_hash ?? '',
285-
status.result.status.toString(),
286-
];
287-
return elements.join(':');
288305
}
289306
}

0 commit comments

Comments
 (0)