Skip to content

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

@olegshmuelov

Description

@olegshmuelov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions