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

[NC-1582] Added iBFT 2.0 Hashing functions and header validation rules #119

Merged

Conversation

saltiniroberto
Copy link
Contributor

@saltiniroberto saltiniroberto commented Oct 22, 2018

PR description

This PR adds the hashing function for iBFT 2.0 and the related header validation rules.
Also, as part of this PR, the interface ValidatorVote is introduced so that the VoteTally class can be shared between Clique, Ibft Legacy and iBFT 2.0.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)


private static final List<KeyPair> COMMITTERS_KEY_PAIRS = committersKeyPairs();
private static final List<Address> VALIDATORS = Arrays.asList(Address.ECREC, Address.SHA256);
private static final Optional<Vote> VOTE = Optional.of(Vote.authVote(Address.fromHexString("1")));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason this needs to be optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the IbftExtraData constructor requires an Optional.


private static BlockHeaderValidator<IbftContext> createValidator(
final long secondsBetweenBlocks, final boolean validateCommitSeals) {
return new BlockHeaderValidator.Builder<IbftContext>()
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have a rule to make sure the coinbase is a validator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. line 80 of IbftExtraDataValidationRule

Copy link
Contributor

Choose a reason for hiding this comment

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

needs to be done outside of extra data validation rule ... in my opinion.

@saltiniroberto saltiniroberto merged commit 77a3df3 into PegaSysEng:master Oct 25, 2018
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