* feat: use native nodejs addon module for Stacks binary encoding and decoding (Clarity values, binary wire formats, addresses, etc) * refactor: move transaction, post-condition, and clarity value decoding from js to native addon * chore: fix rosetta pox contract-call parsing * chore: use npm registry for stacks-encoding-native-js * chore: fix unused export * chore: commit dev file to be converted to unit tests * refactor: use stacks-encoding-native lib for stacks-address operations * chore: bump stacks-encoding-native lib * chore: stacks-native-encoding version bump with fix for decoding multisig tx sender address * chore: stacks-native-encoding version bump with fix for decoding zero-length prefixed contract call args * test: introduce tests for on-btc-chain originating stx tx processing * chore: prettier ignore json payload sample files * chore: clear up type import syntax * test: tests for on-btc-chain originating stx-lock tx processing * feat: expand cpu profiling capabilties with distinct start and stop endpoints easier to use in scripts * chore: fix compilation error in /utils * feat: support for performing cpu profiling with the native addon * fix: avoid re-injecting sourcemap support when running with ts-node * chore: updates for latest stacks-native-encoding library function usage, only decode clarity value type signatures when needed * chore: decode only clarity value repr string rather than deep value in several areas * chore: fix package-lock.json * feat: commit load testing script with sampled endpoint list * chore: fix synthetic-stx-txs-tests * chore: update to latest stacks-encoding-native types (using hex strings rather than js buffers) * chore: bump stacks-encoding-native version * chore: fix regular integration tests * chore: fix bug with rosetta principal repr parsing * chore: bump stacks-encoding-native version * chore: add several TODO(perf) comments where buffers should be hex strings * chore: remove stacks-native-encoding debug code that have since been converted into unit tests * chore: remove debug code * fix: bug fix for reverse file stream bug if read chunk starts with line-ending * chore: wrap synthetic stx txs tests
Usage
Perform an event-replay import with a recent TSV (at least block height 52499).
Run API in readonly mode with profiling enabled:
npm run build
STACKS_PROFILER_PORT=9119 STACKS_BLOCKCHAIN_API_PORT=3998 STACKS_API_MODE=readonly STACKS_CHAIN_ID=0x80000000 NODE_ENV=production node lib/index.js
Run load test script inside this directory:
./load-test.sh ./sampled-requests.txt
The script reads from the list of GET http endpoints, sampled from real-world traffic. It initiates a "start CPU profiling" request to the API, then iterates through the sampled endpoints using curl, issuing requests as fast as the server can respond.
It also checks for non-200 responses and will exit with an error if found. This can be used for regression testing to ensure the sampled endpoints at least return a success code.
Once all requests have been issued, a "stop CPU profiling" request is sent. The profile result is saved to disk in this directory as a *.cpuprofile file. This can be opened in vscode to analyze.