-
Notifications
You must be signed in to change notification settings - Fork 121
feat: pox-4 support #1754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: pox-4 support #1754
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
37bdb83
feat: handle pox-3 force unlocks
zone117x 0359fe7
chore: todo note
zone117x aad6cca
feat: handle pox-3 force unlocks, pox-4 events, and revoke-delegate-s…
zone117x f1e3ff0
chore: rename pox-2 file
zone117x cd7b3ff
chore: simplified pox route paths
zone117x cddfaa2
feat: add migration to create pox4_events table
zone117x 9f1541b
test: follow redirects in test fetch helper
zone117x bed4c6e
chore: fix storing different pox version events
zone117x 85ec974
test: fix tests with missing pox4_events
zone117x dd9813a
chore: move delegations lookup endpoint into pox router
zone117x 3b4325e
fix: handle pox4_events during reorgs
zone117x d0b2f09
test: fix pox4events reorg count
zone117x 3f7f144
chore: update stacks-node image to stacks 3.0
zone117x 007bae3
test: begin transitioning pox tests to use pox-4
zone117x 753b8a4
chore: bump stacks-node to wip nakamoto branch
zone117x 7e5d368
test: switch more tests from pox-3 to pox-4
zone117x 6b7d5f4
fix: tx fee fall back in faucet
zone117x b7bf986
test: update delegation check endpoints
zone117x ff6c611
chore: isolate error in delegate-revoke test
zone117x fbdf822
chore: pox3 to pox4 misc renames
zone117x d5fb7d1
ci: rename 2.4 to 2.5
zone117x f8b4aa8
test: remove no-longer applicable delegate-stx while stacking test
zone117x d8c91d5
chore: remove incorrect commend in pox4 test
zone117x f46a19e
Merge branch 'nakamoto' into feat/pox-3-force-unlocks
zone117x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious where this part is in the stacks-core codebase (haven't been able to find, would love to peek at that code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The synthetic pox events are at https://github.com/stacks-network/stacks-core/blob/next/pox-locking/src/events.rs
This
revokeone is WIP stacks-network/stacks-core#4157