Wasm: force wasm pvm to make top level call in fixed amount of ticks
Context
Fixes #3598 (closed)
Context: to have points in the execution where the fast VM and the PVM can synchronize, with a known number of ticks, the PVM has to enforce a fixed number of ticks between top-level calls. To do so, once the VM has finished executing a top-level call, then it will continue increasing the tick counter while doing nothing, until the fixed number of ticks is reached. If the execution has not finished when that number is reached, then the PVM is Stuck (cf !6101 (merged)).
The tick at which a top level call was started is stored in pvm_state.last_top_level_call
The max nb of tick is stored in the pvm_state and a primitive to change it is added in Internal_for_tests. The goal is for tests to run in a reasonable time, if the kernel is known to be fast / simple.
Manually testing the MR
A new test is added in src/lib_scoru_wasm/test/test_fixed_nb_ticks.ml with a kernel looping indefinitely.
dune runtest src/lib_scoru_wasm
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