diff --git a/Makefile b/Makefile index d7447efb7..e780ca95c 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,10 @@ all: @cp _build/default/src/bin_client/admin_main.exe tezos-admin-client @cp _build/default/src/lib_protocol_compiler/main.exe tezos-protocol-compiler +%.pkg: + @jbuilder build --dev $(patsubst %.opam,%.install, \ + $(shell find -name tezos-$*.opam)) + doc-html: @jbuilder build @doc ${DEV} @mkdir -p $$(pwd)/docs/_build/api/odoc @@ -40,3 +44,4 @@ clean: @-make -C docs clean .PHONY: all test build-deps docker-image clean + diff --git a/src/lib_base/protocol_environment.ml b/src/lib_base/protocol_environment.ml new file mode 100644 index 000000000..15a6f6a58 --- /dev/null +++ b/src/lib_base/protocol_environment.ml @@ -0,0 +1,104 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2017. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +open Error_monad + +module Make(Param : sig val name: string end)() = struct + + include Pervasives + module Pervasives = Pervasives + module Compare = Compare + module Array = Array + module List = List + module Bytes = struct + include Bytes + include EndianBytes.BigEndian + module LE = EndianBytes.LittleEndian + end + module String = struct + include String + include EndianString.BigEndian + module LE = EndianString.LittleEndian + end + module Set = Set + module Map = Map + module Int32 = Int32 + module Int64 = Int64 + module Nativeint = Nativeint + module Buffer = Buffer + module Format = Format + module Z = Z + module Lwt_sequence = Lwt_sequence + module Lwt = Lwt + module Lwt_list = Lwt_list + module MBytes = MBytes + module Uri = Uri + module Data_encoding = Data_encoding + module Time = Time + module Ed25519 = Ed25519 + module Hash = struct + include Tezos_crypto + include Tezos_crypto.S + module Net_id = Net_id + module Block_hash = Block_hash + module Operation_hash = Operation_hash + module Operation_list_hash = Operation_list_hash + module Operation_list_list_hash = Operation_list_list_hash + module Context_hash = Context_hash + module Protocol_hash = Protocol_hash + module Make_minimal_Blake2B = Blake2B.Make_minimal + module Make_Blake2B = Blake2B.Make + end + module Blake2B = Blake2B + module Tezos_data = struct + module type DATA = S.T + module type HASHABLE_DATA = S.HASHABLE + module Fitness = Fitness + module Operation = Operation + module Block_header = Block_header + module Protocol = Protocol + end + module RPC_arg = RPC_arg + module RPC_path = RPC_path + module RPC_query = RPC_query + module RPC_service = RPC_service + module RPC_answer = RPC_answer + module RPC_directory = RPC_directory + module Fitness = Fitness + module Error_monad = struct + type error_category = [ `Branch | `Temporary | `Permanent ] + include Error_monad.Make() + end + module Logging = Logging.Make(Param) + + type error += Ecoproto_error of Error_monad.error list + + let () = + let id = Format.asprintf "Ecoproto.%s" Param.name in + register_wrapped_error_kind + (fun ecoerrors -> Error_monad.classify_errors ecoerrors) + ~id ~title:"Error returned by the protocol" + ~description:"Wrapped error for the economic protocol." + ~pp:(fun ppf -> + Format.fprintf ppf + "@[Economic error:@ %a@]" + (Format.pp_print_list Error_monad.pp)) + Data_encoding.(obj1 (req "ecoproto" + (list Error_monad.error_encoding))) + (function Ecoproto_error ecoerrors -> Some ecoerrors + | _ -> None ) + (function ecoerrors -> Ecoproto_error ecoerrors) + + let wrap_error = function + | Ok _ as ok -> ok + | Error errors -> Error [Ecoproto_error errors] + + module Option = Option + +end diff --git a/src/lib_client_base/jbuild b/src/lib_client_base/jbuild index 066301e2d..c9c070d37 100644 --- a/src/lib_client_base/jbuild +++ b/src/lib_client_base/jbuild @@ -5,17 +5,12 @@ (public_name tezos-client-base) (libraries (tezos-base tezos-shell-services - tezos-storage - tezos-rpc-http - tezos-protocol-updater - tezos-protocol-compiler)) + tezos-rpc-http)) (flags (:standard -w -9+27-30-32-40@8 -safe-string -open Tezos_base__TzPervasives - -open Tezos_storage -open Tezos_rpc_http - -open Tezos_shell_services - -open Tezos_protocol_updater)))) + -open Tezos_shell_services)))) (alias ((name runtest_indent) diff --git a/src/lib_client_environment/environment.ml b/src/lib_client_environment/environment.ml new file mode 100644 index 000000000..3279ef8bf --- /dev/null +++ b/src/lib_client_environment/environment.ml @@ -0,0 +1,34 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2017. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +module Make(Param : sig val name: string end)() = struct + + include Tezos_base.Protocol_environment.Make(Param)() + + module Micheline = Micheline + module Updater = struct + include Fake_updater.Make(Fake_context) + module type PROTOCOL = + RAW_PROTOCOL with type error := Error_monad.error + and type 'a tzresult := 'a Error_monad.tzresult + end + module Base58 = struct + include Base58 + let simple_encode enc s = simple_encode enc s + let simple_decode enc s = simple_decode enc s + include Make(struct type context = Fake_context.t end) + let decode s = decode s + end + module Context = struct + include Fake_context + let register_resolver = Base58.register_resolver + let complete ctxt s = Base58.complete ctxt s + end + +end diff --git a/src/lib_client_environment/fake_context.ml b/src/lib_client_environment/fake_context.ml new file mode 100644 index 000000000..88f5a6a8c --- /dev/null +++ b/src/lib_client_environment/fake_context.ml @@ -0,0 +1,24 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2017. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +type t + +type key = string list +type value = MBytes.t +let mem _ _ = assert false +let dir_mem _ _ = assert false +let get _ _ = assert false +let set _ _ _ = assert false +let del _ _ = assert false +let remove_rec _ _ = assert false +let fold _ _ ~init:_ ~f:_ = assert false +let keys _ _ = assert false +let fold_keys _ _ ~init:_ ~f:_ = assert false +let register_resolver _ _ = () +let complete _ _ = assert false diff --git a/src/lib_client_environment/fake_updater.ml b/src/lib_client_environment/fake_updater.ml new file mode 100644 index 000000000..31a3d635b --- /dev/null +++ b/src/lib_client_environment/fake_updater.ml @@ -0,0 +1,72 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2017. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +module Make(Context : sig type t end) = struct + + type validation_result = { + context: Context.t ; + fitness: Fitness.t ; + message: string option ; + max_operation_data_length: int ; + max_number_of_operations: int list ; + max_operations_ttl: int ; + } + + type rpc_context = { + block_hash: Block_hash.t ; + block_header: Block_header.t ; + operation_hashes: unit -> Operation_hash.t list list Lwt.t ; + operations: unit -> Operation.t list list Lwt.t ; + context: Context.t ; + } + + module type RAW_PROTOCOL = sig + type error = .. + type 'a tzresult = ('a, error list) result + val max_block_length: int + type operation + val parse_operation: + Operation_hash.t -> Operation.t -> operation tzresult + val compare_operations: operation -> operation -> int + type validation_state + val current_context: validation_state -> Context.t tzresult Lwt.t + val precheck_block: + ancestor_context: Context.t -> + ancestor_timestamp: Time.t -> + Block_header.t -> + unit tzresult Lwt.t + val begin_application: + predecessor_context: Context.t -> + predecessor_timestamp: Time.t -> + predecessor_fitness: Fitness.t -> + Block_header.t -> + validation_state tzresult Lwt.t + val begin_construction: + predecessor_context: Context.t -> + predecessor_timestamp: Time.t -> + predecessor_level: Int32.t -> + predecessor_fitness: Fitness.t -> + predecessor: Block_hash.t -> + timestamp: Time.t -> + ?proto_header: MBytes.t -> + unit -> validation_state tzresult Lwt.t + val apply_operation: + validation_state -> operation -> validation_state tzresult Lwt.t + val finalize_block: + validation_state -> validation_result tzresult Lwt.t + val rpc_services: rpc_context RPC_directory.t + val configure_sandbox: + Context.t -> Data_encoding.json option -> Context.t tzresult Lwt.t + end + + let compile _ _ = assert false + let activate _ _ = assert false + let fork_test_network _ ~protocol:_ ~expiration:_ = assert false + +end diff --git a/src/lib_client_environment/jbuild b/src/lib_client_environment/jbuild new file mode 100644 index 000000000..846c512b7 --- /dev/null +++ b/src/lib_client_environment/jbuild @@ -0,0 +1,17 @@ +(jbuild_version 1) + +(library + ((name tezos_client_environment) + (public_name tezos-client-environment) + (libraries (tezos-base + tezos-protocol-environment-sigs + tezos-micheline)) + (flags (:standard -w -9+27-30-32-40@8 + -safe-string + -open Tezos_base__TzPervasives + -open Tezos_micheline)))) + +(alias + ((name runtest_indent) + (deps ((glob_files *.ml) (glob_files *.mli))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_client_environment/tezos-client-environment.opam b/src/lib_client_environment/tezos-client-environment.opam new file mode 100644 index 000000000..6d795dd44 --- /dev/null +++ b/src/lib_client_environment/tezos-client-environment.opam @@ -0,0 +1,20 @@ +opam-version: "1.2" +version: "dev" +maintainer: "contact@tezos.com" +authors: [ "Tezos devteam" ] +homepage: "https://www.tezos.com/" +bug-reports: "https://gitlab.com/tezos/tezos/issues" +dev-repo: "https://gitlab.com/tezos/tezos.git" +license: "unreleased" +depends: [ + "ocamlfind" { build } + "jbuilder" { build & >= "1.0+beta15" } + "tezos-base" + "tezos-micheline" +] +build: [ + [ "jbuilder" "build" "-p" name "-j" jobs ] +] +build-test: [ + [ "jbuilder" "runtest" "-p" name "-j" jobs ] +] diff --git a/src/lib_protocol_updater/tezos_protocol_environment.ml b/src/lib_protocol_updater/tezos_protocol_environment.ml index e07130166..68066766a 100644 --- a/src/lib_protocol_updater/tezos_protocol_environment.ml +++ b/src/lib_protocol_updater/tezos_protocol_environment.ml @@ -9,78 +9,15 @@ module Make(Param : sig val name: string end)() = struct - include Pervasives - module Pervasives = Pervasives - module Compare = Compare - module Array = Array - module List = List - module Bytes = struct - include Bytes - include EndianBytes.BigEndian - module LE = EndianBytes.LittleEndian - end - module String = struct - include String - include EndianString.BigEndian - module LE = EndianString.LittleEndian - end - module Set = Set - module Map = Map - module Int32 = Int32 - module Int64 = Int64 - module Nativeint = Nativeint - module Buffer = Buffer - module Format = Format - module Z = Z - module Lwt_sequence = Lwt_sequence - module Lwt = Lwt - module Lwt_list = Lwt_list - module MBytes = MBytes - module Uri = Uri - module Data_encoding = Data_encoding - module Time = Time - module Ed25519 = Ed25519 - module Hash = struct - include Tezos_crypto - include Tezos_crypto.S - module Net_id = Net_id - module Block_hash = Block_hash - module Operation_hash = Operation_hash - module Operation_list_hash = Operation_list_hash - module Operation_list_list_hash = Operation_list_list_hash - module Context_hash = Context_hash - module Protocol_hash = Protocol_hash - module Make_minimal_Blake2B = Blake2B.Make_minimal - module Make_Blake2B = Blake2B.Make - end - module Blake2B = Blake2B - module Tezos_data = struct - module type DATA = Tezos_base.S.T - module type HASHABLE_DATA = Tezos_base.S.HASHABLE - module Fitness = Fitness - module Operation = Operation - module Block_header = Block_header - module Protocol = Protocol - end - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service - module RPC_answer = RPC_answer - module RPC_directory = RPC_directory + include Tezos_base.Protocol_environment.Make(Param)() + module Micheline = Micheline - module Fitness = Fitness - module Error_monad = struct - type error_category = [ `Branch | `Temporary | `Permanent ] - include Error_monad.Make() - end module Updater = struct include Updater module type PROTOCOL = RAW_PROTOCOL with type error := Error_monad.error and type 'a tzresult := 'a Error_monad.tzresult end - module Logging = Logging.Make(Param) module Base58 = struct include Base58 let simple_encode enc s = simple_encode enc s @@ -94,28 +31,4 @@ module Make(Param : sig val name: string end)() = struct let complete ctxt s = Base58.complete ctxt s end - type error += Ecoproto_error of Error_monad.error list - - let () = - let id = Format.asprintf "Ecoproto.%s" Param.name in - register_wrapped_error_kind - (fun ecoerrors -> Error_monad.classify_errors ecoerrors) - ~id ~title:"Error returned by the protocol" - ~description:"Wrapped error for the economic protocol." - ~pp:(fun ppf -> - Format.fprintf ppf - "@[Economic error:@ %a@]" - (Format.pp_print_list Error_monad.pp)) - Data_encoding.(obj1 (req "ecoproto" - (list Error_monad.error_encoding))) - (function Ecoproto_error ecoerrors -> Some ecoerrors - | _ -> None ) - (function ecoerrors -> Ecoproto_error ecoerrors) - - let wrap_error = function - | Ok _ as ok -> ok - | Error errors -> Error [Ecoproto_error errors] - - module Option = Option - end diff --git a/src/proto_alpha/lib_client_alpha/client_baking_blocks.ml b/src/proto_alpha/lib_client_alpha/client_baking_blocks.ml index 1c697e752..e0b6f1ab7 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_blocks.ml +++ b/src/proto_alpha/lib_client_alpha/client_baking_blocks.ml @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + type block_info = { hash: Block_hash.t ; net_id: Net_id.t ; diff --git a/src/proto_alpha/lib_client_alpha/client_baking_blocks.mli b/src/proto_alpha/lib_client_alpha/client_baking_blocks.mli index db499e69a..b96390f53 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_blocks.mli +++ b/src/proto_alpha/lib_client_alpha/client_baking_blocks.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + type block_info = { hash: Block_hash.t ; net_id: Net_id.t ; diff --git a/src/proto_alpha/lib_client_alpha/client_baking_daemon.mli b/src/proto_alpha/lib_client_alpha/client_baking_daemon.mli index 7c6277ae4..2c4c9109b 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_daemon.mli +++ b/src/proto_alpha/lib_client_alpha/client_baking_daemon.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + val run: Client_commands.full_context -> ?max_priority: int -> diff --git a/src/proto_alpha/lib_client_alpha/client_baking_endorsement.ml b/src/proto_alpha/lib_client_alpha/client_baking_endorsement.ml index 416080470..abe28f2dc 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_endorsement.ml +++ b/src/proto_alpha/lib_client_alpha/client_baking_endorsement.ml @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + open Logging.Client.Endorsement module State : sig diff --git a/src/proto_alpha/lib_client_alpha/client_baking_endorsement.mli b/src/proto_alpha/lib_client_alpha/client_baking_endorsement.mli index 3d6089a7c..2b436c503 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_endorsement.mli +++ b/src/proto_alpha/lib_client_alpha/client_baking_endorsement.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + val forge_endorsement: Client_commands.full_context -> Client_proto_rpcs.block -> diff --git a/src/proto_alpha/lib_client_alpha/client_baking_forge.ml b/src/proto_alpha/lib_client_alpha/client_baking_forge.ml index 9c9a32c81..34937cd25 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_forge.ml +++ b/src/proto_alpha/lib_client_alpha/client_baking_forge.ml @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + open Logging.Client.Baking let generate_proof_of_work_nonce () = diff --git a/src/proto_alpha/lib_client_alpha/client_baking_forge.mli b/src/proto_alpha/lib_client_alpha/client_baking_forge.mli index edc2c7837..fcb2a25e4 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_forge.mli +++ b/src/proto_alpha/lib_client_alpha/client_baking_forge.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + val generate_seed_nonce: unit -> Nonce.t (** [generate_seed_nonce ()] is a random nonce that is typically used in block headers. When baking, bakers generate random nonces whose diff --git a/src/proto_alpha/lib_client_alpha/client_baking_lib.ml b/src/proto_alpha/lib_client_alpha/client_baking_lib.ml index e85af57bc..6c1806692 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_lib.ml +++ b/src/proto_alpha/lib_client_alpha/client_baking_lib.ml @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + let bake_block (cctxt : Client_commands.full_context) block ?force ?max_priority ?(free_baking=false) ?src_sk delegate = begin diff --git a/src/proto_alpha/lib_client_alpha/client_baking_lib.mli b/src/proto_alpha/lib_client_alpha/client_baking_lib.mli index f4dcffb2b..4e28fd023 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_lib.mli +++ b/src/proto_alpha/lib_client_alpha/client_baking_lib.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + (** Mine a block *) val bake_block: Client_commands.full_context -> @@ -48,7 +51,7 @@ val run_daemon: Client_commands.full_context -> ?max_priority:int -> endorsement_delay:int -> - ('a * Tezos_embedded_raw_protocol_alpha.Tezos_context.public_key_hash) list -> + ('a * public_key_hash) list -> endorsement:bool -> baking:bool -> denunciation:bool -> diff --git a/src/proto_alpha/lib_client_alpha/client_baking_operations.ml b/src/proto_alpha/lib_client_alpha/client_baking_operations.ml index 4320a5fe0..02307959b 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_operations.ml +++ b/src/proto_alpha/lib_client_alpha/client_baking_operations.ml @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + type operation = { hash: Operation_hash.t ; content: Operation.t option diff --git a/src/proto_alpha/lib_client_alpha/client_baking_operations.mli b/src/proto_alpha/lib_client_alpha/client_baking_operations.mli index e1aa91f09..605e95cb9 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_operations.mli +++ b/src/proto_alpha/lib_client_alpha/client_baking_operations.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + type operation = { hash: Operation_hash.t ; content: Operation.t option ; diff --git a/src/proto_alpha/lib_client_alpha/client_baking_revelation.ml b/src/proto_alpha/lib_client_alpha/client_baking_revelation.ml index e9421da3f..ca977f40d 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_revelation.ml +++ b/src/proto_alpha/lib_client_alpha/client_baking_revelation.ml @@ -7,6 +7,7 @@ (* *) (**************************************************************************) +open Proto_alpha open Tezos_context let inject_seed_nonce_revelation rpc_config block ?async nonces = diff --git a/src/proto_alpha/lib_client_alpha/client_baking_revelation.mli b/src/proto_alpha/lib_client_alpha/client_baking_revelation.mli index a11990629..ad8e70871 100644 --- a/src/proto_alpha/lib_client_alpha/client_baking_revelation.mli +++ b/src/proto_alpha/lib_client_alpha/client_baking_revelation.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + val inject_seed_nonce_revelation: #Client_rpcs.ctxt -> Client_proto_rpcs.block -> diff --git a/src/proto_alpha/lib_client_alpha/client_proto_args.ml b/src/proto_alpha/lib_client_alpha/client_proto_args.ml index 54e9863ff..03bd57efd 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_args.ml +++ b/src/proto_alpha/lib_client_alpha/client_proto_args.ml @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context open Cli_entries type error += Bad_tez_arg of string * string (* Arg_name * value *) diff --git a/src/proto_alpha/lib_client_alpha/client_proto_args.mli b/src/proto_alpha/lib_client_alpha/client_proto_args.mli index 8182b9b58..4bebca379 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_args.mli +++ b/src/proto_alpha/lib_client_alpha/client_proto_args.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + val tez_sym: string open Cli_entries diff --git a/src/proto_alpha/lib_client_alpha/client_proto_context.ml b/src/proto_alpha/lib_client_alpha/client_proto_context.ml index 36a04aa60..83b7c8b2c 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_context.ml +++ b/src/proto_alpha/lib_client_alpha/client_proto_context.ml @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context open Tezos_micheline open Client_proto_contracts open Client_keys diff --git a/src/proto_alpha/lib_client_alpha/client_proto_context.mli b/src/proto_alpha/lib_client_alpha/client_proto_context.mli index a4c331d20..1db1ef725 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_context.mli +++ b/src/proto_alpha/lib_client_alpha/client_proto_context.mli @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context open Environment val list_contract_labels : diff --git a/src/proto_alpha/lib_client_alpha/client_proto_context_commands.ml b/src/proto_alpha/lib_client_alpha/client_proto_context_commands.ml index bd595dbd3..c2e2a849c 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_context_commands.ml +++ b/src/proto_alpha/lib_client_alpha/client_proto_context_commands.ml @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context open Tezos_micheline open Client_proto_context open Client_proto_contracts diff --git a/src/proto_alpha/lib_client_alpha/client_proto_contracts.ml b/src/proto_alpha/lib_client_alpha/client_proto_contracts.ml index 6bee4e755..c509982ed 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_contracts.ml +++ b/src/proto_alpha/lib_client_alpha/client_proto_contracts.ml @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + module ContractEntity = struct type t = Contract.t let encoding = Contract.encoding diff --git a/src/proto_alpha/lib_client_alpha/client_proto_contracts.mli b/src/proto_alpha/lib_client_alpha/client_proto_contracts.mli index 97b0db443..bfbbd7968 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_contracts.mli +++ b/src/proto_alpha/lib_client_alpha/client_proto_contracts.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + module RawContractAlias : Client_aliases.Alias with type t = Contract.t diff --git a/src/proto_alpha/lib_client_alpha/client_proto_contracts_commands.ml b/src/proto_alpha/lib_client_alpha/client_proto_contracts_commands.ml index 0d0c64573..021b9cb6f 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_contracts_commands.ml +++ b/src/proto_alpha/lib_client_alpha/client_proto_contracts_commands.ml @@ -1,3 +1,14 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2017. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +open Proto_alpha +open Tezos_context open Client_proto_contracts let group = diff --git a/src/proto_alpha/lib_client_alpha/client_proto_nonces.ml b/src/proto_alpha/lib_client_alpha/client_proto_nonces.ml index c6d9fbb38..5b5cdaf1b 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_nonces.ml +++ b/src/proto_alpha/lib_client_alpha/client_proto_nonces.ml @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + (* TODO locking... *) type t = (Block_hash.t * Nonce.t) list diff --git a/src/proto_alpha/lib_client_alpha/client_proto_nonces.mli b/src/proto_alpha/lib_client_alpha/client_proto_nonces.mli index 738c3b47d..9e35073a7 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_nonces.mli +++ b/src/proto_alpha/lib_client_alpha/client_proto_nonces.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + val mem: #Client_commands.wallet -> Block_hash.t -> bool tzresult Lwt.t diff --git a/src/proto_alpha/lib_client_alpha/client_proto_programs.ml b/src/proto_alpha/lib_client_alpha/client_proto_programs.ml index af23b3ee6..c292a1112 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_programs.ml +++ b/src/proto_alpha/lib_client_alpha/client_proto_programs.ml @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context open Tezos_micheline open Michelson_v1_printer diff --git a/src/proto_alpha/lib_client_alpha/client_proto_programs.mli b/src/proto_alpha/lib_client_alpha/client_proto_programs.mli index 14e531329..2055efdd0 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_programs.mli +++ b/src/proto_alpha/lib_client_alpha/client_proto_programs.mli @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context open Tezos_micheline module Program : Client_aliases.Alias diff --git a/src/proto_alpha/lib_client_alpha/client_proto_rpcs.ml b/src/proto_alpha/lib_client_alpha/client_proto_rpcs.ml index e8d839589..e7eeba941 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_rpcs.ml +++ b/src/proto_alpha/lib_client_alpha/client_proto_rpcs.ml @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + let string_of_errors exns = Format.asprintf " @[%a@]" pp_print_error exns diff --git a/src/proto_alpha/lib_client_alpha/client_proto_rpcs.mli b/src/proto_alpha/lib_client_alpha/client_proto_rpcs.mli index 270325520..7bbd73d59 100644 --- a/src/proto_alpha/lib_client_alpha/client_proto_rpcs.mli +++ b/src/proto_alpha/lib_client_alpha/client_proto_rpcs.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + val string_of_errors: error list -> string val handle_error: Client_commands.full_context -> 'a tzresult -> 'a Lwt.t diff --git a/src/proto_alpha/lib_client_alpha/jbuild b/src/proto_alpha/lib_client_alpha/jbuild index f756d5002..43d64d56a 100644 --- a/src/proto_alpha/lib_client_alpha/jbuild +++ b/src/proto_alpha/lib_client_alpha/jbuild @@ -4,19 +4,16 @@ ((name tezos_embedded_client_alpha) (public_name tezos-embedded-client-alpha) (libraries (tezos-base - tezos-embedded-protocol-alpha - tezos-embedded-protocol-alpha.raw + tezos-protocol-alpha + tezos-client-environment tezos-shell-services tezos-client-base)) (library_flags (:standard -linkall)) (flags (:standard -w -9+27-30-32-40@8 -safe-string -open Tezos_base__TzPervasives - -open Tezos_embedded_protocol_environment_alpha - -open Tezos_embedded_raw_protocol_alpha -open Tezos_shell_services - -open Tezos_client_base - -open Tezos_context)))) + -open Tezos_client_base)))) (alias ((name runtest_indent) diff --git a/src/proto_alpha/lib_client_alpha/michelson_v1_emacs.ml b/src/proto_alpha/lib_client_alpha/michelson_v1_emacs.ml index 4a4b943a0..c7acfcd6d 100644 --- a/src/proto_alpha/lib_client_alpha/michelson_v1_emacs.ml +++ b/src/proto_alpha/lib_client_alpha/michelson_v1_emacs.ml @@ -7,6 +7,7 @@ (* *) (**************************************************************************) +open Proto_alpha open Tezos_micheline open Micheline diff --git a/src/proto_alpha/lib_client_alpha/michelson_v1_emacs.mli b/src/proto_alpha/lib_client_alpha/michelson_v1_emacs.mli index 685982615..caf52ddb6 100644 --- a/src/proto_alpha/lib_client_alpha/michelson_v1_emacs.mli +++ b/src/proto_alpha/lib_client_alpha/michelson_v1_emacs.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + val print_expr : Format.formatter -> Script.expr -> diff --git a/src/proto_alpha/lib_client_alpha/michelson_v1_error_reporter.ml b/src/proto_alpha/lib_client_alpha/michelson_v1_error_reporter.ml index 7961aab34..6b64f4d6e 100644 --- a/src/proto_alpha/lib_client_alpha/michelson_v1_error_reporter.ml +++ b/src/proto_alpha/lib_client_alpha/michelson_v1_error_reporter.ml @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context open Tezos_micheline open Script_typed_ir open Script_ir_translator diff --git a/src/proto_alpha/lib_client_alpha/michelson_v1_parser.ml b/src/proto_alpha/lib_client_alpha/michelson_v1_parser.ml index cc82affa8..e2651c292 100644 --- a/src/proto_alpha/lib_client_alpha/michelson_v1_parser.ml +++ b/src/proto_alpha/lib_client_alpha/michelson_v1_parser.ml @@ -7,6 +7,7 @@ (* *) (**************************************************************************) +open Proto_alpha open Tezos_micheline open Micheline_parser open Micheline diff --git a/src/proto_alpha/lib_client_alpha/michelson_v1_parser.mli b/src/proto_alpha/lib_client_alpha/michelson_v1_parser.mli index 900cb501d..bfb86b0a9 100644 --- a/src/proto_alpha/lib_client_alpha/michelson_v1_parser.mli +++ b/src/proto_alpha/lib_client_alpha/michelson_v1_parser.mli @@ -7,6 +7,9 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context + open Tezos_micheline (** The result of parsing and expanding a Michelson V1 script or data. *) diff --git a/src/proto_alpha/lib_client_alpha/michelson_v1_printer.ml b/src/proto_alpha/lib_client_alpha/michelson_v1_printer.ml index 9ac3fee68..85d59e3c2 100644 --- a/src/proto_alpha/lib_client_alpha/michelson_v1_printer.ml +++ b/src/proto_alpha/lib_client_alpha/michelson_v1_printer.ml @@ -7,6 +7,7 @@ (* *) (**************************************************************************) +open Proto_alpha open Tezos_micheline open Micheline open Micheline_printer diff --git a/src/proto_alpha/lib_client_alpha/michelson_v1_printer.mli b/src/proto_alpha/lib_client_alpha/michelson_v1_printer.mli index f1bbbdeef..e2f0473c8 100644 --- a/src/proto_alpha/lib_client_alpha/michelson_v1_printer.mli +++ b/src/proto_alpha/lib_client_alpha/michelson_v1_printer.mli @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context open Tezos_micheline val print_expr : diff --git a/src/proto_alpha/lib_client_alpha/proto_alpha.ml b/src/proto_alpha/lib_client_alpha/proto_alpha.ml new file mode 100644 index 000000000..3c424168f --- /dev/null +++ b/src/proto_alpha/lib_client_alpha/proto_alpha.ml @@ -0,0 +1,12 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2017. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +module Name = struct let name = "alpha" end +module Environment = Tezos_client_environment.Environment.Make(Name)() +include Tezos_protocol_alpha.Functor.Make(Environment) diff --git a/src/proto_demo/lib_client_demo/proto_demo.ml b/src/proto_demo/lib_client_demo/proto_demo.ml new file mode 100644 index 000000000..51364d14e --- /dev/null +++ b/src/proto_demo/lib_client_demo/proto_demo.ml @@ -0,0 +1,12 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2017. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +module Name = struct let name = "demo" end +module Environment = Tezos_client_environment.Environment.Make(Name)() +include Tezos_protocol_demo.Functor.Make(Environment) diff --git a/src/proto_genesis/lib_client_genesis/client_proto_main.ml b/src/proto_genesis/lib_client_genesis/client_proto_main.ml index 2f06fd9de..86ac03e4e 100644 --- a/src/proto_genesis/lib_client_genesis/client_proto_main.ml +++ b/src/proto_genesis/lib_client_genesis/client_proto_main.ml @@ -7,7 +7,7 @@ (* *) (**************************************************************************) -open Tezos_embedded_raw_protocol_genesis +open Proto_genesis let protocol = Protocol_hash.of_b58check_exn @@ -75,7 +75,7 @@ let commands () = @@ stop) begin fun timestamp hash fitness validation_passes seckey (cctxt : Client_commands.full_context) -> let fitness = - Tezos_embedded_raw_protocol_alpha.Fitness_repr.from_int64 fitness in + Tezos_embedded_client_alpha.Proto_alpha.Fitness_repr.from_int64 fitness in bake cctxt ?timestamp cctxt#block (Activate { protocol = hash ; validation_passes ; fitness }) seckey >>=? fun hash -> diff --git a/src/proto_genesis/lib_client_genesis/client_proto_main.mli b/src/proto_genesis/lib_client_genesis/client_proto_main.mli index 9a13c3a7b..28050b7ec 100644 --- a/src/proto_genesis/lib_client_genesis/client_proto_main.mli +++ b/src/proto_genesis/lib_client_genesis/client_proto_main.mli @@ -7,7 +7,7 @@ (* *) (**************************************************************************) -open Tezos_embedded_raw_protocol_genesis +open Proto_genesis val bake: #Client_rpcs.ctxt -> diff --git a/src/proto_genesis/lib_client_genesis/jbuild b/src/proto_genesis/lib_client_genesis/jbuild index 9d25b1a55..df0594e91 100644 --- a/src/proto_genesis/lib_client_genesis/jbuild +++ b/src/proto_genesis/lib_client_genesis/jbuild @@ -4,18 +4,15 @@ ((name tezos_embedded_client_genesis) (public_name tezos-embedded-client-genesis) (libraries (tezos-base - tezos-embedded-protocol-genesis - tezos-embedded-protocol-genesis.raw - tezos-embedded-protocol-alpha.environment - tezos-embedded-protocol-alpha.raw tezos-shell-services - tezos-client-base)) + tezos-client-base + tezos-client-environment + tezos-embedded-client-alpha + tezos-protocol-genesis)) (library_flags (:standard -linkall)) (flags (:standard -w -9+27-30-32-40@8 -safe-string -open Tezos_base__TzPervasives - -open Tezos_embedded_protocol_environment_genesis - -open Tezos_embedded_raw_protocol_genesis -open Tezos_shell_services -open Tezos_client_base)))) diff --git a/src/proto_genesis/lib_client_genesis/proto_genesis.ml b/src/proto_genesis/lib_client_genesis/proto_genesis.ml new file mode 100644 index 000000000..38e52e123 --- /dev/null +++ b/src/proto_genesis/lib_client_genesis/proto_genesis.ml @@ -0,0 +1,12 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2017. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +module Name = struct let name = "genesis" end +module Environment = Tezos_client_environment.Environment.Make(Name)() +include Tezos_protocol_genesis.Functor.Make(Environment) diff --git a/src/proto_genesis/lib_client_genesis/tezos-embedded-client-genesis.opam b/src/proto_genesis/lib_client_genesis/tezos-embedded-client-genesis.opam index 7e5d18bf0..e95e0a103 100644 --- a/src/proto_genesis/lib_client_genesis/tezos-embedded-client-genesis.opam +++ b/src/proto_genesis/lib_client_genesis/tezos-embedded-client-genesis.opam @@ -10,10 +10,11 @@ depends: [ "ocamlfind" { build } "jbuilder" { build & >= "1.0+beta15" } "tezos-base" - "tezos-embedded-protocol-genesis" - "tezos-embedded-protocol-alpha" + "tezos-protocol-genesis" + "tezos-protocol-alpha" "tezos-shell-services" "tezos-client-base" + "tezos-client-environment" ] build: [ [ "jbuilder" "build" "-p" name "-j" jobs ] diff --git a/test/proto_alpha/jbuild b/test/proto_alpha/jbuild index cd911d4af..82ca1134b 100644 --- a/test/proto_alpha/jbuild +++ b/test/proto_alpha/jbuild @@ -15,12 +15,9 @@ (flags (:standard -w -9-32 -safe-string -open Tezos_base__TzPervasives -open Tezos_rpc_http - -open Tezos_embedded_protocol_environment_alpha - -open Tezos_embedded_raw_protocol_alpha -open Tezos_client_base -open Tezos_embedded_client_genesis - -open Tezos_embedded_client_alpha - -open Tezos_context)))) + -open Tezos_embedded_client_alpha)))) (alias ((name buildtest) diff --git a/test/proto_alpha/proto_alpha_helpers.ml b/test/proto_alpha/proto_alpha_helpers.ml index 19ab8bf26..94c918881 100644 --- a/test/proto_alpha/proto_alpha_helpers.ml +++ b/test/proto_alpha/proto_alpha_helpers.ml @@ -7,7 +7,8 @@ (* *) (**************************************************************************) -module Ed25519 = Environment.Ed25519 +open Proto_alpha +open Tezos_context let (//) = Filename.concat diff --git a/test/proto_alpha/proto_alpha_helpers.mli b/test/proto_alpha/proto_alpha_helpers.mli index 644ae6dcd..821505add 100644 --- a/test/proto_alpha/proto_alpha_helpers.mli +++ b/test/proto_alpha/proto_alpha_helpers.mli @@ -7,7 +7,8 @@ (* *) (**************************************************************************) -module Ed25519 = Environment.Ed25519 +open Proto_alpha +open Tezos_context val init : ?sandbox:string -> diff --git a/test/proto_alpha/test_endorsement.ml b/test/proto_alpha/test_endorsement.ml index 79c73478e..23e09936d 100644 --- a/test/proto_alpha/test_endorsement.ml +++ b/test/proto_alpha/test_endorsement.ml @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context module Helpers = Proto_alpha_helpers module Assert = Helpers.Assert @@ -42,10 +44,10 @@ let test_double_endorsement contract block = (* FIXME: Baking.Invalid_signature is unclassified *) let test_invalid_signature block = let public_key = - Environment.Ed25519.Public_key.of_b58check_exn + Ed25519.Public_key.of_b58check_exn "edpkv8EUUH68jmo3f7Um5PezmfGrRF24gnfLpH3sVNwJnV5bVCxL2n" in let secret_key = - Environment.Ed25519.Secret_key.of_b58check_exn + Ed25519.Secret_key.of_b58check_exn "edsk3gUfUPyBSfrS9CCgmCiQsTCHGkviBDusMxDJstFtojtc1zcpsh" in let account = Helpers.Account.create ~keys:(secret_key, public_key) "WRONG SIGNATURE" in diff --git a/test/proto_alpha/test_michelson_parser.ml b/test/proto_alpha/test_michelson_parser.ml index 7823e259b..1401a7eff 100644 --- a/test/proto_alpha/test_michelson_parser.ml +++ b/test/proto_alpha/test_michelson_parser.ml @@ -7,6 +7,7 @@ (* *) (**************************************************************************) +open Proto_alpha module Helpers = Proto_alpha_helpers module Assert = Helpers.Assert diff --git a/test/proto_alpha/test_origination.ml b/test/proto_alpha/test_origination.ml index c628812d0..e7a05b2ce 100644 --- a/test/proto_alpha/test_origination.ml +++ b/test/proto_alpha/test_origination.ml @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context module Helpers = Proto_alpha_helpers module Assert = Helpers.Assert diff --git a/test/proto_alpha/test_transaction.ml b/test/proto_alpha/test_transaction.ml index 9e9c34529..a541b0c86 100644 --- a/test/proto_alpha/test_transaction.ml +++ b/test/proto_alpha/test_transaction.ml @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context module Helpers = Proto_alpha_helpers module Assert = Helpers.Assert diff --git a/test/proto_alpha/test_vote.ml b/test/proto_alpha/test_vote.ml index 45ae0cad6..d68ffa5d6 100644 --- a/test/proto_alpha/test_vote.ml +++ b/test/proto_alpha/test_vote.ml @@ -7,6 +7,8 @@ (* *) (**************************************************************************) +open Proto_alpha +open Tezos_context open Proto_alpha_helpers let demo_protocol =