Shell: store the last allowed fork level
This commit is contained in:
parent
a43ee47ee1
commit
d02892b810
@ -221,8 +221,9 @@ module Locked_block = struct
|
|||||||
let header : Block_header.t = { shell ; protocol_data = MBytes.create 0 } in
|
let header : Block_header.t = { shell ; protocol_data = MBytes.create 0 } in
|
||||||
Store.Block.Contents.store (store, genesis.block)
|
Store.Block.Contents.store (store, genesis.block)
|
||||||
{ Store.Block.header ; message = Some "Genesis" ;
|
{ Store.Block.header ; message = Some "Genesis" ;
|
||||||
max_operations_ttl = 0 ;
|
max_operations_ttl = 0 ; context ;
|
||||||
context ; metadata = MBytes.create 0 ;
|
metadata = MBytes.create 0 ;
|
||||||
|
last_allowed_fork_level = 0l ;
|
||||||
} >>= fun () ->
|
} >>= fun () ->
|
||||||
Lwt.return header
|
Lwt.return header
|
||||||
|
|
||||||
@ -442,6 +443,8 @@ module Block = struct
|
|||||||
let message { contents = { message } } = message
|
let message { contents = { message } } = message
|
||||||
let max_operations_ttl { contents = { max_operations_ttl } } =
|
let max_operations_ttl { contents = { max_operations_ttl } } =
|
||||||
max_operations_ttl
|
max_operations_ttl
|
||||||
|
let last_allowed_fork_level { contents = { last_allowed_fork_level } } =
|
||||||
|
last_allowed_fork_level
|
||||||
|
|
||||||
let is_genesis b = Block_hash.equal b.hash b.chain_state.genesis.block
|
let is_genesis b = Block_hash.equal b.hash b.chain_state.genesis.block
|
||||||
|
|
||||||
@ -540,7 +543,7 @@ module Block = struct
|
|||||||
chain_state block_header block_header_metadata
|
chain_state block_header block_header_metadata
|
||||||
operations operations_metadata
|
operations operations_metadata
|
||||||
{ Tezos_protocol_environment_shell.context ; message ;
|
{ Tezos_protocol_environment_shell.context ; message ;
|
||||||
max_operations_ttl } =
|
max_operations_ttl ; last_allowed_fork_level } =
|
||||||
let bytes = Block_header.to_bytes block_header in
|
let bytes = Block_header.to_bytes block_header in
|
||||||
let hash = Block_header.hash_raw bytes in
|
let hash = Block_header.hash_raw bytes in
|
||||||
fail_unless
|
fail_unless
|
||||||
@ -577,6 +580,7 @@ module Block = struct
|
|||||||
block_header ;
|
block_header ;
|
||||||
message ;
|
message ;
|
||||||
max_operations_ttl ;
|
max_operations_ttl ;
|
||||||
|
last_allowed_fork_level ;
|
||||||
context = commit ;
|
context = commit ;
|
||||||
metadata = block_header_metadata ;
|
metadata = block_header_metadata ;
|
||||||
} in
|
} in
|
||||||
|
@ -120,6 +120,7 @@ module Block : sig
|
|||||||
val message: t -> string option
|
val message: t -> string option
|
||||||
val max_operations_ttl: t -> int
|
val max_operations_ttl: t -> int
|
||||||
val metadata: t -> MBytes.t
|
val metadata: t -> MBytes.t
|
||||||
|
val last_allowed_fork_level: t -> Int32.t
|
||||||
|
|
||||||
val is_genesis: t -> bool
|
val is_genesis: t -> bool
|
||||||
val predecessor: t -> block option Lwt.t
|
val predecessor: t -> block option Lwt.t
|
||||||
|
@ -84,6 +84,7 @@ module Block = struct
|
|||||||
header: Block_header.t ;
|
header: Block_header.t ;
|
||||||
message: string option ;
|
message: string option ;
|
||||||
max_operations_ttl: int ;
|
max_operations_ttl: int ;
|
||||||
|
last_allowed_fork_level: Int32.t ;
|
||||||
context: Context_hash.t ;
|
context: Context_hash.t ;
|
||||||
metadata: MBytes.t ;
|
metadata: MBytes.t ;
|
||||||
}
|
}
|
||||||
@ -98,16 +99,19 @@ module Block = struct
|
|||||||
let open Data_encoding in
|
let open Data_encoding in
|
||||||
conv
|
conv
|
||||||
(fun { header ; message ; max_operations_ttl ;
|
(fun { header ; message ; max_operations_ttl ;
|
||||||
|
last_allowed_fork_level ;
|
||||||
context ; metadata } ->
|
context ; metadata } ->
|
||||||
(message, max_operations_ttl,
|
(message, max_operations_ttl, last_allowed_fork_level,
|
||||||
context, metadata, header ))
|
context, metadata, header ))
|
||||||
(fun (message, max_operations_ttl,
|
(fun (message, max_operations_ttl, last_allowed_fork_level,
|
||||||
context, metadata, header ) ->
|
context, metadata, header ) ->
|
||||||
{ header ; message ; max_operations_ttl ;
|
{ header ; message ; max_operations_ttl ;
|
||||||
|
last_allowed_fork_level ;
|
||||||
context ; metadata })
|
context ; metadata })
|
||||||
(obj5
|
(obj6
|
||||||
(opt "message" string)
|
(opt "message" string)
|
||||||
(req "max_operations_ttl" uint16)
|
(req "max_operations_ttl" uint16)
|
||||||
|
(req "last_allowed_fork_level" int32)
|
||||||
(req "context" Context_hash.encoding)
|
(req "context" Context_hash.encoding)
|
||||||
(req "metadata" bytes)
|
(req "metadata" bytes)
|
||||||
(req "header" Block_header.encoding))
|
(req "header" Block_header.encoding))
|
||||||
|
@ -89,6 +89,7 @@ module Block : sig
|
|||||||
header: Block_header.t ;
|
header: Block_header.t ;
|
||||||
message: string option ;
|
message: string option ;
|
||||||
max_operations_ttl: int ;
|
max_operations_ttl: int ;
|
||||||
|
last_allowed_fork_level: Int32.t ;
|
||||||
context: Context_hash.t ;
|
context: Context_hash.t ;
|
||||||
metadata: MBytes.t ;
|
metadata: MBytes.t ;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,8 @@ let lolblock ?(operations = []) header =
|
|||||||
max_operations_ttl = 0 ;
|
max_operations_ttl = 0 ;
|
||||||
message = None ;
|
message = None ;
|
||||||
context = Context_hash.zero ;
|
context = Context_hash.zero ;
|
||||||
|
max_operation_data_length = 0 ;
|
||||||
|
last_allowed_fork_level = 0l ;
|
||||||
}
|
}
|
||||||
|
|
||||||
let b1 = lolblock "Blop !"
|
let b1 = lolblock "Blop !"
|
||||||
|
Loading…
Reference in New Issue
Block a user