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

Make "first attempt" timeout to be 15s, to fill the first attempt block #3332

Closed gregorycoppola closed 1 year ago

gregorycoppola commented 1 year ago

Is your feature request related to a problem? Please describe. Currently, the default "first attempt" time for the miner is 5 seconds:

This was done so that miners could get some bid in before attempting a block. But, that was when it was thought to take up to 180 seconds to make a block.

The problem is that if this default miner never gets their second bid through, we now have an empty block: image

Now that block time is around 10-12 seconds (https://github.com/stacks-network/stacks-blockchain/issues/3313#issuecomment-1269264281), we can make the timeout to be 15 seconds by default.

This way, by default:

Describe the solution you'd like Change the default to 15s, with the block likely done in 10-12s, without even hitting the timeout.

Describe alternatives you've considered You could change the toml files instead, but:

Caveats:

Additional context https://github.com/stacks-network/stacks-blockchain/issues/3313#issuecomment-1269264281

jcnelson commented 1 year ago

Needs more data.

muneeb-ali commented 1 year ago

@gregorycoppola I'm assuming this is relevant for any discussions on block size etc?

gregorycoppola commented 1 year ago

@jcnelson Which data are we looking for? Do we just need to run a mock miner and see what the distribution of block times is?

@muneeb-ali I'm not sure if I totally understand the question. But, the "first attempt time" is a value that isn't part of consensus. The miner makes multiple "attempts" at filling a block. Historically, the "first attempt" has always been almost empty, because the budget was 5s, and 5s was very small compared to the time needed to fill a block. A miner can unilaterally change this, or override it, as part of their own mining strategy. For those miners who use the "default", this new default would mean the "first attempt" is full. The "first attempt time" is related to the block limit, because the faster block-filling time impacts both.

jcnelson commented 1 year ago

Given that the miner is now much, much faster at producing blocks, I think we can close this.