Skip to content

Conversation

@MatheusFranco99
Copy link
Contributor

@MatheusFranco99 MatheusFranco99 commented Feb 1, 2024

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:

  • verifying already verified Prepare messages for the Round-Change message creation, after a partial quorum of Round-Change messages is received.
  • verifying already verified Prepare and Round-Change messages for the creation of Proposal messages after a quorum of Round-Change messages is received.

Changes

  1. The validSignedPrepareForHeightRoundAndRoot function was refactored by the following way:
    • a new validPrepareForHeightRoundAndRoot function that performs all the message fields and logic checks.
    • validSignedPrepareForHeightRoundAndRoot now calls validPrepareForHeightRoundAndRoot and then, if there is no error, it verifies the signature.
  2. getRoundChangeJustification, now, calls validPrepareForHeightRoundAndRoot to validate the Prepare messages (for a round and root) without verifying the signature.
  3. Once a quorum of Round-Change messages is reached, the Proposal justification validation for the Proposal creation will not verify signatures (since container messages are already verified). This is accomplished by adding a flag verifySignatures to the isProposalJustification function. For received Proposal messages, the flag is set to true, and, for Proposal validation for creation, the flag is set to false.
  4. The validRoundChangeForData function is refactored to validSignedRoundChangeForData.
  5. A new validRoundChangeForData function is created with similar behavior to validSignedRoundChangeForData 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:

1st 2nd 3rd (quorum)
Old 4.5 9.5 21.5
New 4.5 4.8 21.5

Due to the changes no. 2 and 3, we get the following Round-Change processing improvement:

1st 2nd 3rd (quorum)
Old 4.5 9.5 21.5
New 4.5 4.8 5

@MatheusFranco99 MatheusFranco99 self-assigned this Feb 1, 2024
…dRoundChangeForData function. Propagate name changes.
@github-actions
Copy link

This pull request has been marked as stale due to 60 days of inactivity.

@github-actions github-actions bot added the stale label Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants