Skip to content

Protect against leaders that send several distinct blocks for the same round - #570

Merged
yacovm merged 6 commits into
mainfrom
541
Sep 8, 2026
Merged

Protect against leaders that send several distinct blocks for the same round#570
yacovm merged 6 commits into
mainfrom
541

Conversation

@yacovm

@yacovm yacovm commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

This commit limits block verification at any round to a single block at a time when receiving the block as a block message.

This is to prevent from a malicious leader from sending many distinct blocks and overwhelming the node.

@samliok

samliok commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

for future claude fixes, can we link them under development of a PR? Then when we merge the PR, the issue should auto-close

i did it for this one

@samliok

samliok commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

haven't looked into it but this test is failing TestEpochStopsAtSealingBlock via CI

…e round

This commit limits block verification at any round to a single block at a time when receiving
the block as a block message.

This is to prevent from a malicious leader from sending many distinct blocks and overwhelming the node.

Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
@yacovm

yacovm commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

haven't looked into it but this test is failing TestEpochStopsAtSealingBlock via CI

Fixed the tests

Comment thread simplex/epoch.go Outdated
// Create a task that will verify the block in the future, after its predecessors have also been verified.
blockVerificationTask := e.createBlockVerificationTask(e.oneTimeVerifier.Wrap(block), from, vote)
// Mark the round as pending and wrap the task with a task that will cleanup the pending round after the block verification task is executed.
task := e.markPendingRoundAndCleanupAfter(md.Round, blockVerificationTask)

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.

shouldnt we do this after the check below? otherwise if we receive an invalid block we will mark it as pending forever

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.

nice catch

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.

Comment thread simplex/epoch.go Outdated
Comment thread simplex/epoch_test.go
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
@samliok

samliok commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

hmm weird failure on TestEpochVoteSentTwiceKeepsVerifiedVote

@yacovm
yacovm force-pushed the 541 branch 2 times, most recently from 83bc3a9 to 62de7c4 Compare September 3, 2026 22:40
samliok
samliok previously approved these changes Sep 3, 2026
Comment thread simplex/epoch.go Outdated
Comment thread simplex/epoch.go
}

// Create a task that will verify the block in the future, after its predecessors have also been verified.
task := e.createBlockVerificationTask(e.oneTimeVerifier.Wrap(block), from, vote)

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.

where do we set this block as being processing? if the leader just sends via the handleBlockMessage() then don't we still run into this issue?

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.

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.

a few lines below

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.

	// mark in future messages while we are verifying the block
	msgForRound, exists := e.futureMessages[string(from)][md.Round]
	if !exists {
		msgsForRound := &messagesForRound{}
		msgsForRound.proposalBeingProcessed = true
		e.futureMessages[string(from)][md.Round] = msgsForRound
	} else {
		msgForRound.proposalBeingProcessed = true
	}

Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
@yacovm
yacovm merged commit 49963c4 into main Sep 8, 2026
7 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.

Leader equivocation floods block verification queue, silently dropping genuine proposals

2 participants