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

Spilt Ibft MessageValidator into components #752

Merged
merged 4 commits into from
Feb 4, 2019

Conversation

rain-on
Copy link
Contributor

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

Moving to IBFT2.1 requires that validation be conducted
on the signeddata aspects of a message separately from the
'piggybacked' block.

Moving to IBFT2.1 requires that validation be conducted
on the signeddata aspects of a message separately from the
'piggybacked' block.

Move Validators to using Messages
@rain-on rain-on requested review from jframe and CjHare February 4, 2019 01:39
@@ -1,5 +1,5 @@
/*
* Copyright 2018 ConsenSys AG.
* Copyright 2019 ConsenSys AG.
Copy link
Contributor

@CjHare CjHare Feb 4, 2019

Choose a reason for hiding this comment

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

FYI - copyright dates are usually left as the earliest date i.e. prior art

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added by build magic?

if (!validateBlockMatchesProposalRound(msg.getPayload())) {
return false;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

  proposal = Optional.of(msg);
  return true;
}

return false;

Nicer to read? (removes negation, groups together logical conditions)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Somewhat - but this follows the pattern which has been used throughout - i.e. final return is always true ...

final ConsensusRoundIdentifier roundIdentifier,
final BlockValidator<IbftContext> blockValidator,
final ProtocolContext<IbftContext> protocolContext,
final BlockHeader parentHeader) {
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't look this is used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, and this is part of a bigger issue - but will remove it from here (which is the start of something nice).

msgType);
return false;
}
private final SignedDataValidator signedDataValidator;
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps some tests for messageValidator to prove that it is delegating the validation of the payload to the signedDataValidator

@rain-on rain-on merged commit 1239da9 into PegaSysEng:master Feb 4, 2019
rain-on added a commit to rain-on/pantheon that referenced this pull request Feb 4, 2019
Moving to IBFT2.1 requires that validation be conducted
on the signeddata aspects of a message separately from the
'piggybacked' block.

Move Validators to using Messages
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