Skip to content

Commit 0857de2

Browse files
committed
Merge branch 'develop' into feat/cleanup
* develop: (42 commits) feat: rosetta data api and construction validation with rosetta-cli feat: stx addr encoding LRU cache feat: add nft_custody pg materialized view to speed up nft event lookup fix: build/publish Dockerfile python installation issues Add utils module with script to display top address balances chore: standardize updates between websockets and socket.io fix: transaction broadcast log chore: change @kyranjamie to @rafaelcr on pr template chore: rename github references from blockstack/ to hirosystems/ chore: fix flaky BNS tests #723 feat: endpoint for list of transactions #647 chore: update c32check and cross-sha256 (including transitive) dependencies feat: production-capable CPU profiling #641 chore: add read-only to readme fix: export api version variable for resolution fix: microblock related re-org bug causing txs to be incorrectly orphaned #804 #818 fix: api versioning fix(docs): ensure naming convention is followed fix: rosetta account/balance speed feat: add broadcast/confirmed tx logs ...
2 parents 07340ca + f764054 commit 0857de2

File tree

138 files changed

+7440
-2150
lines changed

Some content is hidden

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

138 files changed

+7440
-2150
lines changed

.env

+14
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ PG_SSL=false
1717
# Enable to have stacks-node events streamed to a file while the application is running
1818
# STACKS_EXPORT_EVENTS_FILE=/tmp/stacks-events.tsv
1919

20+
# Initializes the API in read-only mode i.e. without an event server that listens to events from a node and writes them
21+
# to the local database. The API will only read data from the PG database specified above to respond to requests.
22+
# STACKS_READ_ONLY_MODE=true
23+
24+
# If specified, an http server providing profiling capability endpoints will be opened on the given port.
25+
# This port should not be publicly exposed.
26+
# STACKS_PROFILER_PORT=9119
27+
2028
STACKS_CORE_EVENT_PORT=3700
2129
STACKS_CORE_EVENT_HOST=127.0.0.1
2230

@@ -49,6 +57,9 @@ BTC_FAUCET_PK=29c028009a8331358adcc61bb6397377c995d327ac0343ed8e8f1d4d3ef85c27
4957
TESTNET_SEND_MANY_CONTRACT_ID=STR8P3RD1EHA8AA37ERSSSZSWKS9T2GYQFGXNA4C.send-many-memo
5058
MAINNET_SEND_MANY_CONTRACT_ID=SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-many-memo
5159

60+
# Enable debug logging
61+
# STACKS_API_LOG_LEVEL=debug
62+
5263
# Directory containing Stacks 1.0 BNS data extracted from https://storage.googleapis.com/blockstack-v1-migration-data/export-data.tar.gz
5364
# BNS_IMPORT_DIR=/extracted/export-data-dir/
5465

@@ -73,3 +84,6 @@ MAINNET_SEND_MANY_CONTRACT_ID=SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-man
7384
# IMGIX_DOMAIN=https://<your domain>.imgix.net
7485
# IMGIX_TOKEN=<your token>
7586

87+
# Specify max number of STX address to store in an in-memory LRU cache (CPU optimization).
88+
# Defaults to 50,000, which should result in around 25 megabytes of additional memory usage.
89+
# STACKS_ADDRESS_CACHE_SIZE=10000

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ src/tests-rosetta-cli/
1515
src/tests-bns/
1616
client/src/
1717
config/
18+
utils/src/

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
ecmaVersion: 2020,
1010
sourceType: 'module',
1111
},
12-
ignorePatterns: ['lib/*', 'client/*'],
12+
ignorePatterns: ['lib/*', 'client/*', 'utils/*'],
1313
rules: {
1414
'prettier/prettier': 'error',
1515

.github/ISSUE_TEMPLATE/testnet-bug.md

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ that demonstrates the issue.
3434

3535
----
3636

37-
If you think this is eligible for a [bug bounty](https://testnet.blockstack.org/bounties), please check the relevant boxes below:
38-
3937
### Critical, Launch Blocking Bugs
4038
**Consensus critical bugs**
4139
- [ ] Can cause a chain split

.github/PULL_REQUEST_TEMPLATE.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Describe the changes that where made in this pull request. When possible start w
1111
5. Provide examples of use cases with code samples and applicable acceptance criteria
1212

1313
Example:
14-
As a Blockstack developer, I would like to encrypt files using the app private key. This is needed because storing unencrypted files is unacceptable. This pull request adds the `encryptContent` function which will take a string and encrypt it using the app private key.
14+
As a Hiro Systems developer, I would like to encrypt files using the app private key. This is needed because storing unencrypted files is unacceptable. This pull request adds the `encryptContent` function which will take a string and encrypt it using the app private key.
1515

1616
```
1717
encryptContent('my data')
@@ -41,7 +41,7 @@ Workarounds for or expected timeline for deprecation
4141
- Change in instructions inside tutorials/guides
4242
- etc...
4343
44-
The best way to find these is by searching inside the docs at https://github.com/blockstack/docs
44+
The best way to find these is by searching inside the docs at https://github.com/hirosystems/docs
4545
-->
4646
- [ ] Link to documentation updates:
4747

@@ -60,4 +60,4 @@ Provide context on how tests should be performed.
6060
- [ ] Unit test coverage for new or modified code paths
6161
- [ ] `npm run test` passes
6262
- [ ] Changelog is updated
63-
- [ ] Tag 1 of @kyranjamie or @zone117x for review
63+
- [ ] Tag 1 of @rafaelcr or @zone117x for review

.github/workflows/gh-pages.yml

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
name: gh-pages
22

33
on:
4-
push:
4+
workflow_run:
5+
workflows:
6+
- "stacks-blockchain-api"
57
branches:
6-
- 'master'
8+
- master
9+
types:
10+
- completed
711
workflow_dispatch:
812

913
jobs:
1014
gh-pages:
1115
runs-on: ubuntu-latest
1216
steps:
1317
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
1420

1521
- name: Use Node.js
1622
uses: actions/setup-node@v2
@@ -26,15 +32,18 @@ jobs:
2632
run: npm run generate:docs
2733
working-directory: client
2834

35+
- name: Generate git info
36+
run: npm run git-info
37+
2938
- name: Install deps
3039
run: npm install
3140
working-directory: docs
3241

33-
- name: Generate and deploy gh-pages
34-
run: npm run generate:types && npm run generate:docs && npm run generate:postman
42+
- name: Generate docs
43+
run: npm run generate:resolved-spec && npm run generate:types && npm run generate:docs && npm run generate:postman
3544
working-directory: docs
3645

37-
- name: Publish test coverage report
46+
- name: Deploy gh-pages
3847
uses: JamesIves/[email protected]
3948
with:
4049
branch: gh-pages

.github/workflows/stacks-blockchain-api.yml

+120
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,126 @@ jobs:
266266
uses: codecov/codecov-action@v1
267267
if: always()
268268

269+
test-rosetta-cli-data:
270+
runs-on: ubuntu-latest
271+
steps:
272+
- uses: actions/checkout@v2
273+
274+
- name: Use Node.js
275+
uses: actions/setup-node@v2
276+
with:
277+
node-version: '14'
278+
check-latest: true
279+
280+
- name: Cache node modules
281+
uses: actions/cache@v2
282+
env:
283+
cache-name: cache-node-modules
284+
with:
285+
path: |
286+
~/.npm
287+
node_modules
288+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
289+
restore-keys: |
290+
${{ runner.os }}-build-${{ env.cache-name }}-
291+
${{ runner.os }}-build-
292+
${{ runner.os }}-
293+
294+
- name: Install deps
295+
run: npm install --audit=false
296+
297+
- name: Setup env vars
298+
run: echo "STACKS_CORE_EVENT_HOST=http://0.0.0.0">> $GITHUB_ENV
299+
300+
- name: Setup cli enviroment variable
301+
run: |
302+
echo STACKS_BLOCKCHAIN_API_HOST=0.0.0.0>> .env
303+
echo STACKS_CORE_PROXY_HOST=0.0.0.0 >> .env
304+
echo STACKS_CORE_RPC_HOST=0.0.0.0 >> .env
305+
echo STACKS_CORE_EVENT_HOST=0.0.0.0 >> .env
306+
echo BTC_RPC_HOST=http://0.0.0.0 >> .env
307+
308+
- name: Setup integration environment
309+
run: |
310+
sudo ufw disable
311+
npm run devenv:deploy -- -d
312+
npm run devenv:logs -- --no-color &> docker-compose-logs.txt &
313+
314+
- name: Run tests
315+
run: sudo npm run test:rosetta-cli:data
316+
317+
- name: Print integration environment logs
318+
run: cat docker-compose-logs.txt
319+
if: failure()
320+
321+
- name: Teardown integration environment
322+
run: npm run devenv:stop
323+
if: always()
324+
325+
- name: Upload coverage to Codecov
326+
uses: codecov/codecov-action@v1
327+
if: always()
328+
329+
test-rosetta-cli-construction:
330+
runs-on: ubuntu-latest
331+
steps:
332+
- uses: actions/checkout@v2
333+
334+
- name: Use Node.js
335+
uses: actions/setup-node@v2
336+
with:
337+
node-version: '14'
338+
check-latest: true
339+
340+
- name: Cache node modules
341+
uses: actions/cache@v2
342+
env:
343+
cache-name: cache-node-modules
344+
with:
345+
path: |
346+
~/.npm
347+
node_modules
348+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
349+
restore-keys: |
350+
${{ runner.os }}-build-${{ env.cache-name }}-
351+
${{ runner.os }}-build-
352+
${{ runner.os }}-
353+
354+
- name: Install deps
355+
run: npm install --audit=false
356+
357+
- name: Setup env vars
358+
run: echo "STACKS_CORE_EVENT_HOST=http://0.0.0.0">> $GITHUB_ENV
359+
360+
- name: Setup cli enviroment variable
361+
run: |
362+
echo STACKS_BLOCKCHAIN_API_HOST=0.0.0.0>> .env
363+
echo STACKS_CORE_PROXY_HOST=0.0.0.0 >> .env
364+
echo STACKS_CORE_RPC_HOST=0.0.0.0 >> .env
365+
echo STACKS_CORE_EVENT_HOST=0.0.0.0 >> .env
366+
echo BTC_RPC_HOST=http://0.0.0.0 >> .env
367+
368+
- name: Setup integration environment
369+
run: |
370+
sudo ufw disable
371+
npm run devenv:deploy -- -d
372+
npm run devenv:logs -- --no-color &> docker-compose-logs.txt &
373+
374+
- name: Run tests
375+
run: sudo npm run test:rosetta-cli:construction
376+
377+
- name: Print integration environment logs
378+
run: cat docker-compose-logs.txt
379+
if: failure()
380+
381+
- name: Teardown integration environment
382+
run: npm run devenv:stop
383+
if: always()
384+
385+
- name: Upload coverage to Codecov
386+
uses: codecov/codecov-action@v1
387+
if: always()
388+
269389
test-tokens:
270390
runs-on: ubuntu-latest
271391
steps:

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,7 @@ yarn.lock
126126

127127
# Git info output
128128
.git-info
129+
130+
#rosetta-cli results
131+
rosetta-output-construction/rosetta-cli-output-const.json
132+
rosetta-output/rosetta-cli-output.json

.vscode/launch.json

+34
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,34 @@
4949
},
5050
"killBehavior": "polite",
5151
},
52+
{
53+
"type": "node",
54+
"request": "launch",
55+
"name": "Launch: read-only",
56+
"skipFiles": [
57+
"<node_internals>/**"
58+
],
59+
"runtimeArgs": [
60+
"-r",
61+
"ts-node/register/transpile-only",
62+
"-r",
63+
"tsconfig-paths/register"
64+
],
65+
"args": [
66+
"${workspaceFolder}/src/index.ts"
67+
],
68+
"outputCapture": "std",
69+
"internalConsoleOptions": "openOnSessionStart",
70+
"env": {
71+
"STACKS_BLOCKCHAIN_API_PORT": "3998",
72+
"STACKS_READ_ONLY_MODE": "true",
73+
"STACKS_BLOCKCHAIN_API_DB": "pg",
74+
"STACKS_CHAIN_ID": "0x80000000",
75+
"NODE_ENV": "development",
76+
"TS_NODE_SKIP_IGNORE": "true"
77+
},
78+
"killBehavior": "polite",
79+
},
5280
{
5381
"type": "node",
5482
"request": "launch",
@@ -182,5 +210,11 @@
182210
"cwd": "${workspaceFolder}/docs",
183211
"args": ["${workspaceFolder}/docs/scripts/generate-types.ts"]
184212
}
213+
],
214+
"compounds": [
215+
{
216+
"name": "Launch: mocknet reader-writer",
217+
"configurations": ["Launch: mocknet", "Launch: read-only"]
218+
}
185219
]
186220
}

.vscode/tasks.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{
1515
"label": "stacks-node:deploy-dev",
1616
"type": "shell",
17-
"command": "npm run devenv:deploy -- -d && npm run devenv:logs",
17+
"command": "npm run devenv:deploy -- -d",
1818
"isBackground": true,
1919
"problemMatcher": [
2020
{

CHANGELOG.md

+55
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
1+
# [0.68.0](https://github.com/blockstack/stacks-blockchain-api/compare/v0.67.1...v0.68.0) (2021-09-20)
2+
3+
4+
### Bug Fixes
5+
6+
* return the latest name by address [#714](https://github.com/blockstack/stacks-blockchain-api/issues/714) ([101922b](https://github.com/blockstack/stacks-blockchain-api/commit/101922bc843140fbe5df2113f2e7d396925cbb40))
7+
8+
9+
### Features
10+
11+
* ability to configure multiple tx broadcast endpoints [#765](https://github.com/blockstack/stacks-blockchain-api/issues/765) ([8a9222a](https://github.com/blockstack/stacks-blockchain-api/commit/8a9222a3cb6ba47ee2c90473e34f433b88e73572))
12+
13+
## [0.67.1](https://github.com/blockstack/stacks-blockchain-api/compare/v0.67.0...v0.67.1) (2021-09-17)
14+
15+
16+
### Bug Fixes
17+
18+
* ignore out of order microblocks causing API to crash ([1e0b3d0](https://github.com/blockstack/stacks-blockchain-api/commit/1e0b3d0e18ca8e98f6a602d173b8cef9b1b9652b))
19+
20+
# [0.67.0](https://github.com/blockstack/stacks-blockchain-api/compare/v0.66.1...v0.67.0) (2021-09-16)
21+
22+
23+
### Bug Fixes
24+
25+
* **rosetta:** use coinbase txs hash instead of stx_lock for forged unlock_transaction [#760](https://github.com/blockstack/stacks-blockchain-api/issues/760) ([37adcc7](https://github.com/blockstack/stacks-blockchain-api/commit/37adcc70aa55e58c9ad3dd0684b24972130fa6d4))
26+
* disable http keep-alive for stacks-node /v2 proxied endpoints ([cebeda0](https://github.com/blockstack/stacks-blockchain-api/commit/cebeda0e376dd7afd6729b2cd525e3c2373f27cd))
27+
* increase the 10 second cap on prometheus http metric reporting ([735874e](https://github.com/blockstack/stacks-blockchain-api/commit/735874e45c1e198724e7d01ca9e4eec4d108706c))
28+
* replicate query optimizations to other asset txs queries ([05c9931](https://github.com/blockstack/stacks-blockchain-api/commit/05c9931b6168aed48ae8c980d4d882002ad34a49))
29+
30+
31+
### Features
32+
33+
* automatically generate postman collection from the openapi spec ([5f07d74](https://github.com/blockstack/stacks-blockchain-api/commit/5f07d7455fefa61f3f7d35e05e56b06da28987db))
34+
* **rosetta:** support memos in stx token transfer operations [#752](https://github.com/blockstack/stacks-blockchain-api/issues/752) ([6f4f3e2](https://github.com/blockstack/stacks-blockchain-api/commit/6f4f3e2a9129975a5252b5e33cf18168ec1c0acf))
35+
36+
## [0.66.1](https://github.com/blockstack/stacks-blockchain-api/compare/v0.66.0...v0.66.1) (2021-09-09)
37+
38+
39+
### Bug Fixes
40+
41+
* support post in api status endpoint ([7dcb019](https://github.com/blockstack/stacks-blockchain-api/commit/7dcb01901bccdfc50d97bc68a0cdebf9d431307d))
42+
43+
# [0.66.0](https://github.com/blockstack/stacks-blockchain-api/compare/v0.65.0...v0.66.0) (2021-09-09)
44+
45+
46+
### Bug Fixes
47+
48+
* optimize query that retrieves txs with asset transfers ([821f578](https://github.com/blockstack/stacks-blockchain-api/commit/821f578792454737700b2960e0167d1b974c3819))
49+
* **rosetta:** do not assume encoding of delegate-stx `pox_addr` data [#732](https://github.com/blockstack/stacks-blockchain-api/issues/732) ([a97bd6f](https://github.com/blockstack/stacks-blockchain-api/commit/a97bd6f0d23bc32f3d13b5840f3d41bffaaf79ee))
50+
51+
52+
### Features
53+
54+
* added a new endpoint fee_rate [#729](https://github.com/blockstack/stacks-blockchain-api/issues/729) ([7c09ac5](https://github.com/blockstack/stacks-blockchain-api/commit/7c09ac53a9886f7369ff95bd1781eca1f744c054))
55+
156
# [0.65.0](https://github.com/blockstack/stacks-blockchain-api/compare/v0.64.2...v0.65.0) (2021-09-07)
257

358

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM node:14-alpine
33
WORKDIR /app
44
COPY . .
55

6-
RUN apk add --no-cache --virtual .build-deps alpine-sdk python git openjdk8-jre
6+
RUN apk add --no-cache --virtual .build-deps alpine-sdk python2 git openjdk8-jre
77
RUN echo "GIT_TAG=$(git tag --points-at HEAD)" >> .env
88
RUN npm config set unsafe-perm true && npm install && npm run build && npm prune --production
99
RUN apk del .build-deps

README-rosetta.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ requires token transfer transactions while `rosetta-cli` is running.
2828

2929
Documentation for the Rosetta APIs can be found at
3030

31-
https://blockstack.github.io/stacks-blockchain-api/
31+
https://hirosystems.github.io/stacks-blockchain-api/

api-architecture.png

320 KB
Loading

0 commit comments

Comments
 (0)