Alpha: remove block from endorsements
This commit is contained in:
parent
392f6cec46
commit
ec6db686d9
@ -300,15 +300,13 @@ let rec pp_contents_and_result_list :
|
||||
Ed25519.Public_key_hash.pp id
|
||||
pp_balance_updates bus
|
||||
| Single_and_result
|
||||
(Endorsement { block ; level },
|
||||
(Endorsement { level },
|
||||
Endorsement_result (delegate, slots)) ->
|
||||
Format.fprintf ppf
|
||||
"@[<v 2>Endorsement:@,\
|
||||
Block: %a@,\
|
||||
Level: %a@,\
|
||||
Delegate: %a@,\
|
||||
Slots: %a@]"
|
||||
Block_hash.pp block
|
||||
Raw_level.pp level
|
||||
Signature.Public_key_hash.pp delegate
|
||||
(Format.pp_print_list
|
||||
|
@ -554,7 +554,7 @@ module Endorse = struct
|
||||
let level = level.level in
|
||||
let shell = { Tezos_base.Operation.branch = hash } in
|
||||
let contents =
|
||||
Single (Endorsement { block = hash ; level }) in
|
||||
Single (Endorsement { level }) in
|
||||
sign ~watermark:Endorsement src_sk shell (Contents_list contents)
|
||||
|
||||
let signing_slots
|
||||
|
@ -803,7 +803,6 @@ and _ contents_list =
|
||||
|
||||
and _ contents =
|
||||
| Endorsement : {
|
||||
block: Block_hash.t ;
|
||||
level: Raw_level.t ;
|
||||
} -> Kind.endorsement contents
|
||||
| Seed_nonce_revelation : {
|
||||
|
@ -608,10 +608,7 @@ let apply_contents_list
|
||||
(contents_list : kind contents_list)
|
||||
: (context * kind contents_result_list) tzresult Lwt.t =
|
||||
match contents_list with
|
||||
| Single (Endorsement { block ; level }) ->
|
||||
fail_unless
|
||||
(Block_hash.equal block pred_block)
|
||||
(Wrong_endorsement_predecessor (pred_block, block)) >>=? fun () ->
|
||||
| Single (Endorsement { level }) ->
|
||||
let block = operation.shell.branch in
|
||||
fail_unless
|
||||
(Block_hash.equal block pred_block)
|
||||
@ -646,7 +643,7 @@ let apply_contents_list
|
||||
| Single (Endorsement e1),
|
||||
Single (Endorsement e2)
|
||||
when Raw_level.(e1.level = e2.level) &&
|
||||
not (Block_hash.equal e1.block e2.block) ->
|
||||
not (Block_hash.equal op1.shell.branch op2.shell.branch) ->
|
||||
let level = Level.from_raw ctxt e1.level in
|
||||
let oldest_level = Level.last_allowed_fork_level ctxt in
|
||||
fail_unless Level.(level < Level.current ctxt)
|
||||
|
@ -390,9 +390,9 @@ module Forge = struct
|
||||
() ({ branch }, Contents_list (Single operation))
|
||||
|
||||
let endorsement ctxt
|
||||
b ~branch ~block ~level () =
|
||||
b ~branch ~level () =
|
||||
operation ctxt b ~branch
|
||||
(Endorsement { block ; level })
|
||||
(Endorsement { level })
|
||||
|
||||
let proposals ctxt
|
||||
b ~branch ~source ~period ~proposals () =
|
||||
|
@ -129,7 +129,6 @@ module Forge : sig
|
||||
val endorsement:
|
||||
'a #RPC_context.simple -> 'a ->
|
||||
branch:Block_hash.t ->
|
||||
block:Block_hash.t ->
|
||||
level:Raw_level.t ->
|
||||
unit -> MBytes.t shell_tzresult Lwt.t
|
||||
|
||||
|
@ -52,7 +52,6 @@ and _ contents_list =
|
||||
|
||||
and _ contents =
|
||||
| Endorsement : {
|
||||
block: Block_hash.t ;
|
||||
level: Raw_level_repr.t ;
|
||||
} -> Kind.endorsement contents
|
||||
| Seed_nonce_revelation : {
|
||||
@ -305,8 +304,7 @@ module Encoding = struct
|
||||
inj: 'a -> 'b contents } -> 'b case
|
||||
|
||||
let endorsement_encoding =
|
||||
obj2
|
||||
(req "block" Block_hash.encoding)
|
||||
obj1
|
||||
(req "level" Raw_level_repr.encoding)
|
||||
|
||||
let endorsement_case =
|
||||
@ -319,9 +317,9 @@ module Encoding = struct
|
||||
| Contents (Endorsement _ as op) -> Some op
|
||||
| _ -> None) ;
|
||||
proj =
|
||||
(fun (Endorsement { block ; level }) -> (block, level)) ;
|
||||
(fun (Endorsement { level }) -> level) ;
|
||||
inj =
|
||||
(fun (block, level) -> Endorsement { block ; level })
|
||||
(fun level -> Endorsement { level })
|
||||
}
|
||||
|
||||
let endorsement_encoding =
|
||||
|
@ -53,7 +53,6 @@ and _ contents_list =
|
||||
|
||||
and _ contents =
|
||||
| Endorsement : {
|
||||
block: Block_hash.t ;
|
||||
level: Raw_level_repr.t ;
|
||||
} -> Kind.endorsement contents
|
||||
| Seed_nonce_revelation : {
|
||||
|
@ -39,10 +39,7 @@ let endorsement ?delegate ?level ctxt ?(signing_context = ctxt) () =
|
||||
| None -> Context.get_level ctxt
|
||||
| Some level -> return level
|
||||
end >>=? fun level ->
|
||||
let op =
|
||||
Single
|
||||
(Endorsement
|
||||
{ block = Context.branch ctxt ; level }) in
|
||||
let op = Single (Endorsement { level }) in
|
||||
return (sign ~watermark:Signature.Endorsement delegate.sk signing_context op)
|
||||
|
||||
let sign ?watermark sk ctxt (Contents_list contents) =
|
||||
|
Loading…
Reference in New Issue
Block a user