diff --git a/src/lib_shell/state.ml b/src/lib_shell/state.ml index 05bfbbaff..a8cce1501 100644 --- a/src/lib_shell/state.ml +++ b/src/lib_shell/state.ml @@ -221,8 +221,9 @@ module Locked_block = struct let header : Block_header.t = { shell ; protocol_data = MBytes.create 0 } in Store.Block.Contents.store (store, genesis.block) { Store.Block.header ; message = Some "Genesis" ; - max_operations_ttl = 0 ; - context ; metadata = MBytes.create 0 ; + max_operations_ttl = 0 ; context ; + metadata = MBytes.create 0 ; + last_allowed_fork_level = 0l ; } >>= fun () -> Lwt.return header @@ -442,6 +443,8 @@ module Block = struct let message { contents = { message } } = message let max_operations_ttl { contents = { 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 @@ -540,7 +543,7 @@ module Block = struct chain_state block_header block_header_metadata operations operations_metadata { 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 hash = Block_header.hash_raw bytes in fail_unless @@ -577,6 +580,7 @@ module Block = struct block_header ; message ; max_operations_ttl ; + last_allowed_fork_level ; context = commit ; metadata = block_header_metadata ; } in diff --git a/src/lib_shell/state.mli b/src/lib_shell/state.mli index ae115dde0..ec29e3541 100644 --- a/src/lib_shell/state.mli +++ b/src/lib_shell/state.mli @@ -120,6 +120,7 @@ module Block : sig val message: t -> string option val max_operations_ttl: t -> int val metadata: t -> MBytes.t + val last_allowed_fork_level: t -> Int32.t val is_genesis: t -> bool val predecessor: t -> block option Lwt.t diff --git a/src/lib_shell/store.ml b/src/lib_shell/store.ml index 692922cf7..889001e00 100644 --- a/src/lib_shell/store.ml +++ b/src/lib_shell/store.ml @@ -84,6 +84,7 @@ module Block = struct header: Block_header.t ; message: string option ; max_operations_ttl: int ; + last_allowed_fork_level: Int32.t ; context: Context_hash.t ; metadata: MBytes.t ; } @@ -98,16 +99,19 @@ module Block = struct let open Data_encoding in conv (fun { header ; message ; max_operations_ttl ; + last_allowed_fork_level ; context ; metadata } -> - (message, max_operations_ttl, + (message, max_operations_ttl, last_allowed_fork_level, context, metadata, header )) - (fun (message, max_operations_ttl, + (fun (message, max_operations_ttl, last_allowed_fork_level, context, metadata, header ) -> { header ; message ; max_operations_ttl ; + last_allowed_fork_level ; context ; metadata }) - (obj5 + (obj6 (opt "message" string) (req "max_operations_ttl" uint16) + (req "last_allowed_fork_level" int32) (req "context" Context_hash.encoding) (req "metadata" bytes) (req "header" Block_header.encoding)) diff --git a/src/lib_shell/store.mli b/src/lib_shell/store.mli index fbd6a3a29..4c20999e3 100644 --- a/src/lib_shell/store.mli +++ b/src/lib_shell/store.mli @@ -89,6 +89,7 @@ module Block : sig header: Block_header.t ; message: string option ; max_operations_ttl: int ; + last_allowed_fork_level: Int32.t ; context: Context_hash.t ; metadata: MBytes.t ; } diff --git a/src/lib_shell/test/test_store.ml b/src/lib_shell/test/test_store.ml index 65f9f826b..f645927e9 100644 --- a/src/lib_shell/test/test_store.ml +++ b/src/lib_shell/test/test_store.ml @@ -93,6 +93,8 @@ let lolblock ?(operations = []) header = max_operations_ttl = 0 ; message = None ; context = Context_hash.zero ; + max_operation_data_length = 0 ; + last_allowed_fork_level = 0l ; } let b1 = lolblock "Blop !"