Alpha: ignore delegate with unrevealed keys when freezing rolls
This commit is contained in:
parent
c78dd51f3d
commit
a875a5f2e9
@ -37,6 +37,7 @@
|
||||
"Level_storage",
|
||||
"Nonce_storage",
|
||||
"Seed_storage",
|
||||
"Public_key_storage",
|
||||
"Roll_storage",
|
||||
"Contract_storage",
|
||||
"Reward_storage",
|
||||
@ -44,7 +45,6 @@
|
||||
"Fitness_storage",
|
||||
"Vote_storage",
|
||||
"Init_storage",
|
||||
"Public_key_storage",
|
||||
|
||||
"Alpha_context",
|
||||
|
||||
|
@ -696,10 +696,10 @@ module Roll : sig
|
||||
val clear_cycle: context -> Cycle.t -> context tzresult Lwt.t
|
||||
|
||||
val baking_rights_owner:
|
||||
context -> Level.t -> priority:int -> public_key_hash tzresult Lwt.t
|
||||
context -> Level.t -> priority:int -> public_key tzresult Lwt.t
|
||||
|
||||
val endorsement_rights_owner:
|
||||
context -> Level.t -> slot:int -> public_key_hash tzresult Lwt.t
|
||||
context -> Level.t -> slot:int -> public_key tzresult Lwt.t
|
||||
|
||||
end
|
||||
|
||||
|
@ -123,7 +123,7 @@ let check_baking_rights c { Block_header.priority ; _ }
|
||||
let level = Level.current c in
|
||||
Roll.baking_rights_owner c level ~priority >>=? fun delegate ->
|
||||
check_timestamp c priority pred_timestamp >>=? fun () ->
|
||||
return delegate
|
||||
return (Ed25519.Public_key.hash delegate)
|
||||
|
||||
let pay_baking_bond c { Block_header.priority ; _ } id =
|
||||
if Compare.Int.(priority >= Constants.first_free_baking_slot c)
|
||||
@ -143,6 +143,7 @@ let check_signing_rights c slot delegate =
|
||||
(Invalid_endorsement_slot (Constants.max_signing_slot c, slot)) >>=? fun () ->
|
||||
let level = Level.current c in
|
||||
Roll.endorsement_rights_owner c level ~slot >>=? fun owning_delegate ->
|
||||
let owning_delegate = Ed25519.Public_key.hash owning_delegate in
|
||||
fail_unless (Ed25519.Public_key_hash.equal owning_delegate delegate)
|
||||
(Wrong_delegate (owning_delegate, delegate))
|
||||
|
||||
@ -187,9 +188,9 @@ let select_delegate delegate delegate_list max_priority =
|
||||
if Compare.Int.(n >= max_priority)
|
||||
then return (List.rev acc)
|
||||
else
|
||||
let LCons (pkh, t) = l in
|
||||
let LCons (pk, t) = l in
|
||||
let acc =
|
||||
if Ed25519.Public_key_hash.equal delegate pkh
|
||||
if Ed25519.Public_key_hash.equal delegate (Ed25519.Public_key.hash pk)
|
||||
then n :: acc
|
||||
else acc in
|
||||
t () >>=? fun t ->
|
||||
|
@ -75,12 +75,12 @@ val endorsement_reward: block_priority:int -> Tez.t tzresult Lwt.t
|
||||
(** [baking_priorities ctxt level] is the lazy list of contract's
|
||||
public key hashes that are allowed to bake for [level]. *)
|
||||
val baking_priorities:
|
||||
context -> Level.t -> public_key_hash lazy_list
|
||||
context -> Level.t -> public_key lazy_list
|
||||
|
||||
(** [endorsement_priorities ctxt level] is the lazy list of contract's
|
||||
public key hashes that are allowed to endorse for [level]. *)
|
||||
val endorsement_priorities:
|
||||
context -> Level.t -> public_key_hash lazy_list
|
||||
context -> Level.t -> public_key lazy_list
|
||||
|
||||
(** [first_baking_priorities ctxt ?max_priority contract_hash level]
|
||||
is a list of priorities of max [?max_priority] elements, where the
|
||||
|
@ -107,7 +107,7 @@ module Baker = struct
|
||||
let Misc.LCons (h, t) = l in
|
||||
t () >>=? fun t ->
|
||||
loop t (pred n) >>=? fun t ->
|
||||
return (h :: t)
|
||||
return (Ed25519.Public_key.hash h :: t)
|
||||
in
|
||||
loop contract_list max >>=? fun prio ->
|
||||
return (level.level, prio)
|
||||
@ -266,7 +266,7 @@ module Endorser = struct
|
||||
let Misc.LCons (h, t) = l in
|
||||
t () >>=? fun t ->
|
||||
loop t (pred n) >>=? fun t ->
|
||||
return (h :: t)
|
||||
return (Ed25519.Public_key.hash h :: t)
|
||||
in
|
||||
loop contract_list max >>=? fun prio ->
|
||||
return (level.level, prio)
|
||||
|
@ -134,7 +134,8 @@ module I = struct
|
||||
| Some (shell, contents) ->
|
||||
let operation = { hash ; shell ; contents ; signature } in
|
||||
let level = Alpha_context.Level.current ctxt in
|
||||
Baking.baking_priorities ctxt level >>=? fun (Misc.LCons (baker_pkh, _)) ->
|
||||
Baking.baking_priorities ctxt level >>=? fun (Misc.LCons (baker_pk, _)) ->
|
||||
let baker_pkh = Ed25519.Public_key.hash baker_pk in
|
||||
let baker_contract = Contract.implicit_contract baker_pkh in
|
||||
let block_prio = 0 in
|
||||
Apply.apply_operation
|
||||
|
@ -80,7 +80,9 @@ module Random = struct
|
||||
| None ->
|
||||
loop sequence
|
||||
| Some delegate ->
|
||||
return delegate
|
||||
Public_key_storage.get_option c delegate >>=? function
|
||||
| None -> loop sequence
|
||||
| Some delegate -> return delegate
|
||||
in
|
||||
Storage.Roll.Owner.snapshot_exists c cycle >>= fun snapshot_exists ->
|
||||
fail_unless snapshot_exists (No_roll_snapshot_for_cycle cycle) >>=? fun () ->
|
||||
|
@ -36,11 +36,11 @@ val clear_cycle :
|
||||
|
||||
val baking_rights_owner :
|
||||
Raw_context.t -> Level_repr.t -> priority:int ->
|
||||
Ed25519.Public_key_hash.t tzresult Lwt.t
|
||||
Ed25519.Public_key.t tzresult Lwt.t
|
||||
|
||||
val endorsement_rights_owner :
|
||||
Raw_context.t -> Level_repr.t -> slot:int ->
|
||||
Ed25519.Public_key_hash.t tzresult Lwt.t
|
||||
Ed25519.Public_key.t tzresult Lwt.t
|
||||
|
||||
module Contract : sig
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user