Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Round change validation #315

Merged
merged 5 commits into from
Nov 29, 2018
Merged

Conversation

rain-on
Copy link
Contributor

@rain-on rain-on commented Nov 26, 2018

Validates round change messages through the use of the underlying MessageValidator class.

@rain-on rain-on force-pushed the round_change_validation branch 2 times, most recently from 102e65d to 48aa056 Compare November 26, 2018 22:45
msg.getUnsignedMessageData().getPreparedCertificate().get();

if (!messageValidator.addPreprepareMessage(certificate.getIbftPrePrepareMessage())) {
LOG.info("Invalid Round Change message, embedded Preprepare message failed validation.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space in RoundChange like other messages

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

for (final IbftSignedMessageData<IbftUnsignedPrepareMessageData> prepareMsg :
certificate.getIbftPrepareMessages()) {
if (!messageValidator.validatePrepareMessage(prepareMsg)) {
LOG.info("Invalid RoundChange message, embedded prepare message failed validation.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capitalise Prepare

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@rain-on rain-on force-pushed the round_change_validation branch 2 times, most recently from e0d9f38 to e465d6f Compare November 27, 2018 21:31
@rain-on rain-on force-pushed the round_change_validation branch 3 times, most recently from 6bb4358 to 21ff411 Compare November 28, 2018 05:47
RoundChangeValidator has been added which is responsible for
validating the content of a RoundChange message by using the
underlying MessageValidator capabilities.
Copy link
Contributor

@saltiniroberto saltiniroberto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One major issue in the validation checks

}

if (prepareCertRound.getRoundNumber() > currentRound.getRoundNumber()) {
LOG.info("Invalid RoundChange message, PreprepareCertificate is not for a past round.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct check is
pepareCertRound.getRoundNumber() < RounChnageMesage.getRoundChangeIdentifier().getRoundIdentifier()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

@Test
public void roundChangeWithPreprepareFromAFutureRoundFails() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test may need to be revisited after addressing my other comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to state preprepare must be earlier than roundchange target.

@rain-on rain-on merged commit 24b8d73 into PegaSysEng:master Nov 29, 2018
@rain-on rain-on deleted the round_change_validation branch January 16, 2019 21:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants