Alpha: remove dead code for deposit forfeiting

This commit is contained in:
Benjamin Canou 2018-05-11 16:49:16 +02:00
parent 3e6633bacc
commit 3ca03f6da7
7 changed files with 6 additions and 33 deletions

View File

@ -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 ;
}

View File

@ -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 ->

View File

@ -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

View File

@ -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 ;
}

View File

@ -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 ;
}

View File

@ -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 ;
}

View File

@ -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 ;
}