From 1a7cf2fead914c18ca8f4707a415db193621ac05 Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Thu, 10 Jan 2019 17:04:23 +0100 Subject: [PATCH] proto_genesis: remove the dependency on proto_alpha --- .../lib_client/client_proto_main.ml | 14 +++++++++- src/proto_genesis/lib_client/dune | 3 +- src/proto_genesis/lib_client/proto_alpha.ml | 28 ------------------- .../lib_client/tezos-client-genesis.opam | 1 - 4 files changed, 14 insertions(+), 32 deletions(-) delete mode 100644 src/proto_genesis/lib_client/proto_alpha.ml diff --git a/src/proto_genesis/lib_client/client_proto_main.ml b/src/proto_genesis/lib_client/client_proto_main.ml index c854c6340..9924187ac 100644 --- a/src/proto_genesis/lib_client/client_proto_main.ml +++ b/src/proto_genesis/lib_client/client_proto_main.ml @@ -56,6 +56,18 @@ let file_parameter = else return p) +let fitness_from_int64 fitness = + (* definition taken from src/proto_alpha/lib_protocol/src/constants_repr.ml *) + let version_number = "\000" in + (* definitions taken from src/proto_alpha/lib_protocol/src/fitness_repr.ml *) + let int64_to_bytes i = + let b = MBytes.create 8 in + MBytes.set_int64 b 0 i; + b + in + [ MBytes.of_string version_number ; + int64_to_bytes fitness ] + let commands () = let open Clic in let args = @@ -87,7 +99,7 @@ let commands () = file_parameter @@ stop) begin fun timestamp hash fitness sk param_json_file (cctxt : Client_context.full) -> - let fitness = Proto_alpha.Fitness_repr.from_int64 fitness in + let fitness = fitness_from_int64 fitness in Tezos_stdlib_unix.Lwt_utils_unix.Json.read_file param_json_file >>=? fun json -> let protocol_parameters = Data_encoding.Binary.to_bytes_exn Data_encoding.json json in bake cctxt ?timestamp cctxt#block diff --git a/src/proto_genesis/lib_client/dune b/src/proto_genesis/lib_client/dune index 7ed212465..fd23c5039 100644 --- a/src/proto_genesis/lib_client/dune +++ b/src/proto_genesis/lib_client/dune @@ -6,8 +6,7 @@ tezos-client-base tezos-client-commands tezos-protocol-environment - tezos-protocol-genesis - tezos-protocol-alpha) + tezos-protocol-genesis) (library_flags (:standard -linkall)) (flags (:standard -w -9+27-30-32-40@8 -safe-string diff --git a/src/proto_genesis/lib_client/proto_alpha.ml b/src/proto_genesis/lib_client/proto_alpha.ml deleted file mode 100644 index ac9ab8485..000000000 --- a/src/proto_genesis/lib_client/proto_alpha.ml +++ /dev/null @@ -1,28 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) -(* *) -(*****************************************************************************) - -module Name = struct let name = "genesis-alpha" end -module Alpha_environment = Tezos_protocol_environment_faked.MakeV1(Name)() -include Tezos_protocol_alpha.Functor.Make(Alpha_environment) diff --git a/src/proto_genesis/lib_client/tezos-client-genesis.opam b/src/proto_genesis/lib_client/tezos-client-genesis.opam index 733703bd4..a7b8c64ce 100644 --- a/src/proto_genesis/lib_client/tezos-client-genesis.opam +++ b/src/proto_genesis/lib_client/tezos-client-genesis.opam @@ -15,7 +15,6 @@ depends: [ "tezos-client-commands" "tezos-protocol-environment" "tezos-protocol-genesis" - "tezos-protocol-alpha" ] build: [ [ "dune" "build" "-p" name "-j" jobs ]