stacks-network / stacks-core

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

Configurable minimum gap between blocks #5080

Closed obycode closed 1 month ago

obycode commented 1 month ago

There should be a configuration parameter to set the minimum time required between blocks, so that a miner can ensure that blocks are not mined too quickly. This parameter should be greater than or equal to 1 second because if a block is mined within the same second as its parent, it will be rejected by the signers, since a block's timestamp must be greater than its parent's timestamp.

diwakergupta commented 1 month ago

This parameter should be greater than or equal to 1 second because if a block is mined within the same second as its parent, it will be rejected by the signers, since a block's timestamp must be greater than its parent's timestamp.

Just to pressure test this: to me it feels odd that signers are using 1 second granularity to compare timestamps 🤔 Is there some fundamental reason for this? Otherwise an alternative solution would be to have signers use millisecs or even micro second granularity no?

obycode commented 1 month ago

In the current design, the timestamp stored in the block header only has second granularity. This seems fine since we do not have any goals currently of sub-second block times. Are you thinking from a future-proofing perspective?

diwakergupta commented 1 month ago

In the current design, the timestamp stored in the block header only has second granularity. This seems fine since we do not have any goals currently of sub-second block times. Are you thinking from a future-proofing perspective?

Ah ok, good to know. Yeah I was just curious, felt like an artificial constraint. Even if we don't have sub-second block times, having to enforce some minimum time between blocks felt odd. Thanks for the explanation, makes sense.