Etherlink/Kernel: don't read the curent block twice to validate next blueprint
What and how
During stage 2, the current block was read twice during stage two:
- at the beginning of the produce function, to extract the information needed to build the next block (in particular the transaction and receipt root hashes),
- when parsing the blueprint, its timestamp and parent hash are checked against the timestamp and hash of the previous block.
The second block read happens once per L2 block, the first one may happens one or several times per L2 block (several times when rebooting in the middle of the block is needed).
In this MR, we avoid the second read by propagating the information from the first one.
Why
There are two motivations behind this MR:
- performance: reading a block can be costly because the size of the block can be large so storage host functions may have to be called many times to get all the content,
- this is a preparation for changes related to Tezlink: in a future MR we will introduce a notion of block header containing all the information we need about the current block to validate the next blueprint and turn it into the next block.
Manually testing the MR
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
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