Skip to content

Commit

Permalink
Align to review
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusFranco99 committed Jul 24, 2024
1 parent efecd96 commit 6106533
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions message/validation/genesis/consensus_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package validation

import (
"bytes"
"encoding/hex"
"fmt"
"time"

Expand Down Expand Up @@ -46,14 +45,6 @@ func (mv *messageValidator) validateConsensusMessage(
return consensusDescriptor, msgSlot, e
}

// Rule: consensus message must have the same identifier as the ssv message's identifier
if !bytes.Equal(signedMsg.Message.Identifier, messageID[:]) {
e := ErrMismatchedIdentifier
e.want = hex.EncodeToString(messageID[:])
e.got = hex.EncodeToString(signedMsg.Message.Identifier)
return consensusDescriptor, msgSlot, e
}

if err := mv.validateSignatureFormat(signedMsg.Signature); err != nil {
return consensusDescriptor, msgSlot, err
}
Expand Down Expand Up @@ -140,8 +131,10 @@ func (mv *messageValidator) validateConsensusMessage(
signerState.Reset(msgRound)
}

if mv.hasFullData(signedMsg) && signerState.ProposalData == nil && signedMsg.Message.MsgType == genesisspecqbft.ProposalMsgType {
signerState.ProposalData = signedMsg.FullData
if signedMsg.Message.MsgType == genesisspecqbft.ProposalMsgType {
if mv.hasFullData(signedMsg) && signerState.ProposalData == nil {
signerState.ProposalData = signedMsg.FullData
}
}

signerState.MessageCounts.RecordConsensusMessage(signedMsg)
Expand Down Expand Up @@ -215,6 +208,12 @@ func (mv *messageValidator) validateSignerBehaviorConsensus(
msgSlot := phase0.Slot(signedMsg.Message.Height)
msgRound := signedMsg.Message.Round

// If signer state is nil, this is the first message for the signer and
// the next rules can't be checked.
if signerState == nil {
return mv.validateJustifications(share, signedMsg)
}

if msgSlot < signerState.Slot {
// Signers aren't allowed to decrease their slot.
// If they've sent a future message due to clock error,
Expand Down

0 comments on commit 6106533

Please sign in to comment.