Alpha: remove some fixme and assert false
This commit is contained in:
parent
17644e0fa3
commit
ac62538eb6
@ -221,6 +221,24 @@ let register_resolvers enc resolve =
|
|||||||
type error += Unimplemented_sandbox_migration
|
type error += Unimplemented_sandbox_migration
|
||||||
|
|
||||||
let configure_sandbox ctxt json =
|
let configure_sandbox ctxt json =
|
||||||
|
let rec json_equals x y = match x, y with
|
||||||
|
| `Float x, `Float y -> Compare.Float.(x = y)
|
||||||
|
| `Bool x, `Bool y -> Compare.Bool.(x = y)
|
||||||
|
| `String x, `String y -> Compare.String.(x = y)
|
||||||
|
| `Null, `Null -> true
|
||||||
|
| `O x, `O y ->
|
||||||
|
let sort =
|
||||||
|
List.sort (fun (a, _) (b, _) -> Compare.String.compare a b) in
|
||||||
|
Compare.Int.(=) (List.length x) (List.length y) &&
|
||||||
|
List.for_all2
|
||||||
|
(fun (nx, vx) (ny, vy) ->
|
||||||
|
Compare.String.(nx = ny) && json_equals vx vy)
|
||||||
|
(sort x) (sort y)
|
||||||
|
| `A x, `A y ->
|
||||||
|
Compare.Int.(=) (List.length x) (List.length y) &&
|
||||||
|
List.for_all2 json_equals x y
|
||||||
|
| _, _ -> false
|
||||||
|
in
|
||||||
let json =
|
let json =
|
||||||
match json with
|
match json with
|
||||||
| None -> `O []
|
| None -> `O []
|
||||||
@ -233,10 +251,11 @@ let configure_sandbox ctxt json =
|
|||||||
get_sandboxed ctxt >>=? function
|
get_sandboxed ctxt >>=? function
|
||||||
| None ->
|
| None ->
|
||||||
fail Unimplemented_sandbox_migration
|
fail Unimplemented_sandbox_migration
|
||||||
| Some _ ->
|
| Some existing ->
|
||||||
(* FIXME GRGR fail if parameter changed! *)
|
if json_equals existing json then
|
||||||
(* failwith "Changing sandbox parameter is not yet implemented" *)
|
return ctxt
|
||||||
return ctxt
|
else
|
||||||
|
failwith "Changing sandbox parameter is not yet implemented"
|
||||||
|
|
||||||
(* Generic context ********************************************************)
|
(* Generic context ********************************************************)
|
||||||
|
|
||||||
|
@ -33,11 +33,6 @@ module Contract = struct
|
|||||||
(struct let name = ["global_counter"] end)
|
(struct let name = ["global_counter"] end)
|
||||||
(Make_value(Int32))
|
(Make_value(Int32))
|
||||||
|
|
||||||
(* module Set = *)
|
|
||||||
(* Make_data_set_storage *)
|
|
||||||
(* (Make_subcontext(Raw_context)(struct let name = ["set"] end)) *)
|
|
||||||
(* (Contract_repr.Index) *)
|
|
||||||
|
|
||||||
module Indexed_context =
|
module Indexed_context =
|
||||||
Make_indexed_subcontext
|
Make_indexed_subcontext
|
||||||
(Make_subcontext(Raw_context)(struct let name = ["index"] end))
|
(Make_subcontext(Raw_context)(struct let name = ["index"] end))
|
||||||
@ -330,13 +325,6 @@ module Seed = struct
|
|||||||
let set_option ctxt l v = Cycle.Nonce.set_option (ctxt, l.cycle) l.level v
|
let set_option ctxt l v = Cycle.Nonce.set_option (ctxt, l.cycle) l.level v
|
||||||
let delete ctxt l = Cycle.Nonce.delete (ctxt, l.cycle) l.level
|
let delete ctxt l = Cycle.Nonce.delete (ctxt, l.cycle) l.level
|
||||||
let remove ctxt l = Cycle.Nonce.remove (ctxt, l.cycle) l.level
|
let remove ctxt l = Cycle.Nonce.remove (ctxt, l.cycle) l.level
|
||||||
(* We don't need the follwing iterators and I am kind of busy
|
|
||||||
defining a signature "Non_iterable_indexed_data_storage" *)
|
|
||||||
let clear _ctxt = assert false
|
|
||||||
let keys _ctxt = assert false
|
|
||||||
let bindings _ctxt = assert false
|
|
||||||
let fold _ctxt = assert false
|
|
||||||
let fold_keys _ctxt = assert false
|
|
||||||
end
|
end
|
||||||
module For_cycle = Cycle.Seed
|
module For_cycle = Cycle.Seed
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ module Seed : sig
|
|||||||
}
|
}
|
||||||
| Revealed of Seed_repr.nonce
|
| Revealed of Seed_repr.nonce
|
||||||
|
|
||||||
module Nonce : Indexed_data_storage
|
module Nonce : Non_iterable_indexed_data_storage
|
||||||
with type key := Level_repr.t
|
with type key := Level_repr.t
|
||||||
and type value := nonce_status
|
and type value := nonce_status
|
||||||
and type t := Raw_context.t
|
and type t := Raw_context.t
|
||||||
|
@ -61,10 +61,8 @@ module type Single_data_storage = sig
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
(** The generic signature of indexed data accessors (a set of values
|
(** Restricted version of {!Indexed_data_storage} w/o iterators. *)
|
||||||
of the same type indexed by keys of the same form in the
|
module type Non_iterable_indexed_data_storage = sig
|
||||||
hierarchical (key x value) database). *)
|
|
||||||
module type Indexed_data_storage = sig
|
|
||||||
|
|
||||||
type t
|
type t
|
||||||
type context = t
|
type context = t
|
||||||
@ -115,13 +113,29 @@ module type Indexed_data_storage = sig
|
|||||||
bucket does not exists. *)
|
bucket does not exists. *)
|
||||||
val remove: context -> key -> Raw_context.t Lwt.t
|
val remove: context -> key -> Raw_context.t Lwt.t
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
(** The generic signature of indexed data accessors (a set of values
|
||||||
|
of the same type indexed by keys of the same form in the
|
||||||
|
hierarchical (key x value) database). *)
|
||||||
|
module type Indexed_data_storage = sig
|
||||||
|
|
||||||
|
include Non_iterable_indexed_data_storage
|
||||||
|
|
||||||
|
(** Empties all the keys and associated data. *)
|
||||||
val clear: context -> Raw_context.t Lwt.t
|
val clear: context -> Raw_context.t Lwt.t
|
||||||
|
|
||||||
|
(** Lists all the keys. *)
|
||||||
val keys: context -> key list Lwt.t
|
val keys: context -> key list Lwt.t
|
||||||
|
|
||||||
|
(** Lists all the keys and associated data. *)
|
||||||
val bindings: context -> (key * value) list Lwt.t
|
val bindings: context -> (key * value) list Lwt.t
|
||||||
|
|
||||||
|
(** Iterates over all the keys and associated data. *)
|
||||||
val fold:
|
val fold:
|
||||||
context -> init:'a -> f:(key -> value -> 'a -> 'a Lwt.t) -> 'a Lwt.t
|
context -> init:'a -> f:(key -> value -> 'a -> 'a Lwt.t) -> 'a Lwt.t
|
||||||
|
|
||||||
|
(** Iterate over all the keys. *)
|
||||||
val fold_keys:
|
val fold_keys:
|
||||||
context -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t
|
context -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t
|
||||||
|
|
||||||
@ -151,6 +165,7 @@ module type Data_set_storage = sig
|
|||||||
particular order. *)
|
particular order. *)
|
||||||
val elements: context -> elt list Lwt.t
|
val elements: context -> elt list Lwt.t
|
||||||
|
|
||||||
|
(** Iterates over the elements of the set. *)
|
||||||
val fold: context -> init:'a -> f:(elt -> 'a -> 'a Lwt.t) -> 'a Lwt.t
|
val fold: context -> init:'a -> f:(elt -> 'a -> 'a Lwt.t) -> 'a Lwt.t
|
||||||
|
|
||||||
(** Removes all elements in the set *)
|
(** Removes all elements in the set *)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user