Skip to content

Conversation

@zone117x
Copy link
Contributor

@zone117x zone117x commented Nov 30, 2020

Closes #2086

Uses a rust build script to compress the STX balance and vesting contents from chainstate.txt into deflate streams. These are embedded in the binary using include_bytes!(...). The binary is ~8MB larger. The compression and embedding is contained in a separate lib to make local dev less painful (rebuilds are not slowed down when making changes to the main src).

This file contains the all STX balances and vesting entries from Stacks 1.0.
(Note: it also contains on-chain name metadata, but name related data is not handled in this PR).

Combined, there are nearly 400k entries from a Stacks 1.0 export. An iterator<T> is used to alleviate boot memory usage issues. This PR includes a sample chainstate.txt file with only 10s of entries, which loads instantaneously. When the final Stacks 1.0 migration PR is opened, it will commit the full ~20MB chainstate.txt file.

The initial token balances are emitted as STX mint events in the pseudo-genesis-block. Emitting the token vesting entry calls is still WIP -- may need to be done after PR #2109.

@zone117x zone117x self-assigned this Nov 30, 2020
@zone117x zone117x force-pushed the feat/v1-to-v2-import branch from f47315f to 73d8dc9 Compare November 30, 2020 15:10
@zone117x zone117x added this to the 2020 W49-W51 milestone Dec 1, 2020
@zone117x
Copy link
Contributor Author

zone117x commented Dec 2, 2020

@kantai do you have any idea about this pox related test failure? Locally, cargo test --workspace --bin=stacks-node -- --test-threads 1 --ignored passes every time for me, but fails every time in CI. I'm not sure how the changes could cause this.

@kantai
Copy link
Contributor

kantai commented Dec 2, 2020

The bitcoind tests additionally require setting BITCOIND_TEST=1 to test. It looks like the failure may be due to the burn height calculation changing during genesis initialization -- the "unlock" height for the stack-stx operation appears to have changed.

@zone117x zone117x force-pushed the feat/v1-to-v2-import branch from d9af1c6 to 31328e1 Compare December 2, 2020 17:36
Copy link
Contributor

@kantai kantai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM! Though I think this may need to be opened against next, rather than master, because this would change the change consensus (the genesis block is different, so this would cause a chain split).

@zone117x zone117x force-pushed the feat/v1-to-v2-import branch from ab5d453 to 3a27c63 Compare December 5, 2020 00:44
Copy link
Member

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jcnelson jcnelson self-requested a review December 8, 2020 04:30
Copy link
Member

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to discuss whether or not all of the STX are minted in the genesis block and dolled out by the lockup contract (i.e. what's written now), versus having STX minted on-the-fly when the unlock height comes. I think it will have a painful impact on PoX if we do the former.

@jcnelson jcnelson self-requested a review December 8, 2020 18:43
Copy link
Member

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there -- please change the .unwrap() to .expect() and make sure there's an open an issue describing how eagerly minting all the locked-up STX at boot-time effectively breaks PoX. Once these two tasks are done, then it LGTM.

@blockstack-devops
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@stacks-network stacks-network locked as resolved and limited conversation to collaborators Nov 28, 2024
@wileyj wileyj deleted the feat/v1-to-v2-import branch March 11, 2025 21:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Stacks v1 → v2 Upgrade] Embed chainstate.txt in Stacks 2.0

6 participants