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

Ibft validates block on proposal reception #565

Closed
wants to merge 4 commits into from

Conversation

rain-on
Copy link
Contributor

@rain-on rain-on commented Jan 15, 2019

Prior to this change, only the header was validated on block reception - now the block will be fully processed/validated (other than the commit seals, which will not exist until later in the process).

This has necessitated splitting up the BlockImporter into an Importer and a validator - both of which are available from the protocolSpecification.

Finally - an error existed in Ibft whereby the blockheadervalidator was specified at application startup, rather than being derived from the current block number (i.e. from ProtocolSchedule) - this has now been resolved.

@rain-on rain-on requested review from ajsutton and jframe January 15, 2019 02:32
@rain-on rain-on requested a review from CjHare January 15, 2019 05:52
@@ -47,6 +48,9 @@ public IbftRound createNewRound(final BlockHeader parentHeader, final int round)
final ConsensusRoundIdentifier roundIdentifier =
new ConsensusRoundIdentifier(nextBlockHeight, round);

BlockValidator<IbftContext> blockValidator =
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: final

proposedBlock.getHeader(), parentHeader, protocolContext, FULL)) {
LOG.info("Invalid Proposal message, block did not pass header validation.");

final Optional<BlockValidationOutputs> validationResult =
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like validationResult is a misleading name for this - I'd expect it to either be empty to indicate valid or have an enum to give the reason it was invalid. This is maybe more blockProcessingOutputs? The BlockValidationOutputs class might be better as BlockProcessingOutputs as well. Not sure there's an ideal name in any case.

@rain-on
Copy link
Contributor Author

rain-on commented Jan 16, 2019

Too large, so has been broken into sub PRs.

@rain-on rain-on reopened this Jan 16, 2019
@rain-on rain-on closed this Jan 16, 2019
@rain-on
Copy link
Contributor Author

rain-on commented Jan 16, 2019

Closed.

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.

2 participants