Rollup-Node: Add reference based Mutable API for PVMs
What
Part of RV-184
- Introduces a mutable api for the pvm in
Pvm_sig
Why
- Having a mutable API will enable ownership/move semantics to be used in the RISCV implementation of the PVM which will help avoid doing extraneous state copies when the PVM is used in a linear fashion.
How
- In the
pvm_sig.mlmodule, (which is the RN's view of the PVM capabilities) add a submoduleMut_api- Add conversion functions between mutable and immutable state types of the PVM.
- The mutable functions will not return a new state, but modify it in place (by returning a
unit Lwt.t/<side_effect_data> Lwt.t)
- The Arith & WASM pvm will just use a
<state> refwrapper and will use the immutable api "behind the scenes" - The RISCV PVM will currently also use the
<state> refwrapper, but it will be later modified to call into the Rust backend. See RV-113 & RV-217 & RV-183
Manually testing the MR
This MR adds unused code, the mutable API will be used in the FUELED_PVM module which is tested by rollup node tests.
The changes are tested in !14963 (merged)
make
# Just the rollup node tests
dune exec ./tezt/tests/main.exe -- --verbose --file tezt/tests/sc_rollup.ml
# Alternatively all tests
make test
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 Felix Puscasu