From a991396e10520d4c881efc11e2ee531993895e90 Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Wed, 21 Nov 2018 19:21:59 +0100 Subject: [PATCH] Alpha: make origination cost for tz[123]s on par with KT1s --- src/proto_alpha/lib_protocol/src/apply.ml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_protocol/src/apply.ml b/src/proto_alpha/lib_protocol/src/apply.ml index 2aa67974c..59d20937b 100644 --- a/src/proto_alpha/lib_protocol/src/apply.ml +++ b/src/proto_alpha/lib_protocol/src/apply.ml @@ -373,6 +373,15 @@ let apply_manager_operation_content : (ctxt, (Reveal_result : kind successful_manager_operation_result), []) | Transaction { amount ; parameters ; destination } -> begin spend ctxt source amount >>=? fun ctxt -> + begin match Contract.is_implicit destination with + | None -> return (ctxt, []) + | Some _ -> + Contract.allocated ctxt destination >>=? function + | true -> return (ctxt, []) + | false -> + Fees.origination_burn ctxt ~payer >>=? fun (ctxt, orignation_burn) -> + return (ctxt, [ Delegate.Contract payer, Delegate.Debited orignation_burn ]) + end >>=? fun (ctxt, maybe_burn_balance_update) -> Contract.credit ctxt destination amount >>=? fun ctxt -> Contract.get_script ctxt destination >>=? fun (ctxt, script) -> match script with @@ -398,8 +407,9 @@ let apply_manager_operation_content : big_map_diff = None; balance_updates = Delegate.cleanup_balance_updates - [ Contract source, Debited amount ; - Contract destination, Credited amount ] ; + ([ Delegate.Contract source, Delegate.Debited amount ; + Contract destination, Credited amount ] + @ maybe_burn_balance_update) ; originated_contracts = [] ; consumed_gas = Gas.consumed ~since:before_operation ~until:ctxt ; storage_size = Z.zero ;