Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature for consensus mechanism for avoiding empty blocks #921

Closed
vncoelho opened this issue Jul 16, 2019 · 10 comments
Closed

Feature for consensus mechanism for avoiding empty blocks #921

vncoelho opened this issue Jul 16, 2019 · 10 comments
Labels
Consensus Module - Changes that affect the consensus protocol or internal verification logic Discussion Initial issue state - proposed but not yet accepted Feature Type: Large changes or new features

Comments

@vncoelho
Copy link
Member

vncoelho commented Jul 16, 2019

There are two points to be discussed here:

  1. Create the mechanism for, at least, guiding the consensus for not generating empty blocks on private nets
  2. Discuss if empty blocks are really useful for NEO Mainnet. I believe that since NEO is strict one-block finality we could discuss if empty blocks are useful. On the other hand, I believe that with the amount of DApps and use of NEO and GAS that we currently have, empty blocks will also not be very common (even when thinking about 5s blocks as proposed in Decrease block time to 5 sec #375).

By avoiding the generation of empty blocks the possible results are:

  • Users, exchange, among others start to send "watch-only" transactions for ensuring that a block will be published within the expected minimum block time;
  • One-block finality will be more spread among other projects, which will start to see that for NEO txs there is no need to really wait for more than 1 block.

Regarding the first point, recently we had another good discussion, with @igormcoelho and other guys from other Blockchain projects (such as Ethereum), regarding failing tx's that does not modify storage.
But, in general, I think that there is no problem, NEO economic model is different.
If someone wants to pay for registering a call I do not see a problem, sys_fees should be consistent and provide the expected distribution.

@vncoelho vncoelho changed the title Avoid empty blocks as default - Watch-only transactions Avoid empty blocks as default Jul 16, 2019
@vncoelho vncoelho changed the title Avoid empty blocks as default Feature for consensus mechanism for avoiding empty blocks Jul 16, 2019
@lock9
Copy link
Contributor

lock9 commented Jul 16, 2019

This is very important, we don't need empty blocks. Any chance this could break the current code?

@lock9 lock9 added the Discussion Initial issue state - proposed but not yet accepted label Jul 16, 2019
@vncoelho
Copy link
Member Author

vncoelho commented Jul 16, 2019

Current it would not break the code. In fact, it would be a simply modification on the Consensus side.

However, we would need a better formula for GAS (perhaps, in terms of time and not blocks).
This is something that @erikzhang would need to discuss with careful with @dahongfei.

I do not know for sure, @lock9, it is just an idea. While there might be benefits there might be consequences out of my control.

In general, I support it, otherwise I would not take time of everybody to discuss that. I believe it would be good in long term.
But this insight can be wrong and keep generation based on blocks might still be the best way to produce the remaining GAS.

@shargon
Copy link
Member

shargon commented Jul 16, 2019

If you don't allow empty blocks, you must remove the threshold timestamp between blocks, and if you remove this, one CN could send a block with one year more than expected, and the next blocks, will wait for be validated one year.

@lock9
Copy link
Contributor

lock9 commented Jul 16, 2019

@shargon what if we have a limit of 15 seconds? If 15 seconds passes, we generate an empty block, but for 5 seconds interval, we only generate the block if there is data.

So:
A block every 5 seconds, if there are transactions OR, if no transactions, a block every 15 seconds.
What do you think?

@uvmetal
Copy link

uvmetal commented Jul 16, 2019

OOps. I bungled some math. cringe

@shargon
Copy link
Member

shargon commented Jul 17, 2019

I like it, 5 blocks if there are tx, and 15 if there are not. good @lock9 , but hard to implement in consensus...

@lock9
Copy link
Contributor

lock9 commented Jul 18, 2019

@shargon I guess this is not my problem? 😂

@vncoelho what is your opinion? Do you think it is possible to have a block every 5 seconds, only if we have data?
@igormcoelho you mentioned something about keeping the "current state shared". Do you think we could use this strategy to have "blocks every 5 seconds", that are not actually "blocks"? Like one block every 15 seconds, but every 5, if there is data, there is a "state agreement"?
Maybe it is not possible... we will need a whole block structure every 5 seconds, right?

@shargon
Copy link
Member

shargon commented Jul 18, 2019

also "unpredictable" time, is not a good idea, because you can't stimate times according to block numbers

@txhsl
Copy link

txhsl commented Jul 24, 2019

@lock9 That's a little bit like the vBFT in Ontology. But in Neo, the CNs generate blocks in a fixed sequence instead of randomly, which will result in a problem in the reward of GAS.
@vncoelho Removing empty blocks will also cause the same issue unless that rule of sequence is changed. 🤔

@lock9 lock9 added Consensus Module - Changes that affect the consensus protocol or internal verification logic Enhancement Type - Changes that may affect performance, usability or add new features to existing modules. labels Aug 10, 2019
@vncoelho vncoelho removed the Enhancement Type - Changes that may affect performance, usability or add new features to existing modules. label Sep 18, 2019
@vncoelho
Copy link
Member Author

@neo-project/core, some people are asking for this feature for privatenets.

@devhawk, for example, commented about a feature for triggering consensus when running a smart contract (perhaps, something related to when transactions arrives in the mempool).

I believe that the best way to design this is as a plugin, which will not affect any configuration for normal use.
Perhaps we already have all the ingredients for pushing this plugin.
For example, the feature mentioned by @devhawk, could be a plugin that triggers consensus every time there are >= X Transactions in the mempool.

@vncoelho vncoelho added the Feature Type: Large changes or new features label Sep 18, 2019
Thacryba pushed a commit to simplitech/neo that referenced this issue Feb 17, 2020
* regular updates

* fix issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Consensus Module - Changes that affect the consensus protocol or internal verification logic Discussion Initial issue state - proposed but not yet accepted Feature Type: Large changes or new features
Projects
None yet
Development

No branches or pull requests

6 participants