From d84d17cd3964e3903df367422c73727a1e476a1a Mon Sep 17 00:00:00 2001 From: Igor Crevar Date: Fri, 2 Jun 2023 13:11:14 +0200 Subject: [PATCH] EVM-519 Resolve slashing related TODOs in the code --- consensus/polybft/consensus_runtime.go | 13 +++++-------- consensus/polybft/fsm.go | 2 -- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/consensus/polybft/consensus_runtime.go b/consensus/polybft/consensus_runtime.go index 0b64602d6a..f3fe714ee6 100644 --- a/consensus/polybft/consensus_runtime.go +++ b/consensus/polybft/consensus_runtime.go @@ -287,8 +287,8 @@ func (c *consensusRuntime) OnBlockInserted(fullBlock *types.FullBlock) { var ( epoch = c.epoch err error - //nolint:godox - // TODO - this will need to take inconsideration if slashing occurred (to be fixed in EVM-519) + // calculation of epoch and sprint end does not consider slashing currently + isEndOfEpoch = c.isFixedSizeOfEpochMet(fullBlock.Block.Header.Number, epoch) ) @@ -352,13 +352,10 @@ func (c *consensusRuntime) FSM() error { return fmt.Errorf("cannot create block builder for fsm: %w", err) } - //nolint:godox - // TODO - recognize slashing occurred (to be fixed in EVM-519) - slash := false - pendingBlockNumber := parent.Number + 1 - isEndOfSprint := slash || c.isFixedSizeOfSprintMet(pendingBlockNumber, epoch) - isEndOfEpoch := slash || c.isFixedSizeOfEpochMet(pendingBlockNumber, epoch) + // calculation of epoch and sprint end does not consider slashing currently + isEndOfSprint := c.isFixedSizeOfSprintMet(pendingBlockNumber, epoch) + isEndOfEpoch := c.isFixedSizeOfEpochMet(pendingBlockNumber, epoch) valSet := validator.NewValidatorSet(epoch.Validators, c.logger) diff --git a/consensus/polybft/fsm.go b/consensus/polybft/fsm.go index e7603236af..07664dd2cf 100644 --- a/consensus/polybft/fsm.go +++ b/consensus/polybft/fsm.go @@ -111,8 +111,6 @@ func (f *fsm) BuildProposal(currentRound uint64) ([]byte, error) { return nil, err } - //nolint:godox - // TODO: we will need to revisit once slashing is implemented (to be fixed in EVM-519) extra := &Extra{Parent: extraParent.Committed} // for non-epoch ending blocks, currentValidatorsHash is the same as the nextValidatorsHash nextValidators := f.validators.Accounts()