From afee01abb7f2634a5a911d8dd7b5a40e44334402 Mon Sep 17 00:00:00 2001 From: Sorin Stanculeanu Date: Thu, 6 Feb 2025 10:24:03 +0200 Subject: [PATCH] fix after review --- common/common.go | 6 +++--- process/headerCheck/headerSignatureVerify.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/common.go b/common/common.go index 3b44e80fc4..00b6f92d28 100644 --- a/common/common.go +++ b/common/common.go @@ -40,10 +40,10 @@ func IsEpochChangeBlockForFlagActivation(header data.HeaderHandler, enableEpochs return isStartOfEpochBlock && isBlockInActivationEpoch } -// IsEpochStartProofAfterFlagActivation returns true if the provided proof is the proof of the epoch start block after the activation epoch of equivalent messages -func IsEpochStartProofAfterFlagActivation(proof consensus.ProofHandler, enableEpochsHandler EnableEpochsHandler) bool { +// IsEpochStartProofForFlagActivation returns true if the provided proof is the proof of the epoch start block on the activation epoch of equivalent messages +func IsEpochStartProofForFlagActivation(proof consensus.ProofHandler, enableEpochsHandler EnableEpochsHandler) bool { isStartOfEpochProof := proof.GetIsStartOfEpoch() - isProofInActivationEpoch := proof.GetHeaderEpoch() >= enableEpochsHandler.GetActivationEpoch(EquivalentMessagesFlag) + isProofInActivationEpoch := proof.GetHeaderEpoch() == enableEpochsHandler.GetActivationEpoch(EquivalentMessagesFlag) return isStartOfEpochProof && isProofInActivationEpoch } diff --git a/process/headerCheck/headerSignatureVerify.go b/process/headerCheck/headerSignatureVerify.go index a2ee09a06d..4b9e204c6d 100644 --- a/process/headerCheck/headerSignatureVerify.go +++ b/process/headerCheck/headerSignatureVerify.go @@ -314,7 +314,7 @@ func (hsv *HeaderSigVerifier) VerifyHeaderWithProof(header data.HeaderHandler) e } prevProof := header.GetPreviousProof() - if common.IsEpochStartProofAfterFlagActivation(prevProof, hsv.enableEpochsHandler) { + if common.IsEpochStartProofForFlagActivation(prevProof, hsv.enableEpochsHandler) { return hsv.verifyHeaderProofAtTransition(prevProof) } @@ -369,7 +369,7 @@ func (hsv *HeaderSigVerifier) VerifyHeaderProof(proofHandler data.HeaderProofHan return fmt.Errorf("%w for flag %s", process.ErrFlagNotActive, common.EquivalentMessagesFlag) } - if common.IsEpochStartProofAfterFlagActivation(proofHandler, hsv.enableEpochsHandler) { + if common.IsEpochStartProofForFlagActivation(proofHandler, hsv.enableEpochsHandler) { return hsv.verifyHeaderProofAtTransition(proofHandler) }