-
Notifications
You must be signed in to change notification settings - Fork 679
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
[Stacks 2.1] Epoch 2.0 boot data is not emitted to event-observers #3367
Comments
Can we specify which observer endpoints, and possibly even which fields, are affected? |
Yes it's missing data from the genesis (first) [[ustx_balance]]
address = "STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6"
amount = 10000000000000000 |
I think I am seeing the right events possibly. I'll upload the toml file and the log from my listener. |
Thanks for the testing @gregorycoppola! From comparing your config to mine, it looks like this is what probably makes the difference: [[burnchain.epochs]]
epoch_name = "2.0"
start_height = 105
[[burnchain.epochs]]
epoch_name = "2.05"
start_height = 106
[[burnchain.epochs]]
epoch_name = "2.1"
start_height = 107 The <2.1 epochs are each configured to mine at least 1 stacks block (if perfectly in sync with the burnchain block height). My config has those set to the minimum possible values taken from the original PR where this config was introduced, which allows booting into an epoch 2.1 Stacks node ASAP. I'll look into adjust the regtest env setup and API to use this config and verify the results. We should consider fixing/implementing a "fast epoch2.1" config to avoid this issue, because while it's useful to test the epoch transitions right now, as soon as 2.1 launches, this extra ceremony will just become a developer burden. |
The root of this issue appears to be related to the restarting the miner after it has synced any bitcoind chainstate (but before it has mined the first block). The regtest docker image I'm using performs the following in the image build steps:
Later, when the docker image is ran, both the stacks node and bitcoind are started from the existing chainstate and start mining stacks blocks immediately. This setup saves significant time during API development iteration cycles, as well as during CI. It has been working well except for a bug related to the restart step causing the epoch 2.0 event data to not be emitted once the miner is resumed from existing chainstate. My guess is that the |
Is it meant to be supported to stop and re-start the node like this? Which exact command are you using to actually start the regtest program? Is there any output to show how the result of running this flow is wrong? |
Not sure, seems like a bug to me.
The commands and config are fairly self-contained here: https://github.com/zone117x/stacks-regtest-env/blob/5ef3683275f49e43209d4b0cb2280df1b0615ed3/Dockerfile.e2e#L97-L113
Here's the output of the event stream when attaching an event-observer that prints the results: |
I'm looking into this actively now. I'm trying to figure out the intended output, by making a docker script that does not do the snapshot step. |
Issue_3367_A_bug_with_genesis_boot_events_that_seemingly_requires_a_difficult_refactor.pdf @jcnelson I investigated this bug and wrote the above report about 1) what seems to be wrong, and 2) potential fixes. It seems like all potential fixes are difficult/risky. I would really like to get your opinion at least before trying any of them. And, arguably you would be the best person to refactor if we do a trickier option. |
If the goal of this effort is to create a "pre-heated" chainstate for faster devnet/regtest boots, we could add a cli flag that would gracefully exit the node right after the bitcoin sync/leader key registration, but before genesis block. |
@lgalabru What do you mean by "tweaked" here? |
Ability to customize genesis balances. |
Well, also the boot contracts don't get output. One of the three suggestions in the doc is to move the generation of these events to run at the time of "stacks block 1", which I think is kind of what you are saying... but I wasn't confident to make this kind of change by myself. |
I'm going to make it so that the system just pushes the boot receipts for a designated genesis block (whose height is 0). The boot receipts will be pushed immediately after the chainstate DB is instantiated, but before any bitcoin blocks get downloaded. Note that this is different from how it works now, where the boot receipts are pushed with the first non-genesis block (whose height is 1). |
Completed! |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The boot contracts (e.g. bns, pox, seed account balances, etc) are ignored / not emitted through the event-observer interface when bootstrapping a neon/krypton Stacks node to Epoch 2.1.
This appears to be only a bug in the event-emitter code, because while boot contracts & balances are not emitted, they are still visible through RPC /
v2/<endpoint>
calls.This behavior breaks event-observers like the API which end up with negative STX balances for config.toml seed accounts, missing contract ABIs for pox-1 and bns, etc..
Using something like the following to bootstrap a Stacks node into krypton mode (this is paired with a bitcoind instance booted into regtest mode and an regtest auto-mining script):
The text was updated successfully, but these errors were encountered: