Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR aims to improve the Round-Change validation functions.
The reason is that, from benchmark tests, Round-Change message processing showed unexpectedly high latency. This performance hurdle comes from:
Changes
validSignedPrepareForHeightRoundAndRoot
function was refactored by the following way:validPrepareForHeightRoundAndRoot
function that performs all the message fields and logic checks.validSignedPrepareForHeightRoundAndRoot
now callsvalidPrepareForHeightRoundAndRoot
and then, if there is no error, it verifies the signature.getRoundChangeJustification
, now, callsvalidPrepareForHeightRoundAndRoot
to validate the Prepare messages (for a round and root) without verifying the signature.verifySignatures
to theisProposalJustification
function. For received Proposal messages, the flag is set totrue
, and, for Proposal validation for creation, the flag is set tofalse
.validRoundChangeForData
function is refactored tovalidSignedRoundChangeForData
.validRoundChangeForData
function is created with similar behavior tovalidSignedRoundChangeForData
but without verifying signatures.Performance Comparison
All times are in milliseconds.
Due to the change no. 2, we get the following Round-Change processing improvement:
Due to the changes no. 2 and 3, we get the following Round-Change processing improvement: