diff --git a/src/client/embedded/alpha/client_proto_context.ml b/src/client/embedded/alpha/client_proto_context.ml index 53da0768c..14a09c3fe 100644 --- a/src/client/embedded/alpha/client_proto_context.ml +++ b/src/client/embedded/alpha/client_proto_context.ml @@ -120,10 +120,8 @@ let originate_contract rpc_config let faucet rpc_config block ?force ?branch ~manager_pkh () = get_branch rpc_config block branch >>=? fun (net_id, branch) -> - Client_proto_rpcs.Context.faucet_counter rpc_config block >>=? fun pcounter -> - let counter = Int32.succ pcounter in Client_proto_rpcs.Helpers.Forge.Anonymous.faucet - rpc_config block ~net_id ~branch ~id:manager_pkh counter >>=? fun bytes -> + rpc_config block ~net_id ~branch ~id:manager_pkh () >>=? fun bytes -> originate rpc_config ?force ~block bytes let delegate_contract rpc_config diff --git a/src/client/embedded/alpha/client_proto_rpcs.ml b/src/client/embedded/alpha/client_proto_rpcs.ml index 5f6054bb2..6b954f21b 100644 --- a/src/client/embedded/alpha/client_proto_rpcs.ml +++ b/src/client/embedded/alpha/client_proto_rpcs.ml @@ -77,9 +77,6 @@ module Context = struct let next_level cctxt block = call_error_service1 cctxt Services.Context.next_level block () - let faucet_counter cctxt block = - call_error_service1 cctxt Services.Context.faucet_counter block () - let voting_period_kind cctxt block = call_error_service1 cctxt Services.Context.voting_period_kind block () @@ -262,9 +259,9 @@ module Helpers = struct block ~net_id ~branch ~level ~nonce () = operations cctxt block ~net_id ~branch [Seed_nonce_revelation { level ; nonce }] let faucet cctxt - block ~net_id ~branch ~id counter = + block ~net_id ~branch ~id () = let nonce = Sodium.Random.Bigbytes.generate 16 in - operations cctxt block ~net_id ~branch [Faucet { id ; counter ; nonce }] + operations cctxt block ~net_id ~branch [Faucet { id ; nonce }] end let empty_proof_of_work_nonce = MBytes.of_string diff --git a/src/client/embedded/alpha/client_proto_rpcs.mli b/src/client/embedded/alpha/client_proto_rpcs.mli index 68c201e5a..e0ff11ecb 100644 --- a/src/client/embedded/alpha/client_proto_rpcs.mli +++ b/src/client/embedded/alpha/client_proto_rpcs.mli @@ -65,10 +65,6 @@ module Context : sig (** [next_level cctxt blk] returns the (protocol view of the) level of the successor of [blk]. *) - val faucet_counter: - Client_rpcs.config -> - block -> int32 tzresult Lwt.t - val voting_period_kind: Client_rpcs.config -> block -> Voting_period.kind tzresult Lwt.t @@ -335,7 +331,7 @@ module Helpers : sig net_id:Net_id.t -> branch:Block_hash.t -> id:public_key_hash -> - int32 -> MBytes.t tzresult Lwt.t + unit -> MBytes.t tzresult Lwt.t end val block_proto_header: Client_rpcs.config -> diff --git a/src/proto/alpha/apply.ml b/src/proto/alpha/apply.ml index 474bf91ee..6cbf00747 100644 --- a/src/proto/alpha/apply.ml +++ b/src/proto/alpha/apply.ml @@ -198,9 +198,7 @@ let apply_anonymous_operation ctxt miner_contract origination_nonce kind = ctxt contract Constants.seed_nonce_revelation_tip >>=? fun ctxt -> return (ctxt, origination_nonce) end - | Faucet { id = manager ; counter } -> - Contract.check_faucet_counter_increment ctxt counter >>=? fun () -> - Contract.increment_faucet_counter ctxt >>=? fun ctxt -> + | Faucet { id = manager } -> (* Free tez for all! *) begin match miner_contract with diff --git a/src/proto/alpha/contract_storage.ml b/src/proto/alpha/contract_storage.ml index 5581c455e..59a25dc35 100644 --- a/src/proto/alpha/contract_storage.ml +++ b/src/proto/alpha/contract_storage.ml @@ -13,8 +13,6 @@ type error += | Cannot_pay_storage_fee of Contract_repr.contract * Tez_repr.t * Tez_repr.t (* `Temporary *) | Counter_in_the_past of Contract_repr.contract * int32 * int32 (* `Branch *) | Counter_in_the_future of Contract_repr.contract * int32 * int32 (* `Temporary *) - | Faucet_counter_in_the_past of int32 * int32 (* `Branch *) - | Faucet_counter_in_the_future of int32 * int32 (* `Temporary *) | Unspendable_contract of Contract_repr.contract (* `Permanent *) | Non_existing_contract of Contract_repr.contract (* `Temporary *) | Non_delegatable_contract of Contract_repr.contract (* `Permanent *) @@ -107,36 +105,6 @@ let () = (req "found" int32)) (function Counter_in_the_past (c, x, y) -> Some (c, x, y) | _ -> None) (fun (c, x, y) -> Counter_in_the_past (c, x, y)) ; - register_error_kind - `Temporary - ~id:"contract.faucet_counter_in_the_future" - ~title:"Invalid faucet counter (not yet reached) in a manager operation" - ~description:"An operation assumed a faucet counter in the future" - ~pp:(fun ppf (exp, found) -> - Format.fprintf ppf - "Faucet counter %ld not yet reached (expected %ld)" - found exp) - Data_encoding. - (obj2 - (req "expected" int32) - (req "found" int32)) - (function Faucet_counter_in_the_future (x, y) -> Some (x, y) | _ -> None) - (fun (x, y) -> Faucet_counter_in_the_future (x, y)) ; - register_error_kind - `Branch - ~id:"contract.faucet_counter_in_the_past" - ~title:"Invalid faucet counter (already used) in a manager operation" - ~description:"An operation assumed a faucet counter in the past" - ~pp:(fun ppf (exp, found) -> - Format.fprintf ppf - "Faucet counter %ld already used (expected %ld)" - found exp) - Data_encoding. - (obj2 - (req "expected" int32) - (req "found" int32)) - (function Faucet_counter_in_the_past (x, y) -> Some (x, y) | _ -> None) - (fun (x, y) -> Faucet_counter_in_the_past (x, y)) ; register_error_kind `Temporary ~id:"contract.non_existing_contract" @@ -260,23 +228,6 @@ let increment_counter c contract = Storage.Contract.Counter.get c contract >>=? fun contract_counter -> Storage.Contract.Counter.set c contract (Int32.succ contract_counter) -let get_faucet_counter c = - Storage.Contract.Faucet_counter.get c - -let check_faucet_counter_increment c counter = - Storage.Contract.Faucet_counter.get c >>=? fun faucet_counter -> - let expected = Int32.succ faucet_counter in - if Compare.Int32.(expected = counter) - then return () - else if Compare.Int32.(expected > counter) then - fail (Faucet_counter_in_the_past (expected, counter)) - else - fail (Faucet_counter_in_the_future (expected, counter)) - -let increment_faucet_counter c = - Storage.Contract.Faucet_counter.get c >>=? fun faucet_counter -> - Storage.Contract.Faucet_counter.set c (Int32.succ faucet_counter) - let get_script c contract = Storage.Contract.Code.get_option c contract >>=? fun code -> Storage.Contract.Storage.get_option c contract >>=? fun storage -> @@ -416,5 +367,4 @@ let originate c nonce ~balance ~manager ?script ~delegate ~spendable ~delegatabl return (c, contract, nonce) let init c = - Storage.Contract.Faucet_counter.init c 0l >>=? fun c -> Storage.Contract.Global_counter.init c 0l diff --git a/src/proto/alpha/contract_storage.mli b/src/proto/alpha/contract_storage.mli index c09d2f768..57a841b30 100644 --- a/src/proto/alpha/contract_storage.mli +++ b/src/proto/alpha/contract_storage.mli @@ -28,10 +28,6 @@ val list: Storage.t -> Contract_repr.t list tzresult Lwt.t val check_counter_increment: Storage.t -> Contract_repr.t -> int32 -> unit tzresult Lwt.t val increment_counter: Storage.t -> Contract_repr.t -> Storage.t tzresult Lwt.t -val get_faucet_counter: Storage.t -> int32 tzresult Lwt.t -val check_faucet_counter_increment: Storage.t -> int32 -> unit tzresult Lwt.t -val increment_faucet_counter: Storage.t -> Storage.t tzresult Lwt.t - val is_delegatable : Storage.t -> Contract_repr.t -> bool tzresult Lwt.t val is_spendable : Storage.t -> Contract_repr.t -> bool tzresult Lwt.t diff --git a/src/proto/alpha/operation_repr.ml b/src/proto/alpha/operation_repr.ml index 11628eb6c..b7df5f4f5 100644 --- a/src/proto/alpha/operation_repr.ml +++ b/src/proto/alpha/operation_repr.ml @@ -34,7 +34,6 @@ and anonymous_operation = } | Faucet of { id: Ed25519.Public_key_hash.t ; - counter: counter ; nonce: MBytes.t ; } @@ -284,19 +283,18 @@ module Encoding = struct (fun ((), level, nonce) -> Seed_nonce_revelation { level ; nonce }) let faucet_encoding = - (obj4 + (obj3 (req "kind" (constant "faucet")) (req "id" Ed25519.Public_key_hash.encoding) - (req "counter" int32) (req "nonce" (Fixed.bytes 16))) let faucet_case tag = case ~tag faucet_encoding (function - | Faucet { id ; counter ; nonce } -> Some ((), id, counter, nonce) + | Faucet { id ; nonce } -> Some ((), id, nonce) | _ -> None ) - (fun ((), id, counter, nonce) -> Faucet { id ; counter ; nonce }) + (fun ((), id, nonce) -> Faucet { id ; nonce }) let unsigned_operation_case tag = case ~tag diff --git a/src/proto/alpha/operation_repr.mli b/src/proto/alpha/operation_repr.mli index cc2536b9a..c8e0e5ab2 100644 --- a/src/proto/alpha/operation_repr.mli +++ b/src/proto/alpha/operation_repr.mli @@ -34,7 +34,6 @@ and anonymous_operation = } | Faucet of { id: Ed25519.Public_key_hash.t ; - counter: counter ; nonce: MBytes.t ; } diff --git a/src/proto/alpha/services.ml b/src/proto/alpha/services.ml index b0bcbd244..4e518f41f 100644 --- a/src/proto/alpha/services.ml +++ b/src/proto/alpha/services.ml @@ -161,13 +161,6 @@ module Context = struct describe ~title: "detailled level info" Level.encoding) RPC.Path.(custom_root / "context" / "next_level") - let faucet_counter custom_root = - RPC.service - ~description: "Access the global faucet counter." - ~input: empty - ~output: (wrap_tzerror int32) - RPC.Path.(custom_root / "context" / "faucet_counter") - let voting_period_kind custom_root = RPC.service ~description: "Voting period kind for the current block" diff --git a/src/proto/alpha/services_registration.ml b/src/proto/alpha/services_registration.ml index e5cd39e22..c16306f8c 100644 --- a/src/proto/alpha/services_registration.ml +++ b/src/proto/alpha/services_registration.ml @@ -158,8 +158,6 @@ let next_level ctxt = let () = register0 Services.Context.next_level next_level -let () = register0 Services.Context.faucet_counter Contract.get_faucet_counter - let () = register0 Services.Context.voting_period_kind Vote.get_current_period_kind diff --git a/src/proto/alpha/storage.ml b/src/proto/alpha/storage.ml index 1512032bd..8b9adaffe 100644 --- a/src/proto/alpha/storage.ml +++ b/src/proto/alpha/storage.ml @@ -108,8 +108,6 @@ module Key = struct let global_counter = store_root ["global_counter"] - let faucet_counter = store_root ["faucet_counter"] - let next_cycle_to_be_rewarded = store_root ["next_cycle_to_be_rewarded"] let rewards = store_root ["rewards"] @@ -267,14 +265,6 @@ module Contract = struct let encoding = Data_encoding.int32 end) - module Faucet_counter = - Make_single_data_storage(struct - type value = int32 - let name = "faucet counter" - let key = Key.faucet_counter - let encoding = Data_encoding.int32 - end) - (** FIXME REMOVE : use 'list' *) module Set = Make_data_set_storage(struct diff --git a/src/proto/alpha/storage.mli b/src/proto/alpha/storage.mli index 839bd3a8b..45ae2110e 100644 --- a/src/proto/alpha/storage.mli +++ b/src/proto/alpha/storage.mli @@ -122,12 +122,6 @@ module Contract : sig val init : t -> int32 -> t tzresult Lwt.t end - module Faucet_counter : sig - val get : t -> int32 tzresult Lwt.t - val set : t -> int32 -> t tzresult Lwt.t - val init : t -> int32 -> t tzresult Lwt.t - end - (** The domain of alive contracts *) module Set : Data_set_storage with type value = Contract_repr.t diff --git a/src/proto/alpha/tezos_context.mli b/src/proto/alpha/tezos_context.mli index 0565df5d9..a20dbe343 100644 --- a/src/proto/alpha/tezos_context.mli +++ b/src/proto/alpha/tezos_context.mli @@ -369,12 +369,6 @@ module Contract : sig val check_counter_increment: context -> contract -> int32 -> unit tzresult Lwt.t - val get_faucet_counter: context -> int32 tzresult Lwt.t - - val check_faucet_counter_increment: context -> int32 -> unit tzresult Lwt.t - - val increment_faucet_counter: context -> context tzresult Lwt.t - end module Vote : sig @@ -441,7 +435,6 @@ and anonymous_operation = } | Faucet of { id: Ed25519.Public_key_hash.t ; - counter: counter ; nonce: MBytes.t ; } diff --git a/src/tezos-deps.opam b/src/tezos-deps.opam index c626a4045..8b8979109 100644 --- a/src/tezos-deps.opam +++ b/src/tezos-deps.opam @@ -19,11 +19,11 @@ depends: [ "calendar" "cohttp" {>= "0.21" } "conduit" + "ezjsonm" {= "0.4.3" } "git" "git-unix" "ipv6-multicast" "irmin-watcher" (* for `irmin.unix` *) - "ezjsonm" {= "0.4.3" } "irmin" {>= "0.12" & < "1.0" } "lwt" {>= "3.0.0" } "lwt_ssl"