Tests: add Context.{get_seed,get_seed_nonce_hash}

This commit is contained in:
Marco Stronati 2018-05-22 16:58:14 +02:00 committed by Grégoire Henry
parent eeb7c6ff5e
commit dde6addbfb
4 changed files with 18 additions and 0 deletions

View File

@ -82,6 +82,17 @@ let get_bakers ctxt =
(fun p -> p.Alpha_services.Delegate.Baking_rights.delegate) (fun p -> p.Alpha_services.Delegate.Baking_rights.delegate)
bakers) bakers)
let get_seed_nonce_hash ctxt =
let header =
match ctxt with
| B { header } -> header
| I i -> Incremental.header i in
match header.protocol_data.contents.seed_nonce_hash with
| None -> failwith "Ne committed nonce"
| Some hash -> return hash
let get_seed ctxt = Alpha_services.Seed.get rpc_ctxt ctxt
let get_constants b = let get_constants b =
Alpha_services.Constants.all rpc_ctxt b Alpha_services.Constants.all rpc_ctxt b

View File

@ -24,6 +24,11 @@ val get_endorser: t -> int -> public_key_hash tzresult Lwt.t
val get_bakers: t -> public_key_hash list tzresult Lwt.t val get_bakers: t -> public_key_hash list tzresult Lwt.t
val get_seed_nonce_hash: t -> Nonce_hash.t tzresult Lwt.t
(** Returns the seed of the cycle to which the block belongs to. *)
val get_seed: t -> Seed.seed tzresult Lwt.t
(** Returns all the constants of the protocol *) (** Returns all the constants of the protocol *)
val get_constants: t -> Constants.t tzresult Lwt.t val get_constants: t -> Constants.t tzresult Lwt.t

View File

@ -20,6 +20,7 @@ type t = {
type incremental = t type incremental = t
let predecessor { predecessor ; _ } = predecessor let predecessor { predecessor ; _ } = predecessor
let header st = st.header
let level st = st.header.shell.level let level st = st.header.shell.level

View File

@ -14,6 +14,7 @@ type t
type incremental = t type incremental = t
val predecessor: incremental -> Block.t val predecessor: incremental -> Block.t
val header: incremental -> Block_header.t
val level: incremental -> int32 val level: incremental -> int32