Skip to content

[Core Plugin DBFT] include consensus time into block interval#3637

Closed
Jim8y wants to merge 1 commit intoneo-project:masterfrom
Jim8y:block-interval
Closed

[Core Plugin DBFT] include consensus time into block interval#3637
Jim8y wants to merge 1 commit intoneo-project:masterfrom
Jim8y:block-interval

Conversation

@Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Dec 20, 2024

Description

this pr implements issue #3627 to include consensus time into block interval.

Fixes # (issue)

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to know

{
TimeSpan span = neoSystem.Settings.TimePerBlock;
if (block_received_index + 1 == context.Block.Index)
if (block_received_index + 1 == context.Block.Index && onPrepareBlockIndex + 1 == context.Block.Index)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required? seems a fix for a different thing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required. In fact, it was also required previously, because node can miss PrepareRequest from the previous round and get a block via P2P in which case using the onPrepareReceivedTime would be wrong.

Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my perspective this change is not essential right at this moment.

I am not against the idea of the change itself, but I am not in favor of merging this without strong tests, as we already did in the past.
This requires a setup with delay and a design of experiments that simulate mainnet.
Otherwise, setup some nodes on cloud and test it.

{
var diff = TimeProvider.Current.UtcNow - block_received_time;
// Include the consensus time into the consensus intervals.
var diff = TimeProvider.Current.UtcNow - onPrepareReceivedTime;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this methodology can trigger strange behaviors in a real scenario, after change views, delays and etc...

@vncoelho
Copy link
Member

My suggestion is that each core dev interested in the PR should setup a node.

I am available for that. Just set a date and my node will be ready to join our Core Testnet.
We can share any needed details internally to make a quick setup.

@Jim8y
Copy link
Contributor Author

Jim8y commented Dec 20, 2024

From my perspective this change is not essential right at this moment.

I am not against the idea of the change itself, but I am not in favor of merging this without strong tests, as we already did in the past.
This requires a setup with delay and a design of experiments that simulate mainnet.
Otherwise, setup some nodes on cloud and test it.

Tests will be done only after this one is properly reviewed, otherwise if this pr keeps changing, comments and suggestions keeps coming, it's meaningless to carry out any real world tests.

Copy link
Contributor

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See nspcc-dev/dbft#56 (comment) for my results, in general the approach is good and it can be done for the good.

Just don't expect this to give you <5% deviations on 3s mainnet, it's good, but not sufficient for that purpose.

if (block_received_index + 1 == context.Block.Index)
if (block_received_index + 1 == context.Block.Index && onPrepareBlockIndex + 1 == context.Block.Index)
{
var diff = TimeProvider.Current.UtcNow - block_received_time;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely block_received_time is not needed now.

{
TimeSpan span = neoSystem.Settings.TimePerBlock;
if (block_received_index + 1 == context.Block.Index)
if (block_received_index + 1 == context.Block.Index && onPrepareBlockIndex + 1 == context.Block.Index)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required. In fact, it was also required previously, because node can miss PrepareRequest from the previous round and get a block via P2P in which case using the onPrepareReceivedTime would be wrong.

@Jim8y
Copy link
Contributor Author

Jim8y commented Mar 28, 2025

close as can be done in another pr

@Jim8y Jim8y closed this Mar 28, 2025
AnnaShaleva added a commit that referenced this pull request Apr 16, 2025
Close #3627. A port of #3637 with format updates.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
AnnaShaleva added a commit that referenced this pull request Apr 16, 2025
Close #3627. A port of #3637 with format updates.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
shargon added a commit that referenced this pull request Apr 17, 2025
Close #3627. A port of #3637 with format updates.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Shargon <shargon@gmail.com>
cschuchardt88 pushed a commit to cschuchardt88/neo that referenced this pull request Jun 8, 2025
)

Close neo-project#3627. A port of neo-project#3637 with format updates.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Shargon <shargon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants