From 579b88eda95c0924ed416b65d26c8f46403ed25b Mon Sep 17 00:00:00 2001 From: icristescu Date: Mon, 21 Mar 2022 21:45:46 +0100 Subject: [PATCH 1/4] lib_context: update to irmin.3.2.0 --- manifest/main.ml | 4 ++-- src/lib_context/encoding/context.ml | 10 +++++++++ src/lib_context/encoding/context_binary.ml | 2 ++ src/lib_context/helpers/context.ml | 26 ++-------------------- src/lib_context/tezos-context.opam | 4 ++-- 5 files changed, 18 insertions(+), 28 deletions(-) diff --git a/manifest/main.ml b/manifest/main.ml index 431ad22b4e89..d5a1fc3c0a49 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -144,10 +144,10 @@ let ipaddr = let ipaddr_unix = external_sublib ipaddr "ipaddr.unix" -let irmin = external_lib "irmin" V.(at_least "3.1.0" && less_than "3.2.0") +let irmin = external_lib "irmin" V.(at_least "3.2.0" && less_than "3.3.0") let irmin_pack = - external_lib "irmin-pack" V.(at_least "3.1.0" && less_than "3.2.0") + external_lib "irmin-pack" V.(at_least "3.2.0" && less_than "3.3.0") let irmin_pack_unix = external_sublib irmin_pack "irmin-pack.unix" diff --git a/src/lib_context/encoding/context.ml b/src/lib_context/encoding/context.ml index 0649bbf2f757..9463ecf42874 100644 --- a/src/lib_context/encoding/context.ml +++ b/src/lib_context/encoding/context.ml @@ -35,6 +35,8 @@ module Conf = struct let contents_length_header = Some `Varint let inode_child_order = `Seeded_hash + + let forbid_empty_dir_persistence = true end module Hash : sig @@ -54,6 +56,8 @@ end = struct let to_raw_string = H.to_raw_string + let unsafe_of_raw_string s = H.of_raw_string s + let of_context_hash s = H.of_raw_string (Context_hash.to_string s) let to_context_hash h = Context_hash.of_string_exn (H.to_raw_string h) @@ -75,6 +79,12 @@ end = struct let short_hash ?seed t = short_hash_string ?seed (H.to_raw_string t) + let hash_size = H.digest_size + + let short_hash_substring t ~off = + let str = Bigstringaf.substring t ~off ~len:hash_size in + short_hash_string str + let t : t Irmin.Type.t = Irmin.Type.map ~pp diff --git a/src/lib_context/encoding/context_binary.ml b/src/lib_context/encoding/context_binary.ml index ef76582cb150..d91777bbc4f4 100644 --- a/src/lib_context/encoding/context_binary.ml +++ b/src/lib_context/encoding/context_binary.ml @@ -35,4 +35,6 @@ module Conf = struct let inode_child_order = `Hash_bits let contents_length_header = Some `Varint + + let forbid_empty_dir_persistence = true end diff --git a/src/lib_context/helpers/context.ml b/src/lib_context/helpers/context.ml index 74a6a6b629bb..73e1b3cbc455 100644 --- a/src/lib_context/helpers/context.ml +++ b/src/lib_context/helpers/context.ml @@ -360,29 +360,9 @@ struct let+ (p, r) = Store.Tree.produce_proof repo key f in (Proof.to_tree p, r) - (* This is temporary until the release of irmin.3.2.0, see - https://github.com/mirage/irmin/issues/1790. *) - let specialise_error = function - | Ok r -> Lwt.return_ok r - | Error (`Msg error) -> - if - String.equal - error - "Bad_stream verify_stream: did not consume the full stream" - then Lwt.return_error (`Stream_too_long error) - else - let x = String.split ' ' error in - if - List.exists (String.equal "empty") x - && List.exists (String.equal "Bad_stream") x - then Lwt.return_error (`Stream_too_short error) - else Lwt.return_error (`Proof_mismatch error) - let verify_tree_proof proof f = - let open Lwt_syntax in let proof = Proof.of_tree proof in - let* result = Store.Tree.verify_proof proof f in - specialise_error result + Store.Tree.verify_proof proof f let produce_stream_proof repo key f = let open Lwt_syntax in @@ -393,10 +373,8 @@ struct (Proof.to_stream p, r) let verify_stream_proof proof f = - let open Lwt_syntax in let proof = Proof.of_stream proof in - let* result = Store.Tree.verify_stream proof f in - specialise_error result + Store.Tree.verify_stream proof f end type error += Unsupported_context_hash_version of Context_hash.Version.t diff --git a/src/lib_context/tezos-context.opam b/src/lib_context/tezos-context.opam index e46f110c5775..f65b6456cfaf 100644 --- a/src/lib_context/tezos-context.opam +++ b/src/lib_context/tezos-context.opam @@ -11,8 +11,8 @@ depends: [ "dune" { >= "2.9" } "tezos-base" "tezos-stdlib" - "irmin" { >= "3.1.0" & < "3.2.0" } - "irmin-pack" { >= "3.1.0" & < "3.2.0" } + "irmin" { >= "3.2.0" & < "3.3.0" } + "irmin-pack" { >= "3.2.0" & < "3.3.0" } "tezos-shell-services" "bigstringaf" { >= "0.2.0" } "fmt" { >= "0.8.7" } -- GitLab From b9e1159b005bb509fb86b947b54a13b2064a8a1d Mon Sep 17 00:00:00 2001 From: icristescu Date: Mon, 21 Mar 2022 21:46:12 +0100 Subject: [PATCH 2/4] proto_alpha: update to irmin.3.2.0 --- .../bin_sc_rollup_node/tezos-sc-rollup-node-alpha.opam | 4 ++-- .../lib_protocol/test/helpers/tx_rollup_l2_helpers.ml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/bin_sc_rollup_node/tezos-sc-rollup-node-alpha.opam b/src/proto_alpha/bin_sc_rollup_node/tezos-sc-rollup-node-alpha.opam index 192e3d826257..e0bf8c7b7447 100644 --- a/src/proto_alpha/bin_sc_rollup_node/tezos-sc-rollup-node-alpha.opam +++ b/src/proto_alpha/bin_sc_rollup_node/tezos-sc-rollup-node-alpha.opam @@ -25,8 +25,8 @@ depends: [ "tezos-shell-services" "tezos-sc-rollup-alpha" "data-encoding" { >= "0.5.3" & < "0.6" } - "irmin-pack" { >= "3.1.0" & < "3.2.0" } - "irmin" { >= "3.1.0" & < "3.2.0" } + "irmin-pack" { >= "3.2.0" & < "3.3.0" } + "irmin" { >= "3.2.0" & < "3.3.0" } "ringo" { = "0.8" } "ringo-lwt" { = "0.8" } ] diff --git a/src/proto_alpha/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml index 611a99257ef9..6fe05f06e1a0 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml @@ -38,6 +38,8 @@ module Store = struct let inode_child_order = `Seeded_hash let contents_length_header = None + + let forbid_empty_dir_persistence = true end open Irmin_pack_mem.Maker (Conf) -- GitLab From b2ac4f39aea4b57f35618fd3231b37708ecac101 Mon Sep 17 00:00:00 2001 From: icristescu Date: Tue, 29 Mar 2022 17:51:38 +0200 Subject: [PATCH 3/4] lib_store: update to irmin.3.2.0 --- src/lib_store/tezos-store.opam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib_store/tezos-store.opam b/src/lib_store/tezos-store.opam index 1f2350d1bdcb..05372a349caa 100644 --- a/src/lib_store/tezos-store.opam +++ b/src/lib_store/tezos-store.opam @@ -13,7 +13,7 @@ depends: [ "tezos-base" "tezos-version" "index" { >= "1.6.0" & < "1.7.0" } - "irmin-pack" { >= "3.1.0" & < "3.2.0" } + "irmin-pack" { >= "3.2.0" & < "3.3.0" } "tezos-context" "tezos-validation" "tezos-protocol-updater" -- GitLab From e8d4074aa8e3fea3b2505a762012973f104aaca2 Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Tue, 5 Apr 2022 09:33:42 +0200 Subject: [PATCH 4/4] Build: update tezos/opam-repository ref commit --- .gitlab/ci/templates.yml | 2 +- scripts/version.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab/ci/templates.yml b/.gitlab/ci/templates.yml index b8ab51d7e94f..18ec643d8632 100644 --- a/.gitlab/ci/templates.yml +++ b/.gitlab/ci/templates.yml @@ -1,6 +1,6 @@ variables: ## This value MUST be the same as `opam_repository_tag` in `scripts/version.sh` - build_deps_image_version: c8a5db8c3707dd671be8c0f5b000f463b032d022 + build_deps_image_version: 29a6599583f528867fc9af6c9bf3e888b3ed46a5 build_deps_image_name: registry.gitlab.com/tezos/opam-repository GIT_STRATEGY: fetch GIT_DEPTH: "1" diff --git a/scripts/version.sh b/scripts/version.sh index 4fee55327e7a..9cc24abbeca1 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -20,12 +20,12 @@ export recommended_node_version=14.12.0 ## full_opam_repository is a commit hash of the public OPAM repository, i.e. ## https://github.com/ocaml/opam-repository -export full_opam_repository_tag=8beae05aa76907a8ad832633c7f9a43d7d4ff2f9 +export full_opam_repository_tag=cb33a152429f2129849d61ea57eff998f6b25411 ## opam_repository is an additional, tezos-specific opam repository. ## This value MUST be the same as `build_deps_image_version` in `.gitlab/ci/templates.yml export opam_repository_url=https://gitlab.com/tezos/opam-repository -export opam_repository_tag=c8a5db8c3707dd671be8c0f5b000f463b032d022 +export opam_repository_tag=29a6599583f528867fc9af6c9bf3e888b3ed46a5 export opam_repository_git=$opam_repository_url.git export opam_repository=$opam_repository_git\#$opam_repository_tag -- GitLab