Alpha: rename bond into deposit

This commit is contained in:
Grégoire Henry 2018-03-15 15:21:21 +01:00 committed by Benjamin Canou
parent 987e4a5314
commit 71ee3114a7
15 changed files with 96 additions and 96 deletions

View File

@ -107,7 +107,7 @@ let test_endorsement_rewards block0 =
done ;
return (!account, !cpt) in
let bond = Tez.to_mutez Constants.endorsement_security_deposit in
let deposit = Tez.to_mutez Constants.endorsement_security_deposit in
(* Endorsement Rights *)
(* #1 endorse & inject in a block *)
@ -118,7 +118,7 @@ let test_endorsement_rewards block0 =
Helpers.Baking.bake block0 b1 [ op ] >>=? fun hash1 ->
Helpers.display_level (`Hash hash1) >>=? fun () ->
Assert.balance_equal ~block:(`Hash hash1) ~msg:__LOC__ account0
(Int64.sub (Tez.to_mutez balance0) bond) >>=? fun () ->
(Int64.sub (Tez.to_mutez balance0) deposit) >>=? fun () ->
(* #2 endorse & inject in a block *)
let block1 = `Hash hash1 in
@ -129,7 +129,7 @@ let test_endorsement_rewards block0 =
Helpers.Baking.bake block1 b1 [ op ] >>=? fun hash2 ->
Helpers.display_level (`Hash hash2) >>=? fun () ->
Assert.balance_equal ~block:(`Hash hash2) ~msg:__LOC__ account1
(Int64.sub (Tez.to_mutez balance1) bond) >>=? fun () ->
(Int64.sub (Tez.to_mutez balance1) deposit) >>=? fun () ->
(*
(* Check rewards after one cycle for account0 *)

View File

@ -86,7 +86,7 @@ let source_arg =
arg
~long:"source"
~placeholder:"identity"
~doc:"source of the bonds to be paid\n\
~doc:"source of the deposits to be paid\n\
Must be a known identity."
string_parameter

View File

@ -356,7 +356,7 @@ module Nonce : sig
type unrevealed = {
nonce_hash: Nonce_hash.t ;
delegate: public_key_hash ;
bond: Tez.t ;
deposit: Tez.t ;
rewards: Tez.t ;
fees: Tez.t ;
}
@ -495,7 +495,7 @@ module Delegate : sig
val list: context -> public_key_hash list Lwt.t
val freeze_bond:
val freeze_deposit:
context -> public_key_hash -> Tez.t -> context tzresult Lwt.t
val freeze_rewards:

View File

@ -308,7 +308,7 @@ let apply_consensus_operation_content ctxt
Operation.check_signature delegate operation >>=? fun () ->
let delegate = Ed25519.Public_key.hash delegate in
let ctxt = Fitness.increase ~gap:(List.length slots) ctxt in
Baking.freeze_endorsement_bond ctxt delegate >>=? fun ctxt ->
Baking.freeze_endorsement_deposit ctxt delegate >>=? fun ctxt ->
Baking.endorsement_reward ~block_priority >>=? fun reward ->
Delegate.freeze_rewards ctxt delegate reward >>=? fun ctxt ->
return ctxt
@ -603,9 +603,9 @@ let begin_full_construction ctxt pred_timestamp protocol_data =
Baking.check_baking_rights
ctxt protocol_data pred_timestamp >>=? fun delegate_pk ->
let delegate_pkh = Ed25519.Public_key.hash delegate_pk in
Baking.freeze_baking_bond ctxt protocol_data delegate_pkh >>=? fun (ctxt, bond) ->
Baking.freeze_baking_deposit ctxt protocol_data delegate_pkh >>=? fun (ctxt, deposit) ->
let ctxt = Fitness.increase ctxt in
return (ctxt, protocol_data, delegate_pk, bond)
return (ctxt, protocol_data, delegate_pk, deposit)
let begin_partial_construction ctxt =
let ctxt = Fitness.increase ctxt in
@ -627,12 +627,12 @@ let begin_application ctxt block_header pred_timestamp =
(Invalid_commitment
{ expected = current_level.expected_commitment }) >>=? fun () ->
let delegate_pkh = Ed25519.Public_key.hash delegate_pk in
Baking.freeze_baking_bond ctxt
block_header.protocol_data delegate_pkh >>=? fun (ctxt, bond) ->
Baking.freeze_baking_deposit ctxt
block_header.protocol_data delegate_pkh >>=? fun (ctxt, deposit) ->
let ctxt = Fitness.increase ctxt in
return (ctxt, delegate_pk, bond)
return (ctxt, delegate_pk, deposit)
let finalize_application ctxt protocol_data delegate bond fees rewards =
let finalize_application ctxt protocol_data delegate deposit fees rewards =
(* end of level (from this point nothing should fail) *)
Lwt.return Tez.(rewards +? Constants.block_reward) >>=? fun rewards ->
Delegate.freeze_fees ctxt delegate fees >>=? fun ctxt ->
@ -642,7 +642,7 @@ let finalize_application ctxt protocol_data delegate bond fees rewards =
| None -> return ctxt
| Some nonce_hash ->
Nonce.record_hash ctxt
{ nonce_hash ; delegate ; bond ; rewards ; fees }
{ nonce_hash ; delegate ; deposit ; rewards ; fees }
end >>=? fun ctxt ->
(* end of cycle *)
may_snapshot_roll ctxt >>=? fun ctxt ->

View File

@ -14,8 +14,8 @@ open Misc
type error += Invalid_fitness_gap of int64 * int64 (* `Permanent *)
type error += Invalid_endorsement_slot of int * int (* `Permanent *)
type error += Timestamp_too_early of Timestamp.t * Timestamp.t (* `Permanent *)
type error += Cannot_freeze_baking_bond (* `Permanent *)
type error += Cannot_freeze_endorsement_bond (* `Permanent *)
type error += Cannot_freeze_baking_deposit (* `Permanent *)
type error += Cannot_freeze_endorsement_deposit (* `Permanent *)
type error += Inconsistent_endorsement of public_key_hash list (* `Permanent *)
type error += Empty_endorsement
type error += Invalid_block_signature of Block_hash.t * Ed25519.Public_key_hash.t (* `Permanent *)
@ -64,24 +64,24 @@ let () =
(fun (m, g) -> Invalid_endorsement_slot (m, g)) ;
register_error_kind
`Permanent
~id:"baking.cannot_freeze_baking_bond"
~title:"Cannot freeze baking bond"
~id:"baking.cannot_freeze_baking_deposit"
~title:"Cannot freeze baking deposit"
~description:
"Impossible to debit the required tokens on the baker's contract"
~pp:(fun ppf () -> Format.fprintf ppf "Cannot freeze the baking bond")
~pp:(fun ppf () -> Format.fprintf ppf "Cannot freeze the baking deposit")
Data_encoding.unit
(function Cannot_freeze_baking_bond -> Some () | _ -> None)
(fun () -> Cannot_freeze_baking_bond) ;
(function Cannot_freeze_baking_deposit -> Some () | _ -> None)
(fun () -> Cannot_freeze_baking_deposit) ;
register_error_kind
`Permanent
~id:"baking.cannot_freeze_endorsement_bond"
~title:"Cannot freeze endorsement bond"
~id:"baking.cannot_freeze_endorsement_deposit"
~title:"Cannot freeze endorsement deposit"
~description:
"Impossible to debit the required tokens on the endorser's contract"
~pp:(fun ppf () -> Format.fprintf ppf "Cannot freeze the endorsement bond")
~pp:(fun ppf () -> Format.fprintf ppf "Cannot freeze the endorsement deposit")
Data_encoding.unit
(function Cannot_freeze_endorsement_bond -> Some () | _ -> None)
(fun () -> Cannot_freeze_endorsement_bond) ;
(function Cannot_freeze_endorsement_deposit -> Some () | _ -> None)
(fun () -> Cannot_freeze_endorsement_deposit) ;
register_error_kind
`Permanent
~id:"baking.inconsisten_endorsement"
@ -130,19 +130,19 @@ let minimal_time c priority pred_timestamp =
(cumsum_time_between_blocks
pred_timestamp (Constants.time_between_blocks c) (Int32.succ priority))
let freeze_baking_bond ctxt { Block_header.priority ; _ } delegate =
let freeze_baking_deposit ctxt { Block_header.priority ; _ } delegate =
if Compare.Int.(priority >= Constants.first_free_baking_slot ctxt)
then return (ctxt, Tez.zero)
else
let bond = Constants.block_security_deposit in
Delegate.freeze_bond ctxt delegate bond
|> trace Cannot_freeze_baking_bond >>=? fun ctxt ->
return (ctxt, bond)
let deposit = Constants.block_security_deposit in
Delegate.freeze_deposit ctxt delegate deposit
|> trace Cannot_freeze_baking_deposit >>=? fun ctxt ->
return (ctxt, deposit)
let freeze_endorsement_bond ctxt delegate =
let bond = Constants.endorsement_security_deposit in
Delegate.freeze_bond ctxt delegate bond
|> trace Cannot_freeze_endorsement_bond
let freeze_endorsement_deposit ctxt delegate =
let deposit = Constants.endorsement_security_deposit in
Delegate.freeze_deposit ctxt delegate deposit
|> trace Cannot_freeze_endorsement_deposit
let check_timestamp c priority pred_timestamp =
minimal_time c priority pred_timestamp >>=? fun minimal_time ->

View File

@ -15,8 +15,8 @@ type error += Invalid_fitness_gap of int64 * int64 (* `Permanent *)
type error += Invalid_endorsement_slot of int * int (* `Permanent *)
type error += Timestamp_too_early of Timestamp.t * Timestamp.t (* `Permanent *)
type error += Inconsistent_endorsement of public_key_hash list (* `Permanent *)
type error += Cannot_freeze_baking_bond (* `Permanent *)
type error += Cannot_freeze_endorsement_bond (* `Permanent *)
type error += Cannot_freeze_baking_deposit (* `Permanent *)
type error += Cannot_freeze_endorsement_deposit (* `Permanent *)
type error += Invalid_block_signature of Block_hash.t * Ed25519.Public_key_hash.t (* `Permanent *)
val paying_priorities: context -> int list
@ -28,34 +28,34 @@ val paying_priorities: context -> int list
time cannot be computed. *)
val minimal_time: context -> int -> Time.t -> Time.t tzresult Lwt.t
(** [freeze_baking_bond: ctxt delegate priority]
Freeze the baking bond (See !Constants.block_security_deposit)
from a delegate account. No bond is frozen if the baking
(** [freeze_baking_deposit: ctxt delegate priority]
Freeze the baking deposit (See !Constants.block_security_deposit)
from a delegate account. No deposit is frozen if the baking
priority of this block is greater than the maximum number
of paying baking in the network (meaning that n. bakers
skipped their turn).
Raise an error if the delegate account does not have enough
funds to claim baking rights. *)
val freeze_baking_bond:
val freeze_baking_deposit:
context ->
Block_header.protocol_data ->
public_key_hash ->
(context * Tez.t) tzresult Lwt.t
(** [freeze_endorsement_bond: ctxt delegate]
Freeze the endorsement bond (See !Constants.endorsement_security_deposit)
(** [freeze_endorsement_deposit: ctxt delegate]
Freeze the endorsement deposit (See !Constants.endorsement_security_deposit)
from the delegate account.
Raise an error if the baker account does not have enough
funds to claim endorsement rights *)
val freeze_endorsement_bond:
val freeze_endorsement_deposit:
context -> public_key_hash -> context tzresult Lwt.t
(** [check_baking_rights ctxt block pred_timestamp] verifies that:
* the contract that owned the roll at cycle start has the block signer as delegate.
* the timestamp is coherent with the announced slot.
* the bond have been payed if the slot is below [Constants.first_free_baking_slot].
* the deposit have been payed if the slot is below [Constants.first_free_baking_slot].
*)
val check_baking_rights:
context -> Block_header.protocol_data -> Time.t ->

View File

@ -184,30 +184,30 @@ let fold = Storage.Delegates.fold
let list = Storage.Delegates.elements
let get_frozen_bond ctxt contract cycle =
Storage.Contract.Frozen_bonds.get_option (ctxt, contract) cycle >>=? function
let get_frozen_deposit ctxt contract cycle =
Storage.Contract.Frozen_deposits.get_option (ctxt, contract) cycle >>=? function
| None -> return Tez_repr.zero
| Some frozen -> return frozen
let credit_frozen_bond ctxt contract cycle amount =
get_frozen_bond ctxt contract cycle >>=? fun old_amount ->
let credit_frozen_deposit ctxt contract cycle amount =
get_frozen_deposit ctxt contract cycle >>=? fun old_amount ->
Lwt.return Tez_repr.(old_amount +? amount) >>=? fun new_amount ->
Storage.Contract.Frozen_bonds.init_set
Storage.Contract.Frozen_deposits.init_set
(ctxt, contract) cycle new_amount >>= fun ctxt ->
return ctxt
let freeze_bond ctxt delegate amount =
let freeze_deposit ctxt delegate amount =
let { Level_repr.cycle ; _ } = Level_storage.current ctxt in
Roll_storage.Delegate.set_active ctxt delegate >>=? fun ctxt ->
let contract = Contract_repr.implicit_contract delegate in
Storage.Contract.Balance.get ctxt contract >>=? fun balance ->
Lwt.return Tez_repr.(balance -? amount) >>=? fun new_balance ->
Storage.Contract.Balance.set ctxt contract new_balance >>=? fun ctxt ->
credit_frozen_bond ctxt contract cycle amount
credit_frozen_deposit ctxt contract cycle amount
let burn_bond ctxt delegate cycle amount =
let burn_deposit ctxt delegate cycle amount =
let contract = Contract_repr.implicit_contract delegate in
get_frozen_bond ctxt contract cycle >>=? fun old_amount ->
get_frozen_deposit ctxt contract cycle >>=? fun old_amount ->
begin
match Tez_repr.(old_amount -? amount) with
| Ok new_amount ->
@ -219,7 +219,7 @@ let burn_bond ctxt delegate cycle amount =
ctxt delegate old_amount >>=? fun ctxt ->
return (Tez_repr.zero, ctxt)
end >>=? fun (new_amount, ctxt) ->
Storage.Contract.Frozen_bonds.set (ctxt, contract) cycle new_amount
Storage.Contract.Frozen_deposits.set (ctxt, contract) cycle new_amount
@ -288,16 +288,16 @@ let burn_rewards ctxt delegate cycle amount =
let unfreeze ctxt delegate cycle =
let contract = Contract_repr.implicit_contract delegate in
get_frozen_bond ctxt contract cycle >>=? fun bond ->
get_frozen_deposit ctxt contract cycle >>=? fun deposit ->
get_frozen_fees ctxt contract cycle >>=? fun fees ->
get_frozen_rewards ctxt contract cycle >>=? fun rewards ->
Storage.Contract.Balance.get ctxt contract >>=? fun balance ->
Lwt.return Tez_repr.(balance +? bond) >>=? fun balance ->
Lwt.return Tez_repr.(balance +? deposit) >>=? fun balance ->
Lwt.return Tez_repr.(balance +? fees) >>=? fun balance ->
Lwt.return Tez_repr.(balance +? rewards) >>=? fun balance ->
Storage.Contract.Balance.set ctxt contract balance >>=? fun ctxt ->
Roll_storage.Delegate.add_amount ctxt delegate rewards >>=? fun ctxt ->
Storage.Contract.Frozen_bonds.remove (ctxt, contract) cycle >>= fun ctxt ->
Storage.Contract.Frozen_deposits.remove (ctxt, contract) cycle >>= fun ctxt ->
Storage.Contract.Frozen_fees.remove (ctxt, contract) cycle >>= fun ctxt ->
Storage.Contract.Frozen_rewards.remove (ctxt, contract) cycle >>= fun ctxt ->
return ctxt
@ -311,8 +311,8 @@ let cycle_end ctxt last_cycle unrevealed =
List.fold_left
(fun ctxt (u : Nonce_storage.unrevealed) ->
ctxt >>=? fun ctxt ->
burn_bond
ctxt u.delegate revealed_cycle u.bond >>=? 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
@ -337,21 +337,21 @@ let cycle_end ctxt last_cycle unrevealed =
let punish ctxt delegate cycle =
let contract = Contract_repr.implicit_contract delegate in
get_frozen_bond ctxt contract cycle >>=? fun bond ->
get_frozen_deposit ctxt contract cycle >>=? fun deposit ->
get_frozen_fees ctxt contract cycle >>=? fun fees ->
Roll_storage.Delegate.remove_amount ctxt delegate bond >>=? fun ctxt ->
Roll_storage.Delegate.remove_amount ctxt delegate deposit >>=? fun ctxt ->
Roll_storage.Delegate.remove_amount ctxt delegate fees >>=? fun ctxt ->
Storage.Contract.Frozen_bonds.remove (ctxt, contract) cycle >>= fun ctxt ->
Storage.Contract.Frozen_deposits.remove (ctxt, contract) cycle >>= fun ctxt ->
Storage.Contract.Frozen_fees.remove (ctxt, contract) cycle >>= fun ctxt ->
Storage.Contract.Frozen_rewards.remove (ctxt, contract) cycle >>= fun ctxt ->
Lwt.return Tez_repr.(bond +? fees) >>=? fun burned ->
Lwt.return Tez_repr.(deposit +? fees) >>=? fun burned ->
return (ctxt, burned)
let has_frozen_balance ctxt delegate cycle =
let contract = Contract_repr.implicit_contract delegate in
get_frozen_bond ctxt contract cycle >>=? fun bond ->
if Tez_repr.(bond <> zero) then return true
get_frozen_deposit ctxt contract cycle >>=? fun deposit ->
if Tez_repr.(deposit <> zero) then return true
else
get_frozen_fees ctxt contract cycle >>=? fun fees ->
if Tez_repr.(fees <> zero) then return true
@ -362,7 +362,7 @@ let has_frozen_balance ctxt delegate cycle =
let frozen_balance ctxt delegate =
let contract = Contract_repr.implicit_contract delegate in
let balance = Ok Tez_repr.zero in
Storage.Contract.Frozen_bonds.fold
Storage.Contract.Frozen_deposits.fold
(ctxt, contract) ~init:balance
~f:(fun _cycle amount acc ->
Lwt.return acc >>=? fun acc ->

View File

@ -50,11 +50,11 @@ val fold:
(** List all registred delegates. *)
val list: Raw_context.t -> Ed25519.Public_key_hash.t list Lwt.t
(** Various functions to 'freeze' tokens. A frozen 'bond' keeps its
(** Various functions to 'freeze' tokens. A frozen 'deposit' keeps its
associated rolls. When frozen, 'fees' may trigger new rolls
allocation. Rewards won't trigger new rolls allocation until
unfrozen. *)
val freeze_bond:
val freeze_deposit:
Raw_context.t -> Ed25519.Public_key_hash.t -> Tez_repr.t ->
Raw_context.t tzresult Lwt.t
@ -67,14 +67,14 @@ val freeze_rewards:
Raw_context.t tzresult Lwt.t
(** Trigger the context maintenance at the end of cycle 'n', i.e.:
unfroze bond/fees/rewards from 'n - preserved_cycle' ; punish the
unfroze deposit/fees/rewards from 'n - preserved_cycle' ; punish the
provided unrevealed seeds (tipically seed from from cycle 'n -
1'). *)
val cycle_end:
Raw_context.t -> Cycle_repr.t -> Nonce_storage.unrevealed list ->
Raw_context.t tzresult Lwt.t
(** Burn all then frozen bond/fees/rewards for a delegate at a given
(** Burn all then frozen deposit/fees/rewards for a delegate at a given
cycle. Returns the burned amount. *)
val punish:
Raw_context.t -> Ed25519.Public_key_hash.t -> Cycle_repr.t ->

View File

@ -44,7 +44,7 @@ type validation_state =
{ mode : validation_mode ;
ctxt : Alpha_context.t ;
op_count : int ;
bond : Alpha_context.Tez.t ;
deposit : Alpha_context.Tez.t ;
fees : Alpha_context.Tez.t ;
rewards : Alpha_context.Tez.t ;
}
@ -71,9 +71,9 @@ let begin_application
let timestamp = block_header.shell.timestamp in
Alpha_context.init ~level ~timestamp ~fitness ctxt >>=? fun ctxt ->
Apply.begin_application
ctxt block_header pred_timestamp >>=? fun (ctxt, baker, bond) ->
ctxt block_header pred_timestamp >>=? fun (ctxt, baker, deposit) ->
let mode = Application { block_header ; baker = Ed25519.Public_key.hash baker } in
return { mode ; ctxt ; op_count = 0 ; bond ;
return { mode ; ctxt ; op_count = 0 ; deposit ;
fees = Alpha_context.Tez.zero ;
rewards = Alpha_context.Tez.zero }
@ -98,13 +98,13 @@ let begin_construction
| Some proto_header ->
Apply.begin_full_construction
ctxt pred_timestamp
proto_header >>=? fun (ctxt, protocol_data, baker, bond) ->
proto_header >>=? fun (ctxt, protocol_data, baker, deposit) ->
let mode =
let baker = Ed25519.Public_key.hash baker in
Full_construction { predecessor ; baker ; protocol_data } in
return (mode, ctxt, bond)
end >>=? fun (mode, ctxt, bond) ->
return { mode ; ctxt ; op_count = 0 ; bond ;
return (mode, ctxt, deposit)
end >>=? fun (mode, ctxt, deposit) ->
return { mode ; ctxt ; op_count = 0 ; deposit ;
fees = Alpha_context.Tez.zero ;
rewards = Alpha_context.Tez.zero }
@ -128,7 +128,7 @@ let apply_operation ({ mode ; ctxt ; op_count ; _ } as data) operation =
Lwt.return Alpha_context.Tez.(rewards >>? (+?) data.rewards) >>=? fun rewards ->
return { data with ctxt ; op_count ; fees ; rewards }
let finalize_block { mode ; ctxt ; op_count ; bond ; fees ; rewards } =
let finalize_block { mode ; ctxt ; op_count ; deposit ; fees ; rewards } =
match mode with
| Partial_construction _ ->
let ctxt = Alpha_context.finalize ctxt in
@ -137,7 +137,7 @@ let finalize_block { mode ; ctxt ; op_count ; bond ; fees ; rewards } =
{ baker ; block_header = { protocol_data ; _ } }
| Full_construction { protocol_data ; baker ; _ } ->
Apply.finalize_application
ctxt protocol_data baker bond fees rewards >>=? fun ctxt ->
ctxt protocol_data baker deposit fees rewards >>=? fun ctxt ->
let { level ; _ } : Alpha_context.Level.t =
Alpha_context. Level.current ctxt in
let priority = protocol_data.priority in

View File

@ -27,7 +27,7 @@ type validation_state =
{ mode : validation_mode ;
ctxt : Alpha_context.t ;
op_count : int ;
bond : Alpha_context.Tez.t ;
deposit : Alpha_context.Tez.t ;
fees : Alpha_context.Tez.t ;
rewards : Alpha_context.Tez.t ;
}

View File

@ -48,7 +48,7 @@ let reveal c level nonce =
type unrevealed = Storage.Seed.unrevealed_nonce = {
nonce_hash: Nonce_hash.t ;
delegate: Ed25519.Public_key_hash.t ;
bond: Tez_repr.t ;
deposit: Tez_repr.t ;
rewards: Tez_repr.t ;
fees: Tez_repr.t ;
}

View File

@ -20,7 +20,7 @@ val encoding: nonce Data_encoding.t
type unrevealed = Storage.Seed.unrevealed_nonce = {
nonce_hash: Nonce_hash.t ;
delegate: Ed25519.Public_key_hash.t ;
bond: Tez_repr.t ;
deposit: Tez_repr.t ;
rewards: Tez_repr.t ;
fees: Tez_repr.t ;
}

View File

@ -72,9 +72,9 @@ module Contract = struct
(struct let name = ["frozen_balance"] end))
(Cycle_repr.Index)
module Frozen_bonds =
module Frozen_deposits =
Frozen_balance_index.Make_map
(struct let name = ["bonds"] end)
(struct let name = ["deposits"] end)
(Make_value(Tez_repr))
module Frozen_fees =
@ -206,7 +206,7 @@ module Cycle = struct
type unrevealed_nonce = {
nonce_hash: Nonce_hash.t ;
delegate: Ed25519.Public_key_hash.t ;
bond: Tez_repr.t ;
deposit: Tez_repr.t ;
rewards: Tez_repr.t ;
fees: Tez_repr.t ;
}
@ -226,11 +226,11 @@ module Cycle = struct
Tez_repr.encoding
Tez_repr.encoding)
(function
| Unrevealed { nonce_hash ; delegate ; bond ; rewards ; fees } ->
Some (nonce_hash, delegate, bond, rewards, fees)
| Unrevealed { nonce_hash ; delegate ; deposit ; rewards ; fees } ->
Some (nonce_hash, delegate, deposit, rewards, fees)
| _ -> None)
(fun (nonce_hash, delegate, bond, rewards, fees) ->
Unrevealed { nonce_hash ; delegate ; bond ; rewards ; fees }) ;
(fun (nonce_hash, delegate, deposit, rewards, fees) ->
Unrevealed { nonce_hash ; delegate ; deposit ; rewards ; fees }) ;
case (Tag 1)
Seed_repr.nonce_encoding
(function
@ -395,7 +395,7 @@ module Seed = struct
type unrevealed_nonce = Cycle.unrevealed_nonce = {
nonce_hash: Nonce_hash.t ;
delegate: Ed25519.Public_key_hash.t ;
bond: Tez_repr.t ;
deposit: Tez_repr.t ;
rewards: Tez_repr.t ;
fees: Tez_repr.t ;
}

View File

@ -102,7 +102,7 @@ module Contract : sig
and type t := Raw_context.t
(** Frozen balance, see 'delegate_storage.mli' for more explanation *)
module Frozen_bonds : Indexed_data_storage
module Frozen_deposits : Indexed_data_storage
with type key = Cycle_repr.t
and type value = Tez_repr.t
and type t = Raw_context.t * Contract_repr.t
@ -236,7 +236,7 @@ module Seed : sig
type unrevealed_nonce = {
nonce_hash: Nonce_hash.t ;
delegate: Ed25519.Public_key_hash.t ;
bond: Tez_repr.t ;
deposit: Tez_repr.t ;
rewards: Tez_repr.t ;
fees: Tez_repr.t ;
}

View File

@ -57,13 +57,13 @@ let test_endorsement_payment () =
@@ List.nth endorsers endorser_slot in
Contract.get_balance tc (Contract.implicit_contract contract_p.hpub) >>=? fun init_balance ->
(* After one block, endorsement bond cost should be paid *)
(* After one block, endorsement deposit cost should be paid *)
Block.endorsement
root.tezos_header.shell root.hash
root.level block_priority contract_p
root.validation.context endorser_slot
>>=? fun result ->
get_balance_res contract_p result >>=? fun bond_balance ->
get_balance_res contract_p result >>=? fun deposit_balance ->
let protocol_data = Block.get_protocol_data block_priority in
Proto_alpha.Baking.check_baking_rights
result.tezos_context protocol_data root.tezos_header.shell.timestamp
@ -78,7 +78,7 @@ let test_endorsement_payment () =
else Tez.zero in
let cost = Cast.tez_add endorsement_security_deposit block_security_deposit in
let expected_balance = Cast.tez_sub init_balance cost in
Assert.equal_tez ~msg: __LOC__ expected_balance bond_balance ;
Assert.equal_tez ~msg: __LOC__ expected_balance deposit_balance ;
(* After one cycle, (4 blocks in test/proto_alpha/sandbox),
endorsement reward sould be received *)
chain_empty_block result >>=? chain_empty_block >>=?