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

[Event Stream] Report matured miner disbursement and application of PoisonMicroblocks #3621

Open jcnelson opened 1 year ago

jcnelson commented 1 year ago

Right now, the matured block reward disbursement process is opaque. The only evidence that a miner gets paid their block reward is that their account balance increases, and a debug log message gets emitted. Instead, this information should be reported on the node's event stream, so that miners can see when their block rewards are materialized.

In addition, the system should report whether or not the block reward was slashed by a PoisonMicroblock transaction (and if so, which one). This information is currently only visible in debug logs, and must be reconstructed by trawling the chain state and correlating them to offending miners.

kantai commented 1 year ago

Is this currently resulting in any inaccuracies for event stream clients? That is, are the correct balance changes being reported in the event stream or would rewards from poison microblocks be misapplied by a client like the API?

If the answer is "yes, the current event stream is inaccurate", then I think this is probably a high priority feature, and the priority should be mainly emitting enough information for clients to get the correct balances.

If the answer is "no", then I think the priority of this is lower. I'd also want to understand what exactly users want to see from the poison microblocks in the event stream before thinking about implementing this. The reason for this is that getting the poison microblock txid will require changes to our data schemas--- the txid isn't stored in a way that would make emitting it in an event easy. So before those changes are made, I think it makes sense to figure out if they really need to be made at all.