Proto_sigs: split the deprecated module Tezos_data
This commit is contained in:
parent
db57afa4d1
commit
04465e3ac6
@ -56,21 +56,17 @@ module Make(Param : sig val name: string end)() = struct
|
|||||||
module Make_Blake2B = Blake2B.Make
|
module Make_Blake2B = Blake2B.Make
|
||||||
end
|
end
|
||||||
module Blake2B = Blake2B
|
module Blake2B = Blake2B
|
||||||
module Tezos_data = struct
|
module S = S
|
||||||
module type DATA = S.T
|
module Fitness = Fitness
|
||||||
module type HASHABLE_DATA = S.HASHABLE
|
module Operation = Operation
|
||||||
module Fitness = Fitness
|
module Block_header = Block_header
|
||||||
module Operation = Operation
|
module Protocol = Protocol
|
||||||
module Block_header = Block_header
|
|
||||||
module Protocol = Protocol
|
|
||||||
end
|
|
||||||
module RPC_arg = RPC_arg
|
module RPC_arg = RPC_arg
|
||||||
module RPC_path = RPC_path
|
module RPC_path = RPC_path
|
||||||
module RPC_query = RPC_query
|
module RPC_query = RPC_query
|
||||||
module RPC_service = RPC_service
|
module RPC_service = RPC_service
|
||||||
module RPC_answer = RPC_answer
|
module RPC_answer = RPC_answer
|
||||||
module RPC_directory = RPC_directory
|
module RPC_directory = RPC_directory
|
||||||
module Fitness = Fitness
|
|
||||||
module Error_monad = struct
|
module Error_monad = struct
|
||||||
type error_category = [ `Branch | `Temporary | `Permanent ]
|
type error_category = [ `Branch | `Temporary | `Permanent ]
|
||||||
include Error_monad.Make()
|
include Error_monad.Make()
|
||||||
|
@ -48,8 +48,7 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {|
|
|||||||
-warn-error -a+8
|
-warn-error -a+8
|
||||||
-open Tezos_embedded_protocol_environment_%s__Environment
|
-open Tezos_embedded_protocol_environment_%s__Environment
|
||||||
-open Error_monad
|
-open Error_monad
|
||||||
-open Hash
|
-open Hash))
|
||||||
-open Tezos_data))
|
|
||||||
(modules (:standard \ Environment Registerer))))
|
(modules (:standard \ Environment Registerer))))
|
||||||
|
|
||||||
(library
|
(library
|
||||||
|
@ -45,7 +45,6 @@ let opened_modules = [
|
|||||||
"Error_monad" ;
|
"Error_monad" ;
|
||||||
"Hash" ;
|
"Hash" ;
|
||||||
"Logging" ;
|
"Logging" ;
|
||||||
"Tezos_data" ;
|
|
||||||
]
|
]
|
||||||
|
|
||||||
let dump oc files =
|
let dump oc files =
|
||||||
|
@ -45,8 +45,12 @@
|
|||||||
v1/ed25519.mli
|
v1/ed25519.mli
|
||||||
|
|
||||||
;; Tezos specifics
|
;; Tezos specifics
|
||||||
|
v1/s.mli
|
||||||
v1/micheline.mli
|
v1/micheline.mli
|
||||||
v1/tezos_data.mli
|
v1/block_header.mli
|
||||||
|
v1/fitness.mli
|
||||||
|
v1/operation.mli
|
||||||
|
v1/protocol.mli
|
||||||
v1/context.mli
|
v1/context.mli
|
||||||
v1/updater.mli
|
v1/updater.mli
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ let opened_modules = [
|
|||||||
"Pervasives" ;
|
"Pervasives" ;
|
||||||
"Error_monad" ;
|
"Error_monad" ;
|
||||||
"Hash" ;
|
"Hash" ;
|
||||||
"Tezos_data" ;
|
|
||||||
]
|
]
|
||||||
|
|
||||||
let include_mli oc file =
|
let include_mli oc file =
|
||||||
|
33
src/lib_protocol_environment_sigs/v1/block_header.mli
Normal file
33
src/lib_protocol_environment_sigs/v1/block_header.mli
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
(**************************************************************************)
|
||||||
|
(* *)
|
||||||
|
(* Copyright (c) 2014 - 2017. *)
|
||||||
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||||
|
(* *)
|
||||||
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||||
|
(* *)
|
||||||
|
(**************************************************************************)
|
||||||
|
|
||||||
|
type shell_header = {
|
||||||
|
level: Int32.t ;
|
||||||
|
(** The number of preceding block in this chain, i.e. the genesis
|
||||||
|
has level 0. *)
|
||||||
|
proto_level: int ;
|
||||||
|
(** The number of preceding protocol change in the chain (modulo 256),
|
||||||
|
i.e the genesis has proto_level 0. *)
|
||||||
|
predecessor: Block_hash.t ;
|
||||||
|
timestamp: Time.t ;
|
||||||
|
validation_passes: int ;
|
||||||
|
operations_hash: Operation_list_list_hash.t ;
|
||||||
|
fitness: MBytes.t list ;
|
||||||
|
context: Context_hash.t ;
|
||||||
|
}
|
||||||
|
|
||||||
|
val shell_header_encoding: shell_header Data_encoding.t
|
||||||
|
|
||||||
|
type t = {
|
||||||
|
shell: shell_header ;
|
||||||
|
proto: MBytes.t ;
|
||||||
|
}
|
||||||
|
|
||||||
|
include S.HASHABLE with type t := t
|
||||||
|
and type hash := Block_hash.t
|
@ -7,10 +7,6 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
type fitness = MBytes.t list
|
(** The fitness of a block is defined as a list of bytes,
|
||||||
|
compared in a lexicographical order (longer list are greater). *)
|
||||||
val compare: fitness -> fitness -> int
|
include S.T with type t = MBytes.t list
|
||||||
val pp: Format.formatter -> fitness -> unit
|
|
||||||
val to_string: fitness -> string
|
|
||||||
|
|
||||||
val encoding: fitness Data_encoding.t
|
|
||||||
|
25
src/lib_protocol_environment_sigs/v1/operation.mli
Normal file
25
src/lib_protocol_environment_sigs/v1/operation.mli
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
(**************************************************************************)
|
||||||
|
(* *)
|
||||||
|
(* Copyright (c) 2014 - 2017. *)
|
||||||
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||||
|
(* *)
|
||||||
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||||
|
(* *)
|
||||||
|
(**************************************************************************)
|
||||||
|
|
||||||
|
(** Tezos operations. *)
|
||||||
|
|
||||||
|
type shell_header = {
|
||||||
|
branch: Block_hash.t ;
|
||||||
|
(** The operation is only valid in a branch containing the
|
||||||
|
block [branch]. *)
|
||||||
|
}
|
||||||
|
val shell_header_encoding: shell_header Data_encoding.t
|
||||||
|
|
||||||
|
type t = {
|
||||||
|
shell: shell_header ;
|
||||||
|
proto: MBytes.t ;
|
||||||
|
}
|
||||||
|
|
||||||
|
include S.HASHABLE with type t := t
|
||||||
|
and type hash := Operation_hash.t
|
31
src/lib_protocol_environment_sigs/v1/protocol.mli
Normal file
31
src/lib_protocol_environment_sigs/v1/protocol.mli
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
(**************************************************************************)
|
||||||
|
(* *)
|
||||||
|
(* Copyright (c) 2014 - 2017. *)
|
||||||
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||||
|
(* *)
|
||||||
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||||
|
(* *)
|
||||||
|
(**************************************************************************)
|
||||||
|
|
||||||
|
type t = {
|
||||||
|
expected_env: env_version ;
|
||||||
|
components: component list ;
|
||||||
|
}
|
||||||
|
|
||||||
|
(** An OCaml source component of a protocol implementation. *)
|
||||||
|
and component = {
|
||||||
|
(* The OCaml module name. *)
|
||||||
|
name : string ;
|
||||||
|
(* The OCaml interface source code *)
|
||||||
|
interface : string option ;
|
||||||
|
(* The OCaml source code *)
|
||||||
|
implementation : string ;
|
||||||
|
}
|
||||||
|
|
||||||
|
and env_version = V1
|
||||||
|
|
||||||
|
val component_encoding: component Data_encoding.t
|
||||||
|
val env_version_encoding: env_version Data_encoding.t
|
||||||
|
|
||||||
|
include S.HASHABLE with type t := t
|
||||||
|
and type hash := Protocol_hash.t
|
46
src/lib_protocol_environment_sigs/v1/s.mli
Normal file
46
src/lib_protocol_environment_sigs/v1/s.mli
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
(**************************************************************************)
|
||||||
|
(* *)
|
||||||
|
(* Copyright (c) 2014 - 2017. *)
|
||||||
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||||
|
(* *)
|
||||||
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||||
|
(* *)
|
||||||
|
(**************************************************************************)
|
||||||
|
|
||||||
|
(** Generic interface for a datatype with comparison, pretty-printer
|
||||||
|
and serialization functions. *)
|
||||||
|
module type T = sig
|
||||||
|
|
||||||
|
type t
|
||||||
|
|
||||||
|
val compare: t -> t -> int
|
||||||
|
val equal: t -> t -> bool
|
||||||
|
|
||||||
|
val (=): t -> t -> bool
|
||||||
|
val (<>): t -> t -> bool
|
||||||
|
val (<): t -> t -> bool
|
||||||
|
val (<=): t -> t -> bool
|
||||||
|
val (>=): t -> t -> bool
|
||||||
|
val (>): t -> t -> bool
|
||||||
|
val min: t -> t -> t
|
||||||
|
val max: t -> t -> t
|
||||||
|
|
||||||
|
val pp: Format.formatter -> t -> unit
|
||||||
|
|
||||||
|
val encoding: t Data_encoding.t
|
||||||
|
val to_bytes: t -> MBytes.t
|
||||||
|
val of_bytes: MBytes.t -> t option
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
(** Generic interface for a datatype with comparison, pretty-printer,
|
||||||
|
serialization functions and a hashing function. *)
|
||||||
|
module type HASHABLE = sig
|
||||||
|
|
||||||
|
include T
|
||||||
|
|
||||||
|
type hash
|
||||||
|
val hash: t -> hash
|
||||||
|
val hash_raw: MBytes.t -> hash
|
||||||
|
|
||||||
|
end
|
@ -1,128 +1,5 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2017. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
(** Tezos Protocol Environment - Basic data structures *)
|
|
||||||
|
|
||||||
(** Generic interface for a datatype with comparison, pretty-printer
|
|
||||||
and serialization functions. *)
|
|
||||||
module type DATA = sig
|
|
||||||
|
|
||||||
type t
|
|
||||||
|
|
||||||
val compare: t -> t -> int
|
|
||||||
val equal: t -> t -> bool
|
|
||||||
|
|
||||||
val (=): t -> t -> bool
|
|
||||||
val (<>): t -> t -> bool
|
|
||||||
val (<): t -> t -> bool
|
|
||||||
val (<=): t -> t -> bool
|
|
||||||
val (>=): t -> t -> bool
|
|
||||||
val (>): t -> t -> bool
|
|
||||||
val min: t -> t -> t
|
|
||||||
val max: t -> t -> t
|
|
||||||
|
|
||||||
val pp: Format.formatter -> t -> unit
|
|
||||||
|
|
||||||
val encoding: t Data_encoding.t
|
|
||||||
val to_bytes: t -> MBytes.t
|
|
||||||
val of_bytes: MBytes.t -> t option
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
(** Generic interface for a datatype with comparison, pretty-printer,
|
|
||||||
serialization functions and a hashing function. *)
|
|
||||||
module type HASHABLE_DATA = sig
|
|
||||||
|
|
||||||
include DATA
|
|
||||||
|
|
||||||
type hash
|
|
||||||
val hash: t -> hash
|
|
||||||
val hash_raw: MBytes.t -> hash
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
(** The fitness of a block is defined as a list of bytes,
|
|
||||||
compared in a lexicographical order (longer list are greater). *)
|
|
||||||
module Fitness : DATA with type t = MBytes.t list
|
|
||||||
|
|
||||||
(** Tezos operations. *)
|
|
||||||
module Operation : sig
|
|
||||||
|
|
||||||
type shell_header = {
|
|
||||||
branch: Block_hash.t ;
|
|
||||||
(** The operation is only valid in a branch containing the
|
|
||||||
block [branch]. *)
|
|
||||||
}
|
|
||||||
val shell_header_encoding: shell_header Data_encoding.t
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
shell: shell_header ;
|
|
||||||
proto: MBytes.t ;
|
|
||||||
}
|
|
||||||
|
|
||||||
include HASHABLE_DATA with type t := t
|
|
||||||
and type hash := Operation_hash.t
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
module Block_header : sig
|
|
||||||
|
|
||||||
type shell_header = {
|
|
||||||
level: Int32.t ;
|
|
||||||
(** The number of preceding block in this chain, i.e. the genesis
|
|
||||||
has level 0. *)
|
|
||||||
proto_level: int ;
|
|
||||||
(** The number of preceding protocol change in the chain (modulo 256),
|
|
||||||
i.e the genesis has proto_level 0. *)
|
|
||||||
predecessor: Block_hash.t ;
|
|
||||||
timestamp: Time.t ;
|
|
||||||
validation_passes: int ;
|
|
||||||
operations_hash: Operation_list_list_hash.t ;
|
|
||||||
fitness: MBytes.t list ;
|
|
||||||
context: Context_hash.t ;
|
|
||||||
}
|
|
||||||
|
|
||||||
val shell_header_encoding: shell_header Data_encoding.t
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
shell: shell_header ;
|
|
||||||
proto: MBytes.t ;
|
|
||||||
}
|
|
||||||
|
|
||||||
include HASHABLE_DATA with type t := t
|
|
||||||
and type hash := Block_hash.t
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
module Protocol : sig
|
module Protocol : sig
|
||||||
|
|
||||||
type t = {
|
|
||||||
expected_env: env_version ;
|
|
||||||
components: component list ;
|
|
||||||
}
|
|
||||||
|
|
||||||
(** An OCaml source component of a protocol implementation. *)
|
|
||||||
and component = {
|
|
||||||
(* The OCaml module name. *)
|
|
||||||
name : string ;
|
|
||||||
(* The OCaml interface source code *)
|
|
||||||
interface : string option ;
|
|
||||||
(* The OCaml source code *)
|
|
||||||
implementation : string ;
|
|
||||||
}
|
|
||||||
|
|
||||||
and env_version = V1
|
|
||||||
|
|
||||||
val component_encoding: component Data_encoding.t
|
|
||||||
val env_version_encoding: env_version Data_encoding.t
|
|
||||||
|
|
||||||
include HASHABLE_DATA with type t := t
|
|
||||||
and type hash := Protocol_hash.t
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -105,10 +105,10 @@ module Node_protocol_environment_sigs = struct
|
|||||||
and type Context.t = Context.t
|
and type Context.t = Context.t
|
||||||
and type Time.t = Time.t
|
and type Time.t = Time.t
|
||||||
and type MBytes.t = MBytes.t
|
and type MBytes.t = MBytes.t
|
||||||
and type Tezos_data.Operation.shell_header = Operation.shell_header
|
and type Operation.shell_header = Operation.shell_header
|
||||||
and type Tezos_data.Operation.t = Operation.t
|
and type Operation.t = Operation.t
|
||||||
and type Tezos_data.Block_header.shell_header = Block_header.shell_header
|
and type Block_header.shell_header = Block_header.shell_header
|
||||||
and type Tezos_data.Block_header.t = Block_header.t
|
and type Block_header.t = Block_header.t
|
||||||
and type 'a RPC_directory.t = 'a RPC_directory.t
|
and type 'a RPC_directory.t = 'a RPC_directory.t
|
||||||
and type Updater.validation_result = validation_result
|
and type Updater.validation_result = validation_result
|
||||||
and type Updater.rpc_context = rpc_context
|
and type Updater.rpc_context = rpc_context
|
||||||
|
@ -95,10 +95,10 @@ module Node_protocol_environment_sigs : sig
|
|||||||
and type Context.t = Context.t
|
and type Context.t = Context.t
|
||||||
and type Time.t = Time.t
|
and type Time.t = Time.t
|
||||||
and type MBytes.t = MBytes.t
|
and type MBytes.t = MBytes.t
|
||||||
and type Tezos_data.Operation.shell_header = Operation.shell_header
|
and type Operation.shell_header = Operation.shell_header
|
||||||
and type Tezos_data.Operation.t = Operation.t
|
and type Operation.t = Operation.t
|
||||||
and type Tezos_data.Block_header.shell_header = Block_header.shell_header
|
and type Block_header.shell_header = Block_header.shell_header
|
||||||
and type Tezos_data.Block_header.t = Block_header.t
|
and type Block_header.t = Block_header.t
|
||||||
and type 'a RPC_directory.t = 'a RPC_directory.t
|
and type 'a RPC_directory.t = 'a RPC_directory.t
|
||||||
and type Updater.validation_result = validation_result
|
and type Updater.validation_result = validation_result
|
||||||
and type Updater.rpc_context = rpc_context
|
and type Updater.rpc_context = rpc_context
|
||||||
|
@ -26,11 +26,11 @@ and proto_header = {
|
|||||||
|
|
||||||
type block_header = t
|
type block_header = t
|
||||||
|
|
||||||
type raw = Tezos_data.Block_header.t
|
type raw = Block_header.t
|
||||||
type shell_header = Tezos_data.Block_header.shell_header
|
type shell_header = Block_header.shell_header
|
||||||
|
|
||||||
let raw_encoding = Tezos_data.Block_header.encoding
|
let raw_encoding = Block_header.encoding
|
||||||
let shell_header_encoding = Tezos_data.Block_header.shell_header_encoding
|
let shell_header_encoding = Block_header.shell_header_encoding
|
||||||
|
|
||||||
let proto_header_encoding =
|
let proto_header_encoding =
|
||||||
let open Data_encoding in
|
let open Data_encoding in
|
||||||
|
@ -24,8 +24,8 @@ and proto_header = {
|
|||||||
|
|
||||||
type block_header = t
|
type block_header = t
|
||||||
|
|
||||||
type raw = Tezos_data.Block_header.t
|
type raw = Block_header.t
|
||||||
type shell_header = Tezos_data.Block_header.shell_header
|
type shell_header = Block_header.shell_header
|
||||||
|
|
||||||
val encoding: block_header Data_encoding.encoding
|
val encoding: block_header Data_encoding.encoding
|
||||||
val raw_encoding: raw Data_encoding.t
|
val raw_encoding: raw Data_encoding.t
|
||||||
|
@ -413,3 +413,5 @@ let parse_proto bytes =
|
|||||||
| None -> fail Cannot_parse_operation
|
| None -> fail Cannot_parse_operation
|
||||||
|
|
||||||
include Encoding
|
include Encoding
|
||||||
|
|
||||||
|
let hash_raw = Operation.hash
|
||||||
|
@ -92,6 +92,8 @@ type error += Cannot_parse_operation (* `Branch *)
|
|||||||
|
|
||||||
val encoding: operation Data_encoding.t
|
val encoding: operation Data_encoding.t
|
||||||
|
|
||||||
|
val hash_raw: raw -> Operation_hash.t
|
||||||
|
|
||||||
val parse:
|
val parse:
|
||||||
Operation_hash.t -> Operation.t -> operation tzresult
|
Operation_hash.t -> Operation.t -> operation tzresult
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ let parse_operations ctxt () (operations, check) =
|
|||||||
map_s begin fun raw ->
|
map_s begin fun raw ->
|
||||||
begin
|
begin
|
||||||
Lwt.return
|
Lwt.return
|
||||||
(Operation.parse (Tezos_data.Operation.hash raw) raw) >>=? fun op ->
|
(Operation.parse (Operation.hash_raw raw) raw) >>=? fun op ->
|
||||||
begin match check with
|
begin match check with
|
||||||
| Some true -> check_signature ctxt op.signature op.shell op.contents
|
| Some true -> check_signature ctxt op.signature op.shell op.contents
|
||||||
| Some false | None -> return ()
|
| Some false | None -> return ()
|
||||||
|
@ -605,6 +605,8 @@ module Operation : sig
|
|||||||
type t = operation
|
type t = operation
|
||||||
val encoding: operation Data_encoding.t
|
val encoding: operation Data_encoding.t
|
||||||
|
|
||||||
|
val hash_raw: raw -> Operation_hash.t
|
||||||
|
|
||||||
type error += Cannot_parse_operation (* `Branch *)
|
type error += Cannot_parse_operation (* `Branch *)
|
||||||
val parse: Operation_hash.t -> Operation.t -> operation tzresult
|
val parse: Operation_hash.t -> Operation.t -> operation tzresult
|
||||||
|
|
||||||
@ -641,8 +643,8 @@ module Block_header : sig
|
|||||||
|
|
||||||
type block_header = t
|
type block_header = t
|
||||||
|
|
||||||
type raw = Tezos_data.Block_header.t
|
type raw = Block_header.t
|
||||||
type shell_header = Tezos_data.Block_header.shell_header
|
type shell_header = Block_header.shell_header
|
||||||
|
|
||||||
val hash: block_header -> Block_hash.t
|
val hash: block_header -> Block_hash.t
|
||||||
val hash_raw: raw -> Block_hash.t
|
val hash_raw: raw -> Block_hash.t
|
||||||
|
Loading…
Reference in New Issue
Block a user