Shell/Protocol: minor renaming
This commit is contained in:
parent
c316dc00a8
commit
729ca9887d
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 ->
|
||||
|
@ -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 *)
|
||||
|
||||
|
@ -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 ;
|
||||
|
@ -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) ->
|
||||
|
@ -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,
|
||||
|
@ -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" )
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 :
|
||||
|
@ -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
|
||||
|
@ -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 ;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user