RISC-V: Serialisation/deserialisation for regions
Closes RV-200
What
Implements serialisation and deserialisation for various types such that for<M: ManagerSerialise + ManagerDeserialise> AllocatedOf<StateLayout, M>: serde::Serialize + serde::Deserialize.
Why
We need to serialise the state data to and from the disk when the Rollup Node asks for it. Implementing serde::Serialize and serde::Deserialize for these types, allows us to do this.
How
AllocatedOf<L, M> for some layout L is a tree where the leafs are Cell, Cells or DynCells. Every leaf delegates its serialisation/deserialisation capabilities to ManagerSerialise and ManagerDeserialise. Theoretically, each leaf could serialise using ManagerRead and deserialise using ManagerAlloc. However, the manager can achieve this more efficiently (e.g. without extraneous copying) because it can access the underlying values.
Manually Testing
make -C src/riscv all
Benchmarking
No performance impact has been observed on the reference machine.
Tasks for the Author
-
Link all Linear issues related to this MR using magic words (e.g. part of, relates to, closes). -
Eliminate dead code and other spurious artefacts introduced in your changes. -
Document new public functions, methods and types. -
Make sure the documentation for updated functions, methods, and types is correct. -
Add tests for bugs that have been fixed. -
Put in reasonable effort to ensure that CI will pass. -
Benchmark performance and populate the table above if needed. -
Write commit messages to reflect the changes they're about. -
Self-review your changes to ensure they are high-quality. -
Complete all of the above before assigning this MR to reviewers.