Skip to content

Proto/validate: simplify consensus operation checks

Context

Rework the consensus operation checks in lib_protocol/validate.ml to make them more readable and easier to adjust in the future. This MR is refactoring-only and does not change the semantics of consensus operation validation. It is motivated by desired changes (that will be implemented in !7815 (merged)) to the validation of consensus operations in mempool mode.

This MR proceeds as follows:

  • (3 commits) Rework the information present in the validation_info's mode and consensus_info to make accessible the information that will be needed to validate consensus operations without relying on consensus_info.all_expected_features anymore. Also remove some fitness-related information from the modes, that is not really needed during block finalization.
  • (3 commits) Streamline the checks on consensus operations, by retrieving each needed piece of information directly instead on relying on the nebulous all_expected_features. Each commit handles one kind of operation (with grandparent endorsements treated separately from "normal" endorsements).
  • (1 commit) Remove the no longer used all_expected_features.

Manually testing the MR

CI

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • [N/A] Document any change to the user interface, including configuration parameters (see node configuration)
  • [relying on existent tests] Provide automatic testing (see the testing guide).
  • [N/A] For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Diane Gallois-Wong

Merge request reports