SCORU/Node: better abstraction for node_ctxt mutable fields
The node context is implemented as a record with two mutable fields:
type 'a t = {
...
mutable lcc : lcc;
mutable lpc : Sc_rollup.Commitment.t option;
}
This leads to two issues:
- These fields can be mutated even for a
[Read] t`, which should be read-only. - When a copy of an
'a tis created, mutations of these fields in the original won't be reflected in the copy. This can be an issue when using the type casting functionreadonly, which will create a copy.
The second issue was a problem for !7715 (merged), as it would force the publisher worker to keep a Node_cotntext.rw in its state rather than a Node_context.ro, even if it never writes to it (but it should react to changes by other components).
Edited by Antonio Locascio