Skip to content

Ensure macro blocks adhere to the block separation time of 1s - #3382

Draft
sisou wants to merge 2 commits into
albatrossfrom
soeren/macro-block-delay
Draft

Ensure macro blocks adhere to the block separation time of 1s#3382
sisou wants to merge 2 commits into
albatrossfrom
soeren/macro-block-delay

Conversation

@sisou

@sisou sisou commented May 6, 2025

Copy link
Copy Markdown
Member

This fixes #3296.

Pull request checklist

  • All tests pass. The project builds and runs.
  • I have resolved any merge conflicts.
  • I have resolved all clippy and rustfmt warnings.

@sisou

sisou commented May 6, 2025

Copy link
Copy Markdown
Member Author

Devnet Release Scenario run: https://github.com/nimiq/core-rs-albatross/actions/runs/14704410843

@jsdanielh jsdanielh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we add a check for this in verify_macro_block_proposal?

@sisou

sisou commented May 6, 2025

Copy link
Copy Markdown
Member Author

No that would make it non-backward compatible. The beauty of this change is that old and new nodes will accept it (I think). Adding that check would make it a hard-fork.

@jsdanielh

jsdanielh commented May 6, 2025

Copy link
Copy Markdown
Member

No that would make it non-backward compatible. The beauty of this change is that old and new nodes will accept it (I think). Adding that check would make it a hard-fork.

Mmm, then we could check for an acceptable range. Otherwise, we could accept any value there that could make the opposite effect.

@hrxi

hrxi commented May 7, 2025

Copy link
Copy Markdown
Contributor

Have you tested that this has the desired effect? By what mechanism does this introduce a one second delay?

Is it by making the next micro block producer wait two block separation times? Is the macro block not accepted/produced for another second due to this header change?

@sisou

sisou commented May 7, 2025

Copy link
Copy Markdown
Member Author

I have not verified it. Would we worth a private testnet run to see if it works.

I believe it produces the macro block directly (there's no waiting loop there like we have for the micro blocks) and then the next micro block waits 2 block times.

If that's really how it works, can you please check if there is a limit for what the macro block timestamp can be in a proposal? Can it be set to 1 year in the future?

@sisou
sisou force-pushed the soeren/macro-block-delay branch from 2b68635 to e32d4fc Compare August 13, 2025 08:50
@nibhar

nibhar commented Jul 30, 2026

Copy link
Copy Markdown
Member

I was looking into this again, and I believe this to be the actual easiest and smallest addition that can be made to make honest nodes adhere to the 1 second separation time floor.

No that would make it non-backward compatible. The beauty of this change is that old and new nodes will accept it (I think). Adding that check would make it a hard-fork.

Mmm, then we could check for an acceptable range. Otherwise, we could accept any value there that could make the opposite effect.

This is already in effect. Timestamps within TIMESTAMP_MAX_DRIFT are acceptable, and thus max(parent+1s, now()) is an acceptable value. There is also little incentive other than malice to do this, as there is a batch delay penalty. Putting this into validation is a hard fork and I don't think it is needed. Could be folded into a future hard fork as a nice to have maybe.

I believe it produces the macro block directly (there's no waiting loop there like we have for the micro blocks) and then the next micro block waits 2 block times.

That would be my assessment as well

If that's really how it works, can you please check if there is a limit for what the macro block timestamp can be in a proposal? Can it be set to 1 year in the future?

There is a TIMESTAMP_MAX_DRIFT constant that dictates this, but only for wall clock, as we do not have a network clock. currently this is 10 minutes which admittedly, is not exactly small, but also not huge either.

If there are no objections I will resurrect this PR and add a regression test to it.

@nibhar
nibhar self-requested a review July 30, 2026 10:12
@linear

linear Bot commented Jul 30, 2026

Copy link
Copy Markdown

T404-170

@nibhar nibhar self-assigned this Jul 30, 2026
@nibhar
nibhar marked this pull request as draft July 30, 2026 10:14
@nibhar
nibhar force-pushed the soeren/macro-block-delay branch from e32d4fc to 8691372 Compare July 30, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate artificial block delay for macro blocks

4 participants