2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
open Client_proto_args
|
2017-11-07 20:38:11 +04:00
|
|
|
open Client_baking_lib
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-12-03 16:05:02 +04:00
|
|
|
let group =
|
|
|
|
{ Cli_entries.name = "delegate" ;
|
|
|
|
title = "Commands related to delegate operations." }
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
let commands () =
|
|
|
|
let open Cli_entries in
|
|
|
|
[
|
2016-12-03 16:05:02 +04:00
|
|
|
command ~group ~desc: "Launch a daemon that handles delegate operations."
|
2017-09-19 13:31:35 +04:00
|
|
|
(args5 max_priority_arg endorsement_delay_arg
|
2017-11-13 19:34:00 +04:00
|
|
|
Daemon.baking_switch Daemon.endorsement_switch Daemon.denunciation_switch)
|
2016-09-08 21:13:10 +04:00
|
|
|
(prefixes [ "launch" ; "daemon" ]
|
2017-09-19 13:31:35 +04:00
|
|
|
@@ seq_of_param Client_keys.Public_key_hash.alias_param)
|
2017-11-01 15:07:33 +04:00
|
|
|
(fun (max_priority, endorsement_delay, baking, endorsement, denunciation) delegates cctxt ->
|
|
|
|
let (endorsement, baking, denunciation) =
|
|
|
|
if (not endorsement) && (not baking) && (not denunciation)
|
2017-09-19 13:31:35 +04:00
|
|
|
then (true, true, true)
|
2017-11-01 15:07:33 +04:00
|
|
|
else (endorsement, baking, denunciation) in
|
2017-11-07 20:38:11 +04:00
|
|
|
run_daemon cctxt ?max_priority ~endorsement_delay ~endorsement ~baking ~denunciation delegates) ;
|
2016-12-03 16:05:02 +04:00
|
|
|
command ~group ~desc: "Forge and inject an endorsement operation"
|
2017-09-19 13:31:35 +04:00
|
|
|
(args2 force_switch max_priority_arg)
|
2016-09-08 21:13:10 +04:00
|
|
|
(prefixes [ "endorse"; "for" ]
|
|
|
|
@@ Client_keys.Public_key_hash.alias_param
|
2017-11-06 17:12:19 +04:00
|
|
|
~name:"baker" ~desc: "name of the delegate owning the endorsement right"
|
2016-09-08 21:13:10 +04:00
|
|
|
@@ stop)
|
2017-09-19 13:31:35 +04:00
|
|
|
(fun (force, max_priority) (_, delegate) cctxt ->
|
2016-12-03 16:05:02 +04:00
|
|
|
endorse_block cctxt
|
2017-09-19 13:31:35 +04:00
|
|
|
~force ?max_priority delegate) ;
|
2016-12-03 16:05:02 +04:00
|
|
|
command ~group ~desc: "Forge and inject block using the delegate rights"
|
2017-11-01 15:07:33 +04:00
|
|
|
(args3 max_priority_arg force_switch free_baking_switch)
|
2017-11-20 06:37:06 +04:00
|
|
|
(prefixes [ "bake"; "for" ]
|
2016-09-08 21:13:10 +04:00
|
|
|
@@ Client_keys.Public_key_hash.alias_param
|
2017-11-06 17:12:19 +04:00
|
|
|
~name:"baker" ~desc: "name of the delegate owning the baking right"
|
2016-09-08 21:13:10 +04:00
|
|
|
@@ stop)
|
2017-11-01 15:07:33 +04:00
|
|
|
(fun (max_priority, force, free_baking) (_, delegate) cctxt ->
|
2017-11-07 20:38:11 +04:00
|
|
|
bake_block cctxt cctxt#block
|
2017-11-01 15:07:33 +04:00
|
|
|
~force ?max_priority ~free_baking delegate) ;
|
2016-12-03 16:05:02 +04:00
|
|
|
command ~group ~desc: "Forge and inject a seed-nonce revelation operation"
|
2017-09-19 13:31:35 +04:00
|
|
|
(args1 force_switch)
|
2016-09-08 21:13:10 +04:00
|
|
|
(prefixes [ "reveal"; "nonce"; "for" ]
|
2017-09-19 13:31:35 +04:00
|
|
|
@@ seq_of_param Block_hash.param)
|
|
|
|
(fun force block_hashes cctxt ->
|
2016-12-03 16:05:02 +04:00
|
|
|
reveal_block_nonces cctxt
|
2017-09-19 13:31:35 +04:00
|
|
|
~force block_hashes) ;
|
2016-12-03 16:05:02 +04:00
|
|
|
command ~group ~desc: "Forge and inject redemption operations"
|
2017-09-19 13:31:35 +04:00
|
|
|
(args1 force_switch)
|
2016-09-08 21:13:10 +04:00
|
|
|
(prefixes [ "reveal"; "nonces" ]
|
|
|
|
@@ stop)
|
2017-09-19 13:31:35 +04:00
|
|
|
(fun force cctxt ->
|
|
|
|
reveal_nonces cctxt ~force ()) ;
|
2016-09-08 21:13:10 +04:00
|
|
|
]
|