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

Break out RoundChangeCertificate validation #864

Merged
merged 4 commits into from
Feb 15, 2019
Merged

Conversation

rain-on
Copy link
Contributor

@rain-on rain-on commented Feb 14, 2019

With upcoming changes to remove the NewRound message, and place the RoundChangeCertificate in the Proposal, it was decided to break out the RoundChangeCertiifcate validation into a separate file to minimise changes during message restructuring.

tmohay added 2 commits February 14, 2019 21:23
With upcoming changes to remove the NewRound message, and place
the RoundChangeCertificate in the Proposal, it was decided to break
out the RoundChangeCertiifcate validation into a separate file
to minimise changes during message restructuring.
@rain-on rain-on requested review from jframe and CjHare February 14, 2019 11:15
return false;
}

if (!roundChangeCert.getRoundChangePayloads().stream()
Copy link
Contributor

Choose a reason for hiding this comment

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

Would the RoundChangeCertificate benefit from providing this behaviour in a method, say public boolean doesRoundEqual(ConsensRoundIdentifier expectedRound), as that would make the semantics nicer in this spot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just the round check (i.e. not whole validation) - yeah could, the function is more like "doAllRoundChangesMatch(ConsensusRoundIdentifier expectedRound)"

return false;
}

for (final SignedData<RoundChangePayload> roundChangeMsg :
Copy link
Contributor

Choose a reason for hiding this comment

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

The RoundChangePayloadValidator only needs to be created once. And this validation check could be replaced with allMatch on the stream so could do something like if (!roundChangeCert.getRoundChangePayloads().stream()
.allMatch(roundChangeValidator::validateRoundChange)) { .. }

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.

this.quorum = IbftHelpers.calculateRequiredValidatorQuorum(validators.size());
this.chainHeight = chainHeight;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

would if make sense to just have a top level validateRoundChangeCertificate method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this stage we can't - there's 2 concepts - when we make Proposal, this may be an option.

  1. Is the RoundChange self-consistent?
  2. Does this Block align with the content in the RoundChange?

@rain-on rain-on merged commit ce56ea8 into PegaSysEng:master Feb 15, 2019
@rain-on rain-on deleted the rcc branch February 15, 2019 02:55
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