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