-
Notifications
You must be signed in to change notification settings - Fork 130
NewRoundMessageValidator ignores Round Number when comparing blocks #523
Conversation
NewRoundMessageValidator previously ensured the block in the newest PreparedCertificate was the same as that in the Proposal by comparing block hashes. However, the hash-function for received IBFT blocks includes round number - thus the blocks will never be deemed 'equal'. As such, the blocks must be compared using a hash function which ignores the round number - i.e. the OnChain function.
@@ -289,4 +268,25 @@ public void lastestPreparedCertificateMatchesNewRoundProposalIsSuccessful() { | |||
|
|||
assertThat(validator.validateNewRoundMessage(msg)).isTrue(); |
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.
Based on the name for the this test and the added comments referring to failing validation, should this assertion be a isFalse()
rather than isTrue()
?
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.
It looks like this test is proving the successful case when we have multiple PrepareCertificates, so ATM, I think its correct.
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.
My bad, in GitHub interface I'd assumed choosing to expand the collapsed section fully expanded ...turns out multiple clicks were needed, the isTrue()
is in the succeed test, not the fail test.
NewRoundMessageValidator previously ensured the block in the newest
PreparedCertificate was the same as that in the Proposal by comparing
block hashes.
However, the hash-function for received IBFT blocks includes round
number - thus the blocks will never be deemed 'equal'.
As such, the blocks must be compared using a hash function which
ignores the round number - i.e. the OnChain function.
PR description
Fixed Issue(s)