From e9c42123cb1075e37c0672b03949be965950d43a Mon Sep 17 00:00:00 2001 From: Pierre Chambart Date: Fri, 1 Jun 2018 18:24:38 +0200 Subject: [PATCH] Alpha: Simplify a few things after removing dead code. --- src/proto_alpha/lib_protocol/src/storage.ml | 24 +++++++++---------- .../lib_protocol/src/storage_functors.ml | 13 ++-------- .../lib_protocol/src/storage_functors.mli | 4 +--- .../lib_protocol/src/storage_sigs.ml | 11 +-------- 4 files changed, 16 insertions(+), 36 deletions(-) diff --git a/src/proto_alpha/lib_protocol/src/storage.ml b/src/proto_alpha/lib_protocol/src/storage.ml index e81ef1491..810ca8749 100644 --- a/src/proto_alpha/lib_protocol/src/storage.ml +++ b/src/proto_alpha/lib_protocol/src/storage.ml @@ -163,18 +163,18 @@ module Contract = struct module Code = Indexed_context.Make_carbonated_map (struct let name = ["code"] end) - (Make_carbonated_value(struct - type t = Script_repr.lazy_expr - let encoding = Script_repr.lazy_expr_encoding - end)) + (struct + type t = Script_repr.lazy_expr + let encoding = Script_repr.lazy_expr_encoding + end) module Storage = Indexed_context.Make_carbonated_map (struct let name = ["storage"] end) - (Make_carbonated_value(struct - type t = Script_repr.lazy_expr - let encoding = Script_repr.lazy_expr_encoding - end)) + (struct + type t = Script_repr.lazy_expr + let encoding = Script_repr.lazy_expr_encoding + end) type bigmap_key = Raw_context.t * Contract_repr.t @@ -184,10 +184,10 @@ module Contract = struct (Indexed_context.Raw_context) (struct let name = ["big_map"] end)) (String_index) - (Make_carbonated_value (struct - type t = Script_repr.expr - let encoding = Script_repr.expr_encoding - end)) + (struct + type t = Script_repr.expr + let encoding = Script_repr.expr_encoding + end) module Paid_storage_space_fees = Indexed_context.Make_map diff --git a/src/proto_alpha/lib_protocol/src/storage_functors.ml b/src/proto_alpha/lib_protocol/src/storage_functors.ml index c7cfd1c9d..a118c24b4 100644 --- a/src/proto_alpha/lib_protocol/src/storage_functors.ml +++ b/src/proto_alpha/lib_protocol/src/storage_functors.ml @@ -20,15 +20,6 @@ module Make_encoder (V : VALUE) = struct | None -> MBytes.create 0 end -module Make_carbonated_value (V : VALUE) = struct - include V - let size = - match Data_encoding.classify V.encoding with - | `Fixed _size -> - assert false - | `Variable | `Dynamic -> Variable -end - let len_name = "len" let data_name = "data" @@ -313,7 +304,7 @@ module Make_indexed_data_storage end module Make_indexed_carbonated_data_storage - (C : Raw_context.T) (I : INDEX) (V : CARBONATED_VALUE) + (C : Raw_context.T) (I : INDEX) (V : VALUE) : Non_iterable_indexed_carbonated_data_storage with type t = C.t and type key = I.t and type value = V.t = struct @@ -742,7 +733,7 @@ module Make_indexed_subcontext (C : Raw_context.T) (I : INDEX) end - module Make_carbonated_map (N : NAME) (V : CARBONATED_VALUE) = struct + module Make_carbonated_map (N : NAME) (V : VALUE) = struct type t = C.t type context = t type key = I.t diff --git a/src/proto_alpha/lib_protocol/src/storage_functors.mli b/src/proto_alpha/lib_protocol/src/storage_functors.mli index 754550b6b..c308c94bd 100644 --- a/src/proto_alpha/lib_protocol/src/storage_functors.mli +++ b/src/proto_alpha/lib_protocol/src/storage_functors.mli @@ -19,8 +19,6 @@ module Make_single_data_storage : Single_data_storage with type t = C.t and type value = V.t -module Make_carbonated_value (V : VALUE) : CARBONATED_VALUE with type t = V.t - module type INDEX = sig type t val path_length: int @@ -42,7 +40,7 @@ module Make_indexed_data_storage and type value = V.t module Make_indexed_carbonated_data_storage - (C : Raw_context.T) (I : INDEX) (V : CARBONATED_VALUE) + (C : Raw_context.T) (I : INDEX) (V : VALUE) : Non_iterable_indexed_carbonated_data_storage with type t = C.t and type key = I.t and type value = V.t diff --git a/src/proto_alpha/lib_protocol/src/storage_sigs.ml b/src/proto_alpha/lib_protocol/src/storage_sigs.ml index ac2ed73f0..3beb285e6 100644 --- a/src/proto_alpha/lib_protocol/src/storage_sigs.ml +++ b/src/proto_alpha/lib_protocol/src/storage_sigs.ml @@ -338,15 +338,6 @@ module type VALUE = sig val encoding: t Data_encoding.t end -type value_size = - | Fixed of int - | Variable - -module type CARBONATED_VALUE = sig - include VALUE - val size: value_size -end - module type Indexed_raw_context = sig type t @@ -371,7 +362,7 @@ module type Indexed_raw_context = sig and type key = key and type value = V.t - module Make_carbonated_map (N : NAME) (V : CARBONATED_VALUE) + module Make_carbonated_map (N : NAME) (V : VALUE) : Non_iterable_indexed_carbonated_data_storage with type t = t and type key = key and type value = V.t