diff --git a/src/client/embedded/alpha/client_proto_rpcs.ml b/src/client/embedded/alpha/client_proto_rpcs.ml index ca3dccc02..ce417a43b 100644 --- a/src/client/embedded/alpha/client_proto_rpcs.ml +++ b/src/client/embedded/alpha/client_proto_rpcs.ml @@ -267,7 +267,7 @@ module Helpers = struct let block cctxt block shell proto = call_error_service1 cctxt Services.Helpers.Parse.block block - ({ shell ; proto } : Updater.raw_block) + ({ shell ; proto } : Updater.raw_block_header) end end diff --git a/src/client/embedded/alpha/client_proto_rpcs.mli b/src/client/embedded/alpha/client_proto_rpcs.mli index 61f571cfc..84d69d736 100644 --- a/src/client/embedded/alpha/client_proto_rpcs.mli +++ b/src/client/embedded/alpha/client_proto_rpcs.mli @@ -342,7 +342,7 @@ module Helpers : sig proto_operation list tzresult Lwt.t val block: Client_rpcs.config -> - block -> Updater.shell_block -> MBytes.t -> + block -> Updater.shell_block_header -> MBytes.t -> Block.proto_header tzresult Lwt.t end diff --git a/src/node/updater/protocol.mli b/src/node/updater/protocol.mli index 1692449bf..0bd8e85fe 100644 --- a/src/node/updater/protocol.mli +++ b/src/node/updater/protocol.mli @@ -22,7 +22,7 @@ type raw_operation = Store.Operation.t = { proto: MBytes.t ; } -type shell_block = Store.Block_header.shell_header = +type shell_block_header = Store.Block_header.shell_header = { net_id: Net_id.t ; level: Int32.t ; proto_level: int ; (* uint8 *) @@ -32,8 +32,8 @@ type shell_block = Store.Block_header.shell_header = fitness: MBytes.t list ; } -type raw_block = Store.Block_header.t = { - shell: shell_block ; +type raw_block_header = Store.Block_header.t = { + shell: shell_block_header ; proto: MBytes.t ; } @@ -70,13 +70,13 @@ module type PROTOCOL = sig val precheck_block : ancestor_context: Context.t -> ancestor_timestamp: Time.t -> - raw_block -> + raw_block_header -> unit tzresult Lwt.t val begin_application : predecessor_context: Context.t -> predecessor_timestamp: Time.t -> predecessor_fitness: Fitness.fitness -> - raw_block -> + raw_block_header -> validation_state tzresult Lwt.t val begin_construction : predecessor_context: Context.t -> diff --git a/src/node/updater/updater.ml b/src/node/updater/updater.ml index 705ad8ae7..768f3b922 100644 --- a/src/node/updater/updater.ml +++ b/src/node/updater/updater.ml @@ -43,7 +43,7 @@ type raw_operation = Store.Operation.t = { } let raw_operation_encoding = Store.Operation.encoding -type shell_block = Store.Block_header.shell_header = { +type shell_block_header = Store.Block_header.shell_header = { net_id: Net_id.t ; level: Int32.t ; proto_level: int ; (* uint8 *) @@ -52,13 +52,13 @@ type shell_block = Store.Block_header.shell_header = { operations_hash: Operation_list_list_hash.t ; fitness: MBytes.t list ; } -let shell_block_encoding = Store.Block_header.shell_header_encoding +let shell_block_header_encoding = Store.Block_header.shell_header_encoding -type raw_block = Store.Block_header.t = { - shell: shell_block ; +type raw_block_header = Store.Block_header.t = { + shell: shell_block_header ; proto: MBytes.t ; } -let raw_block_encoding = Store.Block_header.encoding +let raw_block_header_encoding = Store.Block_header.encoding (** Version table *) diff --git a/src/node/updater/updater.mli b/src/node/updater/updater.mli index bbd0d5259..52ed2182c 100644 --- a/src/node/updater/updater.mli +++ b/src/node/updater/updater.mli @@ -18,7 +18,7 @@ type raw_operation = Store.Operation.t = { } val raw_operation_encoding: raw_operation Data_encoding.t -type shell_block = Store.Block_header.shell_header = { +type shell_block_header = Store.Block_header.shell_header = { net_id: Net_id.t ; level: Int32.t ; proto_level: int ; (* uint8 *) @@ -27,13 +27,13 @@ type shell_block = Store.Block_header.shell_header = { operations_hash: Operation_list_list_hash.t ; fitness: MBytes.t list ; } -val shell_block_encoding: shell_block Data_encoding.t +val shell_block_header_encoding: shell_block_header Data_encoding.t -type raw_block = Store.Block_header.t = { - shell: shell_block ; +type raw_block_header = Store.Block_header.t = { + shell: shell_block_header ; proto: MBytes.t ; } -val raw_block_encoding: raw_block Data_encoding.t +val raw_block_header_encoding: raw_block_header Data_encoding.t type validation_result = Protocol.validation_result = { context: Context.t ; diff --git a/src/proto/alpha/block_repr.ml b/src/proto/alpha/block_repr.ml index ebdf33fda..362e301a8 100644 --- a/src/proto/alpha/block_repr.ml +++ b/src/proto/alpha/block_repr.ml @@ -13,7 +13,7 @@ open Tezos_hash (** Exported type *) type header = { - shell: Updater.shell_block ; + shell: Updater.shell_block_header ; proto: proto_header ; signature: Ed25519.Signature.t ; } @@ -46,7 +46,7 @@ let signed_proto_header_encoding = let unsigned_header_encoding = let open Data_encoding in merge_objs - Updater.shell_block_encoding + Updater.shell_block_header_encoding proto_header_encoding (** Constants *) @@ -64,7 +64,7 @@ type error += let parse_header ({ shell = { net_id ; level ; proto_level ; predecessor ; timestamp ; fitness ; operations_hash } ; - proto } : Updater.raw_block) : header tzresult = + proto } : Updater.raw_block_header) : header tzresult = match Data_encoding.Binary.of_bytes signed_proto_header_encoding proto with | None -> Error [Cant_parse_proto_header] | Some (proto, signature) -> diff --git a/src/proto/alpha/block_repr.mli b/src/proto/alpha/block_repr.mli index 5d16c21ad..b9b98a600 100644 --- a/src/proto/alpha/block_repr.mli +++ b/src/proto/alpha/block_repr.mli @@ -11,7 +11,7 @@ open Tezos_hash (** Exported type *) type header = { - shell: Updater.shell_block ; + shell: Updater.shell_block_header ; proto: proto_header ; signature: Ed25519.Signature.t ; } @@ -26,16 +26,16 @@ and proto_header = { val max_header_length: int (** Parse the protocol-specific part of a block header. *) -val parse_header: Updater.raw_block -> header tzresult +val parse_header: Updater.raw_block_header -> header tzresult val proto_header_encoding: proto_header Data_encoding.encoding val unsigned_header_encoding: - (Updater.shell_block * proto_header) Data_encoding.encoding + (Updater.shell_block_header * proto_header) Data_encoding.encoding val forge_header: - Updater.shell_block -> proto_header -> MBytes.t + Updater.shell_block_header -> proto_header -> MBytes.t (** [forge_header shell_hdr proto_hdr] is the binary serialization (using [unsigned_header_encoding]) of a block header, comprising both the shell and the protocol part of the header, diff --git a/src/proto/alpha/services.ml b/src/proto/alpha/services.ml index 7e3944558..5bfa98c7d 100644 --- a/src/proto/alpha/services.ml +++ b/src/proto/alpha/services.ml @@ -592,7 +592,7 @@ module Helpers = struct let block custom_root = RPC.service ~description:"Parse a block" - ~input: Updater.raw_block_encoding + ~input: Updater.raw_block_header_encoding ~output: (wrap_tzerror Block.proto_header_encoding) RPC.Path.(custom_root / "helpers" / "parse" / "block" ) diff --git a/src/proto/alpha/tezos_context.mli b/src/proto/alpha/tezos_context.mli index f7dc099e2..77f950b83 100644 --- a/src/proto/alpha/tezos_context.mli +++ b/src/proto/alpha/tezos_context.mli @@ -517,7 +517,7 @@ end module Block : sig type header = { - shell: Updater.shell_block ; + shell: Updater.shell_block_header ; proto: proto_header ; signature: Ed25519.Signature.t ; } @@ -530,16 +530,16 @@ module Block : sig val max_header_length: int - val parse_header: Updater.raw_block -> header tzresult + val parse_header: Updater.raw_block_header -> header tzresult val proto_header_encoding: proto_header Data_encoding.encoding val unsigned_header_encoding: - (Updater.shell_block * proto_header) Data_encoding.encoding + (Updater.shell_block_header * proto_header) Data_encoding.encoding val forge_header: - Updater.shell_block -> proto_header -> MBytes.t + Updater.shell_block_header -> proto_header -> MBytes.t end diff --git a/src/proto/environment/updater.mli b/src/proto/environment/updater.mli index b5be855b8..6830a42fc 100644 --- a/src/proto/environment/updater.mli +++ b/src/proto/environment/updater.mli @@ -16,7 +16,7 @@ val raw_operation_encoding: raw_operation Data_encoding.t (** The version agnostic toplevel structure of blocks. *) -type shell_block = { +type shell_block_header = { net_id: Net_id.t ; (** The genesis of the chain this block belongs to. *) level: Int32.t ; @@ -34,13 +34,13 @@ type shell_block = { of unsigned bytes. Ordered by length and then by contents lexicographically. *) } -val shell_block_encoding: shell_block Data_encoding.t +val shell_block_header_encoding: shell_block_header Data_encoding.t -type raw_block = { - shell: shell_block ; +type raw_block_header = { + shell: shell_block_header ; proto: MBytes.t ; } -val raw_block_encoding: raw_block Data_encoding.t +val raw_block_header_encoding: raw_block_header Data_encoding.t type validation_result = { context: Context.t ; @@ -49,10 +49,11 @@ type validation_result = { } type rpc_context = { + block_hash: Block_hash.t ; + block_header: raw_block_header ; + operations_list: unit -> Operation_hash.t list list ; + operations: unit -> MBytes.t list list ; context: Context.t ; - level: Int32.t ; - timestamp: Time.t ; - fitness: Fitness.fitness ; } (** This is the signature of a Tezos protocol implementation. It has @@ -104,12 +105,12 @@ module type PROTOCOL = sig val precheck_block : ancestor_context: Context.t -> ancestor_timestamp: Time.t -> - raw_block -> + raw_block_header -> unit tzresult Lwt.t (** The first step in a block validation sequence. Initializes a validation context for validating a block. Takes as argument the - {!raw_block} to initialize the context for this block, patching + {!raw_block_header} to initialize the context for this block, patching the context resulting of the application of the predecessor block passed as parameter. The function {!precheck_block} may not have been called before [begin_application], so all the @@ -118,12 +119,12 @@ module type PROTOCOL = sig predecessor_context: Context.t -> predecessor_timestamp: Time.t -> predecessor_fitness: Fitness.fitness -> - raw_block -> + raw_block_header -> validation_state tzresult Lwt.t (** Initializes a validation context for constructing a new block (as opposed to validating an existing block). Since there is no - {!raw_block} header available, the parts that it provides are + {!raw_block_header} header available, the parts that it provides are passed as arguments (predecessor block hash, context resulting of the application of the predecessor block, and timestamp). *) val begin_construction : diff --git a/src/proto/genesis/data.ml b/src/proto/genesis/data.ml index 62fc6b18d..62b0db835 100644 --- a/src/proto/genesis/data.ml +++ b/src/proto/genesis/data.ml @@ -52,7 +52,7 @@ module Command = struct let forge shell command = Data_encoding.Binary.to_bytes - (Data_encoding.tup2 Updater.shell_block_encoding encoding) + (Data_encoding.tup2 Updater.shell_block_header_encoding encoding) (shell, command) end diff --git a/src/proto/genesis/main.ml b/src/proto/genesis/main.ml index 2d6d5805a..9634f8a9f 100644 --- a/src/proto/genesis/main.ml +++ b/src/proto/genesis/main.ml @@ -39,7 +39,7 @@ let compare_operations _ _ = 0 let max_number_of_operations = 0 type block = { - shell: Updater.shell_block ; + shell: Updater.shell_block_header ; command: Data.Command.t ; signature: Ed25519.Signature.t ; } diff --git a/test/proto_alpha/proto_alpha_helpers.mli b/test/proto_alpha/proto_alpha_helpers.mli index c9c4eada5..2d8ae1709 100644 --- a/test/proto_alpha/proto_alpha_helpers.mli +++ b/test/proto_alpha/proto_alpha_helpers.mli @@ -106,7 +106,7 @@ module Mining : sig val mine_stamp : Client_proto_rpcs.block -> secret_key -> - Updater.shell_block -> + Updater.shell_block_header -> int -> Nonce_hash.t -> MBytes.t tzresult Lwt.t