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 Proposal: Eliminate Duplicate Validation Check to Improve Consensus Time #325

Open
olegshmuelov opened this issue Dec 24, 2023 · 1 comment · May be fixed by #367
Open

Optimization Proposal: Eliminate Duplicate Validation Check to Improve Consensus Time #325

olegshmuelov opened this issue Dec 24, 2023 · 1 comment · May be fixed by #367

Comments

@olegshmuelov
Copy link
Contributor

Description
There appears to be a redundancy in the validation of consensus data, resulting in the same checks being conducted twice. This redundancy could be unnecessarily extending the time taken for consensus.

Details
The validation check for the input data (byts) is performed twice:

  1. In the BaseRunner.decide method:
// BaseRunner.decide method
if err := runner.GetValCheckF()(byts); err != nil {
    return errors.Wrap(err, "input data invalid")
}
  1. In the Controller.StartNewInstance method:
// Controller.StartNewInstance method
if err := c.GetConfig().GetValueCheckF()(value); err != nil {
    return errors.Wrap(err, "value invalid")
}

Given that BaseRunner.decide calls Controller.StartNewInstance, this results in the same validation check being performed twice on the same data.

Suggestion
To optimize the consensus time, I propose removing one of these duplicate checks. My recommendation would be to keep the validation in the Controller.StartNewInstance method, as it seems more contextually appropriate for the responsibility of starting a new QBFT instance.

@GalRogozinski
Copy link
Contributor

decide calls StartNewInstance so maybe we should do this check as soon as possible.
Also som "duties" may not have an instance

@MatheusFranco99 MatheusFranco99 linked a pull request Mar 1, 2024 that will close this issue
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.

2 participants