Alpha: remove minimal serialization gas computation

This commit is contained in:
Alain Mebsout 2018-06-28 01:40:32 +02:00 committed by Benjamin Canou
parent 8648555f01
commit 0c8549b871
4 changed files with 2 additions and 18 deletions

View File

@ -304,7 +304,6 @@ module Script : sig
val force_decode : lazy_expr -> (expr * Gas.cost) tzresult val force_decode : lazy_expr -> (expr * Gas.cost) tzresult
val force_bytes : lazy_expr -> (MBytes.t * Gas.cost) tzresult val force_bytes : lazy_expr -> (MBytes.t * Gas.cost) tzresult
val minimal_deserialize_cost : lazy_expr -> Gas.cost val minimal_deserialize_cost : lazy_expr -> Gas.cost
val minimal_serialize_cost : lazy_expr -> Gas.cost
end end
module Constants : sig module Constants : sig

View File

@ -132,15 +132,3 @@ let minimal_deserialize_cost lexpr =
(fun b -> alloc_bytes_cost (MBytes.length b)) (fun b -> alloc_bytes_cost (MBytes.length b))
(fun c_free _ -> c_free) (fun c_free _ -> c_free)
lexpr lexpr
let minimal_serialize_cost lexpr =
let open Gas_limit_repr in
Data_encoding.fold_lazy
(fun v ->
let blocks, _words = expr_size v in
step_cost blocks +@
alloc_bytes_cost blocks (* TODO *)
)
(fun _ -> Gas_limit_repr.free)
(fun _ c_free -> c_free)
lexpr

View File

@ -40,5 +40,3 @@ val force_decode : lazy_expr -> (expr * Gas_limit_repr.cost) tzresult
val force_bytes : lazy_expr -> (MBytes.t * Gas_limit_repr.cost) tzresult val force_bytes : lazy_expr -> (MBytes.t * Gas_limit_repr.cost) tzresult
val minimal_deserialize_cost : lazy_expr -> Gas_limit_repr.cost val minimal_deserialize_cost : lazy_expr -> Gas_limit_repr.cost
val minimal_serialize_cost : lazy_expr -> Gas_limit_repr.cost

View File

@ -159,8 +159,7 @@ module Contract = struct
let consume_serialize_gas ctxt value = let consume_serialize_gas ctxt value =
Lwt.return @@ Lwt.return @@
( Raw_context.consume_gas ctxt (Script_repr.minimal_serialize_cost value) >>? fun _ -> (Script_repr.force_bytes value >>? fun (_value, value_cost) ->
Script_repr.force_bytes value >>? fun (_value, value_cost) ->
Raw_context.consume_gas ctxt value_cost) Raw_context.consume_gas ctxt value_cost)
let get ctxt contract = let get ctxt contract =