-
Notifications
You must be signed in to change notification settings - Fork 130
[NC-1582] Added iBFT 2.0 Hashing functions and header validation rules #119
[NC-1582] Added iBFT 2.0 Hashing functions and header validation rules #119
Conversation
consensus/common/src/main/java/tech/pegasys/pantheon/consensus/common/VoteType.java
Show resolved
Hide resolved
consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/IbftBlockHashing.java
Outdated
Show resolved
Hide resolved
consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/IbftBlockHashing.java
Show resolved
Hide resolved
consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/IbftBlockHashing.java
Outdated
Show resolved
Hide resolved
consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/IbftBlockHashing.java
Show resolved
Hide resolved
|
||
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"))); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
consensus/ibft/src/test/java/tech/pegasys/pantheon/consensus/ibft/IbftBlockHashingTest.java
Outdated
Show resolved
Hide resolved
consensus/ibft/src/test/java/tech/pegasys/pantheon/consensus/ibft/IbftBlockHashingTest.java
Outdated
Show resolved
Hide resolved
consensus/ibft/src/test/java/tech/pegasys/pantheon/consensus/ibft/IbftBlockHashingTest.java
Show resolved
Hide resolved
consensus/ibft/src/test/java/tech/pegasys/pantheon/consensus/ibft/IbftBlockHashingTest.java
Show resolved
Hide resolved
|
||
private static BlockHeaderValidator<IbftContext> createValidator( | ||
final long secondsBetweenBlocks, final boolean validateCommitSeals) { | ||
return new BlockHeaderValidator.Builder<IbftContext>() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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 theVoteTally
class can be shared between Clique, Ibft Legacy and iBFT 2.0.Types of changes