desmos-labs / desmos

Improving the well-being of users on social networks through the blockchain technology.
https://desmos.network
Apache License 2.0
104 stars 46 forks source link

Lower the empty block creation interval #102

Open RiccardoM opened 4 years ago

RiccardoM commented 4 years ago

Context

Currently inside Desmos we have the following Tendermint consensus params set:

This has lead the chain to produce a lot of empty blocks at the current rate of 1 every 5-6 seconds, causing new validators to take up to 6 hours to completely sync the node the first time they start it up.

While empty blocks are used to tell the chain has not stopped (its the only meaning they have), I really think that this should be addressed in some way.

After @kwunyeung told me e-Money have been able to create a 1-minute-heartbeat system, I've browsed through their code and seen that they have set the following parameters instead:

This code can be found inside e-Money's cmd main.go file.

As @kwunyeung said, they are setting all the other parameters as the create_empty_blocks might not work now (but Ethan Frey should have pointed this out already). To fix these they are using all the other 4 to make all the nodes act the same way, effectively lowering the production of empty blocks.

@kwunyeung also said IOV has managed to do a similar thing but with a 5 minutes heartbeat instead.

What I think we should do is implement a 2 minutes heartbeat, as I think we will have enough transactions in any case in the future, and lowering this amount could affect the calculations of slashing and block rewards which are currently based on block height, as @kwunyeung said too.

What are your thoughts @kwunyeung @bragaz?

CC @angelorc

kwunyeung commented 4 years ago

The default behaviour create_empty_block = false of Tendermint is to have block committed immediately when there is tx. Otherwise, it will just keep waiting unless the create_empty_block_interval is not 0 as we need the H+1 block as a proof of block H.

https://github.com/tendermint/tendermint/blob/15e80d244886768e9813ce9d4b7d4c9c19471d83/docs/tendermint-core/configuration.md#empty-blocks-vs-no-empty-blocks

It works well in the early time that I built a simple test app directly with Tendermint.

I have tested it few months ago after Ethan Frey had submitted the fix but it didn't work with distribution and slashing modules. This should be because with these two modules, the states of rewards and signing info in slashing keeps updating in endblock and the states changed, application hash changed and the H+1 proof block keeps creating even if there is no tx.

IOV is different because Ethan Frey didn't build it with Cosmos SDK. He built another SDK called weave which keeps the feature of create_empty_block as they don't have slashing and reward calculations.

I think it won't work as expected unless the entire distribution and slashing calculations can be replaced by consensus timestamp instead of height.