Refactor: introduce lib_client_environment
This allow to use the functorised version of the protocol in the client.
This commit is contained in:
parent
acc0c5c512
commit
c75756bd6d
5
Makefile
5
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
|
||||
|
||||
|
104
src/lib_base/protocol_environment.ml
Normal file
104
src/lib_base/protocol_environment.ml
Normal file
@ -0,0 +1,104 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2017. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* 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
|
||||
"@[<v 2>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
|
@ -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)
|
||||
|
34
src/lib_client_environment/environment.ml
Normal file
34
src/lib_client_environment/environment.ml
Normal file
@ -0,0 +1,34 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2017. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* 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
|
24
src/lib_client_environment/fake_context.ml
Normal file
24
src/lib_client_environment/fake_context.ml
Normal file
@ -0,0 +1,24 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2017. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* 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
|
72
src/lib_client_environment/fake_updater.ml
Normal file
72
src/lib_client_environment/fake_updater.ml
Normal file
@ -0,0 +1,72 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2017. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* 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
|
17
src/lib_client_environment/jbuild
Normal file
17
src/lib_client_environment/jbuild
Normal file
@ -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} ${^}))))
|
20
src/lib_client_environment/tezos-client-environment.opam
Normal file
20
src/lib_client_environment/tezos-client-environment.opam
Normal file
@ -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 ]
|
||||
]
|
@ -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
|
||||
"@[<v 2>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
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
type block_info = {
|
||||
hash: Block_hash.t ;
|
||||
net_id: Net_id.t ;
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
type block_info = {
|
||||
hash: Block_hash.t ;
|
||||
net_id: Net_id.t ;
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
val run:
|
||||
Client_commands.full_context ->
|
||||
?max_priority: int ->
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
open Logging.Client.Endorsement
|
||||
|
||||
module State : sig
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
val forge_endorsement:
|
||||
Client_commands.full_context ->
|
||||
Client_proto_rpcs.block ->
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
open Logging.Client.Baking
|
||||
|
||||
let generate_proof_of_work_nonce () =
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 ->
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
type operation = {
|
||||
hash: Operation_hash.t ;
|
||||
content: Operation.t option
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
type operation = {
|
||||
hash: Operation_hash.t ;
|
||||
content: Operation.t option ;
|
||||
|
@ -7,6 +7,7 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
let inject_seed_nonce_revelation rpc_config block ?async nonces =
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
val inject_seed_nonce_revelation:
|
||||
#Client_rpcs.ctxt ->
|
||||
Client_proto_rpcs.block ->
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Cli_entries
|
||||
|
||||
type error += Bad_tez_arg of string * string (* Arg_name * value *)
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
val tez_sym: string
|
||||
|
||||
open Cli_entries
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Tezos_micheline
|
||||
open Client_proto_contracts
|
||||
open Client_keys
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Environment
|
||||
|
||||
val list_contract_labels :
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Tezos_micheline
|
||||
open Client_proto_context
|
||||
open Client_proto_contracts
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
module ContractEntity = struct
|
||||
type t = Contract.t
|
||||
let encoding = Contract.encoding
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
module RawContractAlias :
|
||||
Client_aliases.Alias with type t = Contract.t
|
||||
|
||||
|
@ -1,3 +1,14 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2017. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Client_proto_contracts
|
||||
|
||||
let group =
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
(* TODO locking... *)
|
||||
|
||||
type t = (Block_hash.t * Nonce.t) list
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
val mem:
|
||||
#Client_commands.wallet ->
|
||||
Block_hash.t -> bool tzresult Lwt.t
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Tezos_micheline
|
||||
|
||||
open Michelson_v1_printer
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Tezos_micheline
|
||||
|
||||
module Program : Client_aliases.Alias
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
let string_of_errors exns =
|
||||
Format.asprintf " @[<v>%a@]" pp_print_error exns
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -7,6 +7,7 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_micheline
|
||||
open Micheline
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
val print_expr :
|
||||
Format.formatter ->
|
||||
Script.expr ->
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Tezos_micheline
|
||||
open Script_typed_ir
|
||||
open Script_ir_translator
|
||||
|
@ -7,6 +7,7 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_micheline
|
||||
open Micheline_parser
|
||||
open Micheline
|
||||
|
@ -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. *)
|
||||
|
@ -7,6 +7,7 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_micheline
|
||||
open Micheline
|
||||
open Micheline_printer
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Tezos_micheline
|
||||
|
||||
val print_expr :
|
||||
|
12
src/proto_alpha/lib_client_alpha/proto_alpha.ml
Normal file
12
src/proto_alpha/lib_client_alpha/proto_alpha.ml
Normal file
@ -0,0 +1,12 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2017. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* 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)
|
12
src/proto_demo/lib_client_demo/proto_demo.ml
Normal file
12
src/proto_demo/lib_client_demo/proto_demo.ml
Normal file
@ -0,0 +1,12 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2017. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* 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)
|
@ -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 ->
|
||||
|
@ -7,7 +7,7 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Tezos_embedded_raw_protocol_genesis
|
||||
open Proto_genesis
|
||||
|
||||
val bake:
|
||||
#Client_rpcs.ctxt ->
|
||||
|
@ -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))))
|
||||
|
||||
|
12
src/proto_genesis/lib_client_genesis/proto_genesis.ml
Normal file
12
src/proto_genesis/lib_client_genesis/proto_genesis.ml
Normal file
@ -0,0 +1,12 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2017. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* 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)
|
@ -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 ]
|
||||
|
@ -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)
|
||||
|
@ -7,7 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
module Ed25519 = Environment.Ed25519
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
let (//) = Filename.concat
|
||||
|
||||
|
@ -7,7 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
module Ed25519 = Environment.Ed25519
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
|
||||
val init :
|
||||
?sandbox:string ->
|
||||
|
@ -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
|
||||
|
@ -7,6 +7,7 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
module Helpers = Proto_alpha_helpers
|
||||
module Assert = Helpers.Assert
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
module Helpers = Proto_alpha_helpers
|
||||
module Assert = Helpers.Assert
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
module Helpers = Proto_alpha_helpers
|
||||
module Assert = Helpers.Assert
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Proto_alpha
|
||||
open Tezos_context
|
||||
open Proto_alpha_helpers
|
||||
|
||||
let demo_protocol =
|
||||
|
Loading…
Reference in New Issue
Block a user