diff --git a/brassaia/test/dune b/brassaia/test/dune index b326cd0db01f383497526002ef0c64c23b3d6f28..88240e30034936c2fd63e454e82417503f68ca7d 100644 --- a/brassaia/test/dune +++ b/brassaia/test/dune @@ -10,7 +10,7 @@ octez-libs.base octez-libs.base.unix octez-libs.brassaia_test_helpers - octez-libs.tezos-context-brassaia.disk + octez-shell-libs.context-ops octez-libs.stdlib-unix octez-libs.test-helpers tezt) diff --git a/devtools/testnet_experiment_tools/dune b/devtools/testnet_experiment_tools/dune index 6ea052d5570068e5cdae0108068573b9e8bdefb0..be336d5bd3aca4f04b91976583149456020fbb6e 100644 --- a/devtools/testnet_experiment_tools/dune +++ b/devtools/testnet_experiment_tools/dune @@ -39,7 +39,7 @@ octez-shell-libs.client-base-unix octez-shell-libs.store octez-shell-libs.store.shared - octez-libs.tezos-context + octez-shell-libs.context-ops octez-protocol-020-PsParisC-libs.baking octez-protocol-020-PsParisC-libs.client octez-protocol-020-PsParisC-libs.client.commands @@ -62,7 +62,7 @@ -open Tezos_client_base_unix -open Tezos_store -open Tezos_store_shared - -open Tezos_context) + -open Tezos_context_ops) (modules sigs tool_020_PsParisC tool_021_PsQuebec tool_alpha)) (executable diff --git a/manifest/product_octez.ml b/manifest/product_octez.ml index b99bf8215619ca68249cd377b096b1a69da42cb0..c9bcb3bc8ee12bf934263082bc2eda1be1ee80c8 100644 --- a/manifest/product_octez.ml +++ b/manifest/product_octez.ml @@ -2717,29 +2717,6 @@ let octez_context_disk = ] ~conflicts:[Conflicts.checkseum] -(* Should not be used directly in most cases, use context_ops abstraction instead *) -let octez_context_brassaia_disk = - octez_lib - "tezos-context-brassaia.disk" - ~path:"src/lib_context_brassaia/disk" - ~deps: - [ - octez_base |> open_ ~m:"TzPervasives"; - bigstringaf; - fmt; - brassaia; - brassaia_pack; - brassaia_pack_unix; - logs_fmt; - octez_stdlib_unix |> open_; - octez_stdlib |> open_; - octez_context_sigs; - octez_context_brassaia_helpers; - octez_context_brassaia_encoding; - octez_context_brassaia_memory |> open_; - ] - ~conflicts:[Conflicts.checkseum] - let _tree_encoding_tests = tezt ["test_proofs"; "test_encoding"] @@ -2759,20 +2736,6 @@ let _tree_encoding_tests = alcotezt; ] -let octez_context = - octez_lib - "tezos-context" - ~path:"src/lib_context" - ~synopsis:"On-disk context abstraction for [octez-node]" - ~deps:[octez_context_disk; octez_context_memory] - -let octez_context_brassaia = - octez_lib - "tezos-context-brassaia" - ~path:"src/lib_context_brassaia" - ~synopsis:"On-disk context abstraction for [octez-node] (brassaia)" - ~deps:[octez_context_brassaia_disk; octez_context_brassaia_memory] - let _octez_context_tests = tezt ["test_context"; "test_merkle_proof"; "tezt_main"] @@ -2825,23 +2788,6 @@ let _irmin_tests = tezt_lib |> open_ |> open_ ~m:"Base"; ] -let _brassaia_tests = - tezt - ["tezt_brassaia"; "test_lib_brassaia_store"; "test_utils"] - ~path:"brassaia/test" - ~opam:"tezos_internal_brassaia_tests" - ~synopsis:"Tezos internal brassaia tests" - ~deps: - [ - octez_base |> open_ ~m:"TzPervasives"; - octez_base_unix; - brassaia_test_helpers; - octez_context_brassaia_disk; - octez_stdlib_unix |> open_; - octez_test_helpers |> open_; - tezt_lib |> open_ |> open_ ~m:"Base"; - ] - let _irmin_data_tests = tezt ["test"; "import"; "test_fixed_size_string_set"] @@ -3262,48 +3208,6 @@ let octez_protocol_environment = octez_event_logging; ] -(* in general this library should not be used directly, context_ops should be - used instead *) -let octez_shell_context = - octez_shell_lib - "shell-context" - ~internal_name:"tezos_shell_context" - ~path:"src/lib_protocol_environment/shell_context" - ~deps: - [ - octez_base |> open_ ~m:"TzPervasives"; - octez_protocol_environment; - octez_context; - ] - -let octez_brassaia_context = - octez_shell_lib - "brassaia-context" - ~internal_name:"tezos_brassaia_context" - ~path:"src/lib_protocol_environment/brassaia_context" - ~deps: - [ - octez_base |> open_ ~m:"TzPervasives"; - octez_protocol_environment; - octez_context_brassaia; - ] - -let octez_duo_context_lib = - let (PPX {preprocess; preprocessor_deps}) = ppx_profiler in - octez_shell_lib - "duo-context-lib" - ~internal_name:"tezos_duo_context_lib" - ~path:"src/lib_protocol_environment/duo_context_lib" - ~preprocess - ~preprocessor_deps - ~deps: - [ - octez_base |> open_ ~m:"TzPervasives"; - octez_protocol_environment; - octez_context_brassaia; - octez_context; - ] - let _octez_protocol_environment_tests = tezt [ @@ -3327,6 +3231,85 @@ let _octez_protocol_environment_tests = ] let octez_context_ops = + let octez_context_brassaia_disk = + octez_lib + "tezos-context-brassaia.disk" + ~path:"src/lib_context_brassaia/disk" + ~deps: + [ + octez_base |> open_ ~m:"TzPervasives"; + bigstringaf; + fmt; + brassaia; + brassaia_pack; + brassaia_pack_unix; + logs_fmt; + octez_stdlib_unix |> open_; + octez_stdlib |> open_; + octez_context_sigs; + octez_context_brassaia_helpers; + octez_context_brassaia_encoding; + octez_context_brassaia_memory |> open_; + ] + ~conflicts:[Conflicts.checkseum] + in + let octez_context_brassaia = + (* Should not be used directly in most cases, use context_ops abstraction instead *) + octez_lib + "tezos-context-brassaia" + ~path:"src/lib_context_brassaia" + ~synopsis:"On-disk context abstraction for [octez-node] (brassaia)" + ~deps:[octez_context_brassaia_disk; octez_context_brassaia_memory] + in + let octez_brassaia_context = + octez_shell_lib + "brassaia-context" + ~internal_name:"tezos_brassaia_context" + ~path:"src/lib_protocol_environment/brassaia_context" + ~deps: + [ + octez_base |> open_ ~m:"TzPervasives"; + octez_protocol_environment; + octez_context_brassaia; + ] + in + let octez_context = + octez_lib + "tezos-context" + ~path:"src/lib_context" + ~synopsis:"On-disk context abstraction for [octez-node]" + ~deps:[octez_context_disk; octez_context_memory] + in + (* in general this library should not be used directly, context_ops should be + used instead *) + let octez_shell_context = + octez_shell_lib + "shell-context" + ~internal_name:"tezos_shell_context" + ~path:"src/lib_protocol_environment/shell_context" + ~deps: + [ + octez_base |> open_ ~m:"TzPervasives"; + octez_protocol_environment; + octez_context; + ] + in + let octez_duo_context_lib = + let (PPX {preprocess; preprocessor_deps}) = ppx_profiler in + octez_shell_lib + "duo-context-lib" + ~internal_name:"tezos_duo_context_lib" + ~path:"src/lib_protocol_environment/duo_context_lib" + ~preprocess + ~preprocessor_deps + ~deps: + [ + octez_base |> open_ ~m:"TzPervasives"; + octez_protocol_environment; + octez_context_brassaia; + octez_context; + ] + in let (PPX {preprocess; preprocessor_deps}) = ppx_profiler in octez_shell_lib "context-ops" @@ -3347,6 +3330,23 @@ let octez_context_ops = octez_duo_context_lib |> open_; ] +let _brassaia_tests = + tezt + ["tezt_brassaia"; "test_lib_brassaia_store"; "test_utils"] + ~path:"brassaia/test" + ~opam:"tezos_internal_brassaia_tests" + ~synopsis:"Tezos internal brassaia tests" + ~deps: + [ + octez_base |> open_ ~m:"TzPervasives"; + octez_base_unix; + brassaia_test_helpers; + octez_context_ops; + octez_stdlib_unix |> open_; + octez_test_helpers |> open_; + tezt_lib |> open_ |> open_ ~m:"Base"; + ] + let _octez_protocol_shell_context_tests = tezt ["test_proxy_context"] @@ -3354,7 +3354,7 @@ let _octez_protocol_shell_context_tests = ~opam:"octez-shell-libs" ~deps: [ - octez_shell_context; + octez_context_ops; alcotezt; octez_test_helpers |> open_; octez_base |> open_ ~m:"TzPervasives"; @@ -3523,7 +3523,7 @@ let octez_protocol_updater = octez_protocol_environment; octez_protocol_compiler_registerer; octez_protocol_compiler_native; - octez_context |> open_; + octez_context_ops |> open_; lwt_exit; dynlink; ] @@ -3649,7 +3649,7 @@ let octez_store_unix_snapshots = octez_stdlib_unix |> open_; octez_crypto |> open_; octez_shell_services |> open_; - octez_context |> open_; + octez_context_ops |> open_; octez_validation |> open_; octez_store_shared |> open_; octez_store_unix |> open_; @@ -4735,7 +4735,7 @@ let octez_node_config = octez_shell_services |> open_; octez_rpc_http |> open_; octez_rpc_http_server |> open_; - octez_context |> open_; + octez_context_ops |> open_; octez_store |> open_; octez_validation |> open_; ] @@ -6566,8 +6566,6 @@ let hash = Protocol.hash octez_client_commands |> open_; octez_stdlib |> open_; octez_stdlib_unix |> open_; - octez_shell_context |> if_ N.(number <= 020) |> open_; - octez_context |> open_; octez_context_memory |> if_ (N.(number >= 012) && N.(number <= 019)); octez_rpc_http_client_unix |> if_ N.(number >= 011); octez_rpc_http_client |> if_ N.(number >= 011) |> open_; @@ -7383,9 +7381,7 @@ let _octez_shell_tests = octez_base_test_helpers |> open_; octez_store |> open_; octez_store_shared |> open_; - octez_context |> open_; octez_context_ops |> open_; - octez_shell_context |> open_; octez_protocol_updater |> open_; octez_p2p |> open_; octez_p2p_services |> open_; @@ -7675,7 +7671,7 @@ let simulation_scenario_lib = octez_client_base_unix |> open_; octez_store |> open_; octez_store_shared |> open_; - octez_context |> open_; + octez_context_ops |> open_; ] @ List.flatten proto_deps) ~modules:("sigs" :: proto_tools) diff --git a/opam/tezos_internal_brassaia_tests.opam b/opam/tezos_internal_brassaia_tests.opam index 1920404dbcaf9c52d75fe99c70c869ca5d113d3f..fc14ba9f060e807b7dbd0e9faf4f4969b781f778 100644 --- a/opam/tezos_internal_brassaia_tests.opam +++ b/opam/tezos_internal_brassaia_tests.opam @@ -13,6 +13,7 @@ depends: [ "tezt" { with-test & >= "4.1.0" & < "5.0.0" } "bls12-381" {with-test} "octez-libs" {with-test} + "octez-shell-libs" {with-test} "octez-alcotezt" {with-test} "fpath" {with-test} "vector" {with-test} diff --git a/src/lib_node_config/dune b/src/lib_node_config/dune index 047410e8f4c67b646db990a24fae85dd1a5d01e2..dc46e71b0b63ad53703455e720c5035d2e567c01 100644 --- a/src/lib_node_config/dune +++ b/src/lib_node_config/dune @@ -12,7 +12,7 @@ octez-shell-libs.shell-services octez-libs.rpc-http octez-libs.rpc-http-server - octez-libs.tezos-context + octez-shell-libs.context-ops octez-shell-libs.store octez-shell-libs.validation) (flags @@ -24,6 +24,6 @@ -open Tezos_shell_services -open Tezos_rpc_http -open Tezos_rpc_http_server - -open Tezos_context + -open Tezos_context_ops -open Tezos_store -open Tezos_validation)) diff --git a/src/lib_protocol_environment/context_ops/context_ops.ml b/src/lib_protocol_environment/context_ops/context_ops.ml index 07de63d65c9680fc0e3bf92042967b4b52c70390..db029ef365290600f7a394e1522e3a055f230f25 100644 --- a/src/lib_protocol_environment/context_ops/context_ops.ml +++ b/src/lib_protocol_environment/context_ops/context_ops.ml @@ -64,6 +64,14 @@ let err_impl_mismatch ~got = ~expected:"shell, memory, brassaia or brassaia_memory" ~got +let irmin_dir = "context" + +let brassaia_dir = "brassaia_context" + +let irmin_context_dir root = Filename.(concat root irmin_dir) + +let brassaia_context_dir root = Filename.(concat root brassaia_dir) + let init ~kind ?patch_context ?readonly ?index_log_size path = let open Lwt_syntax in let init_context () = @@ -703,3 +711,62 @@ let compute_testchain_chain_id (context : Environment_context.t) block_hash = | Context {kind = Duo_memory_context.Context; _} -> Context_wrapper.Memory_context.compute_testchain_chain_id block_hash | Context t -> err_impl_mismatch ~got:t.impl_name + +let export_snapshot context_index context_hash ~path = + match context_index with + | Disk_index index -> Context.export_snapshot index context_hash ~path + | Memory_index index -> + Tezos_context_memory.Context.export_snapshot index context_hash ~path + | Brassaia_index index -> Brassaia.export_snapshot index context_hash ~path + | Brassaia_memory_index index -> + Brassaia_memory.export_snapshot index context_hash ~path + | Duo_index index -> + Context_wrapper.Context.export_snapshot index context_hash ~path + | Duo_memory_index index -> + Context_wrapper.Memory_context.export_snapshot index context_hash ~path + +let integrity_check ?ppf ~root ~auto_repair ~always ~heads context_index = + let open Lwt_syntax in + match context_index with + | Disk_index _ -> + Context.Checks.Pack.Integrity_check.run + ?ppf + ~root:(irmin_context_dir root) + ~auto_repair + ~always + ~heads + () + | Memory_index _ -> + Fmt.failwith + "An in memory context doesn't need to be checked for integrity" + | Brassaia_index _ -> + Brassaia.Checks.Pack.Integrity_check.run + ?ppf + ~root:(brassaia_context_dir root) + ~auto_repair + ~always + ~heads + () + | Brassaia_memory_index _ -> + Fmt.failwith + "An in memory context doesn't need to be checked for integrity" + | Duo_index _ -> + let* () = + Context.Checks.Pack.Integrity_check.run + ?ppf + ~root:(irmin_context_dir root) + ~auto_repair + ~always + ~heads + () + in + Brassaia.Checks.Pack.Integrity_check.run + ?ppf + ~root:(brassaia_context_dir root) + ~auto_repair + ~always + ~heads + () + | Duo_memory_index _ -> + Fmt.failwith + "An in memory context doesn't need to be checked for integrity" diff --git a/src/lib_protocol_environment/context_ops/context_ops.mli b/src/lib_protocol_environment/context_ops/context_ops.mli index d316594b640309e8d29000dfcbea6b049c2319c9..251ce5e06e548440b7d7fe08432345c033e10906 100644 --- a/src/lib_protocol_environment/context_ops/context_ops.mli +++ b/src/lib_protocol_environment/context_ops/context_ops.mli @@ -190,3 +190,14 @@ val exists : index -> Context_hash.t -> bool Lwt.t val close : index -> unit Lwt.t val compute_testchain_chain_id : t -> Block_hash.t -> Chain_id.t + +val export_snapshot : index -> Context_hash.t -> path:string -> unit Lwt.t + +val integrity_check : + ?ppf:Format.formatter -> + root:string -> + auto_repair:bool -> + always:bool -> + heads:string list option -> + index -> + unit Lwt.t diff --git a/src/lib_protocol_environment/duo_context_lib/context_wrapper.ml b/src/lib_protocol_environment/duo_context_lib/context_wrapper.ml index 4656d42d79622232bd8ee36463cfc6aeb7795b9d..089d81d4601e21c1e2f07d1e92e788ea490aa66f 100644 --- a/src/lib_protocol_environment/duo_context_lib/context_wrapper.ml +++ b/src/lib_protocol_environment/duo_context_lib/context_wrapper.ml @@ -1320,6 +1320,14 @@ struct "hash" block_hash1 + let export_snapshot : index -> Context_hash.t -> path:string -> unit Lwt.t = + fun index context_hash ~path -> + let open Lwt_syntax in + let* () = + Irmin_Context.export_snapshot index.irmin_index context_hash ~path + in + Brassaia_Context.export_snapshot index.brassaia_index context_hash ~path + let merkle_tree : t -> Proof.merkle_leaf_kind -> diff --git a/src/lib_protocol_environment/test_shell_context/dune b/src/lib_protocol_environment/test_shell_context/dune index da2f7d4c4fc8a408552697f1d28c0e58ef65b974..57ea9578a849ddc0b9d645a63dba49b9cb4d429b 100644 --- a/src/lib_protocol_environment/test_shell_context/dune +++ b/src/lib_protocol_environment/test_shell_context/dune @@ -7,7 +7,7 @@ (libraries tezt.core bls12-381.archive - octez-shell-libs.shell-context + octez-shell-libs.context-ops octez-alcotezt octez-libs.test-helpers octez-libs.base diff --git a/src/lib_protocol_updater/dune b/src/lib_protocol_updater/dune index ce9ec02cadfee5f7533cdaf970cfd76694da0822..ed4be641b5f560f6f6078ea60a805665caea67e0 100644 --- a/src/lib_protocol_updater/dune +++ b/src/lib_protocol_updater/dune @@ -13,7 +13,7 @@ octez-proto-libs.protocol-environment octez-protocol-compiler.registerer octez-protocol-compiler.native - octez-libs.tezos-context + octez-shell-libs.context-ops lwt-exit dynlink) (flags @@ -22,4 +22,4 @@ -open Tezos_stdlib_unix -open Tezos_micheline -open Tezos_shell_services - -open Tezos_context)) + -open Tezos_context_ops)) diff --git a/src/lib_shell/test/dune b/src/lib_shell/test/dune index 479f0be400c9354b4377408e6a94e9d8e7492ea6..67cb958959817a8833d40a664d7343a2a6c9fb45 100644 --- a/src/lib_shell/test/dune +++ b/src/lib_shell/test/dune @@ -12,9 +12,7 @@ octez-libs.base-test-helpers octez-shell-libs.store octez-shell-libs.store.shared - octez-libs.tezos-context octez-shell-libs.context-ops - octez-shell-libs.shell-context octez-shell-libs.protocol-updater octez-shell-libs.p2p octez-libs.tezos-p2p-services @@ -38,9 +36,7 @@ -open Tezos_base_test_helpers -open Tezos_store -open Tezos_store_shared - -open Tezos_context -open Tezos_context_ops - -open Tezos_shell_context -open Tezos_protocol_updater -open Tezos_p2p -open Tezos_p2p_services diff --git a/src/lib_shell/test/test_prevalidation.ml b/src/lib_shell/test/test_prevalidation.ml index 4744724708abae5a7bc2f9dc880ff1d17f468ed5..6497c49de1162a02007a5223be7ebf33dd6a9342 100644 --- a/src/lib_shell/test/test_prevalidation.ml +++ b/src/lib_shell/test/test_prevalidation.ml @@ -51,16 +51,15 @@ module Init = struct Lwt_utils_unix.with_tempdir "tezos_test_" (fun base_dir -> let open Lwt_result_syntax in let root = Filename.concat base_dir "context" in - let*! idx = Context.init root in + let*! idx = Context_ops.init ~kind:`Disk root in let* genesis = - Context.commit_genesis + Context_ops.commit_genesis idx ~chain_id ~time:Shell_test_helpers.genesis_time ~protocol:Shell_test_helpers.genesis_protocol_hash in - let*! v = Context.checkout_exn idx genesis in - let v = Tezos_shell_context.Shell_context.wrap_disk_context v in + let*! v = Context_ops.checkout_exn idx genesis in f v) let genesis_block ~timestamp ctxt = diff --git a/src/lib_store/unix/dune b/src/lib_store/unix/dune index 4c15ae27e83ada40ac77819bd83ac907b6e615b0..2108a8b3759b550c710f1a0288caa34844385887 100644 --- a/src/lib_store/unix/dune +++ b/src/lib_store/unix/dune @@ -88,7 +88,7 @@ octez-libs.stdlib-unix octez-libs.crypto octez-shell-libs.shell-services - octez-libs.tezos-context + octez-shell-libs.context-ops octez-shell-libs.validation octez-shell-libs.store.shared octez-shell-libs.store.unix) @@ -99,7 +99,7 @@ -open Tezos_stdlib_unix -open Tezos_crypto -open Tezos_shell_services - -open Tezos_context + -open Tezos_context_ops -open Tezos_validation -open Tezos_store_shared -open Tezos_store_unix) diff --git a/src/lib_store/unix/snapshots.ml b/src/lib_store/unix/snapshots.ml index 2af9ac3201f22aa2360b7e929fda94e19f177e35..c926069aba6346259980d0a13d7b2427fb5333cf 100644 --- a/src/lib_store/unix/snapshots.ml +++ b/src/lib_store/unix/snapshots.ml @@ -1459,7 +1459,7 @@ module type EXPORTER = sig unit Lwt.t val export_context : - t -> Context.index -> Context_hash.t -> unit tzresult Lwt.t + t -> Context_ops.index -> Context_hash.t -> unit tzresult Lwt.t val copy_cemented_block : t -> file:string -> start_level:int32 -> end_level:int32 -> unit Lwt.t @@ -1567,7 +1567,10 @@ module Raw_exporter : EXPORTER = struct Naming.(snapshot_context_file t.snapshot_tmp_dir |> file_path) in let*! () = - Context.export_snapshot context_index context_hash ~path:tmp_context_path + Context_ops.export_snapshot + context_index + context_hash + ~path:tmp_context_path in return_unit @@ -1813,7 +1816,10 @@ module Tar_exporter : EXPORTER = struct Naming.(snapshot_context_file t.snapshot_tmp_dir |> file_path) in let*! () = - Context.export_snapshot context_index context_hash ~path:tmp_context_path + Context_ops.export_snapshot + context_index + context_hash + ~path:tmp_context_path in let*! () = Onthefly.add_directory_and_finalize @@ -2457,8 +2463,10 @@ module Make_snapshot_exporter (Exporter : EXPORTER) : Snapshot_exporter = struct let export_context snapshot_exporter ~context_dir context_hash = let open Lwt_result_syntax in let*! () = Event.(emit exporting_context) () in - let*! context_index = Context.init ~readonly:true context_dir in - let is_gc_allowed = Context.is_gc_allowed context_index in + let*! context_index = + Context_ops.init ~kind:`Disk ~readonly:true context_dir + in + let is_gc_allowed = Context_ops.is_gc_allowed context_index in let* () = if not is_gc_allowed then tzfail Cannot_export_snapshot_format else @@ -2469,7 +2477,7 @@ module Make_snapshot_exporter (Exporter : EXPORTER) : Snapshot_exporter = struct Lwt.finalize (fun () -> Exporter.export_context snapshot_exporter context_index context_hash) - (fun () -> Context.close context_index) + (fun () -> Context_ops.close context_index) in let*! () = Event.(emit context_exported) () in return_unit @@ -3831,14 +3839,11 @@ module Make_snapshot_importer (Importer : IMPORTER) : Snapshot_importer = struct ~user_activated_protocol_overrides ~operation_metadata_size_limit = let open Lwt_result_syntax in let* predecessor_context = - let*! o = Context.checkout context_index imported_context_hash in + let*! o = Context_ops.checkout context_index imported_context_hash in match o with | Some ch -> return ch | None -> tzfail (Inconsistent_context imported_context_hash) in - let predecessor_context = - Tezos_shell_context.Shell_context.wrap_disk_context predecessor_context - in let apply_environment = { Block_validation.max_operations_ttl = @@ -3933,32 +3938,36 @@ module Make_snapshot_importer (Importer : IMPORTER) : Snapshot_importer = struct @@ fun () -> Importer.restore_context snapshot_importer ~dst_context_dir in let*! context_index = - Context.init + Context_ops.init + ~kind:`Disk ~readonly:false ~index_log_size:default_index_log_size ?patch_context dst_context_dir in let* genesis_ctxt_hash = - Context.commit_genesis + Context_ops.commit_genesis context_index ~chain_id ~time:genesis.Genesis.time ~protocol:genesis.protocol in + (* TODO: Temporary fix before the context_dir is never provided + outside of context_ops *) + let dst_context_dir = Filename.dirname dst_context_dir in let*! () = if check_consistency then Animation.three_dots ~progress_display_mode:Auto ~msg:"Checking context integrity" @@ fun () -> - Context.Checks.Pack.Integrity_check.run + Context_ops.integrity_check ?ppf:None ~root:dst_context_dir ~auto_repair:false ~always:false ~heads:(Some [Context_hash.to_b58check imported_context_hash]) - () + context_index else Lwt.return_unit in let* block_validation_result = @@ -3975,7 +3984,7 @@ module Make_snapshot_importer (Importer : IMPORTER) : Snapshot_importer = struct ~user_activated_protocol_overrides ~operation_metadata_size_limit in - let*! () = Context.close context_index in + let*! () = Context_ops.close context_index in return (genesis_ctxt_hash, block_validation_result) in let* () = @@ -4074,15 +4083,6 @@ module Make_snapshot_importer (Importer : IMPORTER) : Snapshot_importer = struct snapshot_path user_expected_block in - let patch_context = - Option.map - (fun f ctxt -> - let open Tezos_shell_context in - let ctxt = Shell_context.wrap_disk_context ctxt in - let+ ctxt = f ctxt in - Shell_context.unwrap_disk_context ctxt) - patch_context - in (* Restore protocols *) let* protocol_levels = restore_protocols snapshot_importer progress_display_mode diff --git a/src/proto_020_PsParisC/lib_delegate/abstract_context_index.ml b/src/proto_020_PsParisC/lib_delegate/abstract_context_index.ml index 2e54f32fdc1398787ea5bb20ca04aefeee2427b3..6dbf6c21d4b38371f36a5a7fd1fe5ae3abe568e8 100644 --- a/src/proto_020_PsParisC/lib_delegate/abstract_context_index.ml +++ b/src/proto_020_PsParisC/lib_delegate/abstract_context_index.ml @@ -32,7 +32,7 @@ type t = { let abstract index = { - sync_fun = (fun () -> Context.sync index); - checkout_fun = Shell_context.checkout index; - finalize_fun = (fun () -> Context.close index); + sync_fun = (fun () -> Context_ops.sync index); + checkout_fun = Context_ops.checkout index; + finalize_fun = (fun () -> Context_ops.close index); } diff --git a/src/proto_020_PsParisC/lib_delegate/abstract_context_index.mli b/src/proto_020_PsParisC/lib_delegate/abstract_context_index.mli index 5a280d04ac579a0d7f27272693335772133ed201..4e2f52596c68aec2a00d0c1e6b3a1f9787d0788d 100644 --- a/src/proto_020_PsParisC/lib_delegate/abstract_context_index.mli +++ b/src/proto_020_PsParisC/lib_delegate/abstract_context_index.mli @@ -30,4 +30,4 @@ type t = { finalize_fun : unit -> unit Lwt.t; } -val abstract : Context.index -> t +val abstract : Context_ops.index -> t diff --git a/src/proto_020_PsParisC/lib_delegate/baking_simulator.ml b/src/proto_020_PsParisC/lib_delegate/baking_simulator.ml index 4184b4033f0d023832c7c85e2e2c131d333e8aa5..84c09c7c5d271e95f7a35db355b4094f32cc501a 100644 --- a/src/proto_020_PsParisC/lib_delegate/baking_simulator.ml +++ b/src/proto_020_PsParisC/lib_delegate/baking_simulator.ml @@ -38,7 +38,7 @@ type incremental = { let load_context ~context_path = let open Lwt_result_syntax in protect (fun () -> - let*! index = Context.init ~readonly:true context_path in + let*! index = Context_ops.init ~kind:`Disk ~readonly:true context_path in return (Abstract_context_index.abstract index)) let check_context_consistency (abstract_index : Abstract_context_index.t) diff --git a/src/proto_020_PsParisC/lib_delegate/dune b/src/proto_020_PsParisC/lib_delegate/dune index 94241009fc07a2ad15472c3aafff013ffab13533..e28eeb9b3f49bf047fe6bd92d6525fc723702ea2 100644 --- a/src/proto_020_PsParisC/lib_delegate/dune +++ b/src/proto_020_PsParisC/lib_delegate/dune @@ -19,8 +19,6 @@ octez-shell-libs.client-commands octez-libs.stdlib octez-libs.stdlib-unix - octez-shell-libs.shell-context - octez-libs.tezos-context octez-libs.rpc-http-client-unix octez-libs.rpc-http-client octez-shell-libs.context-ops @@ -46,8 +44,6 @@ -open Tezos_client_commands -open Tezos_stdlib -open Tezos_stdlib_unix - -open Tezos_shell_context - -open Tezos_context -open Tezos_rpc_http_client -open Tezos_context_ops -open Tezos_rpc_http diff --git a/src/proto_021_PsQuebec/lib_delegate/dune b/src/proto_021_PsQuebec/lib_delegate/dune index 5c29a9f2c2750bc51f19dc415b38968d84e0300e..5325387cfb7a404c976d12546a79371d2c5b01d6 100644 --- a/src/proto_021_PsQuebec/lib_delegate/dune +++ b/src/proto_021_PsQuebec/lib_delegate/dune @@ -19,7 +19,6 @@ octez-shell-libs.client-commands octez-libs.stdlib octez-libs.stdlib-unix - octez-libs.tezos-context octez-libs.rpc-http-client-unix octez-libs.rpc-http-client octez-shell-libs.context-ops @@ -45,7 +44,6 @@ -open Tezos_client_commands -open Tezos_stdlib -open Tezos_stdlib_unix - -open Tezos_context -open Tezos_rpc_http_client -open Tezos_context_ops -open Tezos_rpc_http diff --git a/src/proto_alpha/lib_delegate/dune b/src/proto_alpha/lib_delegate/dune index dca3ff85f3faf9f0343c22a9057c026f50e264e1..770e5f4e8fa3df210a9c44911ce926900f77efb7 100644 --- a/src/proto_alpha/lib_delegate/dune +++ b/src/proto_alpha/lib_delegate/dune @@ -19,7 +19,6 @@ octez-shell-libs.client-commands octez-libs.stdlib octez-libs.stdlib-unix - octez-libs.tezos-context octez-libs.rpc-http-client-unix octez-libs.rpc-http-client octez-shell-libs.context-ops @@ -45,7 +44,6 @@ -open Tezos_client_commands -open Tezos_stdlib -open Tezos_stdlib_unix - -open Tezos_context -open Tezos_rpc_http_client -open Tezos_context_ops -open Tezos_rpc_http