RISC-V: Proof-generating state backend
Part of RV-120.
What
This MR introduces a proof-generating backend, to be used when the PVM is required to produce a proof of a particular tick.
Why
State locations which are read or written during the execution of the tick need to be known in order to generate a Merkle proof over the state. The state backend used during execution does not keep this record.
How
The ProofGen backend is a wrapper whose regions wrap the regions of another manager and keep a record of locations accessed during an evaluation step. The logic for updating the record is part of the implementations for its regions of ManagerRead, ManagerWrite, and ManagerReadWrite.
When the PVM will need to produce a proof, the state will be rebound as a proof-generating backend in order to evaluate the requested tick (RV-231). The ProofGen backend will produce a Merkle tree over the state (RV-256), which can then be pruned to obtain a Merkle proof (RV-233).
Manually Testing
make -C src/riscv all
Benchmarking
This MR does not touch the interpreter so it should not have any impact on performance.
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.