From 0512ff55ce5f7bd7eaf8b7309a1929e71f7e6d96 Mon Sep 17 00:00:00 2001 From: Vincent Botbol Date: Wed, 13 Jun 2018 11:05:20 +0200 Subject: [PATCH] Baking: split daemons into 3 different binaries --- .gitignore | 2 + .gitlab-ci.yml | 45 +++++++-- Makefile | 10 +- docs/whitedoc/the_big_picture.rst | 4 + src/bin_client/bash-completion.sh | 3 + src/bin_client/tezos-init-sandboxed-client.sh | 38 ++++++-- src/proto_alpha/bin_accuser/jbuild | 20 ++++ .../bin_accuser/main_accuser_alpha.ml | 21 ++++ .../bin_accuser/tezos-accuser-alpha.opam | 23 +++++ src/proto_alpha/bin_baker/jbuild | 2 + src/proto_alpha/bin_baker/main_baker_alpha.ml | 7 +- src/proto_alpha/bin_endorser/jbuild | 20 ++++ .../bin_endorser/main_endorser_alpha.ml | 21 ++++ .../bin_endorser/tezos-endorser-alpha.opam | 23 +++++ .../lib_delegate/delegate_commands.ml | 96 ++++++++++++------- .../lib_delegate/delegate_commands.mli | 6 +- .../delegate_commands_registration.ml | 2 +- .../tezos-accuser-alpha-commands.opam | 24 +++++ .../tezos-baker-alpha-commands.opam | 24 +++++ .../tezos-endorser-alpha-commands.opam | 24 +++++ 20 files changed, 354 insertions(+), 61 deletions(-) create mode 100644 src/proto_alpha/bin_accuser/jbuild create mode 100644 src/proto_alpha/bin_accuser/main_accuser_alpha.ml create mode 100644 src/proto_alpha/bin_accuser/tezos-accuser-alpha.opam create mode 100644 src/proto_alpha/bin_endorser/jbuild create mode 100644 src/proto_alpha/bin_endorser/main_endorser_alpha.ml create mode 100644 src/proto_alpha/bin_endorser/tezos-endorser-alpha.opam create mode 100644 src/proto_alpha/lib_delegate/tezos-accuser-alpha-commands.opam create mode 100644 src/proto_alpha/lib_delegate/tezos-baker-alpha-commands.opam create mode 100644 src/proto_alpha/lib_delegate/tezos-endorser-alpha-commands.opam diff --git a/.gitignore b/.gitignore index 84c9cdf53..5753c36ad 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ __pycache__ /tezos-client /tezos-admin-client /tezos-alpha-baker +/tezos-alpha-endorser +/tezos-alpha-accuser /tezos-signer /scripts/opam-test-all.sh.DONE diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0be4ef886..7ef863882 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -180,12 +180,12 @@ test:p2p:banned_peers: # test:client_alpha:transaction: # <<: *test_definition # script: - # - jbuilder build @src/proto_alpha/lib_baking/runtest_transaction + # - jbuilder build @src/proto_alpha/lib_delegate/runtest_transaction # test:client_alpha:origination: # <<: *test_definition # script: - # - jbuilder build @src/proto_alpha/lib_baking/runtest_origination + # - jbuilder build @src/proto_alpha/lib_delegate/runtest_origination test:client_alpha:endorsement: <<: *test_definition @@ -490,46 +490,71 @@ opam:49:tezos-shell: variables: package: tezos-shell -opam:50:tezos-client: +opam:50:tezos-endorser-alpha-commands: + <<: *opam_definition + variables: + package: tezos-endorser-alpha-commands + +opam:51:tezos-client: <<: *opam_definition variables: package: tezos-client -opam:51:ocplib-ezresto-directory: +opam:52:tezos-endorser-alpha: + <<: *opam_definition + variables: + package: tezos-endorser-alpha + +opam:53:tezos-accuser-alpha-commands: + <<: *opam_definition + variables: + package: tezos-accuser-alpha-commands + +opam:54:ocplib-ezresto-directory: <<: *opam_definition variables: package: ocplib-ezresto-directory -opam:52:tezos-baker-alpha: +opam:55:tezos-accuser-alpha: + <<: *opam_definition + variables: + package: tezos-accuser-alpha + +opam:56:tezos-baker-alpha: <<: *opam_definition variables: package: tezos-baker-alpha -opam:53:tezos-protocol-demo: +opam:57:tezos-protocol-demo: <<: *opam_definition variables: package: tezos-protocol-demo -opam:54:tezos-signer: +opam:58:tezos-signer: <<: *opam_definition variables: package: tezos-signer -opam:55:ledgerwallet-tezos: +opam:59:ledgerwallet-tezos: <<: *opam_definition variables: package: ledgerwallet-tezos -opam:56:tezos-node: +opam:60:tezos-node: <<: *opam_definition variables: package: tezos-node -opam:57:ocplib-json-typed-browser: +opam:59:ocplib-json-typed-browser: <<: *opam_definition variables: package: ocplib-json-typed-browser +opam:60:tezos-baker-alpha-commands: + <<: *opam_definition + variables: + package: tezos-baker-alpha-commands + ##END_OPAM## diff --git a/Makefile b/Makefile index 58a752d15..0cf79a037 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,17 @@ all: src/bin_client/main_admin.exe \ src/bin_signer/main_signer.exe \ src/lib_protocol_compiler/main_native.exe \ - src/proto_alpha/bin_baker/main_baker_alpha.exe + src/proto_alpha/bin_baker/main_baker_alpha.exe \ + src/proto_alpha/bin_endorser/main_endorser_alpha.exe \ + src/proto_alpha/bin_accuser/main_accuser_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/bin_signer/main_signer.exe tezos-signer @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 + @cp _build/default/src/proto_alpha/bin_endorser/main_endorser_alpha.exe tezos-alpha-endorser + @cp _build/default/src/proto_alpha/bin_accuser/main_accuser_alpha.exe tezos-alpha-accuser all.pkg: @jbuilder build ${DEV} \ @@ -78,7 +82,9 @@ clean: tezos-client \ tezos-admin-client \ tezos-protocol-compiler \ - tezos-alpha-baker + tezos-alpha-baker \ + tezos-alpha-endorser \ + tezos-alpha-accuser @-${MAKE} -C docs clean .PHONY: all test build-deps docker-image clean diff --git a/docs/whitedoc/the_big_picture.rst b/docs/whitedoc/the_big_picture.rst index 56fb29aed..61d42f1d7 100644 --- a/docs/whitedoc/the_big_picture.rst +++ b/docs/whitedoc/the_big_picture.rst @@ -318,6 +318,10 @@ The Final Executables environment to interact with a sandboxed node. - :package:`tezos-baker-alpha` provides the ``tezos-alpha-baker`` binary. + - :package:`tezos-endorser-alpha` provides the ``tezos-alpha-endorser`` + binary. + - :package:`tezos-accuser-alpha` provides the ``tezos-alpha-accuser`` + binary. - :package:`tezos-protocol-compiler` provides the ``tezos-protocol-compiler`` binary that is used by the node to compile new protocols on the fly, and that can be used for diff --git a/src/bin_client/bash-completion.sh b/src/bin_client/bash-completion.sh index 52ec6ad2c..66809692e 100755 --- a/src/bin_client/bash-completion.sh +++ b/src/bin_client/bash-completion.sh @@ -48,4 +48,7 @@ _tezos-alphanet_complete() # Register _pss_complete to provide completion for the following commands complete -F _tezos-client_complete tezos-client complete -F _tezos-client_complete tezos-admin-client +complete -F _tezos-client_complete tezos-alpha-baker +complete -F _tezos-client_complete tezos-alpha-endorser +complete -F _tezos-client_complete tezos-alpha-accuser complete -F _tezos-alphanet_complete alphanet.sh diff --git a/src/bin_client/tezos-init-sandboxed-client.sh b/src/bin_client/tezos-init-sandboxed-client.sh index 4fb9f59eb..10841cc89 100755 --- a/src/bin_client/tezos-init-sandboxed-client.sh +++ b/src/bin_client/tezos-init-sandboxed-client.sh @@ -17,10 +17,16 @@ init_sandboxed_client() { client="$local_client -S -base-dir $client_dir -addr 127.0.0.1 -port $rpc" admin_client="$local_admin_client -S -base-dir $client_dir -addr 127.0.0.1 -port $rpc" alpha_baker="$local_alpha_baker -S -base-dir $client_dir -addr 127.0.0.1 -port $rpc" + alpha_endorser="$local_alpha_endorser -S -base-dir $client_dir -addr 127.0.0.1 -port $rpc" + alpha_accuser="$local_alpha_accuser -S -base-dir $client_dir -addr 127.0.0.1 -port $rpc" + signer="$local_signer -S -base-dir $client_dir -addr 127.0.0.1 -port $rpc" else client="$local_client -base-dir $client_dir -addr 127.0.0.1 -port $rpc" admin_client="$local_admin_client -base-dir $client_dir -addr 127.0.0.1 -port $rpc" alpha_baker="$local_alpha_baker -base-dir $client_dir -addr 127.0.0.1 -port $rpc" + alpha_endorser="$local_alpha_endorser -base-dir $client_dir -addr 127.0.0.1 -port $rpc" + alpha_accuser="$local_alpha_accuser -base-dir $client_dir -addr 127.0.0.1 -port $rpc" + signer="$local_signer -base-dir $client_dir -addr 127.0.0.1 -port $rpc" fi parameters_file="${parameters_file:-$client_dir/protocol_parameters.json}" @@ -94,9 +100,9 @@ may_create_identity() { ## Baker ################################################################### check_baker() { - pids=$(pgrep -x tezos-client 2>/dev/null) + pids=$(pgrep -x tezos-alpha-baker 2>/dev/null) for pid in $pids; do - if grep -- "-baking" "/proc/$pid/cmdline" >/dev/null 2>&1 ; then + if grep -- "-max-priority" "/proc/$pid/cmdline" >/dev/null 2>&1 ; then return 0 fi done @@ -109,13 +115,13 @@ run_baker() { exit 1 fi echo "Start baker..." - exec $client launch daemon -baking -max-priority 64 "$@" > "$client_dir/baker.log" + exec $alpha_baker launch daemon -max-priority 64 "$@" > "$client_dir/baker.log" } stop_baker() { - pids=$(pgrep -x tezos-client 2>/dev/null) + pids=$(pgrep -x tezos-alpha-baker 2>/dev/null) for pid in $pids; do - if grep -- "-baking" "/proc/$pid/cmdline" >/dev/null 2>&1 ; then + if grep -- "-max-priority" "/proc/$pid/cmdline" >/dev/null 2>&1 ; then echo "Killing the baker..." kill "$pid" fi @@ -140,9 +146,9 @@ log_baker() { ## Endorser ################################################################ check_endorser() { - pids=$(pgrep -x tezos-client 2>/dev/null) + pids=$(pgrep -x tezos-alpha-endorser 2>/dev/null) for pid in $pids; do - if grep -- "-endorsement" "/proc/$pid/cmdline" > /dev/null 2>&1 ; then + if grep -- "tezos-alpha-endorser" "/proc/$pid/cmdline" > /dev/null 2>&1 ; then return 0 fi done @@ -155,13 +161,13 @@ run_endorser() { exit 1 fi echo "Start endorser..." - exec $client launch daemon -endorsement "$@" > "$client_dir/endorser.log" + exec $alpha_endorser launch daemon"$@" > "$client_dir/endorser.log" } stop_endorser() { - pids=$(pgrep -x tezos-client 2>/dev/null) + pids=$(pgrep -x tezos-alpha-endorser 2>/dev/null) for pid in $pids; do - if grep -- "-endorsement" "/proc/$pid/cmdline" > /dev/null 2>&1 ; then + if grep -- "tezos-alpha-endorser" "/proc/$pid/cmdline" > /dev/null 2>&1 ; then kill "$pid" fi done @@ -247,12 +253,16 @@ main () { local_admin_client="${local_admin_client:-$bin_dir/../../_build/default/src/bin_client/main_admin.exe}" local_alpha_baker="${local_alpha_baker:-$bin_dir/../../_build/default/src/proto_alpha/bin_baker/main_baker_alpha.exe}" local_signer="${local_signer:-$bin_dir/../../_build/default/src/bin_signer/main_signer.exe}" + local_alpha_endorser="${local_alpha_endorser:-$bin_dir/../../_build/default/src/proto_alpha/bin_endorser/main_endorser_alpha.exe}" + local_alpha_accuser="${local_alpha_accuser:-$bin_dir/../../_build/default/src/proto_alpha/bin_accuser/main_accuser_alpha.exe}" parameters_file="${parameters_file:-$bin_dir/../../scripts/protocol_parameters.json}" else # we assume a clean install with tezos-(admin-)client in the path local_client="${local_client:-$(which tezos-client)}" local_admin_client="${local_admin_client:-$(which tezos-admin-client)}" local_alpha_baker="${local_alpha_baker:-$(which tezos-alpha-baker)}" + local_alpha_endorser="${local_alpha_endorser:-$(which tezos-alpha-endorser)}" + local_alpha_accuser="${local_alpha_accuser:-$(which tezos-alpha-accuser)}" local_signer="${local_signer:-$(which tezos-signer)}" fi @@ -279,6 +289,14 @@ main () { echo "exec $alpha_baker \"\$@\"" >> $client_dir/bin/tezos-alpha-baker chmod +x $client_dir/bin/tezos-alpha-baker + echo '#!/bin/sh' > $client_dir/bin/tezos-alpha-endorser + echo "exec $alpha_endorser \"\$@\"" >> $client_dir/bin/tezos-alpha-endorser + chmod +x $client_dir/bin/tezos-alpha-endorser + + echo '#!/bin/sh' > $client_dir/bin/tezos-alpha-accuser + echo "exec $alpha_accuser \"\$@\"" >> $client_dir/bin/tezos-alpha-accuser + chmod +x $client_dir/bin/tezos-alpha-accuser + echo '#!/bin/sh' > $client_dir/bin/tezos-signer echo "exec $signer \"\$@\"" >> $client_dir/bin/tezos-signer chmod +x $client_dir/bin/tezos-signer diff --git a/src/proto_alpha/bin_accuser/jbuild b/src/proto_alpha/bin_accuser/jbuild new file mode 100644 index 000000000..d03e06a60 --- /dev/null +++ b/src/proto_alpha/bin_accuser/jbuild @@ -0,0 +1,20 @@ +(jbuild_version 1) + +(executable + ((name main_accuser_alpha) + (public_name tezos-accuser-alpha) + (libraries (tezos-client-base-unix + tezos-client-commands + 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_client_commands + -open Tezos_baking_alpha_commands + -open Tezos_client_base_unix)))) + +(alias + ((name runtest_indent) + (deps ((glob_files *.ml{,i}))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/proto_alpha/bin_accuser/main_accuser_alpha.ml b/src/proto_alpha/bin_accuser/main_accuser_alpha.ml new file mode 100644 index 000000000..26e5c4ea3 --- /dev/null +++ b/src/proto_alpha/bin_accuser/main_accuser_alpha.ml @@ -0,0 +1,21 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2018. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +let () = + Client_commands.register Proto_alpha.hash @@ + List.map (Clic.map_command (new Proto_alpha.wrap_full)) @@ + Delegate_commands.accuser_commands () + +let select_commands _ _ = + return + (List.map + (Clic.map_command (new Proto_alpha.wrap_full)) + (Delegate_commands.accuser_commands ())) + +let () = Client_main_run.run select_commands diff --git a/src/proto_alpha/bin_accuser/tezos-accuser-alpha.opam b/src/proto_alpha/bin_accuser/tezos-accuser-alpha.opam new file mode 100644 index 000000000..ec53d8dbb --- /dev/null +++ b/src/proto_alpha/bin_accuser/tezos-accuser-alpha.opam @@ -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+beta20" } + "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 ] +] diff --git a/src/proto_alpha/bin_baker/jbuild b/src/proto_alpha/bin_baker/jbuild index e6a40ad74..a6fb777dd 100644 --- a/src/proto_alpha/bin_baker/jbuild +++ b/src/proto_alpha/bin_baker/jbuild @@ -4,11 +4,13 @@ ((name main_baker_alpha) (public_name tezos-baker-alpha) (libraries (tezos-client-base-unix + tezos-client-commands 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_client_commands -open Tezos_baking_alpha_commands -open Tezos_client_base_unix)))) diff --git a/src/proto_alpha/bin_baker/main_baker_alpha.ml b/src/proto_alpha/bin_baker/main_baker_alpha.ml index 4e91c4ba5..0b835f475 100644 --- a/src/proto_alpha/bin_baker/main_baker_alpha.ml +++ b/src/proto_alpha/bin_baker/main_baker_alpha.ml @@ -7,10 +7,15 @@ (* *) (**************************************************************************) +let () = + Client_commands.register Proto_alpha.hash @@ + List.map (Clic.map_command (new Proto_alpha.wrap_full)) @@ + Delegate_commands.delegate_commands () + let select_commands _ _ = return (List.map (Clic.map_command (new Proto_alpha.wrap_full)) - (Delegate_commands.commands ())) + (Delegate_commands.baker_commands ())) let () = Client_main_run.run select_commands diff --git a/src/proto_alpha/bin_endorser/jbuild b/src/proto_alpha/bin_endorser/jbuild new file mode 100644 index 000000000..52188d135 --- /dev/null +++ b/src/proto_alpha/bin_endorser/jbuild @@ -0,0 +1,20 @@ +(jbuild_version 1) + +(executable + ((name main_endorser_alpha) + (public_name tezos-endorser-alpha) + (libraries (tezos-client-base-unix + tezos-client-commands + 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_client_commands + -open Tezos_baking_alpha_commands + -open Tezos_client_base_unix)))) + +(alias + ((name runtest_indent) + (deps ((glob_files *.ml{,i}))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/proto_alpha/bin_endorser/main_endorser_alpha.ml b/src/proto_alpha/bin_endorser/main_endorser_alpha.ml new file mode 100644 index 000000000..3afdce630 --- /dev/null +++ b/src/proto_alpha/bin_endorser/main_endorser_alpha.ml @@ -0,0 +1,21 @@ +(**************************************************************************) +(* *) +(* Copyright (c) 2014 - 2018. *) +(* Dynamic Ledger Solutions, Inc. *) +(* *) +(* All rights reserved. No warranty, explicit or implicit, provided. *) +(* *) +(**************************************************************************) + +let () = + Client_commands.register Proto_alpha.hash @@ + List.map (Clic.map_command (new Proto_alpha.wrap_full)) @@ + Delegate_commands.delegate_commands () + +let select_commands _ _ = + return + (List.map + (Clic.map_command (new Proto_alpha.wrap_full)) + (Delegate_commands.endorser_commands ())) + +let () = Client_main_run.run select_commands diff --git a/src/proto_alpha/bin_endorser/tezos-endorser-alpha.opam b/src/proto_alpha/bin_endorser/tezos-endorser-alpha.opam new file mode 100644 index 000000000..ec53d8dbb --- /dev/null +++ b/src/proto_alpha/bin_endorser/tezos-endorser-alpha.opam @@ -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+beta20" } + "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 ] +] diff --git a/src/proto_alpha/lib_delegate/delegate_commands.ml b/src/proto_alpha/lib_delegate/delegate_commands.ml index 990bf8618..df43d5c79 100644 --- a/src/proto_alpha/lib_delegate/delegate_commands.ml +++ b/src/proto_alpha/lib_delegate/delegate_commands.ml @@ -14,44 +14,9 @@ let group = { Clic.name = "delegate" ; title = "Commands related to delegate operations." } -let commands () = +let delegate_commands () = let open Clic in [ - command ~group ~desc: "Launch a daemon that handles delegate operations." - (args1 max_priority_arg) - (prefixes [ "launch" ; "baker" ] - @@ seq_of_param Client_keys.Public_key_hash.alias_param) - (fun max_priority delegates cctxt -> - Client_daemon.Baker.run cctxt - ?max_priority - ~min_date:((Time.add (Time.now ()) (Int64.neg 1800L))) - (List.map snd delegates) - ) ; - - command ~group ~desc: "Launch the accuser daemon" - no_options - (prefixes [ "launch" ; "accuser" ] - @@ stop) - (fun () cctxt -> Client_daemon.Accuser.run cctxt) ; - - command ~group ~desc: "Launch the endorser daemon" - (args1 endorsement_delay_arg ) - (prefixes [ "launch" ; "endorser" ] - @@ seq_of_param Client_keys.Public_key_hash.alias_param) - (fun endorsement_delay delegates cctxt -> - Client_daemon.Endorser.run cctxt - ~delay:endorsement_delay - ~min_date:((Time.add (Time.now ()) (Int64.neg 1800L))) - (List.map snd delegates) - ) ; - - command ~group ~desc: "Forge and inject an endorsement operation." - no_options - (prefixes [ "endorse"; "for" ] - @@ Client_keys.Public_key_hash.source_param - ~name:"baker" ~desc: "name of the delegate owning the endorsement right" - @@ stop) - (fun () delegate cctxt -> endorse_block cctxt delegate) ; command ~group ~desc: "Forge and inject block using the delegate rights." (args3 max_priority_arg force_switch minimal_timestamp_switch) (prefixes [ "bake"; "for" ] @@ -73,4 +38,63 @@ let commands () = @@ stop) (fun () cctxt -> reveal_nonces cctxt ()) ; + command ~group ~desc: "Forge and inject an endorsement operation." + no_options + (prefixes [ "endorse"; "for" ] + @@ Client_keys.Public_key_hash.source_param + ~name:"baker" ~desc: "name of the delegate owning the endorsement right" + @@ stop) + (fun () delegate cctxt -> endorse_block cctxt delegate) ; + ] + +let baker_commands () = + let open Clic in + let group = + { Clic.name = "delegate.baker" ; + title = "Commands related to the baker daemon." } + in + [ + command ~group ~desc: "Launch a daemon that handles delegate operations." + (args1 max_priority_arg) + (prefixes [ "launch" ] + @@ seq_of_param Client_keys.Public_key_hash.alias_param) + (fun max_priority delegates cctxt -> + Client_daemon.Baker.run cctxt + ?max_priority + ~min_date:((Time.add (Time.now ()) (Int64.neg 1800L))) + (List.map snd delegates) + ) + ] + +let endorser_commands () = + let open Clic in + let group = + { Clic.name = "delegate.endorser" ; + title = "Commands related to endorser daemon." } + in + [ + command ~group ~desc: "Launch the endorser daemon" + (args1 endorsement_delay_arg ) + (prefixes [ "launch" ] + @@ seq_of_param Client_keys.Public_key_hash.alias_param) + (fun endorsement_delay delegates cctxt -> + Client_daemon.Endorser.run cctxt + ~delay:endorsement_delay + ~min_date:((Time.add (Time.now ()) (Int64.neg 1800L))) + (List.map snd delegates) + ) + ] + +let accuser_commands () = + let open Clic in + let group = + { Clic.name = "delegate.accuser" ; + title = "Commands related to the accuser daemon." } + in + [ + command ~group ~desc: "Launch the accuser daemon" + no_options + (prefixes [ "launch" ] + @@ stop) + (fun () cctxt -> Client_daemon.Accuser.run cctxt) ; ] diff --git a/src/proto_alpha/lib_delegate/delegate_commands.mli b/src/proto_alpha/lib_delegate/delegate_commands.mli index 1cbbf7f78..b86a7cc48 100644 --- a/src/proto_alpha/lib_delegate/delegate_commands.mli +++ b/src/proto_alpha/lib_delegate/delegate_commands.mli @@ -7,4 +7,8 @@ (* *) (**************************************************************************) -val commands: unit -> Proto_alpha.full Clic.command list +val delegate_commands : unit -> Proto_alpha.full Clic.command list + +val baker_commands : unit -> Proto_alpha.full Clic.command list +val endorser_commands : unit -> Proto_alpha.full Clic.command list +val accuser_commands : unit -> Proto_alpha.full Clic.command list diff --git a/src/proto_alpha/lib_delegate/delegate_commands_registration.ml b/src/proto_alpha/lib_delegate/delegate_commands_registration.ml index 0f7397525..efea65321 100644 --- a/src/proto_alpha/lib_delegate/delegate_commands_registration.ml +++ b/src/proto_alpha/lib_delegate/delegate_commands_registration.ml @@ -10,4 +10,4 @@ let () = Client_commands.register Proto_alpha.hash @@ List.map (Clic.map_command (new Proto_alpha.wrap_full)) @@ - Delegate_commands.commands () + Delegate_commands.delegate_commands () diff --git a/src/proto_alpha/lib_delegate/tezos-accuser-alpha-commands.opam b/src/proto_alpha/lib_delegate/tezos-accuser-alpha-commands.opam new file mode 100644 index 000000000..5ec4b6963 --- /dev/null +++ b/src/proto_alpha/lib_delegate/tezos-accuser-alpha-commands.opam @@ -0,0 +1,24 @@ +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+beta20" } + "tezos-base" + "tezos-protocol-environment" + "tezos-protocol-alpha" + "tezos-shell-services" + "tezos-client-base" + "tezos-client-commands" + "tezos-client-alpha" + "tezos-baking-alpha" + "tezos-signer-backends" { test } +] +build: [ + [ "jbuilder" "build" "-p" name "-j" jobs ] +] diff --git a/src/proto_alpha/lib_delegate/tezos-baker-alpha-commands.opam b/src/proto_alpha/lib_delegate/tezos-baker-alpha-commands.opam new file mode 100644 index 000000000..5ec4b6963 --- /dev/null +++ b/src/proto_alpha/lib_delegate/tezos-baker-alpha-commands.opam @@ -0,0 +1,24 @@ +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+beta20" } + "tezos-base" + "tezos-protocol-environment" + "tezos-protocol-alpha" + "tezos-shell-services" + "tezos-client-base" + "tezos-client-commands" + "tezos-client-alpha" + "tezos-baking-alpha" + "tezos-signer-backends" { test } +] +build: [ + [ "jbuilder" "build" "-p" name "-j" jobs ] +] diff --git a/src/proto_alpha/lib_delegate/tezos-endorser-alpha-commands.opam b/src/proto_alpha/lib_delegate/tezos-endorser-alpha-commands.opam new file mode 100644 index 000000000..5ec4b6963 --- /dev/null +++ b/src/proto_alpha/lib_delegate/tezos-endorser-alpha-commands.opam @@ -0,0 +1,24 @@ +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+beta20" } + "tezos-base" + "tezos-protocol-environment" + "tezos-protocol-alpha" + "tezos-shell-services" + "tezos-client-base" + "tezos-client-commands" + "tezos-client-alpha" + "tezos-baking-alpha" + "tezos-signer-backends" { test } +] +build: [ + [ "jbuilder" "build" "-p" name "-j" jobs ] +]