Implement validation of blocks
Context
This MR is part of the %Pipelining project and aims to split the validation from the application of blocks.
Checks previously done at the beginning of the application or the construction of a block are now done in the Validate module. The Apply module does not contain any checks for the blocks. Therefore, a block must be validated before being applied to ensure its correctness.
This MR refactors some code and prepares a future MR that will change the interface of the protocol and will allow to explicitly validate blocks (and operation) before applying them.
Manually testing the MR
This MR does not add any tests. The block's validation was already well tested in all tests that apply / bake blocks. We rely on the CI and the previous tests to ensure that this MR does not change the previous behaviour.
2 tests needed to be updated, since now we ensure, on the protocol side, that operations in a block must be ordered following their validation passes. These tests can be run with the following command:
dune exec src/proto_alpha/lib_protocol/test/integration/consensus/main.exe -- test "baking"
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)
-
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR