Proto: export acceptable_passes

This commit is contained in:
Grégoire Henry 2018-01-31 10:18:32 +01:00 committed by Benjamin Canou
parent ae3ff0503b
commit 618a43b485
10 changed files with 17 additions and 0 deletions

View File

@ -38,6 +38,7 @@ module Make(Context : sig type t end) = struct
type operation
val parse_operation:
Operation_hash.t -> Operation.t -> operation tzresult
val acceptable_passes: operation -> int list
val compare_operations: operation -> operation -> int
type validation_state
val current_context: validation_state -> Context.t tzresult Lwt.t

View File

@ -70,6 +70,12 @@ module type PROTOCOL = sig
val parse_operation:
Operation_hash.t -> Operation.t -> operation tzresult
(** The Validation passes in which an operation can appear.
For instance [[0]] if it only belongs to the first pass.
An answer of [[]] means that the operation is ill-formed
and cannot be included at all. *)
val acceptable_passes: operation -> int list
(** Basic ordering of operations. [compare_operations op1 op2] means
that [op1] should appear before [op2] in a block. *)
val compare_operations: operation -> operation -> int

View File

@ -134,6 +134,7 @@ module type RAW_PROTOCOL = sig
type operation
val parse_operation:
Operation_hash.t -> Operation.t -> operation tzresult
val acceptable_passes: operation -> int list
val compare_operations: operation -> operation -> int
type validation_state
val current_context: validation_state -> Context.t tzresult Lwt.t

View File

@ -45,6 +45,7 @@ module type RAW_PROTOCOL = sig
type operation
val parse_operation:
Operation_hash.t -> Operation.t -> operation tzresult
val acceptable_passes: operation -> int list
val compare_operations: operation -> operation -> int
type validation_state
val current_context: validation_state -> Context.t tzresult Lwt.t

View File

@ -12,6 +12,7 @@
type operation = Tezos_context.operation
let parse_operation = Tezos_context.Operation.parse
let acceptable_passes = Tezos_context.Operation.acceptable_passes
let max_block_length =
Tezos_context.Block_header.max_header_length

View File

@ -362,6 +362,8 @@ let parse hash (op: Operation.t) =
ok { hash ; shell = op.shell ; contents ; signature }
| None -> error Cannot_parse_operation
let acceptable_passes _op = [0]
type error += Invalid_signature (* `Permanent *)
type error += Missing_signature (* `Permanent *)

View File

@ -97,6 +97,8 @@ val hash_raw: raw -> Operation_hash.t
val parse:
Operation_hash.t -> Operation.t -> operation tzresult
val acceptable_passes: operation -> int list
val parse_proto:
MBytes.t ->
(proto_operation * Ed25519.Signature.t option) tzresult Lwt.t

View File

@ -609,6 +609,7 @@ module Operation : sig
type error += Cannot_parse_operation (* `Branch *)
val parse: Operation_hash.t -> Operation.t -> operation tzresult
val acceptable_passes: operation -> int list
val parse_proto:
MBytes.t -> (proto_operation * signature option) tzresult Lwt.t

View File

@ -12,6 +12,7 @@ let max_operation_data_length = 42
let max_block_length = 42
let validation_passes = []
let acceptable_passes _op = []
let parse_operation h _ = Ok h

View File

@ -34,6 +34,7 @@ let () =
type operation = unit
let parse_operation _h _op = Error []
let acceptable_passes _op = []
let compare_operations _ _ = 0
let validation_passes = []