Everywhere: sed 's/picotez/nanotez/g'

This commit is contained in:
Vincent Bernardoff 2018-12-01 22:43:17 +01:00 committed by Benjamin Canou
parent 5693ac2fb3
commit f35b7f33ed
13 changed files with 137 additions and 137 deletions

View File

@ -132,7 +132,7 @@ init_contract_from_file () {
} }
bake () { bake () {
$client bake for bootstrap1 --max-priority 512 --minimal-timestamp --minimal-fees 0 --minimal-picotez-per-byte 0 --minimal-picotez-per-gas-unit 0 $client bake for bootstrap1 --max-priority 512 --minimal-timestamp --minimal-fees 0 --minimal-nanotez-per-byte 0 --minimal-nanotez-per-gas-unit 0
} }
bake_after () { bake_after () {

View File

@ -249,8 +249,8 @@ let max_priority_arg =
let default_minimal_fees = match Tez.of_mutez 100L with None -> assert false | Some t -> t let default_minimal_fees = match Tez.of_mutez 100L with None -> assert false | Some t -> t
let default_minimal_picotez_per_gas_unit = Z.of_int 100 let default_minimal_nanotez_per_gas_unit = Z.of_int 100
let default_minimal_picotez_per_byte = Z.of_int 1000 let default_minimal_nanotez_per_byte = Z.of_int 1000
let minimal_fees_arg = let minimal_fees_arg =
default_arg default_arg
@ -263,21 +263,21 @@ let minimal_fees_arg =
| Some t -> return t | Some t -> return t
| None -> fail (Bad_minimal_fees s))) | None -> fail (Bad_minimal_fees s)))
let minimal_picotez_per_gas_unit_arg = let minimal_nanotez_per_gas_unit_arg =
default_arg default_arg
~long:"minimal-picotez-per-gas-unit" ~long:"minimal-nanotez-per-gas-unit"
~placeholder:"amount" ~placeholder:"amount"
~doc:"exclude operations with fees per gas lower than this threshold (in picotez)" ~doc:"exclude operations with fees per gas lower than this threshold (in nanotez)"
~default:(Z.to_string default_minimal_picotez_per_gas_unit) ~default:(Z.to_string default_minimal_nanotez_per_gas_unit)
(parameter (fun _ s -> (parameter (fun _ s ->
try return (Z.of_string s) try return (Z.of_string s)
with _ -> fail (Bad_minimal_fees s))) with _ -> fail (Bad_minimal_fees s)))
let minimal_picotez_per_byte_arg = let minimal_nanotez_per_byte_arg =
default_arg default_arg
~long:"minimal-picotez-per-byte" ~long:"minimal-nanotez-per-byte"
~placeholder:"amount" ~placeholder:"amount"
~default:(Z.to_string default_minimal_picotez_per_byte) ~default:(Z.to_string default_minimal_nanotez_per_byte)
~doc:"exclude operations with fees per byte lower than this threshold (in tez)" ~doc:"exclude operations with fees per byte lower than this threshold (in tez)"
(parameter (fun _ s -> (parameter (fun _ s ->
try return (Z.of_string s) try return (Z.of_string s)

View File

@ -41,8 +41,8 @@ val delegatable_switch: (bool, Proto_alpha.full) Clic.arg
val spendable_switch: (bool, Proto_alpha.full) Clic.arg val spendable_switch: (bool, Proto_alpha.full) Clic.arg
val max_priority_arg: (int option, Proto_alpha.full) Clic.arg val max_priority_arg: (int option, Proto_alpha.full) Clic.arg
val minimal_fees_arg: (Tez.tez, Proto_alpha.full) Clic.arg val minimal_fees_arg: (Tez.tez, Proto_alpha.full) Clic.arg
val minimal_picotez_per_gas_unit_arg: (Z.t, Proto_alpha.full) Clic.arg val minimal_nanotez_per_gas_unit_arg: (Z.t, Proto_alpha.full) Clic.arg
val minimal_picotez_per_byte_arg: (Z.t, Proto_alpha.full) Clic.arg val minimal_nanotez_per_byte_arg: (Z.t, Proto_alpha.full) Clic.arg
val force_low_fee_arg: (bool, Proto_alpha.full) Clic.arg val force_low_fee_arg: (bool, Proto_alpha.full) Clic.arg
val fee_cap_arg: (Tez.t, Proto_alpha.full) Clic.arg val fee_cap_arg: (Tez.t, Proto_alpha.full) Clic.arg
val burn_cap_arg: (Tez.t, Proto_alpha.full) Clic.arg val burn_cap_arg: (Tez.t, Proto_alpha.full) Clic.arg

View File

@ -69,8 +69,8 @@ let get_manager_operation_gas_and_fee contents =
type fee_parameter = { type fee_parameter = {
minimal_fees: Tez.t ; minimal_fees: Tez.t ;
minimal_picotez_per_byte: Z.t ; minimal_nanotez_per_byte: Z.t ;
minimal_picotez_per_gas_unit: Z.t ; minimal_nanotez_per_gas_unit: Z.t ;
force_low_fee: bool ; force_low_fee: bool ;
fee_cap: Tez.t ; fee_cap: Tez.t ;
burn_cap: Tez.t ; burn_cap: Tez.t ;
@ -78,8 +78,8 @@ type fee_parameter = {
let dummy_fee_parameter = { let dummy_fee_parameter = {
minimal_fees = Tez.zero ; minimal_fees = Tez.zero ;
minimal_picotez_per_byte = Z.zero ; minimal_nanotez_per_byte = Z.zero ;
minimal_picotez_per_gas_unit = Z.zero ; minimal_nanotez_per_gas_unit = Z.zero ;
force_low_fee = false ; force_low_fee = false ;
fee_cap = Tez.one ; fee_cap = Tez.one ;
burn_cap = Tez.zero ; burn_cap = Tez.zero ;
@ -99,24 +99,24 @@ let check_fees
Tez.pp fee >>= fun () -> Tez.pp fee >>= fun () ->
exit 1 exit 1
else begin (* *) else begin (* *)
let fees_in_picotez = let fees_in_nanotez =
Z.mul (Z.of_int64 (Tez.to_mutez fee)) (Z.of_int 1000) in Z.mul (Z.of_int64 (Tez.to_mutez fee)) (Z.of_int 1000) in
let minimal_fees_in_picotez = let minimal_fees_in_nanotez =
Z.mul (Z.of_int64 (Tez.to_mutez config.minimal_fees)) (Z.of_int 1000) in Z.mul (Z.of_int64 (Tez.to_mutez config.minimal_fees)) (Z.of_int 1000) in
let minimal_fees_for_gas_in_picotez = let minimal_fees_for_gas_in_nanotez =
Z.mul config.minimal_picotez_per_gas_unit gas in Z.mul config.minimal_nanotez_per_gas_unit gas in
let minimal_fees_for_size_in_picotez = let minimal_fees_for_size_in_nanotez =
Z.mul config.minimal_picotez_per_byte (Z.of_int size) in Z.mul config.minimal_nanotez_per_byte (Z.of_int size) in
let estimated_fees_in_picotez = let estimated_fees_in_nanotez =
Z.add Z.add
minimal_fees_in_picotez minimal_fees_in_nanotez
(Z.add minimal_fees_for_gas_in_picotez minimal_fees_for_size_in_picotez) in (Z.add minimal_fees_for_gas_in_nanotez minimal_fees_for_size_in_nanotez) in
let estimated_fees = let estimated_fees =
match Tez.of_mutez (Z.to_int64 (Z.div (Z.add (Z.of_int 999) estimated_fees_in_picotez) (Z.of_int 1000))) with match Tez.of_mutez (Z.to_int64 (Z.div (Z.add (Z.of_int 999) estimated_fees_in_nanotez) (Z.of_int 1000))) with
| None -> assert false | None -> assert false
| Some fee -> fee in | Some fee -> fee in
if not config.force_low_fee && if not config.force_low_fee &&
Z.compare fees_in_picotez estimated_fees_in_picotez < 0 then begin Z.compare fees_in_nanotez estimated_fees_in_nanotez < 0 then begin
cctxt#error "The proposed fee (%s%a) are lower than the fee that baker \ cctxt#error "The proposed fee (%s%a) are lower than the fee that baker \
expect by default (%s%a).@\n\ expect by default (%s%a).@\n\
\ Use `--force-low-fee` to emit this operation anyway." \ Use `--force-low-fee` to emit this operation anyway."
@ -432,16 +432,16 @@ let may_patch_limits
Operation.contents_encoding Operation.contents_encoding
(Contents op) (Contents op)
in in
let minimal_fees_in_picotez = let minimal_fees_in_nanotez =
Z.mul (Z.of_int64 (Tez.to_mutez fee_parameter.minimal_fees)) (Z.of_int 1000) in Z.mul (Z.of_int64 (Tez.to_mutez fee_parameter.minimal_fees)) (Z.of_int 1000) in
let minimal_fees_for_gas_in_picotez = let minimal_fees_for_gas_in_nanotez =
Z.mul fee_parameter.minimal_picotez_per_gas_unit gas_limit in Z.mul fee_parameter.minimal_nanotez_per_gas_unit gas_limit in
let minimal_fees_for_size_in_picotez = let minimal_fees_for_size_in_nanotez =
Z.mul fee_parameter.minimal_picotez_per_byte (Z.of_int size) in Z.mul fee_parameter.minimal_nanotez_per_byte (Z.of_int size) in
let fees_in_picotez = let fees_in_nanotez =
Z.add minimal_fees_in_picotez @@ Z.add minimal_fees_in_nanotez @@
Z.add minimal_fees_for_gas_in_picotez minimal_fees_for_size_in_picotez in Z.add minimal_fees_for_gas_in_nanotez minimal_fees_for_size_in_nanotez in
match Tez.of_mutez (Z.to_int64 (Z.div (Z.add (Z.of_int 999) fees_in_picotez) (Z.of_int 1000))) with match Tez.of_mutez (Z.to_int64 (Z.div (Z.add (Z.of_int 999) fees_in_nanotez) (Z.of_int 1000))) with
| None -> assert false | None -> assert false
| Some fee -> return fee | Some fee -> return fee
else else

View File

@ -32,8 +32,8 @@ type 'kind preapply_result =
type fee_parameter = { type fee_parameter = {
minimal_fees: Tez.t ; minimal_fees: Tez.t ;
minimal_picotez_per_byte: Z.t ; minimal_nanotez_per_byte: Z.t ;
minimal_picotez_per_gas_unit: Z.t ; minimal_nanotez_per_gas_unit: Z.t ;
force_low_fee: bool ; force_low_fee: bool ;
fee_cap: Tez.t ; fee_cap: Tez.t ;
burn_cap: Tez.t ; burn_cap: Tez.t ;

View File

@ -226,8 +226,8 @@ let commands version () =
(args8 (args8
fee_arg dry_run_switch fee_arg dry_run_switch
minimal_fees_arg minimal_fees_arg
minimal_picotez_per_byte_arg minimal_nanotez_per_byte_arg
minimal_picotez_per_gas_unit_arg minimal_nanotez_per_gas_unit_arg
force_low_fee_arg force_low_fee_arg
fee_cap_arg fee_cap_arg
burn_cap_arg) burn_cap_arg)
@ -238,13 +238,13 @@ let commands version () =
~name: "mgr" ~desc: "new delegate of the contract" ~name: "mgr" ~desc: "new delegate of the contract"
@@ stop) @@ stop)
begin fun begin fun
(fee, dry_run, minimal_fees, minimal_picotez_per_byte, (fee, dry_run, minimal_fees, minimal_nanotez_per_byte,
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
(_, contract) (_, delegate) (cctxt : Proto_alpha.full) -> (_, contract) (_, delegate) (cctxt : Proto_alpha.full) ->
let fee_parameter = { let fee_parameter = {
Injection.minimal_fees ; Injection.minimal_fees ;
minimal_picotez_per_byte ; minimal_nanotez_per_byte ;
minimal_picotez_per_gas_unit ; minimal_nanotez_per_gas_unit ;
force_low_fee ; force_low_fee ;
fee_cap ; fee_cap ;
burn_cap ; burn_cap ;
@ -265,24 +265,24 @@ let commands version () =
(args8 (args8
fee_arg dry_run_switch fee_arg dry_run_switch
minimal_fees_arg minimal_fees_arg
minimal_picotez_per_byte_arg minimal_nanotez_per_byte_arg
minimal_picotez_per_gas_unit_arg minimal_nanotez_per_gas_unit_arg
force_low_fee_arg force_low_fee_arg
fee_cap_arg fee_cap_arg
burn_cap_arg) burn_cap_arg)
(prefixes [ "withdraw" ; "delegate" ; "from" ] (prefixes [ "withdraw" ; "delegate" ; "from" ]
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract" @@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
@@ stop) @@ stop)
begin fun (fee, dry_run, minimal_fees, minimal_picotez_per_byte, begin fun (fee, dry_run, minimal_fees, minimal_nanotez_per_byte,
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
(_, contract) (cctxt : Proto_alpha.full) -> (_, contract) (cctxt : Proto_alpha.full) ->
source_to_keys cctxt source_to_keys cctxt
~chain:`Main ~block:cctxt#block ~chain:`Main ~block:cctxt#block
contract >>=? fun (src_pk, manager_sk) -> contract >>=? fun (src_pk, manager_sk) ->
let fee_parameter = { let fee_parameter = {
Injection.minimal_fees ; Injection.minimal_fees ;
minimal_picotez_per_byte ; minimal_nanotez_per_byte ;
minimal_picotez_per_gas_unit ; minimal_nanotez_per_gas_unit ;
force_low_fee ; force_low_fee ;
fee_cap ; fee_cap ;
burn_cap ; burn_cap ;
@ -298,8 +298,8 @@ let commands version () =
command ~group ~desc:"Open a new account." command ~group ~desc:"Open a new account."
(args11 fee_arg dry_run_switch delegate_arg delegatable_switch (Client_keys.force_switch ()) (args11 fee_arg dry_run_switch delegate_arg delegatable_switch (Client_keys.force_switch ())
minimal_fees_arg minimal_fees_arg
minimal_picotez_per_byte_arg minimal_nanotez_per_byte_arg
minimal_picotez_per_gas_unit_arg minimal_nanotez_per_gas_unit_arg
force_low_fee_arg force_low_fee_arg
fee_cap_arg fee_cap_arg
burn_cap_arg) burn_cap_arg)
@ -316,8 +316,8 @@ let commands version () =
@@ ContractAlias.destination_param @@ ContractAlias.destination_param
~name:"src" ~desc: "name of the source contract" ~name:"src" ~desc: "name of the source contract"
@@ stop) @@ stop)
begin fun (fee, dry_run, delegate, delegatable, force, minimal_fees, minimal_picotez_per_byte, begin fun (fee, dry_run, delegate, delegatable, force, minimal_fees, minimal_nanotez_per_byte,
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
new_contract manager_pkh balance (_, source) (cctxt : Proto_alpha.full) -> new_contract manager_pkh balance (_, source) (cctxt : Proto_alpha.full) ->
RawContractAlias.of_fresh cctxt force new_contract >>=? fun alias_name -> RawContractAlias.of_fresh cctxt force new_contract >>=? fun alias_name ->
source_to_keys cctxt source_to_keys cctxt
@ -325,8 +325,8 @@ let commands version () =
source >>=? fun (src_pk, src_sk) -> source >>=? fun (src_pk, src_sk) ->
let fee_parameter = { let fee_parameter = {
Injection.minimal_fees ; Injection.minimal_fees ;
minimal_picotez_per_byte ; minimal_nanotez_per_byte ;
minimal_picotez_per_gas_unit ; minimal_nanotez_per_gas_unit ;
force_low_fee ; force_low_fee ;
fee_cap ; fee_cap ;
burn_cap ; burn_cap ;
@ -350,8 +350,8 @@ let commands version () =
dry_run_switch gas_limit_arg storage_limit_arg delegate_arg (Client_keys.force_switch ()) dry_run_switch gas_limit_arg storage_limit_arg delegate_arg (Client_keys.force_switch ())
delegatable_switch spendable_switch init_arg no_print_source_flag delegatable_switch spendable_switch init_arg no_print_source_flag
minimal_fees_arg minimal_fees_arg
minimal_picotez_per_byte_arg minimal_nanotez_per_byte_arg
minimal_picotez_per_gas_unit_arg minimal_nanotez_per_gas_unit_arg
force_low_fee_arg force_low_fee_arg
fee_cap_arg fee_cap_arg
burn_cap_arg) burn_cap_arg)
@ -372,7 +372,7 @@ let commands version () =
~name:"prg" ~desc: "script of the account\n\ ~name:"prg" ~desc: "script of the account\n\
Combine with -init if the storage type is not unit." Combine with -init if the storage type is not unit."
@@ stop) @@ stop)
begin fun (fee, dry_run, gas_limit, storage_limit, delegate, force, delegatable, spendable, initial_storage, no_print_source, minimal_fees, minimal_picotez_per_byte, minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) begin fun (fee, dry_run, gas_limit, storage_limit, delegate, force, delegatable, spendable, initial_storage, no_print_source, minimal_fees, minimal_nanotez_per_byte, minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
alias_name manager balance (_, source) program (cctxt : Proto_alpha.full) -> alias_name manager balance (_, source) program (cctxt : Proto_alpha.full) ->
RawContractAlias.of_fresh cctxt force alias_name >>=? fun alias_name -> RawContractAlias.of_fresh cctxt force alias_name >>=? fun alias_name ->
Lwt.return (Micheline_parser.no_parsing_error program) >>=? fun { expanded = code } -> Lwt.return (Micheline_parser.no_parsing_error program) >>=? fun { expanded = code } ->
@ -381,8 +381,8 @@ let commands version () =
source >>=? fun (src_pk, src_sk) -> source >>=? fun (src_pk, src_sk) ->
let fee_parameter = { let fee_parameter = {
Injection.minimal_fees ; Injection.minimal_fees ;
minimal_picotez_per_byte ; minimal_nanotez_per_byte ;
minimal_picotez_per_gas_unit ; minimal_nanotez_per_gas_unit ;
force_low_fee ; force_low_fee ;
fee_cap ; fee_cap ;
burn_cap ; burn_cap ;
@ -407,8 +407,8 @@ let commands version () =
command ~group ~desc: "Transfer tokens / call a smart contract." command ~group ~desc: "Transfer tokens / call a smart contract."
(args13 fee_arg dry_run_switch gas_limit_arg storage_limit_arg counter_arg arg_arg no_print_source_flag (args13 fee_arg dry_run_switch gas_limit_arg storage_limit_arg counter_arg arg_arg no_print_source_flag
minimal_fees_arg minimal_fees_arg
minimal_picotez_per_byte_arg minimal_nanotez_per_byte_arg
minimal_picotez_per_gas_unit_arg minimal_nanotez_per_gas_unit_arg
force_low_fee_arg force_low_fee_arg
fee_cap_arg fee_cap_arg
burn_cap_arg) burn_cap_arg)
@ -422,14 +422,14 @@ let commands version () =
@@ ContractAlias.destination_param @@ ContractAlias.destination_param
~name: "dst" ~desc: "name/literal of the destination contract" ~name: "dst" ~desc: "name/literal of the destination contract"
@@ stop) @@ stop)
begin fun (fee, dry_run, gas_limit, storage_limit, counter, arg, no_print_source, minimal_fees, minimal_picotez_per_byte, minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) amount (_, source) (_, destination) cctxt -> begin fun (fee, dry_run, gas_limit, storage_limit, counter, arg, no_print_source, minimal_fees, minimal_nanotez_per_byte, minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) amount (_, source) (_, destination) cctxt ->
source_to_keys cctxt source_to_keys cctxt
~chain:`Main ~block:cctxt#block ~chain:`Main ~block:cctxt#block
source >>=? fun (src_pk, src_sk) -> source >>=? fun (src_pk, src_sk) ->
let fee_parameter = { let fee_parameter = {
Injection.minimal_fees ; Injection.minimal_fees ;
minimal_picotez_per_byte ; minimal_nanotez_per_byte ;
minimal_picotez_per_gas_unit ; minimal_nanotez_per_gas_unit ;
force_low_fee ; force_low_fee ;
fee_cap ; fee_cap ;
burn_cap ; burn_cap ;
@ -448,8 +448,8 @@ let commands version () =
command ~group ~desc: "Reveal the public key of the contract manager." command ~group ~desc: "Reveal the public key of the contract manager."
(args7 fee_arg (args7 fee_arg
minimal_fees_arg minimal_fees_arg
minimal_picotez_per_byte_arg minimal_nanotez_per_byte_arg
minimal_picotez_per_gas_unit_arg minimal_nanotez_per_gas_unit_arg
force_low_fee_arg force_low_fee_arg
fee_cap_arg fee_cap_arg
burn_cap_arg) burn_cap_arg)
@ -457,15 +457,15 @@ let commands version () =
@@ ContractAlias.alias_param @@ ContractAlias.alias_param
~name: "src" ~desc: "name of the source contract" ~name: "src" ~desc: "name of the source contract"
@@ stop) @@ stop)
begin fun (fee, minimal_fees, minimal_picotez_per_byte, begin fun (fee, minimal_fees, minimal_nanotez_per_byte,
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) (_, source) cctxt -> minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) (_, source) cctxt ->
source_to_keys cctxt source_to_keys cctxt
~chain:`Main ~block:cctxt#block ~chain:`Main ~block:cctxt#block
source >>=? fun (src_pk, src_sk) -> source >>=? fun (src_pk, src_sk) ->
let fee_parameter = { let fee_parameter = {
Injection.minimal_fees ; Injection.minimal_fees ;
minimal_picotez_per_byte ; minimal_nanotez_per_byte ;
minimal_picotez_per_gas_unit ; minimal_nanotez_per_gas_unit ;
force_low_fee ; force_low_fee ;
fee_cap ; fee_cap ;
burn_cap ; burn_cap ;
@ -481,8 +481,8 @@ let commands version () =
command ~group ~desc: "Register the public key hash as a delegate." command ~group ~desc: "Register the public key hash as a delegate."
(args8 fee_arg dry_run_switch (args8 fee_arg dry_run_switch
minimal_fees_arg minimal_fees_arg
minimal_picotez_per_byte_arg minimal_nanotez_per_byte_arg
minimal_picotez_per_gas_unit_arg minimal_nanotez_per_gas_unit_arg
force_low_fee_arg force_low_fee_arg
fee_cap_arg fee_cap_arg
burn_cap_arg) burn_cap_arg)
@ -491,13 +491,13 @@ let commands version () =
~name: "mgr" ~desc: "the delegate key" ~name: "mgr" ~desc: "the delegate key"
@@ prefixes [ "as" ; "delegate" ] @@ prefixes [ "as" ; "delegate" ]
@@ stop) @@ stop)
begin fun (fee, dry_run, minimal_fees, minimal_picotez_per_byte, begin fun (fee, dry_run, minimal_fees, minimal_nanotez_per_byte,
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) src_pkh cctxt -> minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) src_pkh cctxt ->
Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) ->
let fee_parameter = { let fee_parameter = {
Injection.minimal_fees ; Injection.minimal_fees ;
minimal_picotez_per_byte ; minimal_nanotez_per_byte ;
minimal_picotez_per_gas_unit ; minimal_nanotez_per_gas_unit ;
force_low_fee ; force_low_fee ;
fee_cap ; fee_cap ;
burn_cap ; burn_cap ;

View File

@ -41,8 +41,8 @@ let managers_index = 3
let default_max_priority = 64 let default_max_priority = 64
let default_minimal_fees = Tez.zero let default_minimal_fees = Tez.zero
let default_minimal_picotez_per_gas_unit = Z.of_int 10000 let default_minimal_nanotez_per_gas_unit = Z.of_int 10000
let default_minimal_picotez_per_byte = Z.zero let default_minimal_nanotez_per_byte = Z.zero
let default_await_endorsements = true let default_await_endorsements = true
type state = { type state = {
@ -56,9 +56,9 @@ type state = {
(* Minimal operation fee required to include an operation in a block *) (* Minimal operation fee required to include an operation in a block *)
minimal_fees : Tez.t ; minimal_fees : Tez.t ;
(* Minimal operation fee per gas required to include an operation in a block *) (* Minimal operation fee per gas required to include an operation in a block *)
minimal_picotez_per_gas_unit : Z.t ; minimal_nanotez_per_gas_unit : Z.t ;
(* Minimal operation fee per byte required to include an operation in a block *) (* Minimal operation fee per byte required to include an operation in a block *)
minimal_picotez_per_byte : Z.t ; minimal_nanotez_per_byte : Z.t ;
(* Await endorsements *) (* Await endorsements *)
await_endorsements: bool ; await_endorsements: bool ;
(* truly mutable *) (* truly mutable *)
@ -67,8 +67,8 @@ type state = {
let create_state let create_state
?(minimal_fees = default_minimal_fees) ?(minimal_fees = default_minimal_fees)
?(minimal_picotez_per_gas_unit = default_minimal_picotez_per_gas_unit) ?(minimal_nanotez_per_gas_unit = default_minimal_nanotez_per_gas_unit)
?(minimal_picotez_per_byte = default_minimal_picotez_per_byte) ?(minimal_nanotez_per_byte = default_minimal_nanotez_per_byte)
?(await_endorsements = default_await_endorsements) ?(await_endorsements = default_await_endorsements)
genesis context_path index delegates constants = genesis context_path index delegates constants =
{ genesis ; { genesis ;
@ -77,8 +77,8 @@ let create_state
delegates ; delegates ;
constants ; constants ;
minimal_fees ; minimal_fees ;
minimal_picotez_per_gas_unit ; minimal_nanotez_per_gas_unit ;
minimal_picotez_per_byte ; minimal_nanotez_per_byte ;
await_endorsements ; await_endorsements ;
best_slot = None ; best_slot = None ;
} }
@ -197,8 +197,8 @@ let sort_manager_operations
~max_size ~max_size
~hard_gas_limit_per_block ~hard_gas_limit_per_block
~minimal_fees ~minimal_fees
~minimal_picotez_per_gas_unit ~minimal_nanotez_per_gas_unit
~minimal_picotez_per_byte ~minimal_nanotez_per_byte
(operations : Proto_alpha.operation list) = (operations : Proto_alpha.operation list) =
let compute_weight op (fee, gas) = let compute_weight op (fee, gas) =
let size = Data_encoding.Binary.length Operation.encoding op in let size = Data_encoding.Binary.length Operation.encoding op in
@ -217,16 +217,16 @@ let sort_manager_operations
else else
let (size, gas, _ratio) as weight = compute_weight op (fee, gas) in let (size, gas, _ratio) as weight = compute_weight op (fee, gas) in
let open Alpha_environment in let open Alpha_environment in
let fees_in_picotez = let fees_in_nanotez =
Z.mul (Z.of_int64 (Tez.to_mutez fee)) (Z.of_int 1000) in Z.mul (Z.of_int64 (Tez.to_mutez fee)) (Z.of_int 1000) in
let enough_fees_for_gas = let enough_fees_for_gas =
let minimal_fees_in_picotez = let minimal_fees_in_nanotez =
Z.mul minimal_picotez_per_gas_unit gas in Z.mul minimal_nanotez_per_gas_unit gas in
Z.compare minimal_fees_in_picotez fees_in_picotez <= 0 in Z.compare minimal_fees_in_nanotez fees_in_nanotez <= 0 in
let enough_fees_for_size = let enough_fees_for_size =
let minimal_fees_in_picotez = let minimal_fees_in_nanotez =
Z.mul minimal_picotez_per_byte (Z.of_int size) in Z.mul minimal_nanotez_per_byte (Z.of_int size) in
Z.compare minimal_fees_in_picotez fees_in_picotez <= 0 in Z.compare minimal_fees_in_nanotez fees_in_nanotez <= 0 in
if enough_fees_for_size && enough_fees_for_gas then if enough_fees_for_size && enough_fees_for_gas then
return_some (op, weight) return_some (op, weight)
else else
@ -290,8 +290,8 @@ let classify_operations
~block ~block
~hard_gas_limit_per_block ~hard_gas_limit_per_block
~minimal_fees ~minimal_fees
~minimal_picotez_per_gas_unit ~minimal_nanotez_per_gas_unit
~minimal_picotez_per_byte ~minimal_nanotez_per_byte
(ops: Proto_alpha.operation list) = (ops: Proto_alpha.operation list) =
Alpha_block_services.live_blocks cctxt ~chain:`Main ~block () Alpha_block_services.live_blocks cctxt ~chain:`Main ~block ()
>>=? fun live_blocks -> >>=? fun live_blocks ->
@ -318,8 +318,8 @@ let classify_operations
~max_size ~max_size
~hard_gas_limit_per_block ~hard_gas_limit_per_block
~minimal_fees ~minimal_fees
~minimal_picotez_per_gas_unit ~minimal_nanotez_per_gas_unit
~minimal_picotez_per_byte ~minimal_nanotez_per_byte
manager_operations manager_operations
>>=? fun ordered_operations -> >>=? fun ordered_operations ->
(* Greedy heuristic *) (* Greedy heuristic *)
@ -581,8 +581,8 @@ let forge_block
?(best_effort = operations = None) ?(best_effort = operations = None)
?(sort = best_effort) ?(sort = best_effort)
?(minimal_fees = default_minimal_fees) ?(minimal_fees = default_minimal_fees)
?(minimal_picotez_per_gas_unit = default_minimal_picotez_per_gas_unit) ?(minimal_nanotez_per_gas_unit = default_minimal_nanotez_per_gas_unit)
?(minimal_picotez_per_byte = default_minimal_picotez_per_byte) ?(minimal_nanotez_per_byte = default_minimal_nanotez_per_byte)
?(await_endorsements = default_await_endorsements) ?(await_endorsements = default_await_endorsements)
?timestamp ?timestamp
?mempool ?mempool
@ -605,8 +605,8 @@ let forge_block
~hard_gas_limit_per_block ~hard_gas_limit_per_block
~block:block ~block:block
~minimal_fees ~minimal_fees
~minimal_picotez_per_gas_unit ~minimal_nanotez_per_gas_unit
~minimal_picotez_per_byte ~minimal_nanotez_per_byte
operations_arg operations_arg
>>=? fun (operations, overflowing_ops) -> >>=? fun (operations, overflowing_ops) ->
(* Ensure that we retain operations up to the quota *) (* Ensure that we retain operations up to the quota *)
@ -656,8 +656,8 @@ let forge_block
best_slot = None ; best_slot = None ;
await_endorsements ; await_endorsements ;
minimal_fees = default_minimal_fees ; minimal_fees = default_minimal_fees ;
minimal_picotez_per_gas_unit = default_minimal_picotez_per_gas_unit ; minimal_nanotez_per_gas_unit = default_minimal_nanotez_per_gas_unit ;
minimal_picotez_per_byte = default_minimal_picotez_per_byte ; minimal_nanotez_per_byte = default_minimal_nanotez_per_byte ;
} in } in
filter_and_apply_operations ~timestamp ~protocol_data state bi (operations, overflowing_ops) filter_and_apply_operations ~timestamp ~protocol_data state bi (operations, overflowing_ops)
>>=? fun (final_context, validation_result, operations) -> >>=? fun (final_context, validation_result, operations) ->
@ -897,8 +897,8 @@ let build_block
classify_operations cctxt classify_operations cctxt
~hard_gas_limit_per_block ~hard_gas_limit_per_block
~minimal_fees:state.minimal_fees ~minimal_fees:state.minimal_fees
~minimal_picotez_per_gas_unit:state.minimal_picotez_per_gas_unit ~minimal_nanotez_per_gas_unit:state.minimal_nanotez_per_gas_unit
~minimal_picotez_per_byte:state.minimal_picotez_per_byte ~minimal_nanotez_per_byte:state.minimal_nanotez_per_byte
~block operations ~block operations
>>=? fun (operations, overflowing_ops) -> >>=? fun (operations, overflowing_ops) ->
let next_version = let next_version =
@ -1182,8 +1182,8 @@ let reveal_potential_nonces cctxt new_head =
let create let create
(cctxt : #Proto_alpha.full) (cctxt : #Proto_alpha.full)
?minimal_fees ?minimal_fees
?minimal_picotez_per_gas_unit ?minimal_nanotez_per_gas_unit
?minimal_picotez_per_byte ?minimal_nanotez_per_byte
?await_endorsements ?await_endorsements
?max_priority ?max_priority
~context_path ~context_path
@ -1195,7 +1195,7 @@ let create
Client_baking_simulator.load_context ~context_path >>= fun index -> Client_baking_simulator.load_context ~context_path >>= fun index ->
Client_baking_simulator.check_context_consistency index bi.context >>=? fun () -> Client_baking_simulator.check_context_consistency index bi.context >>=? fun () ->
let state = create_state let state = create_state
?minimal_fees ?minimal_picotez_per_gas_unit ?minimal_picotez_per_byte ?minimal_fees ?minimal_nanotez_per_gas_unit ?minimal_nanotez_per_byte
?await_endorsements ?await_endorsements
genesis_hash context_path index delegates constants in genesis_hash context_path index delegates constants in
return state return state

View File

@ -72,8 +72,8 @@ val forge_block:
?best_effort:bool -> ?best_effort:bool ->
?sort:bool -> ?sort:bool ->
?minimal_fees: Tez.t -> ?minimal_fees: Tez.t ->
?minimal_picotez_per_gas_unit: Z.t -> ?minimal_nanotez_per_gas_unit: Z.t ->
?minimal_picotez_per_byte: Z.t -> ?minimal_nanotez_per_byte: Z.t ->
?await_endorsements: bool -> ?await_endorsements: bool ->
?timestamp:Time.t -> ?timestamp:Time.t ->
?mempool:string -> ?mempool:string ->
@ -107,8 +107,8 @@ val forge_block:
val create: val create:
#Proto_alpha.full -> #Proto_alpha.full ->
?minimal_fees: Tez.t -> ?minimal_fees: Tez.t ->
?minimal_picotez_per_gas_unit: Z.t -> ?minimal_nanotez_per_gas_unit: Z.t ->
?minimal_picotez_per_byte: Z.t -> ?minimal_nanotez_per_byte: Z.t ->
?await_endorsements: bool -> ?await_endorsements: bool ->
?max_priority: int -> ?max_priority: int ->
context_path: string -> context_path: string ->

View File

@ -30,8 +30,8 @@ let bake_block
(cctxt : #Proto_alpha.full) (cctxt : #Proto_alpha.full)
?(chain = `Main) ?(chain = `Main)
?minimal_fees ?minimal_fees
?minimal_picotez_per_gas_unit ?minimal_nanotez_per_gas_unit
?minimal_picotez_per_byte ?minimal_nanotez_per_byte
?(await_endorsements = false) ?(await_endorsements = false)
?force ?force
?max_priority ?max_priority
@ -68,8 +68,8 @@ let bake_block
Client_baking_forge.forge_block cctxt Client_baking_forge.forge_block cctxt
?force ?force
?minimal_fees ?minimal_fees
?minimal_picotez_per_gas_unit ?minimal_nanotez_per_gas_unit
?minimal_picotez_per_byte ?minimal_nanotez_per_byte
~await_endorsements ~await_endorsements
?timestamp:(if minimal_timestamp then None else Some (Time.now ())) ?timestamp:(if minimal_timestamp then None else Some (Time.now ()))
?seed_nonce_hash ?seed_nonce_hash

View File

@ -31,8 +31,8 @@ val bake_block:
#Proto_alpha.full -> #Proto_alpha.full ->
?chain:Chain_services.chain -> ?chain:Chain_services.chain ->
?minimal_fees: Tez.t -> ?minimal_fees: Tez.t ->
?minimal_picotez_per_gas_unit: Z.t -> ?minimal_nanotez_per_gas_unit: Z.t ->
?minimal_picotez_per_byte: Z.t -> ?minimal_nanotez_per_byte: Z.t ->
?await_endorsements: bool -> ?await_endorsements: bool ->
?force:bool -> ?force:bool ->
?max_priority: int -> ?max_priority: int ->

View File

@ -49,8 +49,8 @@ module Baker = struct
let run let run
(cctxt : #Proto_alpha.full) (cctxt : #Proto_alpha.full)
?minimal_fees ?minimal_fees
?minimal_picotez_per_gas_unit ?minimal_nanotez_per_gas_unit
?minimal_picotez_per_byte ?minimal_nanotez_per_byte
?await_endorsements ?await_endorsements
?max_priority ?max_priority
~context_path ~context_path
@ -62,8 +62,8 @@ module Baker = struct
cctxt#message "Baker started." >>= fun () -> cctxt#message "Baker started." >>= fun () ->
Client_baking_forge.create cctxt Client_baking_forge.create cctxt
?minimal_fees ?minimal_fees
?minimal_picotez_per_gas_unit ?minimal_nanotez_per_gas_unit
?minimal_picotez_per_byte ?minimal_nanotez_per_byte
?await_endorsements ?await_endorsements
?max_priority ?max_priority
~context_path delegates block_stream >>=? fun () -> ~context_path delegates block_stream >>=? fun () ->

View File

@ -37,8 +37,8 @@ module Baker : sig
val run: val run:
#Proto_alpha.full -> #Proto_alpha.full ->
?minimal_fees: Tez.t -> ?minimal_fees: Tez.t ->
?minimal_picotez_per_gas_unit: Z.t -> ?minimal_nanotez_per_gas_unit: Z.t ->
?minimal_picotez_per_byte: Z.t -> ?minimal_nanotez_per_byte: Z.t ->
?await_endorsements: bool -> ?await_endorsements: bool ->
?max_priority: int -> ?max_priority: int ->
context_path: string -> context_path: string ->

View File

@ -58,8 +58,8 @@ let delegate_commands () =
(args9 (args9
max_priority_arg max_priority_arg
minimal_fees_arg minimal_fees_arg
minimal_picotez_per_gas_unit_arg minimal_nanotez_per_gas_unit_arg
minimal_picotez_per_byte_arg minimal_nanotez_per_byte_arg
await_endorsements_arg await_endorsements_arg
force_switch force_switch
minimal_timestamp_switch minimal_timestamp_switch
@ -70,14 +70,14 @@ let delegate_commands () =
~name:"baker" ~desc: "name of the delegate owning the baking right" ~name:"baker" ~desc: "name of the delegate owning the baking right"
@@ stop) @@ stop)
(fun (max_priority, minimal_fees, (fun (max_priority, minimal_fees,
minimal_picotez_per_gas_unit, minimal_picotez_per_byte, minimal_nanotez_per_gas_unit, minimal_nanotez_per_byte,
await_endorsements, force, await_endorsements, force,
minimal_timestamp, mempool, context_path) minimal_timestamp, mempool, context_path)
delegate cctxt -> delegate cctxt ->
bake_block cctxt cctxt#block bake_block cctxt cctxt#block
~minimal_fees ~minimal_fees
~minimal_picotez_per_gas_unit ~minimal_nanotez_per_gas_unit
~minimal_picotez_per_byte ~minimal_nanotez_per_byte
~await_endorsements ~await_endorsements
~force ?max_priority ~minimal_timestamp ~force ?max_priority ~minimal_timestamp
?mempool ?context_path delegate) ; ?mempool ?context_path delegate) ;
@ -113,8 +113,8 @@ let baker_commands () =
(args5 (args5
max_priority_arg max_priority_arg
minimal_fees_arg minimal_fees_arg
minimal_picotez_per_gas_unit_arg minimal_nanotez_per_gas_unit_arg
minimal_picotez_per_byte_arg minimal_nanotez_per_byte_arg
no_waiting_for_endorsements_arg) no_waiting_for_endorsements_arg)
(prefixes [ "run" ; "with" ; "local" ; "node" ] (prefixes [ "run" ; "with" ; "local" ; "node" ]
@@ param @@ param
@ -122,15 +122,15 @@ let baker_commands () =
~desc:"Path to the node data directory (e.g. $HOME/.tezos-node)" ~desc:"Path to the node data directory (e.g. $HOME/.tezos-node)"
directory_parameter directory_parameter
@@ seq_of_param Client_keys.Public_key_hash.alias_param) @@ seq_of_param Client_keys.Public_key_hash.alias_param)
(fun (max_priority, minimal_fees, minimal_picotez_per_gas_unit, (fun (max_priority, minimal_fees, minimal_nanotez_per_gas_unit,
minimal_picotez_per_byte, no_waiting_for_endorsements) minimal_nanotez_per_byte, no_waiting_for_endorsements)
node_path delegates cctxt -> node_path delegates cctxt ->
Tezos_signer_backends.Encrypted.decrypt_list Tezos_signer_backends.Encrypted.decrypt_list
cctxt (List.map fst delegates) >>=? fun () -> cctxt (List.map fst delegates) >>=? fun () ->
Client_daemon.Baker.run cctxt Client_daemon.Baker.run cctxt
~minimal_fees ~minimal_fees
~minimal_picotez_per_gas_unit ~minimal_nanotez_per_gas_unit
~minimal_picotez_per_byte ~minimal_nanotez_per_byte
?max_priority ?max_priority
~await_endorsements:(not no_waiting_for_endorsements) ~await_endorsements:(not no_waiting_for_endorsements)
~context_path:(Filename.concat node_path "context") ~context_path:(Filename.concat node_path "context")