Etherlink/Kernel/Stage 2: avoid reading the next blueprint number twice
What
Stacked on !16685 (merged).
In stage 2, the last stored block is typically read twice to get the number of the next blueprint:
- first at the beginning of the
block::producefunction to initialize thecurrent_block_numbermutable variable, - then, if no BIP is found in storage, the
block::next_bip_from_blueprintsfunction is called withcurrent_block_numberas argument but this argument is not passed to theblueprint_storage::read_next_blueprintfunction which therefore rereads the storage.
Note: if the block application succeeds, block_storage::read_current_number is also called in promote_block to forge the BlueprintApplied event but this MR is not about this. See !16661 (merged).
Why
It's always good to save some IOs + it simplifies !16569 (closed) a bit.
How
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
Edited by Raphaël Cauderlier