From 28c237ce434fd81c2fc6ed9c316b6b9a06014581 Mon Sep 17 00:00:00 2001 From: Alexander Hentschel Date: Mon, 12 Jun 2023 21:35:07 -0700 Subject: [PATCH 1/3] fixed typos (no algorithmic changes) --- engine/consensus/compliance/core.go | 4 ++-- state/cluster/badger/mutator.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/consensus/compliance/core.go b/engine/consensus/compliance/core.go index 20bb015c7e2..24a6e6be70d 100644 --- a/engine/consensus/compliance/core.go +++ b/engine/consensus/compliance/core.go @@ -337,9 +337,9 @@ func (c *Core) processBlockProposal(proposal *flow.Block) error { // We know: // - the parent of this block is valid and was appended to the state (ie. we knew the epoch for it) // - if we then see this for the child, one of two things must have happened: - // 1. the proposer malicious created the block for a view very far in the future (it's invalid) + // 1. the proposer maliciously created the block for a view very far in the future (it's invalid) // -> in this case we can disregard the block - // 2. no blocks have been finalized within the epoch commitment deadline, and the epoch ended + // 2. no blocks have been finalized within the epoch commitment deadline, and the epoch ended // (breaking a critical assumption - see EpochCommitSafetyThreshold in protocol.Params for details) // -> in this case, the network has encountered a critical failure // - we assume in general that Case 2 will not happen, therefore this must be Case 1 - an invalid block diff --git a/state/cluster/badger/mutator.go b/state/cluster/badger/mutator.go index f4797ee3034..a4d867f4a8a 100644 --- a/state/cluster/badger/mutator.go +++ b/state/cluster/badger/mutator.go @@ -181,7 +181,7 @@ func (m *MutableState) checkHeaderValidity(candidate *cluster.Block) error { // checkConnectsToFinalizedState validates that the candidate block connects to // the latest finalized state (ie. is not extending an orphaned fork). // Expected error returns: -// - state.UnverifiableExtensionError if the candidate extends an orphaned fork +// - state.OutdatedExtensionError if the candidate extends an orphaned fork func (m *MutableState) checkConnectsToFinalizedState(ctx extendContext) error { header := ctx.candidate.Header finalizedID := ctx.finalizedClusterBlock.ID() From a8028aa98480721aa85e76bf132ddd1933ef5ec6 Mon Sep 17 00:00:00 2001 From: Yurii Oleksyshyn Date: Thu, 15 Jun 2023 13:07:01 +0300 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Alexander Hentschel --- engine/common/follower/cache/cache.go | 2 +- engine/consensus/compliance/core.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/common/follower/cache/cache.go b/engine/common/follower/cache/cache.go index f5ab35a63b6..b494604e8d1 100644 --- a/engine/common/follower/cache/cache.go +++ b/engine/common/follower/cache/cache.go @@ -49,7 +49,7 @@ type Cache struct { byView map[uint64]BlocksByID // lookup of blocks by their respective view; used to detect equivocation byParent map[flow.Identifier]BlocksByID // lookup of blocks by their parentID, for finding a block's known children - notifier hotstuff.ProposalViolationConsumer // equivocation will be reported using this notifier + notifier hotstuff.ProposalViolationConsumer // equivocations will be reported using this notifier lowestView counters.StrictMonotonousCounter // lowest view that the cache accepts blocks for } diff --git a/engine/consensus/compliance/core.go b/engine/consensus/compliance/core.go index 24a6e6be70d..d0fd92b3dd4 100644 --- a/engine/consensus/compliance/core.go +++ b/engine/consensus/compliance/core.go @@ -425,7 +425,7 @@ func checkForAndLogOutdatedInputError(err error, log zerolog.Logger) bool { func checkForAndLogUnverifiableInputError(err error, log zerolog.Logger) bool { if engine.IsUnverifiableInputError(err) { // the block cannot be validated - log.Err(err).Msg("received unverifiable block proposal; this is an indicator of a proposal that cannot be verified under current state") + log.Err(err).Msg("received unverifiable block proposal; this might be an indicator that a malicious proposer is generating detached blocks very far ahead") return true } return false From a5a55eabf668ce73ea6da341d676450d830afab9 Mon Sep 17 00:00:00 2001 From: Yurii Oleksyshyn Date: Thu, 15 Jun 2023 13:32:14 +0300 Subject: [PATCH 3/3] Applied suggestions from PR review --- engine/collection/compliance/core.go | 3 ++- engine/consensus/compliance/core.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/collection/compliance/core.go b/engine/collection/compliance/core.go index 7803fb3095b..c65bd8b6080 100644 --- a/engine/collection/compliance/core.go +++ b/engine/collection/compliance/core.go @@ -392,7 +392,8 @@ func checkForAndLogOutdatedInputError(err error, log zerolog.Logger) bool { func checkForAndLogUnverifiableInputError(err error, log zerolog.Logger) bool { if engine.IsUnverifiableInputError(err) { // the block cannot be validated - log.Err(err).Msg("received unverifiable block proposal; this is an indicator of a proposal that cannot be verified under current state") + log.Warn().Err(err).Msg("received collection proposal with unknown reference block; " + + "this might be an indicator that the node is slightly behind or the proposer published an invalid collection") return true } return false diff --git a/engine/consensus/compliance/core.go b/engine/consensus/compliance/core.go index d0fd92b3dd4..61eb57f51d0 100644 --- a/engine/consensus/compliance/core.go +++ b/engine/consensus/compliance/core.go @@ -425,7 +425,8 @@ func checkForAndLogOutdatedInputError(err error, log zerolog.Logger) bool { func checkForAndLogUnverifiableInputError(err error, log zerolog.Logger) bool { if engine.IsUnverifiableInputError(err) { // the block cannot be validated - log.Err(err).Msg("received unverifiable block proposal; this might be an indicator that a malicious proposer is generating detached blocks very far ahead") + log.Warn().Err(err).Msg("received unverifiable block proposal; " + + "this might be an indicator that a malicious proposer is generating detached blocks very far ahead") return true } return false