Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
37bdb83
feat: handle pox-3 force unlocks
zone117x Dec 1, 2023
0359fe7
chore: todo note
zone117x Dec 8, 2023
aad6cca
feat: handle pox-3 force unlocks, pox-4 events, and revoke-delegate-s…
zone117x Dec 9, 2023
f1e3ff0
chore: rename pox-2 file
zone117x Dec 9, 2023
cd7b3ff
chore: simplified pox route paths
zone117x Dec 9, 2023
cddfaa2
feat: add migration to create pox4_events table
zone117x Dec 9, 2023
9f1541b
test: follow redirects in test fetch helper
zone117x Dec 9, 2023
bed4c6e
chore: fix storing different pox version events
zone117x Dec 9, 2023
85ec974
test: fix tests with missing pox4_events
zone117x Dec 9, 2023
dd9813a
chore: move delegations lookup endpoint into pox router
zone117x Dec 9, 2023
3b4325e
fix: handle pox4_events during reorgs
zone117x Dec 9, 2023
d0b2f09
test: fix pox4events reorg count
zone117x Dec 9, 2023
3f7f144
chore: update stacks-node image to stacks 3.0
zone117x Dec 9, 2023
007bae3
test: begin transitioning pox tests to use pox-4
zone117x Dec 9, 2023
753b8a4
chore: bump stacks-node to wip nakamoto branch
zone117x Dec 10, 2023
7e5d368
test: switch more tests from pox-3 to pox-4
zone117x Dec 10, 2023
6b7d5f4
fix: tx fee fall back in faucet
zone117x Dec 10, 2023
b7bf986
test: update delegation check endpoints
zone117x Dec 10, 2023
ff6c611
chore: isolate error in delegate-revoke test
zone117x Dec 10, 2023
fbdf822
chore: pox3 to pox4 misc renames
zone117x Dec 10, 2023
d5fb7d1
ci: rename 2.4 to 2.5
zone117x Dec 10, 2023
f8b4aa8
test: remove no-longer applicable delegate-stx while stacking test
zone117x Dec 10, 2023
d8c91d5
chore: remove incorrect commend in pox4 test
zone117x Dec 12, 2023
f46a19e
Merge branch 'nakamoto' into feat/pox-3-force-unlocks
zone117x Dec 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -520,24 +520,24 @@ jobs:
flag-name: run-${{ github.job }}
parallel: true

test-2_4:
test-2_5:
strategy:
fail-fast: false
matrix:
suite:
[
block-zero-handling,
faucet-stx,
pox-3-btc-address-formats,
pox-3-delegate-aggregation,
pox-3-delegate-stacking,
pox-3-delegate-revoked-stacking,
pox-3-stack-extend-increase,
pox-3-rosetta-btc-addr-types,
pox-3-rosetta-cycle-phases,
pox-3-rosetta-segwit,
pox-3-burnchain-stack-stx,
pox-3-burnchain-delegate-stx,
pox-4-btc-address-formats,
pox-4-delegate-aggregation,
pox-4-delegate-stacking,
pox-4-delegate-revoked-stacking,
pox-4-stack-extend-increase,
pox-4-rosetta-btc-addr-types,
pox-4-rosetta-cycle-phases,
pox-4-rosetta-segwit,
pox-4-burnchain-stack-stx,
pox-4-burnchain-delegate-stx,
]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -575,7 +575,7 @@ jobs:
npm run devenv:logs-krypton -- --no-color &> docker-compose-logs.txt &

- name: Run tests
run: npm run test:2.4 -- --testPathPattern "${{ matrix.suite }}"
run: npm run test:2.5 -- --testPathPattern "${{ matrix.suite }}"

- name: Print integration environment logs
run: cat docker-compose-logs.txt
Expand Down Expand Up @@ -855,7 +855,7 @@ jobs:
- lint
- lint-docs
- test
- test-2_4
- test-2_5
- test-bns
- test-rosetta
- test-rosetta-cli-construction
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@
{
"type": "node",
"request": "launch",
"name": "Jest: 2.4",
"name": "Jest: 2.5",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"--testTimeout=3600000",
"--runInBand",
"--no-cache",
"--config",
"${workspaceRoot}/tests/jest.config.2.4.js"
"${workspaceRoot}/tests/jest.config.2.5.js",
],
"outputCapture": "std",
"console": "integratedTerminal",
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.dev.stacks-blockchain.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
stacks-blockchain:
image: "hirosystems/stacks-api-e2e:stacks2.4-f930deb"
image: "hirosystems/stacks-api-e2e:stacks3.0-800259e"
restart: on-failure
environment:
STACKS_EVENT_OBSERVER: host.docker.internal:3700
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.dev.stacks-krypton.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
stacks-blockchain:
image: "hirosystems/stacks-api-e2e:stacks2.4-f930deb"
image: "hirosystems/stacks-api-e2e:stacks3.0-800259e"
ports:
- "18443:18443" # bitcoin regtest JSON-RPC interface
- "18444:18444" # bitcoin regtest p2p
Expand Down
4 changes: 4 additions & 0 deletions docs/api/info/get-status.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
"type": "integer",
"nullable": true
},
"pox_v3_unlock_height": {
"type": "integer",
"nullable": true
},
"chain_tip": {
"$ref": "../../entities/info/chain-tip.schema.json"
}
Expand Down
1 change: 1 addition & 0 deletions docs/generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@ export interface ServerStatusResponse {
status: string;
pox_v1_unlock_height?: number;
pox_v2_unlock_height?: number;
pox_v3_unlock_height?: number;
chain_tip?: ChainTip;
}
/**
Expand Down
8 changes: 8 additions & 0 deletions migrations/1701368149776_nakamoto-txs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
exports.up = pgm => {
pgm.addColumn('pox_state', {
pox_v3_unlock_height: {
type: 'bigint',
notNull: true,
default: 0,
},
});

pgm.addColumns('txs', {
// `nakamoto-coinbase` tx types
coinbase_vrf_proof: 'bytea',
Expand Down
203 changes: 203 additions & 0 deletions migrations/1702134678728_pox_4_events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
exports.up = pgm => {
// Adds pox4_events table which matches previous pox2_events table
pgm.createTable('pox4_events', {
id: {
type: 'bigserial',
primaryKey: true,
},
event_index: {
type: 'integer',
notNull: true,
},
tx_id: {
notNull: true,
type: 'bytea',
},
tx_index: {
type: 'smallint',
notNull: true,
},
block_height: {
type: 'integer',
notNull: true,
},
index_block_hash: {
type: 'bytea',
notNull: true,
},
parent_index_block_hash: {
type: 'bytea',
notNull: true,
},
microblock_hash: {
type: 'bytea',
notNull: true,
},
microblock_sequence: {
type: 'integer',
notNull: true,
},
microblock_canonical: {
type: 'boolean',
notNull: true,
},
canonical: {
type: 'boolean',
notNull: true,
},
stacker: {
type: 'string',
notNull: true,
},
locked: {
type: 'numeric',
notNull: true,
},
balance: {
type: 'numeric',
notNull: true,
},
burnchain_unlock_height: {
type: 'bigint',
notNull: true,
},
name: {
type: 'string',
notNull: true,
},
pox_addr: {
type: 'string',
},
pox_addr_raw: {
type: 'bytea',
},
first_cycle_locked: {
// unique to handle-unlock
type: 'numeric',
},
first_unlocked_cycle: {
// unique to handle-unlock
type: 'numeric',
},
delegate_to: {
// unique to delegate-stx
type: 'string',
},
lock_period: {
// unique to stack-stx, delegate-stack-stx
type: 'numeric',
},
lock_amount: {
// unique to stack-stx, delegate-stack-stx
type: 'numeric',
},
start_burn_height: {
// unique to stack-stx, delegate-stack-stx
type: 'numeric',
},
unlock_burn_height: {
// unique to stack-stx, stack-extend, delegate-stack-stx, delegate-stack-extend, delegate-stx
type: 'numeric',
},
delegator: {
// unique to delegate-stack-stx, delegate-stack-increase, delegate-stack-extend
type: 'string',
},
increase_by: {
// unique to stack-increase, delegate-stack-increase
type: 'numeric',
},
total_locked: {
// unique to stack-increase, delegate-stack-increase
type: 'numeric',
},
extend_count: {
// unique to stack-extend, delegate-stack-extend
type: 'numeric',
},
reward_cycle: {
// unique to stack-aggregation-*
type: 'numeric',
},
amount_ustx: {
// unique to stack-aggregation-*, delegate-stx
type: 'numeric',
},
});

pgm.addConstraint(
'pox4_events',
'valid_event_specific_columns',
`CHECK (
CASE name
WHEN 'handle-unlock' THEN
first_cycle_locked IS NOT NULL AND
first_unlocked_cycle IS NOT NULL
WHEN 'stack-stx' THEN
lock_period IS NOT NULL AND
lock_amount IS NOT NULL AND
start_burn_height IS NOT NULL AND
unlock_burn_height IS NOT NULL
WHEN 'stack-increase' THEN
increase_by IS NOT NULL AND
total_locked IS NOT NULL
WHEN 'stack-extend' THEN
extend_count IS NOT NULL AND
unlock_burn_height IS NOT NULL
WHEN 'delegate-stx' THEN
amount_ustx IS NOT NULL AND
delegate_to IS NOT NULL
WHEN 'delegate-stack-stx' THEN
lock_period IS NOT NULL AND
lock_amount IS NOT NULL AND
start_burn_height IS NOT NULL AND
unlock_burn_height IS NOT NULL AND
delegator IS NOT NULL
WHEN 'delegate-stack-increase' THEN
increase_by IS NOT NULL AND
total_locked IS NOT NULL AND
delegator IS NOT NULL
WHEN 'delegate-stack-extend' THEN
extend_count IS NOT NULL AND
unlock_burn_height IS NOT NULL AND
delegator IS NOT NULL
WHEN 'stack-aggregation-commit' THEN
reward_cycle IS NOT NULL AND
amount_ustx IS NOT NULL
WHEN 'stack-aggregation-commit-indexed' THEN
reward_cycle IS NOT NULL AND
amount_ustx IS NOT NULL
WHEN 'stack-aggregation-increase' THEN
reward_cycle IS NOT NULL AND
amount_ustx IS NOT NULL
ELSE false
END
)`
);

pgm.createIndex('pox4_events', [
{ name: 'block_height', sort: 'DESC' },
{ name: 'microblock_sequence', sort: 'DESC' },
{ name: 'tx_index', sort: 'DESC' },
{ name: 'event_index', sort: 'DESC' },
]);

pgm.createIndex('pox4_events', 'tx_id');
pgm.createIndex('pox4_events', 'index_block_hash');
pgm.createIndex('pox4_events', 'microblock_hash');

pgm.createIndex('pox4_events', 'stacker');
pgm.createIndex('pox4_events', 'burnchain_unlock_height');
pgm.createIndex('pox4_events', 'pox_addr');
pgm.createIndex('pox4_events', 'delegator');
pgm.createIndex('pox4_events', 'name');

pgm.createIndex('pox4_events', 'delegate_to');
pgm.createIndex('pox4_events', 'unlock_burn_height');
};

/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
exports.down = pgm => {
pgm.dropTable('pox4_events');
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev:follower": "npm run devenv:build && concurrently npm:dev npm:devenv:follower",
"test": "cross-env NODE_ENV=test jest --config ./tests/jest.config.js --coverage --runInBand",
"test:subnets": "cross-env NODE_ENV=test jest --config ./tests/jest.config.subnets.js --coverage --runInBand",
"test:2.4": "cross-env NODE_ENV=test jest --config ./tests/jest.config.2.4.js --coverage --runInBand",
"test:2.5": "cross-env NODE_ENV=test jest --config ./tests/jest.config.2.5.js --coverage --runInBand",
"test:rosetta": "cross-env NODE_ENV=test jest --config ./tests/jest.config.rosetta.js --coverage --runInBand",
"test:rosetta-construction": "cross-env NODE_ENV=test jest --config ./tests/jest.config.rosetta-construction.js --coverage --runInBand",
"test:rosetta-cli:data": "cross-env NODE_ENV=test STACKS_CHAIN_ID=0x80000000 jest --config ./tests/jest.config.rosetta-cli-data.js --coverage --runInBand",
Expand All @@ -24,7 +24,7 @@
"test:watch": "cross-env NODE_ENV=test jest --config ./tests/jest.config.js --watch",
"test:integration": "concurrently \"docker compose -f docker/docker-compose.dev.postgres.yml up --force-recreate -V\" \"cross-env NODE_ENV=test jest --config ./tests/jest.config.js --no-cache --runInBand; npm run devenv:stop:pg\"",
"test:integration:subnets": "concurrently --hide \"devenv:deploy:subnets\" \"npm:devenv:deploy:subnets\" \"cross-env NODE_ENV=test jest --config ./tests/jest.config.subnets.js --no-cache --runInBand; npm run devenv:stop:subnets\"",
"test:integration:2.4": "concurrently --hide \"devenv:deploy-krypton\" \"npm:devenv:deploy-krypton\" \"cross-env NODE_ENV=test jest --config ./tests/jest.config.2.4.js --no-cache --runInBand; npm run devenv:stop-krypton\"",
"test:integration:2.5": "concurrently --hide \"devenv:deploy-krypton\" \"npm:devenv:deploy-krypton\" \"cross-env NODE_ENV=test jest --config ./tests/jest.config.2.5.js --no-cache --runInBand; npm run devenv:stop-krypton\"",
"test:integration:rosetta": "concurrently \"npm:devenv:deploy-krypton\" \"cross-env NODE_ENV=test jest --config ./tests/jest.config.rosetta.js --no-cache --runInBand; npm run devenv:stop-krypton\"",
"test:integration:rosetta-construction": "concurrently \"npm:devenv:deploy-krypton\" \"cross-env NODE_ENV=test jest --config ./tests/jest.config.rosetta-construction.js --no-cache --runInBand; npm run devenv:stop-krypton\"",
"test:integration:rosetta-cli:data": "concurrently \"npm:devenv:deploy-krypton\" \"cross-env NODE_ENV=test STACKS_CHAIN_ID=0x80000000 jest --config ./tests/jest.config.rosetta-cli-data.js --no-cache --runInBand; npm run devenv:stop-krypton\"",
Expand Down
Loading