Scoru: Add immutable chunked byte vector
Context
This task is the first step necessary for resolving this issue #4506. Also, it makes this upcoming MR !7488 (closed) safe.
The problem is that when we start storing data in memory in durable storage, the existing mutable chunked byte vector is not safe anymore to be used in conjunction with durable storage. For instance, a possible scenario that an external user might find a vector in the durable storage, after what chunked byte vector gets held in memory (in durable storage) and if the user modifies his version of chunked byte vector then it also gets modified in the durable storage, which violates the invariant that durable storage is immutable.
On a more practical side of things, while durable storage holds mutable chunked vector, the possible use-case is possible:
let x = find durable "/key/to/vector"
grow x 6;
store_bytes x "suffix";
encode tree durable
after what an extended chunked byte vector is encoded to the durable storage, which perhaps is not the intended behavior.
UPD I will add extra tests for the immutable version in the follow-up MR. I guess this one is already big enough and there are some tests covering basic logic.
Manually testing the MR
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