Everywhere: sed 's/picotez/nanotez/g'
This commit is contained in:
parent
5693ac2fb3
commit
f35b7f33ed
@ -132,7 +132,7 @@ init_contract_from_file () {
|
||||
}
|
||||
|
||||
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 () {
|
||||
|
@ -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_picotez_per_gas_unit = Z.of_int 100
|
||||
let default_minimal_picotez_per_byte = Z.of_int 1000
|
||||
let default_minimal_nanotez_per_gas_unit = Z.of_int 100
|
||||
let default_minimal_nanotez_per_byte = Z.of_int 1000
|
||||
|
||||
let minimal_fees_arg =
|
||||
default_arg
|
||||
@ -263,21 +263,21 @@ let minimal_fees_arg =
|
||||
| Some t -> return t
|
||||
| None -> fail (Bad_minimal_fees s)))
|
||||
|
||||
let minimal_picotez_per_gas_unit_arg =
|
||||
let minimal_nanotez_per_gas_unit_arg =
|
||||
default_arg
|
||||
~long:"minimal-picotez-per-gas-unit"
|
||||
~long:"minimal-nanotez-per-gas-unit"
|
||||
~placeholder:"amount"
|
||||
~doc:"exclude operations with fees per gas lower than this threshold (in picotez)"
|
||||
~default:(Z.to_string default_minimal_picotez_per_gas_unit)
|
||||
~doc:"exclude operations with fees per gas lower than this threshold (in nanotez)"
|
||||
~default:(Z.to_string default_minimal_nanotez_per_gas_unit)
|
||||
(parameter (fun _ s ->
|
||||
try return (Z.of_string s)
|
||||
with _ -> fail (Bad_minimal_fees s)))
|
||||
|
||||
let minimal_picotez_per_byte_arg =
|
||||
let minimal_nanotez_per_byte_arg =
|
||||
default_arg
|
||||
~long:"minimal-picotez-per-byte"
|
||||
~long:"minimal-nanotez-per-byte"
|
||||
~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)"
|
||||
(parameter (fun _ s ->
|
||||
try return (Z.of_string s)
|
||||
|
@ -41,8 +41,8 @@ val delegatable_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 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_picotez_per_byte_arg: (Z.t, Proto_alpha.full) Clic.arg
|
||||
val minimal_nanotez_per_gas_unit_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 fee_cap_arg: (Tez.t, Proto_alpha.full) Clic.arg
|
||||
val burn_cap_arg: (Tez.t, Proto_alpha.full) Clic.arg
|
||||
|
@ -69,8 +69,8 @@ let get_manager_operation_gas_and_fee contents =
|
||||
|
||||
type fee_parameter = {
|
||||
minimal_fees: Tez.t ;
|
||||
minimal_picotez_per_byte: Z.t ;
|
||||
minimal_picotez_per_gas_unit: Z.t ;
|
||||
minimal_nanotez_per_byte: Z.t ;
|
||||
minimal_nanotez_per_gas_unit: Z.t ;
|
||||
force_low_fee: bool ;
|
||||
fee_cap: Tez.t ;
|
||||
burn_cap: Tez.t ;
|
||||
@ -78,8 +78,8 @@ type fee_parameter = {
|
||||
|
||||
let dummy_fee_parameter = {
|
||||
minimal_fees = Tez.zero ;
|
||||
minimal_picotez_per_byte = Z.zero ;
|
||||
minimal_picotez_per_gas_unit = Z.zero ;
|
||||
minimal_nanotez_per_byte = Z.zero ;
|
||||
minimal_nanotez_per_gas_unit = Z.zero ;
|
||||
force_low_fee = false ;
|
||||
fee_cap = Tez.one ;
|
||||
burn_cap = Tez.zero ;
|
||||
@ -99,24 +99,24 @@ let check_fees
|
||||
Tez.pp fee >>= fun () ->
|
||||
exit 1
|
||||
else begin (* *)
|
||||
let fees_in_picotez =
|
||||
let fees_in_nanotez =
|
||||
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
|
||||
let minimal_fees_for_gas_in_picotez =
|
||||
Z.mul config.minimal_picotez_per_gas_unit gas in
|
||||
let minimal_fees_for_size_in_picotez =
|
||||
Z.mul config.minimal_picotez_per_byte (Z.of_int size) in
|
||||
let estimated_fees_in_picotez =
|
||||
let minimal_fees_for_gas_in_nanotez =
|
||||
Z.mul config.minimal_nanotez_per_gas_unit gas in
|
||||
let minimal_fees_for_size_in_nanotez =
|
||||
Z.mul config.minimal_nanotez_per_byte (Z.of_int size) in
|
||||
let estimated_fees_in_nanotez =
|
||||
Z.add
|
||||
minimal_fees_in_picotez
|
||||
(Z.add minimal_fees_for_gas_in_picotez minimal_fees_for_size_in_picotez) in
|
||||
minimal_fees_in_nanotez
|
||||
(Z.add minimal_fees_for_gas_in_nanotez minimal_fees_for_size_in_nanotez) in
|
||||
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
|
||||
| Some fee -> fee in
|
||||
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 \
|
||||
expect by default (%s%a).@\n\
|
||||
\ Use `--force-low-fee` to emit this operation anyway."
|
||||
@ -432,16 +432,16 @@ let may_patch_limits
|
||||
Operation.contents_encoding
|
||||
(Contents op)
|
||||
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
|
||||
let minimal_fees_for_gas_in_picotez =
|
||||
Z.mul fee_parameter.minimal_picotez_per_gas_unit gas_limit in
|
||||
let minimal_fees_for_size_in_picotez =
|
||||
Z.mul fee_parameter.minimal_picotez_per_byte (Z.of_int size) in
|
||||
let fees_in_picotez =
|
||||
Z.add minimal_fees_in_picotez @@
|
||||
Z.add minimal_fees_for_gas_in_picotez minimal_fees_for_size_in_picotez in
|
||||
match Tez.of_mutez (Z.to_int64 (Z.div (Z.add (Z.of_int 999) fees_in_picotez) (Z.of_int 1000))) with
|
||||
let minimal_fees_for_gas_in_nanotez =
|
||||
Z.mul fee_parameter.minimal_nanotez_per_gas_unit gas_limit in
|
||||
let minimal_fees_for_size_in_nanotez =
|
||||
Z.mul fee_parameter.minimal_nanotez_per_byte (Z.of_int size) in
|
||||
let fees_in_nanotez =
|
||||
Z.add minimal_fees_in_nanotez @@
|
||||
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_nanotez) (Z.of_int 1000))) with
|
||||
| None -> assert false
|
||||
| Some fee -> return fee
|
||||
else
|
||||
|
@ -32,8 +32,8 @@ type 'kind preapply_result =
|
||||
|
||||
type fee_parameter = {
|
||||
minimal_fees: Tez.t ;
|
||||
minimal_picotez_per_byte: Z.t ;
|
||||
minimal_picotez_per_gas_unit: Z.t ;
|
||||
minimal_nanotez_per_byte: Z.t ;
|
||||
minimal_nanotez_per_gas_unit: Z.t ;
|
||||
force_low_fee: bool ;
|
||||
fee_cap: Tez.t ;
|
||||
burn_cap: Tez.t ;
|
||||
|
@ -226,8 +226,8 @@ let commands version () =
|
||||
(args8
|
||||
fee_arg dry_run_switch
|
||||
minimal_fees_arg
|
||||
minimal_picotez_per_byte_arg
|
||||
minimal_picotez_per_gas_unit_arg
|
||||
minimal_nanotez_per_byte_arg
|
||||
minimal_nanotez_per_gas_unit_arg
|
||||
force_low_fee_arg
|
||||
fee_cap_arg
|
||||
burn_cap_arg)
|
||||
@ -238,13 +238,13 @@ let commands version () =
|
||||
~name: "mgr" ~desc: "new delegate of the contract"
|
||||
@@ stop)
|
||||
begin fun
|
||||
(fee, dry_run, minimal_fees, minimal_picotez_per_byte,
|
||||
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
|
||||
(fee, dry_run, minimal_fees, minimal_nanotez_per_byte,
|
||||
minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
|
||||
(_, contract) (_, delegate) (cctxt : Proto_alpha.full) ->
|
||||
let fee_parameter = {
|
||||
Injection.minimal_fees ;
|
||||
minimal_picotez_per_byte ;
|
||||
minimal_picotez_per_gas_unit ;
|
||||
minimal_nanotez_per_byte ;
|
||||
minimal_nanotez_per_gas_unit ;
|
||||
force_low_fee ;
|
||||
fee_cap ;
|
||||
burn_cap ;
|
||||
@ -265,24 +265,24 @@ let commands version () =
|
||||
(args8
|
||||
fee_arg dry_run_switch
|
||||
minimal_fees_arg
|
||||
minimal_picotez_per_byte_arg
|
||||
minimal_picotez_per_gas_unit_arg
|
||||
minimal_nanotez_per_byte_arg
|
||||
minimal_nanotez_per_gas_unit_arg
|
||||
force_low_fee_arg
|
||||
fee_cap_arg
|
||||
burn_cap_arg)
|
||||
(prefixes [ "withdraw" ; "delegate" ; "from" ]
|
||||
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
|
||||
@@ stop)
|
||||
begin fun (fee, dry_run, minimal_fees, minimal_picotez_per_byte,
|
||||
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
|
||||
begin fun (fee, dry_run, minimal_fees, minimal_nanotez_per_byte,
|
||||
minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
|
||||
(_, contract) (cctxt : Proto_alpha.full) ->
|
||||
source_to_keys cctxt
|
||||
~chain:`Main ~block:cctxt#block
|
||||
contract >>=? fun (src_pk, manager_sk) ->
|
||||
let fee_parameter = {
|
||||
Injection.minimal_fees ;
|
||||
minimal_picotez_per_byte ;
|
||||
minimal_picotez_per_gas_unit ;
|
||||
minimal_nanotez_per_byte ;
|
||||
minimal_nanotez_per_gas_unit ;
|
||||
force_low_fee ;
|
||||
fee_cap ;
|
||||
burn_cap ;
|
||||
@ -298,8 +298,8 @@ let commands version () =
|
||||
command ~group ~desc:"Open a new account."
|
||||
(args11 fee_arg dry_run_switch delegate_arg delegatable_switch (Client_keys.force_switch ())
|
||||
minimal_fees_arg
|
||||
minimal_picotez_per_byte_arg
|
||||
minimal_picotez_per_gas_unit_arg
|
||||
minimal_nanotez_per_byte_arg
|
||||
minimal_nanotez_per_gas_unit_arg
|
||||
force_low_fee_arg
|
||||
fee_cap_arg
|
||||
burn_cap_arg)
|
||||
@ -316,8 +316,8 @@ let commands version () =
|
||||
@@ ContractAlias.destination_param
|
||||
~name:"src" ~desc: "name of the source contract"
|
||||
@@ stop)
|
||||
begin fun (fee, dry_run, delegate, delegatable, force, minimal_fees, minimal_picotez_per_byte,
|
||||
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
|
||||
begin fun (fee, dry_run, delegate, delegatable, force, minimal_fees, minimal_nanotez_per_byte,
|
||||
minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap)
|
||||
new_contract manager_pkh balance (_, source) (cctxt : Proto_alpha.full) ->
|
||||
RawContractAlias.of_fresh cctxt force new_contract >>=? fun alias_name ->
|
||||
source_to_keys cctxt
|
||||
@ -325,8 +325,8 @@ let commands version () =
|
||||
source >>=? fun (src_pk, src_sk) ->
|
||||
let fee_parameter = {
|
||||
Injection.minimal_fees ;
|
||||
minimal_picotez_per_byte ;
|
||||
minimal_picotez_per_gas_unit ;
|
||||
minimal_nanotez_per_byte ;
|
||||
minimal_nanotez_per_gas_unit ;
|
||||
force_low_fee ;
|
||||
fee_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 ())
|
||||
delegatable_switch spendable_switch init_arg no_print_source_flag
|
||||
minimal_fees_arg
|
||||
minimal_picotez_per_byte_arg
|
||||
minimal_picotez_per_gas_unit_arg
|
||||
minimal_nanotez_per_byte_arg
|
||||
minimal_nanotez_per_gas_unit_arg
|
||||
force_low_fee_arg
|
||||
fee_cap_arg
|
||||
burn_cap_arg)
|
||||
@ -372,7 +372,7 @@ let commands version () =
|
||||
~name:"prg" ~desc: "script of the account\n\
|
||||
Combine with -init if the storage type is not unit."
|
||||
@@ 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) ->
|
||||
RawContractAlias.of_fresh cctxt force alias_name >>=? fun alias_name ->
|
||||
Lwt.return (Micheline_parser.no_parsing_error program) >>=? fun { expanded = code } ->
|
||||
@ -381,8 +381,8 @@ let commands version () =
|
||||
source >>=? fun (src_pk, src_sk) ->
|
||||
let fee_parameter = {
|
||||
Injection.minimal_fees ;
|
||||
minimal_picotez_per_byte ;
|
||||
minimal_picotez_per_gas_unit ;
|
||||
minimal_nanotez_per_byte ;
|
||||
minimal_nanotez_per_gas_unit ;
|
||||
force_low_fee ;
|
||||
fee_cap ;
|
||||
burn_cap ;
|
||||
@ -407,8 +407,8 @@ let commands version () =
|
||||
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
|
||||
minimal_fees_arg
|
||||
minimal_picotez_per_byte_arg
|
||||
minimal_picotez_per_gas_unit_arg
|
||||
minimal_nanotez_per_byte_arg
|
||||
minimal_nanotez_per_gas_unit_arg
|
||||
force_low_fee_arg
|
||||
fee_cap_arg
|
||||
burn_cap_arg)
|
||||
@ -422,14 +422,14 @@ let commands version () =
|
||||
@@ ContractAlias.destination_param
|
||||
~name: "dst" ~desc: "name/literal of the destination contract"
|
||||
@@ 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
|
||||
~chain:`Main ~block:cctxt#block
|
||||
source >>=? fun (src_pk, src_sk) ->
|
||||
let fee_parameter = {
|
||||
Injection.minimal_fees ;
|
||||
minimal_picotez_per_byte ;
|
||||
minimal_picotez_per_gas_unit ;
|
||||
minimal_nanotez_per_byte ;
|
||||
minimal_nanotez_per_gas_unit ;
|
||||
force_low_fee ;
|
||||
fee_cap ;
|
||||
burn_cap ;
|
||||
@ -448,8 +448,8 @@ let commands version () =
|
||||
command ~group ~desc: "Reveal the public key of the contract manager."
|
||||
(args7 fee_arg
|
||||
minimal_fees_arg
|
||||
minimal_picotez_per_byte_arg
|
||||
minimal_picotez_per_gas_unit_arg
|
||||
minimal_nanotez_per_byte_arg
|
||||
minimal_nanotez_per_gas_unit_arg
|
||||
force_low_fee_arg
|
||||
fee_cap_arg
|
||||
burn_cap_arg)
|
||||
@ -457,15 +457,15 @@ let commands version () =
|
||||
@@ ContractAlias.alias_param
|
||||
~name: "src" ~desc: "name of the source contract"
|
||||
@@ stop)
|
||||
begin fun (fee, minimal_fees, minimal_picotez_per_byte,
|
||||
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) (_, source) cctxt ->
|
||||
begin fun (fee, minimal_fees, minimal_nanotez_per_byte,
|
||||
minimal_nanotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) (_, source) cctxt ->
|
||||
source_to_keys cctxt
|
||||
~chain:`Main ~block:cctxt#block
|
||||
source >>=? fun (src_pk, src_sk) ->
|
||||
let fee_parameter = {
|
||||
Injection.minimal_fees ;
|
||||
minimal_picotez_per_byte ;
|
||||
minimal_picotez_per_gas_unit ;
|
||||
minimal_nanotez_per_byte ;
|
||||
minimal_nanotez_per_gas_unit ;
|
||||
force_low_fee ;
|
||||
fee_cap ;
|
||||
burn_cap ;
|
||||
@ -481,8 +481,8 @@ let commands version () =
|
||||
command ~group ~desc: "Register the public key hash as a delegate."
|
||||
(args8 fee_arg dry_run_switch
|
||||
minimal_fees_arg
|
||||
minimal_picotez_per_byte_arg
|
||||
minimal_picotez_per_gas_unit_arg
|
||||
minimal_nanotez_per_byte_arg
|
||||
minimal_nanotez_per_gas_unit_arg
|
||||
force_low_fee_arg
|
||||
fee_cap_arg
|
||||
burn_cap_arg)
|
||||
@ -491,13 +491,13 @@ let commands version () =
|
||||
~name: "mgr" ~desc: "the delegate key"
|
||||
@@ prefixes [ "as" ; "delegate" ]
|
||||
@@ stop)
|
||||
begin fun (fee, dry_run, minimal_fees, minimal_picotez_per_byte,
|
||||
minimal_picotez_per_gas_unit, force_low_fee, fee_cap, burn_cap) src_pkh cctxt ->
|
||||
begin fun (fee, dry_run, minimal_fees, minimal_nanotez_per_byte,
|
||||
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) ->
|
||||
let fee_parameter = {
|
||||
Injection.minimal_fees ;
|
||||
minimal_picotez_per_byte ;
|
||||
minimal_picotez_per_gas_unit ;
|
||||
minimal_nanotez_per_byte ;
|
||||
minimal_nanotez_per_gas_unit ;
|
||||
force_low_fee ;
|
||||
fee_cap ;
|
||||
burn_cap ;
|
||||
|
@ -41,8 +41,8 @@ let managers_index = 3
|
||||
|
||||
let default_max_priority = 64
|
||||
let default_minimal_fees = Tez.zero
|
||||
let default_minimal_picotez_per_gas_unit = Z.of_int 10000
|
||||
let default_minimal_picotez_per_byte = Z.zero
|
||||
let default_minimal_nanotez_per_gas_unit = Z.of_int 10000
|
||||
let default_minimal_nanotez_per_byte = Z.zero
|
||||
let default_await_endorsements = true
|
||||
|
||||
type state = {
|
||||
@ -56,9 +56,9 @@ type state = {
|
||||
(* Minimal operation fee required to include an operation in a block *)
|
||||
minimal_fees : Tez.t ;
|
||||
(* 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_picotez_per_byte : Z.t ;
|
||||
minimal_nanotez_per_byte : Z.t ;
|
||||
(* Await endorsements *)
|
||||
await_endorsements: bool ;
|
||||
(* truly mutable *)
|
||||
@ -67,8 +67,8 @@ type state = {
|
||||
|
||||
let create_state
|
||||
?(minimal_fees = default_minimal_fees)
|
||||
?(minimal_picotez_per_gas_unit = default_minimal_picotez_per_gas_unit)
|
||||
?(minimal_picotez_per_byte = default_minimal_picotez_per_byte)
|
||||
?(minimal_nanotez_per_gas_unit = default_minimal_nanotez_per_gas_unit)
|
||||
?(minimal_nanotez_per_byte = default_minimal_nanotez_per_byte)
|
||||
?(await_endorsements = default_await_endorsements)
|
||||
genesis context_path index delegates constants =
|
||||
{ genesis ;
|
||||
@ -77,8 +77,8 @@ let create_state
|
||||
delegates ;
|
||||
constants ;
|
||||
minimal_fees ;
|
||||
minimal_picotez_per_gas_unit ;
|
||||
minimal_picotez_per_byte ;
|
||||
minimal_nanotez_per_gas_unit ;
|
||||
minimal_nanotez_per_byte ;
|
||||
await_endorsements ;
|
||||
best_slot = None ;
|
||||
}
|
||||
@ -197,8 +197,8 @@ let sort_manager_operations
|
||||
~max_size
|
||||
~hard_gas_limit_per_block
|
||||
~minimal_fees
|
||||
~minimal_picotez_per_gas_unit
|
||||
~minimal_picotez_per_byte
|
||||
~minimal_nanotez_per_gas_unit
|
||||
~minimal_nanotez_per_byte
|
||||
(operations : Proto_alpha.operation list) =
|
||||
let compute_weight op (fee, gas) =
|
||||
let size = Data_encoding.Binary.length Operation.encoding op in
|
||||
@ -217,16 +217,16 @@ let sort_manager_operations
|
||||
else
|
||||
let (size, gas, _ratio) as weight = compute_weight op (fee, gas) 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
|
||||
let enough_fees_for_gas =
|
||||
let minimal_fees_in_picotez =
|
||||
Z.mul minimal_picotez_per_gas_unit gas in
|
||||
Z.compare minimal_fees_in_picotez fees_in_picotez <= 0 in
|
||||
let minimal_fees_in_nanotez =
|
||||
Z.mul minimal_nanotez_per_gas_unit gas in
|
||||
Z.compare minimal_fees_in_nanotez fees_in_nanotez <= 0 in
|
||||
let enough_fees_for_size =
|
||||
let minimal_fees_in_picotez =
|
||||
Z.mul minimal_picotez_per_byte (Z.of_int size) in
|
||||
Z.compare minimal_fees_in_picotez fees_in_picotez <= 0 in
|
||||
let minimal_fees_in_nanotez =
|
||||
Z.mul minimal_nanotez_per_byte (Z.of_int size) in
|
||||
Z.compare minimal_fees_in_nanotez fees_in_nanotez <= 0 in
|
||||
if enough_fees_for_size && enough_fees_for_gas then
|
||||
return_some (op, weight)
|
||||
else
|
||||
@ -290,8 +290,8 @@ let classify_operations
|
||||
~block
|
||||
~hard_gas_limit_per_block
|
||||
~minimal_fees
|
||||
~minimal_picotez_per_gas_unit
|
||||
~minimal_picotez_per_byte
|
||||
~minimal_nanotez_per_gas_unit
|
||||
~minimal_nanotez_per_byte
|
||||
(ops: Proto_alpha.operation list) =
|
||||
Alpha_block_services.live_blocks cctxt ~chain:`Main ~block ()
|
||||
>>=? fun live_blocks ->
|
||||
@ -318,8 +318,8 @@ let classify_operations
|
||||
~max_size
|
||||
~hard_gas_limit_per_block
|
||||
~minimal_fees
|
||||
~minimal_picotez_per_gas_unit
|
||||
~minimal_picotez_per_byte
|
||||
~minimal_nanotez_per_gas_unit
|
||||
~minimal_nanotez_per_byte
|
||||
manager_operations
|
||||
>>=? fun ordered_operations ->
|
||||
(* Greedy heuristic *)
|
||||
@ -581,8 +581,8 @@ let forge_block
|
||||
?(best_effort = operations = None)
|
||||
?(sort = best_effort)
|
||||
?(minimal_fees = default_minimal_fees)
|
||||
?(minimal_picotez_per_gas_unit = default_minimal_picotez_per_gas_unit)
|
||||
?(minimal_picotez_per_byte = default_minimal_picotez_per_byte)
|
||||
?(minimal_nanotez_per_gas_unit = default_minimal_nanotez_per_gas_unit)
|
||||
?(minimal_nanotez_per_byte = default_minimal_nanotez_per_byte)
|
||||
?(await_endorsements = default_await_endorsements)
|
||||
?timestamp
|
||||
?mempool
|
||||
@ -605,8 +605,8 @@ let forge_block
|
||||
~hard_gas_limit_per_block
|
||||
~block:block
|
||||
~minimal_fees
|
||||
~minimal_picotez_per_gas_unit
|
||||
~minimal_picotez_per_byte
|
||||
~minimal_nanotez_per_gas_unit
|
||||
~minimal_nanotez_per_byte
|
||||
operations_arg
|
||||
>>=? fun (operations, overflowing_ops) ->
|
||||
(* Ensure that we retain operations up to the quota *)
|
||||
@ -656,8 +656,8 @@ let forge_block
|
||||
best_slot = None ;
|
||||
await_endorsements ;
|
||||
minimal_fees = default_minimal_fees ;
|
||||
minimal_picotez_per_gas_unit = default_minimal_picotez_per_gas_unit ;
|
||||
minimal_picotez_per_byte = default_minimal_picotez_per_byte ;
|
||||
minimal_nanotez_per_gas_unit = default_minimal_nanotez_per_gas_unit ;
|
||||
minimal_nanotez_per_byte = default_minimal_nanotez_per_byte ;
|
||||
} in
|
||||
filter_and_apply_operations ~timestamp ~protocol_data state bi (operations, overflowing_ops)
|
||||
>>=? fun (final_context, validation_result, operations) ->
|
||||
@ -897,8 +897,8 @@ let build_block
|
||||
classify_operations cctxt
|
||||
~hard_gas_limit_per_block
|
||||
~minimal_fees:state.minimal_fees
|
||||
~minimal_picotez_per_gas_unit:state.minimal_picotez_per_gas_unit
|
||||
~minimal_picotez_per_byte:state.minimal_picotez_per_byte
|
||||
~minimal_nanotez_per_gas_unit:state.minimal_nanotez_per_gas_unit
|
||||
~minimal_nanotez_per_byte:state.minimal_nanotez_per_byte
|
||||
~block operations
|
||||
>>=? fun (operations, overflowing_ops) ->
|
||||
let next_version =
|
||||
@ -1182,8 +1182,8 @@ let reveal_potential_nonces cctxt new_head =
|
||||
let create
|
||||
(cctxt : #Proto_alpha.full)
|
||||
?minimal_fees
|
||||
?minimal_picotez_per_gas_unit
|
||||
?minimal_picotez_per_byte
|
||||
?minimal_nanotez_per_gas_unit
|
||||
?minimal_nanotez_per_byte
|
||||
?await_endorsements
|
||||
?max_priority
|
||||
~context_path
|
||||
@ -1195,7 +1195,7 @@ let create
|
||||
Client_baking_simulator.load_context ~context_path >>= fun index ->
|
||||
Client_baking_simulator.check_context_consistency index bi.context >>=? fun () ->
|
||||
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
|
||||
genesis_hash context_path index delegates constants in
|
||||
return state
|
||||
|
@ -72,8 +72,8 @@ val forge_block:
|
||||
?best_effort:bool ->
|
||||
?sort:bool ->
|
||||
?minimal_fees: Tez.t ->
|
||||
?minimal_picotez_per_gas_unit: Z.t ->
|
||||
?minimal_picotez_per_byte: Z.t ->
|
||||
?minimal_nanotez_per_gas_unit: Z.t ->
|
||||
?minimal_nanotez_per_byte: Z.t ->
|
||||
?await_endorsements: bool ->
|
||||
?timestamp:Time.t ->
|
||||
?mempool:string ->
|
||||
@ -107,8 +107,8 @@ val forge_block:
|
||||
val create:
|
||||
#Proto_alpha.full ->
|
||||
?minimal_fees: Tez.t ->
|
||||
?minimal_picotez_per_gas_unit: Z.t ->
|
||||
?minimal_picotez_per_byte: Z.t ->
|
||||
?minimal_nanotez_per_gas_unit: Z.t ->
|
||||
?minimal_nanotez_per_byte: Z.t ->
|
||||
?await_endorsements: bool ->
|
||||
?max_priority: int ->
|
||||
context_path: string ->
|
||||
|
@ -30,8 +30,8 @@ let bake_block
|
||||
(cctxt : #Proto_alpha.full)
|
||||
?(chain = `Main)
|
||||
?minimal_fees
|
||||
?minimal_picotez_per_gas_unit
|
||||
?minimal_picotez_per_byte
|
||||
?minimal_nanotez_per_gas_unit
|
||||
?minimal_nanotez_per_byte
|
||||
?(await_endorsements = false)
|
||||
?force
|
||||
?max_priority
|
||||
@ -68,8 +68,8 @@ let bake_block
|
||||
Client_baking_forge.forge_block cctxt
|
||||
?force
|
||||
?minimal_fees
|
||||
?minimal_picotez_per_gas_unit
|
||||
?minimal_picotez_per_byte
|
||||
?minimal_nanotez_per_gas_unit
|
||||
?minimal_nanotez_per_byte
|
||||
~await_endorsements
|
||||
?timestamp:(if minimal_timestamp then None else Some (Time.now ()))
|
||||
?seed_nonce_hash
|
||||
|
@ -31,8 +31,8 @@ val bake_block:
|
||||
#Proto_alpha.full ->
|
||||
?chain:Chain_services.chain ->
|
||||
?minimal_fees: Tez.t ->
|
||||
?minimal_picotez_per_gas_unit: Z.t ->
|
||||
?minimal_picotez_per_byte: Z.t ->
|
||||
?minimal_nanotez_per_gas_unit: Z.t ->
|
||||
?minimal_nanotez_per_byte: Z.t ->
|
||||
?await_endorsements: bool ->
|
||||
?force:bool ->
|
||||
?max_priority: int ->
|
||||
|
@ -49,8 +49,8 @@ module Baker = struct
|
||||
let run
|
||||
(cctxt : #Proto_alpha.full)
|
||||
?minimal_fees
|
||||
?minimal_picotez_per_gas_unit
|
||||
?minimal_picotez_per_byte
|
||||
?minimal_nanotez_per_gas_unit
|
||||
?minimal_nanotez_per_byte
|
||||
?await_endorsements
|
||||
?max_priority
|
||||
~context_path
|
||||
@ -62,8 +62,8 @@ module Baker = struct
|
||||
cctxt#message "Baker started." >>= fun () ->
|
||||
Client_baking_forge.create cctxt
|
||||
?minimal_fees
|
||||
?minimal_picotez_per_gas_unit
|
||||
?minimal_picotez_per_byte
|
||||
?minimal_nanotez_per_gas_unit
|
||||
?minimal_nanotez_per_byte
|
||||
?await_endorsements
|
||||
?max_priority
|
||||
~context_path delegates block_stream >>=? fun () ->
|
||||
|
@ -37,8 +37,8 @@ module Baker : sig
|
||||
val run:
|
||||
#Proto_alpha.full ->
|
||||
?minimal_fees: Tez.t ->
|
||||
?minimal_picotez_per_gas_unit: Z.t ->
|
||||
?minimal_picotez_per_byte: Z.t ->
|
||||
?minimal_nanotez_per_gas_unit: Z.t ->
|
||||
?minimal_nanotez_per_byte: Z.t ->
|
||||
?await_endorsements: bool ->
|
||||
?max_priority: int ->
|
||||
context_path: string ->
|
||||
|
@ -58,8 +58,8 @@ let delegate_commands () =
|
||||
(args9
|
||||
max_priority_arg
|
||||
minimal_fees_arg
|
||||
minimal_picotez_per_gas_unit_arg
|
||||
minimal_picotez_per_byte_arg
|
||||
minimal_nanotez_per_gas_unit_arg
|
||||
minimal_nanotez_per_byte_arg
|
||||
await_endorsements_arg
|
||||
force_switch
|
||||
minimal_timestamp_switch
|
||||
@ -70,14 +70,14 @@ let delegate_commands () =
|
||||
~name:"baker" ~desc: "name of the delegate owning the baking right"
|
||||
@@ stop)
|
||||
(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,
|
||||
minimal_timestamp, mempool, context_path)
|
||||
delegate cctxt ->
|
||||
bake_block cctxt cctxt#block
|
||||
~minimal_fees
|
||||
~minimal_picotez_per_gas_unit
|
||||
~minimal_picotez_per_byte
|
||||
~minimal_nanotez_per_gas_unit
|
||||
~minimal_nanotez_per_byte
|
||||
~await_endorsements
|
||||
~force ?max_priority ~minimal_timestamp
|
||||
?mempool ?context_path delegate) ;
|
||||
@ -113,8 +113,8 @@ let baker_commands () =
|
||||
(args5
|
||||
max_priority_arg
|
||||
minimal_fees_arg
|
||||
minimal_picotez_per_gas_unit_arg
|
||||
minimal_picotez_per_byte_arg
|
||||
minimal_nanotez_per_gas_unit_arg
|
||||
minimal_nanotez_per_byte_arg
|
||||
no_waiting_for_endorsements_arg)
|
||||
(prefixes [ "run" ; "with" ; "local" ; "node" ]
|
||||
@@ param
|
||||
@ -122,15 +122,15 @@ let baker_commands () =
|
||||
~desc:"Path to the node data directory (e.g. $HOME/.tezos-node)"
|
||||
directory_parameter
|
||||
@@ seq_of_param Client_keys.Public_key_hash.alias_param)
|
||||
(fun (max_priority, minimal_fees, minimal_picotez_per_gas_unit,
|
||||
minimal_picotez_per_byte, no_waiting_for_endorsements)
|
||||
(fun (max_priority, minimal_fees, minimal_nanotez_per_gas_unit,
|
||||
minimal_nanotez_per_byte, no_waiting_for_endorsements)
|
||||
node_path delegates cctxt ->
|
||||
Tezos_signer_backends.Encrypted.decrypt_list
|
||||
cctxt (List.map fst delegates) >>=? fun () ->
|
||||
Client_daemon.Baker.run cctxt
|
||||
~minimal_fees
|
||||
~minimal_picotez_per_gas_unit
|
||||
~minimal_picotez_per_byte
|
||||
~minimal_nanotez_per_gas_unit
|
||||
~minimal_nanotez_per_byte
|
||||
?max_priority
|
||||
~await_endorsements:(not no_waiting_for_endorsements)
|
||||
~context_path:(Filename.concat node_path "context")
|
||||
|
Loading…
Reference in New Issue
Block a user