Skip to content

Track scheduled block verifications by sequence and epoch - #674

Open
yacovm wants to merge 1 commit into
mainfrom
659
Open

yacovm wants to merge 1 commit into
mainfrom
659

Conversation

@yacovm

@yacovm yacovm commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

A Telock from the old epoch can share a sequence with a block of the new epoch. When a non-validator received a replayed Telock T2, it scheduled T2 to wait on the preceding Telock T1.

The first block of the next epoch can be indexed instead of T1 and therefore the task of T1 never runs.

Because scheduled sequences were tracked by sequence alone, IsSequenceScheduled kept reporting T2's sequence as already scheduled, and the genuine block of the new epoch that competes with T2's sequence was dropped.

This commit expands tracking the tasks with also looking at the epoch, which allows both tasks to coexist.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

A Telock from the old epoch can share a sequence with a block of the new epoch.
When a non-validator received a replayed Telock T2, it scheduled T2 to wait on the preceding Telock T1.

The first block of the next epoch can be indexed instead of T1 and therefore the task of T1 never runs.

Because scheduled sequences were tracked by sequence alone, IsSequenceScheduled kept reporting T2's
sequence as already scheduled, and the genuine block of the new epoch that competes with T2's sequence was dropped.

This commit expands tracking the tasks with also looking at the epoch, which allows both tasks to coexist.

Signed-off-by: Yacov Manevich <[email protected]>
Comment thread common/block_scheduler.go
@@ -31,15 +31,21 @@ type BlockDependencyManager struct {

dependencies []*TaskWithDependents
// scheduledSeqs holds every seq with a task pending, queued or running.

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.

can we update to

Suggested change
// scheduledSeqs holds every seq with a task pending, queued or running.
// scheduledSeqs holds every sequence and epoch pair with a task pending, queued or running.

or something similar?

func (n *NonValidator) scheduleNewFinalizedBlockTask(block common.Block, finalization *common.Finalization) error {
bh := finalization.Finalization.BlockHeader
if n.verifier.IsSequenceScheduled(bh.Seq) {
if n.verifier.IsSequenceScheduled(bh.Seq, bh.Epoch) {

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.

if we schedule a sequence for T2, do we ever clear this from the non-validators scheduler? Because T1 may never arrive, i think we should call

n.verifier.RemoveOldTasks(md.Seq) after indexing or something

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.

I agree, but - don't we have this problem at the moment irrespective of this PR?

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.

Replayed Telock leaves unsatisfiable verification dependency, stalling non-validator forever

2 participants