Skip to content

Commit

Permalink
Merge pull request #139 from nspcc-dev/commit-protection
Browse files Browse the repository at this point in the history
check: prohibit WatchOnly to send commits
  • Loading branch information
roman-khimov authored Dec 5, 2024
2 parents 7c005d9 + 28758a4 commit b2ba0cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Behaviour changes:
Improvements:

Bugs fixed:
* inappropriate log on attempt to construct Commit for anti-MEV enabled WatchOnly
(#139)

## [0.3.1] (29 November 2024)

Expand Down
11 changes: 8 additions & 3 deletions check.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,20 @@ func (d *DBFT[H]) checkPreCommit() {
d.preBlockProcessed = true
}

// Require PreCommit sent by self for reliability. This condition may be removed
// in the future.
// Require PreCommit sent by self for reliability. This condition must not be
// removed because:
// 1) we need to filter out WatchOnly nodes;
// 2) CNs that have not sent PreCommit must not skip this stage (although it's OK
// from the DKG/TPKE side to build final Block based only on other CN's data).
if d.PreCommitSent() {
d.verifyCommitPayloadsAgainstHeader()
d.sendCommit()
d.changeTimer(d.SecondsPerBlock)
d.checkCommit()
} else {
d.Logger.Debug("can't send commit since self preCommit not yet sent")
if !d.Context.WatchOnly() {
d.Logger.Debug("can't send commit since self preCommit not yet sent")
}
}
}

Expand Down

0 comments on commit b2ba0cd

Please sign in to comment.