Client: split client-alpha into lib and commands and extract the baker

This commit is contained in:
Benjamin Canou 2018-02-15 17:07:08 +01:00
parent a55a60c59b
commit e2be3360a9
75 changed files with 361 additions and 64 deletions

View File

@ -13,6 +13,7 @@ tezos-node
tezos-protocol-compiler
tezos-client
tezos-admin-client
tezos-alpha-baker
scripts/opam-test-all.sh.DONE

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ __pycache__
/tezos-protocol-compiler
/tezos-client
/tezos-admin-client
/tezos-alpha-baker
/scripts/opam-test-all.sh.DONE

View File

@ -151,22 +151,22 @@ test:proto_alpha:
test:client_alpha:transaction:
<<: *test_definition
script:
- jbuilder build @src/proto_alpha/lib_client/runtest_transaction
- jbuilder build @src/proto_alpha/lib_baking/runtest_transaction
test:client_alpha:origination:
<<: *test_definition
script:
- jbuilder build @src/proto_alpha/lib_client/runtest_origination
- jbuilder build @src/proto_alpha/lib_baking/runtest_origination
test:client_alpha:endorsement:
<<: *test_definition
script:
- jbuilder build @src/proto_alpha/lib_client/runtest_endorsement
- jbuilder build @src/proto_alpha/lib_baking/runtest_endorsement
test:client_alpha:vote:
<<: *test_definition
script:
- jbuilder build @src/proto_alpha/lib_client/runtest_vote
- jbuilder build @src/proto_alpha/lib_baking/runtest_vote
test:basic.sh:
<<: *test_definition
@ -336,75 +336,95 @@ opam:24:tezos-p2p:
variables:
package: tezos-p2p
opam:25:ocplib-resto-json:
<<: *opam_definition
variables:
package: ocplib-resto-json
opam:26:tezos-client-alpha:
opam:25:tezos-client-alpha:
<<: *opam_definition
variables:
package: tezos-client-alpha
opam:27:tezos-client-genesis:
opam:26:tezos-client-commands:
<<: *opam_definition
variables:
package: tezos-client-commands
opam:27:ocplib-resto-json:
<<: *opam_definition
variables:
package: ocplib-resto-json
opam:28:tezos-client-genesis:
<<: *opam_definition
variables:
package: tezos-client-genesis
opam:28:tezos-embedded-protocol-alpha:
opam:29:tezos-embedded-protocol-alpha:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-alpha
opam:29:tezos-embedded-protocol-demo:
opam:30:tezos-embedded-protocol-demo:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-demo
opam:30:tezos-embedded-protocol-genesis:
opam:31:tezos-embedded-protocol-genesis:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-genesis
opam:31:tezos-shell:
opam:32:tezos-shell:
<<: *opam_definition
variables:
package: tezos-shell
opam:32:ocplib-ezresto:
opam:33:tezos-baking-alpha:
<<: *opam_definition
variables:
package: tezos-baking-alpha
opam:34:ocplib-ezresto:
<<: *opam_definition
variables:
package: ocplib-ezresto
opam:33:tezos-client:
opam:35:tezos-client:
<<: *opam_definition
variables:
package: tezos-client
opam:34:tezos-node:
opam:36:tezos-node:
<<: *opam_definition
variables:
package: tezos-node
opam:35:ocplib-ezresto-directory:
opam:37:tezos-baking-alpha-commands:
<<: *opam_definition
variables:
package: tezos-baking-alpha-commands
opam:38:ocplib-ezresto-directory:
<<: *opam_definition
variables:
package: ocplib-ezresto-directory
opam:36:tezos-protocol-demo:
opam:39:tezos-client-alpha-commands:
<<: *opam_definition
variables:
package: tezos-client-alpha-commands
opam:40:tezos-baker-alpha:
<<: *opam_definition
variables:
package: tezos-baker-alpha
opam:41:tezos-protocol-demo:
<<: *opam_definition
variables:
package: tezos-protocol-demo
opam:37:tezos-unix-signers:
opam:42:tezos-client-base-unix:
<<: *opam_definition
variables:
package: tezos-unix-signers
opam:38:tezos-client-commands:
<<: *opam_definition
variables:
package: tezos-client-commands
package: tezos-client-base-unix
##END_OPAM##

View File

@ -7,11 +7,13 @@ all:
src/bin_node/main.exe \
src/bin_client/main_client.exe \
src/bin_client/main_admin.exe \
src/lib_protocol_compiler/main_native.exe
src/lib_protocol_compiler/main_native.exe \
src/proto_alpha/bin_baker/main_baker_alpha.exe
@cp _build/default/src/bin_node/main.exe tezos-node
@cp _build/default/src/bin_client/main_client.exe tezos-client
@cp _build/default/src/bin_client/main_admin.exe tezos-admin-client
@cp _build/default/src/lib_protocol_compiler/main_native.exe tezos-protocol-compiler
@cp _build/default/src/proto_alpha/bin_baker/main_baker_alpha.exe tezos-alpha-baker
all.pkg:
@jbuilder build ${DEV} \
@ -56,7 +58,12 @@ install:
clean:
@-jbuilder clean
@-rm -f tezos-node tezos-client tezos-admin-client tezos-protocol-compiler
@-rm -f \
tezos-node \
tezos-client \
tezos-admin-client \
tezos-protocol-compiler \
tezos-alpha-baker
@-make -C docs clean
.PHONY: all test build-deps docker-image clean

View File

@ -9,9 +9,11 @@
tezos-client-base
tezos-client-commands
tezos-client-genesis
tezos-client-alpha
tezos-stdlib-unix
tezos-unix-signers
tezos-client-alpha))
tezos-client-base-unix
tezos-client-alpha-commands.registration
tezos-baking-alpha-commands.registration))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
@ -20,7 +22,7 @@
-open Tezos_shell_services
-open Tezos_client_base
-open Tezos_client_commands
-open Tezos_unix_signers))))
-open Tezos_client_base_unix))))
(install
((section bin)

View File

@ -13,7 +13,10 @@ depends: [
"tezos-client-base"
"tezos-client-genesis"
"tezos-client-alpha"
"tezos-unix-signers"
"tezos-client-alpha-commands"
"tezos-baking-alpha"
"tezos-baking-alpha-commands"
"tezos-client-base-unix"
"tezos-node" { test }
]
build: [

View File

@ -7,7 +7,7 @@
(* *)
(**************************************************************************)
open Client_commands
open Client_context
class file_wallet dir : wallet = object (self)
method private filename alias_name =

View File

@ -1,16 +1,22 @@
(jbuild_version 1)
(library
((name tezos_unix_signers)
(public_name tezos-unix-signers)
((name tezos_client_base_unix)
(public_name tezos-client-base-unix)
(libraries (tezos-base
tezos-client-base
tezos-stdlib-unix))
tezos-client-commands
tezos-stdlib-unix
tezos-rpc-http
tezos-shell-services))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
-open Tezos_rpc_http
-open Tezos_shell_services
-open Tezos_stdlib_unix
-open Tezos_client_base
-open Tezos_client_commands
-linkall))))
(alias

View File

@ -11,6 +11,7 @@ depends: [
"jbuilder" { build & >= "1.0+beta17" }
"tezos-base"
"tezos-client-base"
"tezos-client-commands"
]
build: [
[ "jbuilder" "build" "-p" name "-j" jobs ]

View File

@ -0,0 +1,18 @@
(jbuild_version 1)
(executable
((name main_baker_alpha)
(public_name tezos-baker-alpha)
(libraries (tezos-client-base-unix
tezos-baking-alpha-commands))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
-open Tezos_client_alpha
-open Tezos_baking_alpha_commands
-open Tezos_client_base_unix))))
(alias
((name runtest_indent)
(deps ((glob_files *.ml*)))
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))

View File

@ -0,0 +1,16 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
let select_commands _ _ =
return
(List.map
(Cli_entries.map_command (new Proto_alpha.wrap_full_context))
(Client_baking_commands.commands ()))
let () = Client_main_run.run select_commands

View File

@ -0,0 +1,23 @@
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+beta17" }
"tezos-base"
"tezos-client-base"
"tezos-client-genesis"
"tezos-client-alpha"
"tezos-client-commands"
"tezos-client-base-unix"
"tezos-baking-alpha"
"tezos-baking-alpha-commands"
]
build: [
[ "jbuilder" "build" "-p" name "-j" jobs ]
]

View File

@ -7,4 +7,7 @@
(* *)
(**************************************************************************)
val protocol: Protocol_hash.t
let () =
Client_commands.register Proto_alpha.hash @@
List.map (Cli_entries.map_command (new Proto_alpha.wrap_full_context)) @@
Client_baking_commands.commands ()

View File

@ -294,7 +294,7 @@ end = struct
with Not_found -> [] in
save cctxt
(LevelMap.add level (hash :: previous) map)) >>=? fun () ->
Client_proto_nonces.add cctxt hash nonce
Client_baking_nonces.add cctxt hash nonce
end
@ -377,7 +377,7 @@ let get_unrevealed_nonces (cctxt : #Proto_alpha.full_context) ?(force = false) b
Client_baking_blocks.blocks_from_cycle
cctxt block cycle >>=? fun blocks ->
filter_map_s (fun hash ->
Client_proto_nonces.find cctxt hash >>=? function
Client_baking_nonces.find cctxt hash >>=? function
| None -> return None
| Some nonce ->
Alpha_services.Context.level

View File

@ -56,7 +56,7 @@ let do_reveal cctxt block blocks =
let nonces = List.map snd blocks in
Client_baking_revelation.forge_seed_nonce_revelation cctxt
block nonces >>=? fun () ->
Client_proto_nonces.dels cctxt (List.map fst blocks) >>=? fun () ->
Client_baking_nonces.dels cctxt (List.map fst blocks) >>=? fun () ->
return ()
let reveal_block_nonces (cctxt : #Proto_alpha.full_context) block_hashes =
@ -75,7 +75,7 @@ let reveal_block_nonces (cctxt : #Proto_alpha.full_context) block_hashes =
Lwt.return_none))
block_hashes >>= fun block_infos ->
filter_map_s (fun (bi : Client_baking_blocks.block_info) ->
Client_proto_nonces.find cctxt bi.hash >>=? function
Client_baking_nonces.find cctxt bi.hash >>=? function
| None ->
cctxt#warning "Cannot find nonces for block %a (ignoring)@."
Block_hash.pp_short bi.hash >>= fun () ->

View File

@ -0,0 +1,77 @@
(jbuild_version 1)
(library
((name tezos_baking_alpha)
(public_name tezos-baking-alpha)
(libraries (tezos-base
tezos-protocol-alpha
tezos-protocol-environment-client
tezos-shell-services
tezos-client-base
tezos-client-alpha
tezos-client-commands
tezos-rpc))
(library_flags (:standard -linkall))
(modules (:standard \ client_baking_commands client_baking_commands_registration main_alpha_baker))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
-open Tezos_shell_services
-open Tezos_client_base
-open Tezos_client_alpha
-open Tezos_client_commands
-open Tezos_rpc))))
(library
((name tezos_baking_alpha_commands)
(public_name tezos-baking-alpha-commands)
(libraries (tezos-base
tezos-protocol-alpha
tezos-protocol-environment-client
tezos-shell-services
tezos-client-base
tezos-client-alpha
tezos-client-commands
tezos-baking-alpha))
(library_flags (:standard -linkall))
(modules (client_baking_commands))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
-open Tezos_shell_services
-open Tezos_client_base
-open Tezos_client_alpha
-open Tezos_client_commands
-open Tezos_baking_alpha
-open Tezos_rpc))))
(library
((name tezos_baking_alpha_commands_registration)
(public_name tezos-baking-alpha-commands.registration)
(libraries (tezos-base
tezos-protocol-alpha
tezos-protocol-environment-client
tezos-shell-services
tezos-client-base
tezos-client-alpha
tezos-client-commands
tezos-baking-alpha
tezos-baking-alpha-commands
tezos-rpc))
(library_flags (:standard -linkall))
(modules (client_baking_commands_registration))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
-open Tezos_shell_services
-open Tezos_client_base
-open Tezos_client_alpha
-open Tezos_client_commands
-open Tezos_baking_alpha
-open Tezos_baking_alpha_commands
-open Tezos_rpc))))
(alias
((name runtest_indent)
(deps ((glob_files *.ml*)))
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))

View File

@ -12,7 +12,8 @@
tezos-client-base
tezos-client-genesis
tezos-client-alpha
tezos-unix-signers
tezos-baking-alpha
tezos-client-base-unix
alcotest-lwt))
(flags (:standard -w -9-32 -safe-string
-open Tezos_base__TzPervasives
@ -21,7 +22,8 @@
-open Tezos_client_base
-open Tezos_client_genesis
-open Tezos_client_alpha
-open Tezos_unix_signers))))
-open Tezos_baking_alpha
-open Tezos_client_base_unix))))
(alias
((name buildtest)

View File

@ -47,7 +47,7 @@ let activate_alpha () =
~location:"edsk31vznjHSSpGExDMHYASz45VZqXN4DPxvsa4hAyY8dHM28cZzp6" in
Tezos_client_genesis.Client_proto_main.bake
!rpc_ctxt (`Head 0)
(Activate { protocol = Client_proto_main.protocol ;
(Activate { protocol = Proto_alpha.hash ;
fitness })
dictator_sk

View File

@ -0,0 +1,23 @@
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+beta17" }
"tezos-base"
"tezos-protocol-environment-client"
"tezos-protocol-alpha"
"tezos-shell-services"
"tezos-client-base"
"tezos-client-commands"
"tezos-client-alpha"
"tezos-baking-alpha"
]
build: [
[ "jbuilder" "build" "-p" name "-j" jobs ]
]

View File

@ -0,0 +1,29 @@
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+beta17" }
"tezos-base"
"tezos-protocol-environment-client"
"tezos-protocol-alpha"
"tezos-shell-services"
"tezos-client-base"
"tezos-client-commands"
"tezos-client-alpha"
"tezos-node" { test }
"tezos-client-genesis" { test }
"tezos-client-base-unix" { test }
"alcotest-lwt" { test }
]
build: [
[ "jbuilder" "build" "-p" name "-j" jobs ]
]
build-test: [
[ "jbuilder" "runtest" "-p" name "-j" jobs ]
]

View File

@ -8,7 +8,6 @@
tezos-protocol-environment-client
tezos-shell-services
tezos-client-base
tezos-client-commands
tezos-rpc))
(library_flags (:standard -linkall))
(flags (:standard -w -9+27-30-32-40@8
@ -16,7 +15,6 @@
-open Tezos_base__TzPervasives
-open Tezos_shell_services
-open Tezos_client_base
-open Tezos_client_commands
-open Tezos_rpc))))
(alias

View File

@ -32,7 +32,7 @@ let expand_all source ast errors =
f tl in
let error_map = error_map ([], []) in
let rec expand expr =
match Michelson_macros.expand expr with
match Michelson_v1_macros.expand expr with
| Ok expanded ->
begin
match expanded with

View File

@ -62,7 +62,7 @@ let inject_types type_map parsed =
let unparse ?type_map parse expanded =
let rec unexpand expr =
match Michelson_macros.unexpand expr with
match Michelson_v1_macros.unexpand expr with
| Seq (loc, items, annot) ->
Seq (loc, List.map unexpand items, annot)
| Prim (loc, name, args, annot) ->

View File

@ -11,6 +11,10 @@ module Name = struct let name = "alpha" end
module Alpha_environment = Tezos_protocol_environment_client.Fake.Make(Name)()
include Tezos_protocol_alpha.Functor.Make(Alpha_environment)
let hash =
Protocol_hash.of_b58check_exn
"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"
class type rpc_context = object
inherit RPC_context.json
inherit [Block_services.block] Alpha_environment.RPC_context.simple

View File

@ -14,13 +14,7 @@ depends: [
"tezos-protocol-alpha"
"tezos-shell-services"
"tezos-client-base"
"tezos-node" { test }
"tezos-client-genesis" { test }
"alcotest-lwt" { test }
]
build: [
[ "jbuilder" "build" "-p" name "-j" jobs ]
]
build-test: [
[ "jbuilder" "runtest" "-p" name "-j" jobs ]
]

View File

@ -7,14 +7,9 @@
(* *)
(**************************************************************************)
let protocol =
Protocol_hash.of_b58check_exn
"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"
let () =
Client_commands.register protocol @@
Client_commands.register Proto_alpha.hash @@
List.map (Cli_entries.map_command (new Proto_alpha.wrap_full_context)) @@
Client_proto_programs_commands.commands () @
Client_proto_contracts_commands.commands () @
Client_proto_context_commands.commands () @
Client_baking_main.commands ()
Client_proto_context_commands.commands ()

View File

@ -0,0 +1,52 @@
(jbuild_version 1)
(library
((name tezos_client_alpha_commands)
(public_name tezos-client-alpha-commands)
(libraries (tezos-base
tezos-protocol-alpha
tezos-protocol-environment-client
tezos-shell-services
tezos-client-base
tezos-client-alpha
tezos-client-commands
tezos-rpc))
(library_flags (:standard -linkall))
(modules (:standard \ alpha_commands_registration))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
-open Tezos_shell_services
-open Tezos_client_base
-open Tezos_client_alpha
-open Tezos_client_commands
-open Tezos_rpc))))
(library
((name tezos_client_alpha_commands_registration)
(public_name tezos-client-alpha-commands.registration)
(libraries (tezos-base
tezos-protocol-alpha
tezos-protocol-environment-client
tezos-shell-services
tezos-client-base
tezos-client-alpha
tezos-client-commands
tezos-client-alpha-commands
tezos-rpc))
(library_flags (:standard -linkall))
(modules (alpha_commands_registration))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
-open Tezos_shell_services
-open Tezos_client_base
-open Tezos_client_alpha
-open Tezos_client_commands
-open Tezos_client_alpha_commands
-open Tezos_rpc))))
(alias
((name runtest_indent)
(deps ((glob_files *.ml*)))
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))

View File

@ -0,0 +1,22 @@
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+beta17" }
"tezos-base"
"tezos-protocol-environment-client"
"tezos-protocol-alpha"
"tezos-shell-services"
"tezos-client-base"
"tezos-client-alpha"
"tezos-client-commands"
]
build: [
[ "jbuilder" "build" "-p" name "-j" jobs ]
]

View File

@ -1 +0,0 @@
../../../lib_client/michelson_macros.ml

View File

@ -1 +0,0 @@
../../../lib_client/michelson_macros.mli

View File

@ -0,0 +1 @@
../../../lib_client/michelson_v1_macros.ml

View File

@ -0,0 +1 @@
../../../lib_client/michelson_v1_macros.mli