Proto/Alpha: use uint16 for mining priority.

This commit is contained in:
Grégoire Henry 2017-04-10 12:50:15 +02:00
parent 77d6805664
commit 6212af55f1
15 changed files with 55 additions and 62 deletions

View File

@ -53,8 +53,7 @@ let inject_block cctxt block
let shell = let shell =
{ Store.Block_header.net_id = bi.net ; predecessor = bi.hash ; { Store.Block_header.net_id = bi.net ; predecessor = bi.hash ;
timestamp ; fitness ; operations } in timestamp ; fitness ; operations } in
let slot = let slot = { Block.level = level.level ; priority } in
{ Block.level = level.level ; priority = Int32.of_int priority } in
compute_stamp cctxt block compute_stamp cctxt block
src_sk shell slot seed_nonce_hash >>=? fun proof_of_work_nonce -> src_sk shell slot seed_nonce_hash >>=? fun proof_of_work_nonce ->
Client_proto_rpcs.Helpers.Forge.block cctxt Client_proto_rpcs.Helpers.Forge.block cctxt

View File

@ -35,7 +35,7 @@ module Constants : sig
block -> (Period.t list) tzresult Lwt.t block -> (Period.t list) tzresult Lwt.t
val first_free_mining_slot: val first_free_mining_slot:
Client_rpcs.config -> Client_rpcs.config ->
block -> int32 tzresult Lwt.t block -> int tzresult Lwt.t
val max_signing_slot: val max_signing_slot:
Client_rpcs.config -> Client_rpcs.config ->
block -> int tzresult Lwt.t block -> int tzresult Lwt.t

View File

@ -26,7 +26,7 @@ and proto_header = {
and mining_slot = { and mining_slot = {
level: Raw_level_repr.t ; level: Raw_level_repr.t ;
priority: Int32.t ; priority: int ;
} }
let mining_slot_encoding = let mining_slot_encoding =
@ -36,7 +36,7 @@ let mining_slot_encoding =
(fun (level, priority) -> { level ; priority }) (fun (level, priority) -> { level ; priority })
(obj2 (obj2
(req "level" Raw_level_repr.encoding) (req "level" Raw_level_repr.encoding)
(req "proprity" int32)) (req "priority" uint16))
let proto_header_encoding = let proto_header_encoding =
let open Data_encoding in let open Data_encoding in

View File

@ -24,7 +24,7 @@ and proto_header = {
and mining_slot = { and mining_slot = {
level: Raw_level_repr.t ; level: Raw_level_repr.t ;
priority: Int32.t ; priority: int ;
} }
val mining_slot_encoding: mining_slot Data_encoding.encoding val mining_slot_encoding: mining_slot Data_encoding.encoding

View File

@ -38,7 +38,7 @@ type constants = {
voting_period_length: int32 ; voting_period_length: int32 ;
time_before_reward: Period_repr.t ; time_before_reward: Period_repr.t ;
slot_durations: Period_repr.t list ; slot_durations: Period_repr.t list ;
first_free_mining_slot: int32 ; first_free_mining_slot: int ;
max_signing_slot: int ; max_signing_slot: int ;
instructions_per_transaction: int ; instructions_per_transaction: int ;
proof_of_work_threshold: int64 ; proof_of_work_threshold: int64 ;
@ -58,7 +58,7 @@ let default = {
Int64.(mul 365L (mul 24L 3600L)) ; Int64.(mul 365L (mul 24L 3600L)) ;
slot_durations = slot_durations =
List.map Period_repr.of_seconds_exn [ 60L ] ; List.map Period_repr.of_seconds_exn [ 60L ] ;
first_free_mining_slot = 16l ; first_free_mining_slot = 16 ;
max_signing_slot = 15 ; max_signing_slot = 15 ;
instructions_per_transaction = 16 * 1024 ; instructions_per_transaction = 16 * 1024 ;
proof_of_work_threshold = proof_of_work_threshold =
@ -103,7 +103,7 @@ let constants_encoding =
opt Compare_slot_durations.(=) opt Compare_slot_durations.(=)
default.slot_durations c.slot_durations default.slot_durations c.slot_durations
and first_free_mining_slot = and first_free_mining_slot =
opt Compare.Int32.(=) opt Compare.Int.(=)
default.first_free_mining_slot c.first_free_mining_slot default.first_free_mining_slot c.first_free_mining_slot
and max_signing_slot = and max_signing_slot =
opt Compare.Int.(=) opt Compare.Int.(=)
@ -171,8 +171,8 @@ let constants_encoding =
(opt "voting_period_length" int32) (opt "voting_period_length" int32)
(opt "time_before_reward" int64) (opt "time_before_reward" int64)
(opt "slot_durations" (list Period_repr.encoding)) (opt "slot_durations" (list Period_repr.encoding))
(opt "first_free_mining_slot" int32) (opt "first_free_mining_slot" uint16)
(opt "max_signing_slot" int31) (opt "max_signing_slot" uint16)
(opt "instructions_per_transaction" int31) (opt "instructions_per_transaction" int31)
(opt "proof_of_work_threshold" int64) (opt "proof_of_work_threshold" int64)
(opt "bootstrap_keys" (list Ed25519.Public_key.encoding)) (opt "bootstrap_keys" (list Ed25519.Public_key.encoding))

View File

@ -71,7 +71,7 @@ let apply_operation ({ mode ; ctxt ; op_count } as data) operation =
let pred_block, block_prio, miner_contract = let pred_block, block_prio, miner_contract =
match mode with match mode with
| Construction { pred_block } -> | Construction { pred_block } ->
pred_block, 0l, None pred_block, 0, None
| Application (block, delegate) -> | Application (block, delegate) ->
block.shell.predecessor, block.shell.predecessor,
block.proto.mining_slot.priority, block.proto.mining_slot.priority,
@ -94,7 +94,7 @@ let finalize_block { mode ; ctxt ; op_count } = match mode with
let fitness = Tezos_context.Fitness.current ctxt in let fitness = Tezos_context.Fitness.current ctxt in
let commit_message = let commit_message =
Format.asprintf Format.asprintf
"lvl %ld, fit %Ld, prio %ld, %d ops" "lvl %ld, fit %Ld, prio %d, %d ops"
level fitness priority op_count in level fitness priority op_count in
let ctxt = Tezos_context.finalize ~commit_message ctxt in let ctxt = Tezos_context.finalize ~commit_message ctxt in
return ctxt return ctxt

View File

@ -110,6 +110,7 @@ let () =
(fun () -> Cannot_pay_endorsement_bond) (fun () -> Cannot_pay_endorsement_bond)
let minimal_time c priority pred_timestamp = let minimal_time c priority pred_timestamp =
let priority = Int32.of_int priority in
let rec cumsum_slot_durations acc durations p = let rec cumsum_slot_durations acc durations p =
if Compare.Int32.(<=) p 0l then if Compare.Int32.(<=) p 0l then
ok acc ok acc
@ -147,7 +148,7 @@ let check_mining_rights c
let pay_mining_bond c let pay_mining_bond c
{ Block.proto = { mining_slot = { priority} } } { Block.proto = { mining_slot = { priority} } }
id = id =
if Compare.Int32.(priority >= Constants.first_free_mining_slot c) if Compare.Int.(priority >= Constants.first_free_mining_slot c)
then return c then return c
else else
Contract.spend c (Contract.default_contract id) Constants.mining_bond_cost Contract.spend c (Contract.default_contract id) Constants.mining_bond_cost
@ -168,7 +169,7 @@ let check_signing_rights c slot delegate =
(Wrong_delegate (owning_delegate, delegate)) (Wrong_delegate (owning_delegate, delegate))
let paying_priorities c = let paying_priorities c =
0l ---> Constants.first_free_mining_slot c 0 --> Constants.first_free_mining_slot c
let bond_and_reward = let bond_and_reward =
match Tez.(Constants.mining_bond_cost +? Constants.mining_reward) with match Tez.(Constants.mining_bond_cost +? Constants.mining_reward) with
@ -176,25 +177,25 @@ let bond_and_reward =
| Error _ -> assert false | Error _ -> assert false
let base_mining_reward c ~priority = let base_mining_reward c ~priority =
if Compare.Int32.(priority < Constants.first_free_mining_slot c) if Compare.Int.(priority < Constants.first_free_mining_slot c)
then bond_and_reward then bond_and_reward
else Constants.mining_reward else Constants.mining_reward
type error += Incorect_priority type error += Incorect_priority
let endorsement_reward ~block_priority:prio = let endorsement_reward ~block_priority:prio =
if Compare.Int32.(prio >= 0l) if Compare.Int.(prio >= 0)
then then
Lwt.return Lwt.return
Tez.(Constants.endorsement_reward /? (Int64.(succ (of_int32 prio)))) Tez.(Constants.endorsement_reward /? (Int64.(succ (of_int prio))))
else fail Incorect_priority else fail Incorect_priority
let mining_priorities c level = let mining_priorities c level =
let rec f priority = let rec f priority =
Roll.mining_rights_owner c level ~priority >>=? fun delegate -> Roll.mining_rights_owner c level ~priority >>=? fun delegate ->
return (LCons (delegate, (fun () -> f (Int32.succ priority)))) return (LCons (delegate, (fun () -> f (succ priority))))
in in
f 0l f 0
let endorsement_priorities c level = let endorsement_priorities c level =
let rec f slot = let rec f slot =
@ -205,7 +206,7 @@ let endorsement_priorities c level =
let select_delegate delegate delegate_list max_priority = let select_delegate delegate delegate_list max_priority =
let rec loop acc l n = let rec loop acc l n =
if Compare.Int32.(n >= max_priority) if Compare.Int.(n >= max_priority)
then return (List.rev acc) then return (List.rev acc)
else else
let LCons (pkh, t) = l in let LCons (pkh, t) = l in
@ -214,9 +215,9 @@ let select_delegate delegate delegate_list max_priority =
then n :: acc then n :: acc
else acc in else acc in
t () >>=? fun t -> t () >>=? fun t ->
loop acc t (Int32.succ n) loop acc t (succ n)
in in
loop [] delegate_list 0l loop [] delegate_list 0
let first_mining_priorities let first_mining_priorities
ctxt ctxt
@ -227,8 +228,7 @@ let first_mining_priorities
let first_endorsement_slots let first_endorsement_slots
ctxt ctxt
?(max_priority = ?(max_priority = Constants.max_signing_slot ctxt)
Int32.of_int (Constants.max_signing_slot ctxt))
delegate level = delegate level =
endorsement_priorities ctxt level >>=? fun delegate_list -> endorsement_priorities ctxt level >>=? fun delegate_list ->
select_delegate delegate delegate_list max_priority select_delegate delegate delegate_list max_priority

View File

@ -19,10 +19,9 @@ type error += Wrong_delegate of public_key_hash * public_key_hash (* `Permanent
type error += Cannot_pay_mining_bond (* `Permanent *) type error += Cannot_pay_mining_bond (* `Permanent *)
type error += Cannot_pay_endorsement_bond (* `Permanent *) type error += Cannot_pay_endorsement_bond (* `Permanent *)
val paying_priorities: context -> int32 list val paying_priorities: context -> int list
val minimal_time: val minimal_time: context -> int -> Time.t -> Time.t tzresult Lwt.t
context -> int32 -> Time.t -> Time.t tzresult Lwt.t
(** [minimal_time ctxt priority pred_block_time] returns the minimal (** [minimal_time ctxt priority pred_block_time] returns the minimal
time, given the predecessor block timestamp [pred_block_time], time, given the predecessor block timestamp [pred_block_time],
after which a miner with priority [priority] is allowed to after which a miner with priority [priority] is allowed to
@ -56,9 +55,9 @@ val check_signing_rights:
(** If this priority should have payed the bond it is the base mining (** If this priority should have payed the bond it is the base mining
reward and the bond, or just the base reward otherwise *) reward and the bond, or just the base reward otherwise *)
val base_mining_reward: context -> priority:int32 -> Tez.t val base_mining_reward: context -> priority:int -> Tez.t
val endorsement_reward: block_priority:int32 -> Tez.t tzresult Lwt.t val endorsement_reward: block_priority:int -> Tez.t tzresult Lwt.t
val mining_priorities: val mining_priorities:
context -> Level.t -> public_key_hash lazy_list context -> Level.t -> public_key_hash lazy_list
@ -70,10 +69,10 @@ val endorsement_priorities:
val first_mining_priorities: val first_mining_priorities:
context -> context ->
?max_priority:int32 -> ?max_priority:int ->
public_key_hash -> public_key_hash ->
Level.t -> Level.t ->
int32 list tzresult Lwt.t int list tzresult Lwt.t
(** [first_mining_priorities ctxt ?max_priority contract_hash level] (** [first_mining_priorities ctxt ?max_priority contract_hash level]
is a list of priorities of max [?max_priority] elements, where the is a list of priorities of max [?max_priority] elements, where the
delegate of [contract_hash] is allowed to mine for [level]. If delegate of [contract_hash] is allowed to mine for [level]. If
@ -82,9 +81,9 @@ val first_mining_priorities:
val first_endorsement_slots: val first_endorsement_slots:
context -> context ->
?max_priority:int32 -> ?max_priority:int ->
public_key_hash -> public_key_hash ->
Level.t -> int32 list tzresult Lwt.t Level.t -> int list tzresult Lwt.t
val check_signature: val check_signature:
context -> Block.header -> public_key_hash -> unit tzresult Lwt.t context -> Block.header -> public_key_hash -> unit tzresult Lwt.t

View File

@ -73,7 +73,7 @@ module Random = struct
let cycle = level.Level_repr.cycle in let cycle = level.Level_repr.cycle in
Seed_storage.for_cycle c cycle >>=? fun random_seed -> Seed_storage.for_cycle c cycle >>=? fun random_seed ->
let rd = level_random random_seed kind level in let rd = level_random random_seed kind level in
let sequence = Seed_repr.sequence rd offset in let sequence = Seed_repr.sequence rd (Int32.of_int offset) in
Storage.Roll.Last_for_cycle.get c cycle >>=? fun bound -> Storage.Roll.Last_for_cycle.get c cycle >>=? fun bound ->
let roll, _ = Roll_repr.random sequence bound in let roll, _ = Roll_repr.random sequence bound in
Storage.Roll.Owner_for_cycle.get c (cycle, roll) Storage.Roll.Owner_for_cycle.get c (cycle, roll)
@ -84,7 +84,7 @@ let mining_rights_owner c level ~priority =
Random.owner c "mining" level priority Random.owner c "mining" level priority
let endorsement_rights_owner c level ~slot = let endorsement_rights_owner c level ~slot =
Random.owner c "endorsement" level (Int32.of_int slot) Random.owner c "endorsement" level slot
module Contract = struct module Contract = struct

View File

@ -35,7 +35,7 @@ val clear_cycle :
Storage.t -> Cycle_repr.t -> Storage.t tzresult Lwt.t Storage.t -> Cycle_repr.t -> Storage.t tzresult Lwt.t
val mining_rights_owner : val mining_rights_owner :
Storage.t -> Level_repr.t -> priority:int32 -> Storage.t -> Level_repr.t -> priority:int ->
Ed25519.Public_key_hash.t tzresult Lwt.t Ed25519.Public_key_hash.t tzresult Lwt.t
val endorsement_rights_owner : val endorsement_rights_owner :

View File

@ -73,7 +73,7 @@ module Constants = struct
~description: "First free mining slot" ~description: "First free mining slot"
~input: empty ~input: empty
~output: (wrap_tzerror @@ ~output: (wrap_tzerror @@
describe ~title: "first free mining slot" int32) describe ~title: "first free mining slot" uint16)
RPC.Path.(custom_root / "constants" / "first_free_mining_slot") RPC.Path.(custom_root / "constants" / "first_free_mining_slot")
let max_signing_slot custom_root = let max_signing_slot custom_root =
@ -81,7 +81,7 @@ module Constants = struct
~description: "Max signing slot" ~description: "Max signing slot"
~input: empty ~input: empty
~output: (wrap_tzerror @@ ~output: (wrap_tzerror @@
describe ~title: "max signing slot" int31) describe ~title: "max signing slot" uint16)
RPC.Path.(custom_root / "constants" / "max_signing_slot") RPC.Path.(custom_root / "constants" / "max_signing_slot")
let instructions_per_transaction custom_root = let instructions_per_transaction custom_root =
@ -563,7 +563,7 @@ module Helpers = struct
(req "fitness" Fitness.encoding) (req "fitness" Fitness.encoding)
(req "operations" Operation_list_list_hash.encoding) (req "operations" Operation_list_list_hash.encoding)
(req "level" Raw_level.encoding) (req "level" Raw_level.encoding)
(req "priority" int31) (req "priority" uint16)
(req "nonce_hash" Nonce_hash.encoding) (req "nonce_hash" Nonce_hash.encoding)
(req "proof_of_work_nonce" (req "proof_of_work_nonce"
(Fixed.bytes Tezos_context.Constants.proof_of_work_nonce_size))) (Fixed.bytes Tezos_context.Constants.proof_of_work_nonce_size)))

View File

@ -174,7 +174,7 @@ let () =
(*-- Helpers -----------------------------------------------------------------*) (*-- Helpers -----------------------------------------------------------------*)
let minimal_timestamp ctxt prio = let minimal_timestamp ctxt prio =
let prio = match prio with None -> 0l | Some p -> Int32.of_int p in let prio = match prio with None -> 0 | Some p -> p in
Mining.minimal_time ctxt prio Mining.minimal_time ctxt prio
let () = register1 let () = register1
@ -196,7 +196,7 @@ let () =
Tezos_context.Level.current ctxt >>=? fun level -> Tezos_context.Level.current ctxt >>=? fun level ->
Mining.mining_priorities ctxt level >>=? fun (Misc.LCons (miner_pkh, _)) -> Mining.mining_priorities ctxt level >>=? fun (Misc.LCons (miner_pkh, _)) ->
let miner_contract = Contract.default_contract miner_pkh in let miner_contract = Contract.default_contract miner_pkh in
let block_prio = 0l in let block_prio = 0 in
Apply.apply_operation Apply.apply_operation
ctxt (Some miner_contract) pred_block block_prio operation ctxt (Some miner_contract) pred_block block_prio operation
>>=? function >>=? function
@ -281,11 +281,11 @@ let () = register2 Services.Helpers.levels levels
let default_max_mining_priority ctxt arg = let default_max_mining_priority ctxt arg =
let default = Constants.first_free_mining_slot ctxt in let default = Constants.first_free_mining_slot ctxt in
match arg with match arg with
| None -> Int32.mul 2l default | None -> 2 * default
| Some m -> Int32.of_int m | Some m -> m
let mining_rights ctxt level max = let mining_rights ctxt level max =
let max = Int32.to_int (default_max_mining_priority ctxt max) in let max = default_max_mining_priority ctxt max in
Mining.mining_priorities ctxt level >>=? fun contract_list -> Mining.mining_priorities ctxt level >>=? fun contract_list ->
let rec loop l n = let rec loop l n =
match n with match n with
@ -309,8 +309,7 @@ let () =
List.mapi List.mapi
(fun prio c -> (fun prio c ->
let timestamp = Timestamp.current ctxt in let timestamp = Timestamp.current ctxt in
Mining.minimal_time Mining.minimal_time ctxt prio timestamp >>= function
ctxt (Int32.of_int prio) timestamp >>= function
| Error _ -> Lwt.return None | Error _ -> Lwt.return None
| Ok minimal_timestamp -> Lwt.return (Some (c, minimal_timestamp))) | Ok minimal_timestamp -> Lwt.return (Some (c, minimal_timestamp)))
slots slots
@ -348,7 +347,7 @@ let mining_rights_for_delegate
(fun priority -> (fun priority ->
let timestamp = Timestamp.current ctxt in let timestamp = Timestamp.current ctxt in
Mining.minimal_time ctxt priority timestamp >>=? fun time -> Mining.minimal_time ctxt priority timestamp >>=? fun time ->
return (raw_level, Int32.to_int priority, time)) return (raw_level, priority, time))
priorities >>=? fun priorities -> priorities >>=? fun priorities ->
return (priorities @ t) return (priorities @ t)
in in
@ -391,10 +390,8 @@ let () =
let endorsement_rights_for_delegate let endorsement_rights_for_delegate
ctxt contract (max_priority, min_level, max_level) = ctxt contract (max_priority, min_level, max_level) =
let max_priority =
Int32.of_int @@
default_max_endorsement_priority ctxt max_priority in
Level.current ctxt >>=? fun current_level -> Level.current ctxt >>=? fun current_level ->
let max_priority = default_max_endorsement_priority ctxt max_priority in
let max_level = let max_level =
match max_level with match max_level with
| None -> | None ->
@ -412,10 +409,7 @@ let endorsement_rights_for_delegate
Mining.first_endorsement_slots Mining.first_endorsement_slots
ctxt ~max_priority contract level >>=? fun slots -> ctxt ~max_priority contract level >>=? fun slots ->
let raw_level = level.level in let raw_level = level.level in
let slots = let slots = List.rev_map (fun slot -> (raw_level, slot)) slots in
List.rev_map
(fun slot -> (raw_level, Int32.to_int slot))
slots in
return (List.rev_append slots t) return (List.rev_append slots t)
in in
loop min_level loop min_level
@ -442,7 +436,6 @@ let () = register1 Services.Helpers.Forge.operations forge_operations
let forge_block _ctxt let forge_block _ctxt
(net_id, predecessor, timestamp, fitness, operations, (net_id, predecessor, timestamp, fitness, operations,
raw_level, priority, seed_nonce_hash, proof_of_work_nonce) : MBytes.t tzresult Lwt.t = raw_level, priority, seed_nonce_hash, proof_of_work_nonce) : MBytes.t tzresult Lwt.t =
let priority = Int32.of_int priority in
let mining_slot = { Block.level = raw_level ; priority } in let mining_slot = { Block.level = raw_level ; priority } in
return (Block.forge_header return (Block.forge_header
{ net_id ; predecessor ; timestamp ; fitness ; operations } { net_id ; predecessor ; timestamp ; fitness ; operations }

View File

@ -172,7 +172,7 @@ module Constants : sig
val voting_period_length: context -> int32 val voting_period_length: context -> int32
val time_before_reward: context -> Period.t val time_before_reward: context -> Period.t
val slot_durations: context -> Period.t list val slot_durations: context -> Period.t list
val first_free_mining_slot: context -> int32 val first_free_mining_slot: context -> int
val max_signing_slot: context -> int val max_signing_slot: context -> int
val instructions_per_transaction: context -> int val instructions_per_transaction: context -> int
val proof_of_work_threshold: context -> int64 val proof_of_work_threshold: context -> int64
@ -530,7 +530,7 @@ module Block : sig
and mining_slot = { and mining_slot = {
level: Raw_level.t ; level: Raw_level.t ;
priority: Int32.t ; priority: int ;
} }
val mining_slot_encoding: mining_slot Data_encoding.encoding val mining_slot_encoding: mining_slot Data_encoding.encoding
@ -556,7 +556,7 @@ module Roll : sig
val clear_cycle: context -> Cycle.t -> context tzresult Lwt.t val clear_cycle: context -> Cycle.t -> context tzresult Lwt.t
val mining_rights_owner: val mining_rights_owner:
context -> Level.t -> priority:int32 -> public_key_hash tzresult Lwt.t context -> Level.t -> priority:int -> public_key_hash tzresult Lwt.t
val endorsement_rights_owner: val endorsement_rights_owner:
context -> Level.t -> slot:int -> public_key_hash tzresult Lwt.t context -> Level.t -> slot:int -> public_key_hash tzresult Lwt.t

View File

@ -28,7 +28,9 @@ val empty : unit encoding
val unit : unit encoding val unit : unit encoding
val constant : string -> unit encoding val constant : string -> unit encoding
val int8 : int encoding val int8 : int encoding
val uint8 : int encoding
val int16 : int encoding val int16 : int encoding
val uint16 : int encoding
val int31 : int encoding val int31 : int encoding
val int32 : int32 encoding val int32 : int32 encoding
val int64 : int64 encoding val int64 : int64 encoding

View File

@ -399,7 +399,7 @@ module Mining = struct
let shell = let shell =
{ Store.Block_header.net_id = bi.net ; predecessor = bi.hash ; { Store.Block_header.net_id = bi.net ; predecessor = bi.hash ;
timestamp ; fitness ; operations } in timestamp ; fitness ; operations } in
let slot = { Block.level = level.level ; priority = Int32.of_int priority } in let slot = { Block.level = level.level ; priority } in
mine_stamp mine_stamp
block src_sk shell slot seed_nonce_hash >>=? fun proof_of_work_nonce -> block src_sk shell slot seed_nonce_hash >>=? fun proof_of_work_nonce ->
Client_proto_rpcs.Helpers.Forge.block rpc_config Client_proto_rpcs.Helpers.Forge.block rpc_config
@ -410,7 +410,7 @@ module Mining = struct
~fitness ~fitness
~operations ~operations
~level:level.level ~level:level.level
~priority:priority ~priority
~seed_nonce_hash ~seed_nonce_hash
~proof_of_work_nonce ~proof_of_work_nonce
() >>=? fun unsigned_header -> () >>=? fun unsigned_header ->
@ -453,7 +453,7 @@ module Mining = struct
let endorsement_reward contract block = let endorsement_reward contract block =
Client_mining_blocks.info rpc_config block >>=? fun bi -> Client_mining_blocks.info rpc_config block >>=? fun bi ->
get_first_priority bi.level.level contract block >>=? fun prio -> get_first_priority bi.level.level contract block >>=? fun prio ->
Mining.endorsement_reward ~block_priority:(Int32.of_int prio) >|= Mining.endorsement_reward ~block_priority:prio >|=
Register_client_embedded_proto_alpha.wrap_error >>|? Register_client_embedded_proto_alpha.wrap_error >>|?
Tez.to_cents Tez.to_cents