From 3ca03f6da7273f4f37bfdf9dad2ccc3762ff95e9 Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Fri, 11 May 2018 16:49:16 +0200 Subject: [PATCH] Alpha: remove dead code for deposit forfeiting --- .../lib_protocol/src/alpha_context.mli | 1 - src/proto_alpha/lib_protocol/src/apply.ml | 2 +- .../lib_protocol/src/delegate_storage.ml | 20 ------------------- .../lib_protocol/src/nonce_storage.ml | 1 - .../lib_protocol/src/nonce_storage.mli | 1 - src/proto_alpha/lib_protocol/src/storage.ml | 13 +++++------- src/proto_alpha/lib_protocol/src/storage.mli | 1 - 7 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/proto_alpha/lib_protocol/src/alpha_context.mli b/src/proto_alpha/lib_protocol/src/alpha_context.mli index 4658c3727..c9e942be6 100644 --- a/src/proto_alpha/lib_protocol/src/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/src/alpha_context.mli @@ -388,7 +388,6 @@ module Nonce : sig type unrevealed = { nonce_hash: Nonce_hash.t ; delegate: public_key_hash ; - deposit: Tez.t ; rewards: Tez.t ; fees: Tez.t ; } diff --git a/src/proto_alpha/lib_protocol/src/apply.ml b/src/proto_alpha/lib_protocol/src/apply.ml index 6056190e7..31d281f24 100644 --- a/src/proto_alpha/lib_protocol/src/apply.ml +++ b/src/proto_alpha/lib_protocol/src/apply.ml @@ -680,7 +680,7 @@ let finalize_application ctxt protocol_data delegate = | None -> return ctxt | Some nonce_hash -> Nonce.record_hash ctxt - { nonce_hash ; delegate ; deposit = Tez.zero ; rewards ; fees } + { nonce_hash ; delegate ; rewards ; fees } end >>=? fun ctxt -> (* end of cycle *) may_snapshot_roll ctxt >>=? fun ctxt -> diff --git a/src/proto_alpha/lib_protocol/src/delegate_storage.ml b/src/proto_alpha/lib_protocol/src/delegate_storage.ml index ddc46de41..bc618f02d 100644 --- a/src/proto_alpha/lib_protocol/src/delegate_storage.ml +++ b/src/proto_alpha/lib_protocol/src/delegate_storage.ml @@ -205,24 +205,6 @@ let freeze_deposit ctxt delegate amount = Storage.Contract.Balance.set ctxt contract new_balance >>=? fun ctxt -> credit_frozen_deposit ctxt contract cycle amount -let burn_deposit ctxt delegate cycle amount = - let contract = Contract_repr.implicit_contract delegate in - get_frozen_deposit ctxt contract cycle >>=? fun old_amount -> - begin - match Tez_repr.(old_amount -? amount) with - | Ok new_amount -> - Roll_storage.Delegate.remove_amount - ctxt delegate amount >>=? fun ctxt -> - return (new_amount, ctxt) - | Error _ -> - Roll_storage.Delegate.remove_amount - ctxt delegate old_amount >>=? fun ctxt -> - return (Tez_repr.zero, ctxt) - end >>=? fun (new_amount, ctxt) -> - Storage.Contract.Frozen_deposits.set (ctxt, contract) cycle new_amount - - - let get_frozen_fees ctxt contract cycle = Storage.Contract.Frozen_fees.get_option (ctxt, contract) cycle >>=? function | None -> return Tez_repr.zero @@ -311,8 +293,6 @@ let cycle_end ctxt last_cycle unrevealed = List.fold_left (fun ctxt (u : Nonce_storage.unrevealed) -> ctxt >>=? fun ctxt -> - burn_deposit - ctxt u.delegate revealed_cycle u.deposit >>=? fun ctxt -> burn_fees ctxt u.delegate revealed_cycle u.fees >>=? fun ctxt -> burn_rewards diff --git a/src/proto_alpha/lib_protocol/src/nonce_storage.ml b/src/proto_alpha/lib_protocol/src/nonce_storage.ml index b30bd5418..c3fea0778 100644 --- a/src/proto_alpha/lib_protocol/src/nonce_storage.ml +++ b/src/proto_alpha/lib_protocol/src/nonce_storage.ml @@ -89,7 +89,6 @@ let reveal ctxt level nonce = type unrevealed = Storage.Seed.unrevealed_nonce = { nonce_hash: Nonce_hash.t ; delegate: Signature.Public_key_hash.t ; - deposit: Tez_repr.t ; rewards: Tez_repr.t ; fees: Tez_repr.t ; } diff --git a/src/proto_alpha/lib_protocol/src/nonce_storage.mli b/src/proto_alpha/lib_protocol/src/nonce_storage.mli index d28a8e43c..0fed3a6af 100644 --- a/src/proto_alpha/lib_protocol/src/nonce_storage.mli +++ b/src/proto_alpha/lib_protocol/src/nonce_storage.mli @@ -20,7 +20,6 @@ val encoding: nonce Data_encoding.t type unrevealed = Storage.Seed.unrevealed_nonce = { nonce_hash: Nonce_hash.t ; delegate: Signature.Public_key_hash.t ; - deposit: Tez_repr.t ; rewards: Tez_repr.t ; fees: Tez_repr.t ; } diff --git a/src/proto_alpha/lib_protocol/src/storage.ml b/src/proto_alpha/lib_protocol/src/storage.ml index 16503d93e..5adf6daec 100644 --- a/src/proto_alpha/lib_protocol/src/storage.ml +++ b/src/proto_alpha/lib_protocol/src/storage.ml @@ -207,7 +207,6 @@ module Cycle = struct type unrevealed_nonce = { nonce_hash: Nonce_hash.t ; delegate: Signature.Public_key_hash.t ; - deposit: Tez_repr.t ; rewards: Tez_repr.t ; fees: Tez_repr.t ; } @@ -220,18 +219,17 @@ module Cycle = struct let open Data_encoding in union [ case (Tag 0) - (tup5 + (tup4 Nonce_hash.encoding Signature.Public_key_hash.encoding Tez_repr.encoding - Tez_repr.encoding Tez_repr.encoding) (function - | Unrevealed { nonce_hash ; delegate ; deposit ; rewards ; fees } -> - Some (nonce_hash, delegate, deposit, rewards, fees) + | Unrevealed { nonce_hash ; delegate ; rewards ; fees } -> + Some (nonce_hash, delegate, rewards, fees) | _ -> None) - (fun (nonce_hash, delegate, deposit, rewards, fees) -> - Unrevealed { nonce_hash ; delegate ; deposit ; rewards ; fees }) ; + (fun (nonce_hash, delegate, rewards, fees) -> + Unrevealed { nonce_hash ; delegate ; rewards ; fees }) ; case (Tag 1) Seed_repr.nonce_encoding (function @@ -396,7 +394,6 @@ module Seed = struct type unrevealed_nonce = Cycle.unrevealed_nonce = { nonce_hash: Nonce_hash.t ; delegate: Signature.Public_key_hash.t ; - deposit: Tez_repr.t ; rewards: Tez_repr.t ; fees: Tez_repr.t ; } diff --git a/src/proto_alpha/lib_protocol/src/storage.mli b/src/proto_alpha/lib_protocol/src/storage.mli index 1e58cebc8..65812a225 100644 --- a/src/proto_alpha/lib_protocol/src/storage.mli +++ b/src/proto_alpha/lib_protocol/src/storage.mli @@ -236,7 +236,6 @@ module Seed : sig type unrevealed_nonce = { nonce_hash: Nonce_hash.t ; delegate: Signature.Public_key_hash.t ; - deposit: Tez_repr.t ; rewards: Tez_repr.t ; fees: Tez_repr.t ; }