Tezlink/Kernel: Remove temporary big_map artifacts
What
Remove remaining temporary big_maps in the durable storage.
Also move the temporary id definition as I checked on Tezos L1 and temporary big_map are shared between operations in batch.
Why
Since the implementation of the temporary big_map are not still in memory some data remains in the durable storage at the end of a batch application. This is not good and it could maybe lead to unexpected behavior
How
First, introduce new functions to work with mutable BigMapId
Then move the BigMapId for next_temporary_id outside of validate_and_apply_operation to make it for common to the whole batch.
In the end clear the temporary big_maps by decrementing that id
Manually testing the MR
The last two commits of the MR introduce verification that big_map -1 was removed from the storage.
make -f etherlink.mk test
If you move this commit at the start of the MR, most of the test will fail because big_map -1 was not removed from the storage.
The test verify_temp_big_map_content_is_cleaned should also fails because the storage is True instead of false due to the remaining content of the big_map. That last test shows that having those artifact in the storage can affect the behavior of smart contract execution.
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