Add context hash version to proto env v3
We are planning to have a new context hash calculation. Tezos node needs distinguish the versions of hashings.
Temporary, only the hash version 0 is supported, and setting other hash versions raises an error. Other hash versions will be supported in a future shell upgrade.
Type
type Context_hash.Version.t = private int
.
Comparison and encoding as uint16
are defined.
Context backend
Context backend, Irmin, must remember the hash version of each commit: when a commit is checked out, the hash version of the commit must be properly loaded.
Context
has the following new APIs for the hash version:
-
get_hash_version : Context.t -> Context_hash.Version.t
No Lwt. -
set_hash_version : Context.t -> Context_hash.Version.t -> Context.t tzresult Lwt.t
Returns a new context with the specified hash version. Once the version is changed,hash
of the context MUST recalculate the hashes of the tree nodes using the new hash version. It may take a long time.
Not only the disk context, the memory, proxy, and dummy contexts have the same functions.
Protocol environment V3
It exposes
- Context_hash.Version
-
get_hash_version
andset_hash_version
to Proto alpha.
Edited by Clément Hurlin