Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node,consensus: no duplicate proposals allowed #1421

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

jchappelow
Copy link
Member

@jchappelow jchappelow commented Feb 26, 2025

This addresses a strange proposal announcement amplification that can occur given the right timing, which @charithabandi observed once but could not easily reproduce.

In short, to support reannoucement of block proposals as well as preventing malicious spam proposals from stacking up behind the consensus event loop, we made the entire proposal stream handler atomic w.r.t. AcceptProposal => download = NotifyBlockProposal. However, NotifyBlockProposal is mostly asynchronous, meaning the next call to AcceptProposal will return true and allow the same proposal, which includes a full block, to be downloaded again and queued in another consensus msg for NotifyBlockProposal.

To resolve this, we take a nearly identical approach to that used with AcceptCommit and its stream handler. The main difference being that we completely block any subsequent proposal until the prior is processed (either fully rejected or fully accepted and block execution begun).

@jchappelow jchappelow force-pushed the nodupprops branch 2 times, most recently from 38548c6 to aa6e655 Compare February 27, 2025 16:15
}()

from := s.Conn().RemotePeer()
n.log.Info("Accept proposal?", "height", height, "blockID", prop.Hash, "prevHash", prop.PrevHash,
Copy link
Contributor

Choose a reason for hiding this comment

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

AcceptProposal logs the same, so this can be removed.

@jchappelow jchappelow merged commit cc32a05 into kwilteam:main Feb 27, 2025
2 checks passed
@jchappelow jchappelow deleted the nodupprops branch February 27, 2025 17:34
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