Skip to content

Abort block building and sending upon commit of an epoch sealing block#433

Merged
yacovm merged 3 commits into
mainfrom
stopEpochAtEpochChange
Jul 9, 2026
Merged

Abort block building and sending upon commit of an epoch sealing block#433
yacovm merged 3 commits into
mainfrom
stopEpochAtEpochChange

Conversation

@yacovm

@yacovm yacovm commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Once a block carrying SealingBlockInfo is committed (designates a sealing block), mark the epoch as sealed and stop it from doing any further work: it no longer verifies blocks, builds/proposes blocks, or broadcasts/sends messages.

The motivation is to prevent the epoch from interacting with the VM or other nodes, as a sealed epoch is supposed to be terminated right after its sealing.

High level changes:

  • Added epochSealed (an atomic.Bool)
  • indexFinalization() now sets epochSealed and returns without progressing to the next round when the committed block is a sealing block.
  • broadcast/send now abort if sealed, and the block verification and block-building tasks abort when the epoch is sealed.

Add TestEpochStopsAtSealingBlock, which drives an epoch through a chain via block messages, finalizations and notarizations and asserts that: without a sealing block every block is verified and the epoch proposes a block for the round it leads; with a sealing block only the blocks up to and including it are verified and committed.

TestEpochBuildsInRoundAfterSealingBlock which drives an epoch through a chain via block messages and finalizations and ensures that a block is not built in the round after the epoch is sealed.

Once a block carrying SealingBlockInfo is committed (designates a sealing block),
mark the epoch as sealed and stop it from doing any further work: it no longer verifies
blocks, builds/proposes blocks, or broadcasts/sends messages.

The motivation is to prevent the epoch from interacting with the VM or other nodes,
as a sealed epoch is supposed to be terminated right after its sealing.

High level changes:

- Added epochSealed (an atomic.Bool)
- indexFinalization() now sets epochSealed and returns without progressing to
  the next round when the committed block is a sealing block.
- broadcast/send now abort if sealed, and the block
  verification and block-building tasks abort when the epoch is sealed.

Add TestEpochStopsAtSealingBlock, which drives an epoch through a chain
via block messages, finalizations and notarizations and asserts that:
without a sealing block every block is verified and the epoch proposes a
block for the round it leads; with a sealing block only the blocks up to
and including it are verified and committed.

TestEpochBuildsInRoundAfterSealingBlock which drives an epoch through a chain
via block messages and finalizations and ensures that a block is not built
in the round after the epoch is sealed.

Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
Comment thread simplex/epoch.go
return nil
}

func (e *Epoch) broadcast(msg *common.Message) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shouldn't we still allow certain messages to get through? i.e. we should be able to respond to replication requests, and digest requests.

Also when a node sends an empty vote for an older round we respond with our latest finalization, round and maybe notarization or finalization.

if e.round > vote.Round {

Also, we have

func (e *Epoch) broadcastReplicationSync() {

if our epochs are transitioning during this time, the lagging node will not be able to catch up. At least I don't think we ever retry broadcasting the replication sync if no nodes respond.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

All right good call, Fixed.

I also realized that we drop the finalization message of the sealing block this way so I also fixed that: 05acb41

Comment thread simplex/epoch.go
…epoch

Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
Comment thread common/msg_test.go
expected: false,
},
{
// A block digest request is a request but not a replication message.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shouldn't we send this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yeah probably

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
@yacovm yacovm force-pushed the stopEpochAtEpochChange branch from 12ded99 to aab1189 Compare July 9, 2026 15:59
@yacovm yacovm merged commit 181f777 into main Jul 9, 2026
6 checks passed
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.

2 participants