Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization Suggestion: Reduce Redundant Calls to SignedMessage.Validate in QBFT Message Processing #326

Open
olegshmuelov opened this issue Dec 24, 2023 · 0 comments · May be fixed by #366

Comments

@olegshmuelov
Copy link
Contributor

Details
The method SignedMessage.Validate is being called multiple times across different functions, which may lead to inefficiencies in processing.
The method SignedMessage.Validate is redundantly invoked in several places:

  1. Within the Instance.BaseMsgValidation method:
// Instance.BaseMsgValidation method
if err := msg.Validate(); err != nil {
    return errors.Wrap(err, "invalid signed message")
}
  1. Also in other functions such as isValidProposal, validSignedPrepareForHeightRoundAndRoot, validateCommit, and validRoundChangeForData. For example, in isValidProposal:
// isValidProposal function
if err := signedProposal.Validate(); err != nil {
    return errors.Wrap(err, "proposal invalid")
}

Proposed Solution
We can call SignedMessage.Validate only once at the beginning to avoid repeating it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant