From 836e1ab528379ac5e0e9151cf369628dcf1034a3 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Wed, 2 Sep 2026 23:42:52 -0300 Subject: fix initialization persistence --- lib/kernel/Branch.ml | 7 +++++-- lib/kernel/BranchManager.ml | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'lib/kernel') diff --git a/lib/kernel/Branch.ml b/lib/kernel/Branch.ml index 31442f6..f44ab6e 100644 --- a/lib/kernel/Branch.ml +++ b/lib/kernel/Branch.ml @@ -73,6 +73,9 @@ module Make (S : Abstract.Storage.STORAGE) = struct let make conn = let open Utilities.Result in - let* empty = SI.with_transaction conn MultigroupM.empty_under in - Ok (new branch conn { multigroups = empty; previous = None } |> Protocols.Handle.make) + SI.with_transaction conn (fun tx -> + let* empty = MultigroupM.empty_under tx in + let branch = { multigroups = empty; previous = None } in + let* _ = SI.store_blob tx (Representation.to_blob branch) in + Ok (new branch conn branch |> Protocols.Handle.make)) end diff --git a/lib/kernel/BranchManager.ml b/lib/kernel/BranchManager.ml index c1e4aef..016f75a 100644 --- a/lib/kernel/BranchManager.ml +++ b/lib/kernel/BranchManager.ml @@ -14,8 +14,11 @@ module Make (S : Abstract.Storage.STORAGE) = struct let root_for tx label = let open Utilities.Result in let* label = S.get tx (S.Label label) in - let label = Option.map Concepts.Hash.hash_of_blob label in - Ok label + let data = Option.map (fun blob -> Concepts.Blob.bytes_of_blob blob + |> Bytes.to_string + |> Concepts.Hash.of_raw_string) + label in + Ok data let persist_root tx label addr = let data = Concepts.Hash.blob_of_hash addr in -- cgit v1.2.3