stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 664 forks source link

PoX Event Generation Issue #5110

Open BowTiedDevOps opened 2 weeks ago

BowTiedDevOps commented 2 weeks ago

When a stacking transaction is made in the prepare phase of a cycle, the event that is being displayed is incrementing the start-cycle-id variable by 1, but not the end-cycle-id, hence making the 2 variables show the same cycle.

Reference transactions:

This might not be an issue at all, and actually be the expected behavior. A suggested fix by @janniks in order to increase clarity in the events would be to add an stacking_cycles entry to the event that would show how many cycles is the user stacking (end-cycle-id - start-cycle-id). In this case, that would be 0, because the user will not be stacking.

wileyj commented 2 weeks ago

@hstove thanks - usually i report and block spammers from the org as well (already done)

hstove commented 2 weeks ago

There are a few things here:

I think the fix is relatively easy, but I'm not sure how much impact this has downstream.

Another thought for a workaround is that, for stack-stx, you can basically always just use start-cycle-id and lock-period to determine the unlock cycle. Both of those are correct in the examples listed above.

janniks commented 2 weeks ago

Careful. This was the intended behavior. It is confusing, yes.

The “end” cycle is non-inclusive (range style). This way a event that didn‘t make it into the intended reward cycle has it‘s start-cycle-id shifted. If the start and end fall on the same cycle-id, this is how the event let‘s us know the stacker didn‘t make it into any reward set. If stacking for multiple cycles, (and in prepare phase) the start is shifted still, but there will be a valid range where the stacker should make it into the next reward set.

Hope that helps — we could make the UX better by calculating the cycles for the stacker or otherwise displaying that the event was in a prepare phase and needs to be treated differently. So far these fields were mainly intended for downstream machines to query by valid ranges. Less for human eyes.