From 279a45e4c407f5acca4c0a9ba67d67e10a441d1b Mon Sep 17 00:00:00 2001 From: Jules Viennot Date: Tue, 28 Jun 2022 10:24:37 +0200 Subject: [PATCH 1/3] Proto: increase paid storage implementation --- src/proto_alpha/lib_client/injection.ml | 6 +- .../lib_client/operation_result.ml | 17 +++++ src/proto_alpha/lib_injector/l1_operation.ml | 2 + .../lib_protocol/alpha_context.mli | 23 +++++++ src/proto_alpha/lib_protocol/apply.ml | 16 +++++ src/proto_alpha/lib_protocol/apply_results.ml | 68 +++++++++++++++++++ .../lib_protocol/apply_results.mli | 5 ++ .../lib_protocol/contract_storage.ml | 6 ++ .../lib_protocol/contract_storage.mli | 7 ++ src/proto_alpha/lib_protocol/fees_storage.ml | 25 ++++++- src/proto_alpha/lib_protocol/fees_storage.mli | 17 +++++ .../lib_protocol/operation_repr.ml | 36 ++++++++++ .../lib_protocol/operation_repr.mli | 14 ++++ .../lib_protocol/test/helpers/block.ml | 4 +- .../lib_protocol/validate_operation.ml | 3 +- 15 files changed, 245 insertions(+), 4 deletions(-) diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index bf0d74bf4ab2..b68b8fe18e23 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -318,6 +318,7 @@ let estimated_gas_single (type kind) | Delegation_result {consumed_gas} -> Ok consumed_gas | Register_global_constant_result {consumed_gas; _} -> Ok consumed_gas | Set_deposits_limit_result {consumed_gas} -> Ok consumed_gas + | Increase_paid_storage_result {consumed_gas; _} -> Ok consumed_gas | Tx_rollup_origination_result {consumed_gas; _} -> Ok consumed_gas | Tx_rollup_submit_batch_result {consumed_gas; _} -> Ok consumed_gas | Tx_rollup_commit_result {consumed_gas; _} -> Ok consumed_gas @@ -400,6 +401,7 @@ let estimated_storage_single (type kind) ~tx_rollup_origination_size | Register_global_constant_result {size_of_constant; _} -> Ok size_of_constant | Set_deposits_limit_result _ -> Ok Z.zero + | Increase_paid_storage_result _ -> Ok Z.zero | Tx_rollup_origination_result _ -> Ok tx_rollup_origination_size | Tx_rollup_submit_batch_result {paid_storage_size_diff; _} | Sc_rollup_execute_outbox_message_result {paid_storage_size_diff; _} -> @@ -508,6 +510,7 @@ let originated_contracts_single (type kind) | Reveal_result _ -> Ok [] | Delegation_result _ -> Ok [] | Set_deposits_limit_result _ -> Ok [] + | Increase_paid_storage_result _ -> Ok [] | Tx_rollup_origination_result _ -> Ok [] | Tx_rollup_submit_batch_result _ -> Ok [] | Tx_rollup_commit_result _ -> Ok [] @@ -858,7 +861,8 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) let safety_guard = match c.operation with | Transaction {destination = Implicit _; _} - | Reveal _ | Delegation _ | Set_deposits_limit _ -> + | Reveal _ | Delegation _ | Set_deposits_limit _ + | Increase_paid_storage _ -> Gas.Arith.zero | _ -> safety_guard in diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 698a03b80621..afcc5c4774d2 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -185,6 +185,16 @@ let pp_manager_operation_content (type kind) source ppf match limit_opt with | None -> Format.pp_print_string ppf "Unlimited deposits" | Some limit -> Format.fprintf ppf "Limit: %a" Tez.pp limit) + | Increase_paid_storage {amount_in_bytes; destination} -> + Format.fprintf + ppf + "Increase paid storage:@,Bytes: : %a@,From: %a@,To: %a" + Z.pp_print + amount_in_bytes + Contract.pp + source + Contract_hash.pp + destination | Tx_rollup_origination -> Format.fprintf ppf "Tx rollup origination:@,From: %a" Contract.pp source | Tx_rollup_submit_batch {tx_rollup; content; burn_limit = _} -> @@ -564,6 +574,11 @@ let pp_manager_operation_contents_result ppf op_result = pp_storage_size ppf size_of_constant ; Format.fprintf ppf "@,Global address: %a" Script_expr_hash.pp global_address in + let pp_increase_paid_storage_result + (Increase_paid_storage_result {consumed_gas; balance_updates}) = + pp_balance_updates ppf balance_updates ; + pp_consumed_gas ppf consumed_gas + in let pp_tx_rollup_origination_result (Tx_rollup_origination_result {balance_updates; consumed_gas; originated_tx_rollup}) = @@ -712,6 +727,7 @@ let pp_manager_operation_contents_result ppf op_result = | Delegation_result _ -> "delegation" | Register_global_constant_result _ -> "global constant registration" | Set_deposits_limit_result _ -> "deposits limit modification" + | Increase_paid_storage_result _ -> "paid storage increase" | Tx_rollup_origination_result _ -> "transaction rollup origination" | Tx_rollup_submit_batch_result _ -> "transaction rollup batch submission" | Tx_rollup_commit_result _ -> "transaction rollup commitment" @@ -749,6 +765,7 @@ let pp_manager_operation_contents_result ppf op_result = | Origination_result op_res -> pp_origination_result ppf op_res | Register_global_constant_result _ as op -> pp_register_global_constant_result op + | Increase_paid_storage_result _ as op -> pp_increase_paid_storage_result op | Tx_rollup_origination_result _ as op -> pp_tx_rollup_origination_result op | Tx_rollup_submit_batch_result _ as op -> pp_tx_rollup_submit_batch_result op diff --git a/src/proto_alpha/lib_injector/l1_operation.ml b/src/proto_alpha/lib_injector/l1_operation.ml index 4fe159cac90b..2aa9b014171e 100644 --- a/src/proto_alpha/lib_injector/l1_operation.ml +++ b/src/proto_alpha/lib_injector/l1_operation.ml @@ -49,6 +49,7 @@ module Manager_operation = struct make origination_case; make delegation_case; make set_deposits_limit_case; + make increase_paid_storage_case; make register_global_constant_case; make tx_rollup_origination_case; make tx_rollup_submit_batch_case; @@ -81,6 +82,7 @@ module Manager_operation = struct | Delegation _ -> delegation_case | Register_global_constant _ -> register_global_constant_case | Set_deposits_limit _ -> set_deposits_limit_case + | Increase_paid_storage _ -> increase_paid_storage_case | Tx_rollup_origination -> tx_rollup_origination_case | Tx_rollup_submit_batch _ -> tx_rollup_submit_batch_case | Tx_rollup_commit _ -> tx_rollup_commit_case diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 306daa7d0dc6..72bf5041a224 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -1689,6 +1689,9 @@ module Contract : sig val check_allocated_and_get_balance : context -> public_key_hash -> Tez.t tzresult Lwt.t + val increase_paid_storage : + context -> t -> amount_in_bytes:Z.t -> context tzresult Lwt.t + val fresh_contract_from_current_nonce : context -> (context * Contract_hash.t) tzresult @@ -3559,6 +3562,8 @@ module Kind : sig type set_deposits_limit = Set_deposits_limit_kind + type increase_paid_storage = Increase_paid_storage_kind + type failing_noop = Failing_noop_kind type register_global_constant = Register_global_constant_kind @@ -3609,6 +3614,7 @@ module Kind : sig | Delegation_manager_kind : delegation manager | Register_global_constant_manager_kind : register_global_constant manager | Set_deposits_limit_manager_kind : set_deposits_limit manager + | Increase_paid_storage_manager_kind : increase_paid_storage manager | Tx_rollup_origination_manager_kind : tx_rollup_origination manager | Tx_rollup_submit_batch_manager_kind : tx_rollup_submit_batch manager | Tx_rollup_commit_manager_kind : tx_rollup_commit manager @@ -3758,6 +3764,11 @@ and _ manager_operation = | Set_deposits_limit : Tez.t option -> Kind.set_deposits_limit manager_operation + | Increase_paid_storage : { + amount_in_bytes : Z.t; + destination : Contract_hash.t; + } + -> Kind.increase_paid_storage manager_operation | Tx_rollup_origination : Kind.tx_rollup_origination manager_operation | Tx_rollup_submit_batch : { tx_rollup : Tx_rollup.t; @@ -4025,6 +4036,9 @@ module Operation : sig val set_deposits_limit_case : Kind.set_deposits_limit Kind.manager case + val increase_paid_storage_case : + Kind.increase_paid_storage Kind.manager case + val sc_rollup_originate_case : Kind.sc_rollup_originate Kind.manager case val sc_rollup_add_messages_case : @@ -4071,6 +4085,8 @@ module Operation : sig val set_deposits_limit_case : Kind.set_deposits_limit case + val increase_paid_storage_case : Kind.increase_paid_storage case + val tx_rollup_origination_case : Kind.tx_rollup_origination case val tx_rollup_submit_batch_case : Kind.tx_rollup_submit_batch case @@ -4393,6 +4409,13 @@ module Fees : sig Z.t -> (context * Z.t * Receipt.balance_updates) tzresult Lwt.t + val burn_storage_increase_fees : + ?origin:Receipt_repr.update_origin -> + context -> + payer:Token.source -> + Z.t -> + (context * Receipt.balance_updates) tzresult Lwt.t + val burn_origination_fees : ?origin:Receipt.update_origin -> context -> diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 3462c7fb0d97..d6fd9a2152a5 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -1553,6 +1553,21 @@ let apply_external_manager_operation_content : Set_deposits_limit_result {consumed_gas = Gas.consumed ~since:ctxt_before_op ~until:ctxt}, [] ) + | Increase_paid_storage {amount_in_bytes; destination} -> + let contract = Contract.Originated destination in + Contract.increase_paid_storage ctxt contract ~amount_in_bytes + >>=? fun ctxt -> + let payer = `Contract (Contract.Implicit source) in + Fees.burn_storage_increase_fees ctxt ~payer amount_in_bytes + >|=? fun (ctxt, storage_bus) -> + let result = + Increase_paid_storage_result + { + balance_updates = storage_bus; + consumed_gas = Gas.consumed ~since:ctxt_before_op ~until:ctxt; + } + in + (ctxt, result, []) | Tx_rollup_origination -> Tx_rollup.originate ctxt >>=? fun (ctxt, originated_tx_rollup) -> let result = @@ -2043,6 +2058,7 @@ let burn_manager_storage_fees : global_address = payload.global_address; } ) | Set_deposits_limit_result _ -> return (ctxt, storage_limit, smopr) + | Increase_paid_storage_result _ -> return (ctxt, storage_limit, smopr) | Tx_rollup_origination_result payload -> Fees.burn_tx_rollup_origination_fees ctxt ~storage_limit ~payer >|=? fun (ctxt, storage_limit, origination_bus) -> diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 824c7b4bdeef..4a6a046f5ef5 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -61,6 +61,11 @@ type _ successful_manager_operation_result = consumed_gas : Gas.Arith.fp; } -> Kind.set_deposits_limit successful_manager_operation_result + | Increase_paid_storage_result : { + balance_updates : Receipt.balance_updates; + consumed_gas : Gas.Arith.fp; + } + -> Kind.increase_paid_storage successful_manager_operation_result | Tx_rollup_origination_result : { balance_updates : Receipt.balance_updates; consumed_gas : Gas.Arith.fp; @@ -517,6 +522,25 @@ module Manager_result = struct | Set_deposits_limit_result {consumed_gas} -> consumed_gas) ~inj:(fun consumed_gas -> Set_deposits_limit_result {consumed_gas}) + let increase_paid_storage_case = + make + ~op_case:Operation.Encoding.Manager_operations.increase_paid_storage_case + ~encoding: + Data_encoding.( + obj2 + (dft "balance_updates" Receipt.balance_updates_encoding []) + (dft "consumed_milligas" Gas.Arith.n_fp_encoding Gas.Arith.zero)) + ~select:(function + | Successful_manager_result (Increase_paid_storage_result _ as op) -> + Some op + | _ -> None) + ~kind:Kind.Increase_paid_storage_manager_kind + ~proj:(function + | Increase_paid_storage_result {balance_updates; consumed_gas} -> + (balance_updates, consumed_gas)) + ~inj:(fun (balance_updates, consumed_gas) -> + Increase_paid_storage_result {balance_updates; consumed_gas}) + let[@coq_axiom_with_reason "gadt"] tx_rollup_origination_case = make ~op_case:Operation.Encoding.Manager_operations.tx_rollup_origination_case @@ -930,6 +954,7 @@ let successful_manager_operation_result_encoding : make Manager_result.origination_case; make Manager_result.delegation_case; make Manager_result.set_deposits_limit_case; + make Manager_result.increase_paid_storage_case; make Manager_result.sc_rollup_originate_case; ] @@ -1007,6 +1032,10 @@ let equal_manager_kind : -> Some Eq | Kind.Set_deposits_limit_manager_kind, _ -> None + | ( Kind.Increase_paid_storage_manager_kind, + Kind.Increase_paid_storage_manager_kind ) -> + Some Eq + | Kind.Increase_paid_storage_manager_kind, _ -> None | ( Kind.Tx_rollup_origination_manager_kind, Kind.Tx_rollup_origination_manager_kind ) -> Some Eq @@ -1466,6 +1495,17 @@ module Encoding = struct Some (op, res) | _ -> None) + let[@coq_axiom_with_reason "gadt"] increase_paid_storage_case = + make_manager_case + Operation.Encoding.increase_paid_storage_case + Manager_result.increase_paid_storage_case + (function + | Contents_and_result + ( (Manager_operation {operation = Increase_paid_storage _; _} as op), + res ) -> + Some (op, res) + | _ -> None) + let[@coq_axiom_with_reason "gadt"] tx_rollup_origination_case = make_manager_case Operation.Encoding.tx_rollup_origination_case @@ -1718,6 +1758,7 @@ let contents_result_encoding = make delegation_case; make register_global_constant_case; make set_deposits_limit_case; + make increase_paid_storage_case; make tx_rollup_origination_case; make tx_rollup_submit_batch_case; make tx_rollup_commit_case; @@ -1780,6 +1821,7 @@ let contents_and_result_encoding = make delegation_case; make register_global_constant_case; make set_deposits_limit_case; + make increase_paid_storage_case; make tx_rollup_origination_case; make tx_rollup_submit_batch_case; make tx_rollup_commit_case; @@ -2079,6 +2121,32 @@ let kind_equal : } ) -> Some Eq | Manager_operation {operation = Set_deposits_limit _; _}, _ -> None + | ( Manager_operation {operation = Increase_paid_storage _; _}, + Manager_operation_result + {operation_result = Applied (Increase_paid_storage_result _); _} ) -> + Some Eq + | ( Manager_operation {operation = Increase_paid_storage _; _}, + Manager_operation_result + {operation_result = Backtracked (Increase_paid_storage_result _, _); _} + ) -> + Some Eq + | ( Manager_operation {operation = Increase_paid_storage _; _}, + Manager_operation_result + { + operation_result = + Failed (Alpha_context.Kind.Increase_paid_storage_manager_kind, _); + _; + } ) -> + Some Eq + | ( Manager_operation {operation = Increase_paid_storage _; _}, + Manager_operation_result + { + operation_result = + Skipped Alpha_context.Kind.Increase_paid_storage_manager_kind; + _; + } ) -> + Some Eq + | Manager_operation {operation = Increase_paid_storage _; _}, _ -> None | ( Manager_operation {operation = Tx_rollup_origination; _}, Manager_operation_result {operation_result = Applied (Tx_rollup_origination_result _); _} ) -> diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index 994a878ed20b..08f47c7c7cbb 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -157,6 +157,11 @@ and _ successful_manager_operation_result = consumed_gas : Gas.Arith.fp; } -> Kind.set_deposits_limit successful_manager_operation_result + | Increase_paid_storage_result : { + balance_updates : Receipt.balance_updates; + consumed_gas : Gas.Arith.fp; + } + -> Kind.increase_paid_storage successful_manager_operation_result | Tx_rollup_origination_result : { balance_updates : Receipt.balance_updates; consumed_gas : Gas.Arith.fp; diff --git a/src/proto_alpha/lib_protocol/contract_storage.ml b/src/proto_alpha/lib_protocol/contract_storage.ml index b685d00aa156..6a8ea9cf2c7a 100644 --- a/src/proto_alpha/lib_protocol/contract_storage.ml +++ b/src/proto_alpha/lib_protocol/contract_storage.ml @@ -630,6 +630,12 @@ let set_paid_storage_space_and_return_fees_to_pay c contract new_storage_space = Storage.Contract.Paid_storage_space.update c contract new_storage_space >|=? fun c -> (to_pay, c) +let increase_paid_storage c contract ~amount_in_bytes:storage_incr = + Storage.Contract.Paid_storage_space.get c contract + >>=? fun already_paid_space -> + let new_storage_space = Z.add already_paid_space storage_incr in + Storage.Contract.Paid_storage_space.update c contract new_storage_space + let update_balance ctxt contract f amount = Storage.Contract.Spendable_balance.get ctxt contract >>=? fun balance -> f balance amount >>?= fun new_balance -> diff --git a/src/proto_alpha/lib_protocol/contract_storage.mli b/src/proto_alpha/lib_protocol/contract_storage.mli index 37c7232a9bee..8b6890c863c6 100644 --- a/src/proto_alpha/lib_protocol/contract_storage.mli +++ b/src/proto_alpha/lib_protocol/contract_storage.mli @@ -189,6 +189,13 @@ val set_paid_storage_space_and_return_fees_to_pay : Z.t -> (Z.t * Raw_context.t) tzresult Lwt.t +(** Enable a payer to increase the paid storage of a contract by some amount. *) +val increase_paid_storage : + Raw_context.t -> + Contract_repr.t -> + amount_in_bytes:Z.t -> + Raw_context.t tzresult Lwt.t + (** Increases the balance of a contract. Calling this function directly may break important invariants. Consider calling [credit] instead. *) val increase_balance_only_call_from_token : diff --git a/src/proto_alpha/lib_protocol/fees_storage.ml b/src/proto_alpha/lib_protocol/fees_storage.ml index 9a378f8eef8b..134b46d1470e 100644 --- a/src/proto_alpha/lib_protocol/fees_storage.ml +++ b/src/proto_alpha/lib_protocol/fees_storage.ml @@ -25,6 +25,8 @@ type error += Cannot_pay_storage_fee (* `Temporary *) +type error += Negative_storage_input (* `Temporary *) + type error += Operation_quota_exceeded (* `Temporary *) type error += Storage_limit_too_high (* `Permanent *) @@ -36,10 +38,19 @@ let () = ~id:"contract.cannot_pay_storage_fee" ~title:"Cannot pay storage fee" ~description:"The storage fee is higher than the contract balance" - ~pp:(fun ppf () -> Format.fprintf ppf "Cannot pay storage storage fee") + ~pp:(fun ppf () -> Format.fprintf ppf "Cannot pay storage fee") Data_encoding.empty (function Cannot_pay_storage_fee -> Some () | _ -> None) (fun () -> Cannot_pay_storage_fee) ; + register_error_kind + `Temporary + ~id:"contract.negative_storage_input" + ~title:"Negative storage input" + ~description:"The storage amount asked for an operation is null or negative" + ~pp:(fun ppf () -> Format.fprintf ppf "Null or negative storage input") + Data_encoding.empty + (function Negative_storage_input -> Some () | _ -> None) + (fun () -> Negative_storage_input) ; register_error_kind `Temporary ~id:"storage_exhausted.operation" @@ -101,6 +112,18 @@ let burn_storage_fees ?(origin = Receipt_repr.Block_application) c >>=? fun (ctxt, balance_updates) -> return (ctxt, remaining, balance_updates) ) +let burn_storage_increase_fees ?(origin = Receipt_repr.Block_application) c + ~payer amount_in_bytes = + if Compare.Z.(amount_in_bytes <= Z.zero) then fail Negative_storage_input + else + let cost_per_byte = Constants_storage.cost_per_byte c in + Tez_repr.(cost_per_byte *? Z.to_int64 amount_in_bytes) >>?= fun to_burn -> + (* Burning the fees... *) + trace + Cannot_pay_storage_fee + ( source_must_exist c payer >>=? fun () -> + Token.transfer ~origin c payer `Storage_fees to_burn ) + let burn_origination_fees ?(origin = Receipt_repr.Block_application) c ~storage_limit ~payer = let origination_size = Constants_storage.origination_size c in diff --git a/src/proto_alpha/lib_protocol/fees_storage.mli b/src/proto_alpha/lib_protocol/fees_storage.mli index d8269da66845..3086687b83c3 100644 --- a/src/proto_alpha/lib_protocol/fees_storage.mli +++ b/src/proto_alpha/lib_protocol/fees_storage.mli @@ -25,6 +25,8 @@ type error += Cannot_pay_storage_fee (* `Temporary *) +type error += Negative_storage_input (* `Temporary *) + type error += Operation_quota_exceeded (* `Temporary *) type error += Storage_limit_too_high (* `Permanent *) @@ -69,6 +71,21 @@ val burn_storage_fees : Z.t -> (Raw_context.t * Z.t * Receipt_repr.balance_updates) tzresult Lwt.t +(** [burn_storage_increase_fees ctxt ~payer amount_in_bytes] takes funds from the + [payer] to pay the cost of the [amount_in_bytes] storage. This function has an + optional parameter [~origin] that allows to set the origin of returned + balance updates (by default the parameter is set to [Block_application]). + Returns an updated context and the relevant balance updates. + Raises the [Negative_storage_input] error if the amount_in_bytes is null or negative. + Raises the [Cannot_pay_storage_fee] error if the funds from the [payer] are + not sufficient to pay the storage fees. *) +val burn_storage_increase_fees : + ?origin:Receipt_repr.update_origin -> + Raw_context.t -> + payer:Token.source -> + Z.t -> + (Raw_context.t * Receipt_repr.balance_updates) tzresult Lwt.t + (** Calls [burn_storage_fees] with the parameter [consumed] mapped to the constant [origination_size]. *) val burn_origination_fees : diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index 5501508072a0..53dd36c014a1 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -72,6 +72,8 @@ module Kind = struct type set_deposits_limit = Set_deposits_limit_kind + type increase_paid_storage = Increase_paid_storage_kind + type failing_noop = Failing_noop_kind type register_global_constant = Register_global_constant_kind @@ -122,6 +124,7 @@ module Kind = struct | Delegation_manager_kind : delegation manager | Register_global_constant_manager_kind : register_global_constant manager | Set_deposits_limit_manager_kind : set_deposits_limit manager + | Increase_paid_storage_manager_kind : increase_paid_storage manager | Tx_rollup_origination_manager_kind : tx_rollup_origination manager | Tx_rollup_submit_batch_manager_kind : tx_rollup_submit_batch manager | Tx_rollup_commit_manager_kind : tx_rollup_commit manager @@ -339,6 +342,11 @@ and _ manager_operation = | Set_deposits_limit : Tez_repr.t option -> Kind.set_deposits_limit manager_operation + | Increase_paid_storage : { + amount_in_bytes : Z.t; + destination : Contract_hash.t; + } + -> Kind.increase_paid_storage manager_operation | Tx_rollup_origination : Kind.tx_rollup_origination manager_operation | Tx_rollup_submit_batch : { tx_rollup : Tx_rollup_repr.t; @@ -456,6 +464,7 @@ let manager_kind : type kind. kind manager_operation -> kind Kind.manager = | Delegation _ -> Kind.Delegation_manager_kind | Register_global_constant _ -> Kind.Register_global_constant_manager_kind | Set_deposits_limit _ -> Kind.Set_deposits_limit_manager_kind + | Increase_paid_storage _ -> Kind.Increase_paid_storage_manager_kind | Tx_rollup_origination -> Kind.Tx_rollup_origination_manager_kind | Tx_rollup_submit_batch _ -> Kind.Tx_rollup_submit_batch_manager_kind | Tx_rollup_commit _ -> Kind.Tx_rollup_commit_manager_kind @@ -708,6 +717,27 @@ module Encoding = struct inj = (fun key -> Set_deposits_limit key); } + let[@coq_axiom_with_reason "gadt"] increase_paid_storage_case = + MCase + { + tag = 9; + name = "increase_paid_storage"; + encoding = + obj2 + (req "amount" Data_encoding.z) + (req "destination" Contract_repr.originated_encoding); + select = + (function + | Manager (Increase_paid_storage _ as op) -> Some op | _ -> None); + proj = + (function + | Increase_paid_storage {amount_in_bytes; destination} -> + (amount_in_bytes, destination)); + inj = + (fun (amount_in_bytes, destination) -> + Increase_paid_storage {amount_in_bytes; destination}); + } + let[@coq_axiom_with_reason "gadt"] tx_rollup_origination_case = MCase { @@ -1500,6 +1530,9 @@ module Encoding = struct let set_deposits_limit_case = make_manager_case 112 Manager_operations.set_deposits_limit_case + let increase_paid_storage_case = + make_manager_case 113 Manager_operations.increase_paid_storage_case + let tx_rollup_origination_case = make_manager_case tx_rollup_operation_tag_offset @@ -1623,6 +1656,7 @@ module Encoding = struct make origination_case; make delegation_case; make set_deposits_limit_case; + make increase_paid_storage_case; make failing_noop_case; make register_global_constant_case; make tx_rollup_origination_case; @@ -1837,6 +1871,8 @@ let equal_manager_operation_kind : | Register_global_constant _, _ -> None | Set_deposits_limit _, Set_deposits_limit _ -> Some Eq | Set_deposits_limit _, _ -> None + | Increase_paid_storage _, Increase_paid_storage _ -> Some Eq + | Increase_paid_storage _, _ -> None | Tx_rollup_origination, Tx_rollup_origination -> Some Eq | Tx_rollup_origination, _ -> None | Tx_rollup_submit_batch _, Tx_rollup_submit_batch _ -> Some Eq diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index d8caa794bc15..3b4899fa08fe 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -101,6 +101,8 @@ module Kind : sig type set_deposits_limit = Set_deposits_limit_kind + type increase_paid_storage = Increase_paid_storage_kind + type failing_noop = Failing_noop_kind type register_global_constant = Register_global_constant_kind @@ -151,6 +153,7 @@ module Kind : sig | Delegation_manager_kind : delegation manager | Register_global_constant_manager_kind : register_global_constant manager | Set_deposits_limit_manager_kind : set_deposits_limit manager + | Increase_paid_storage_manager_kind : increase_paid_storage manager | Tx_rollup_origination_manager_kind : tx_rollup_origination manager | Tx_rollup_submit_batch_manager_kind : tx_rollup_submit_batch manager | Tx_rollup_commit_manager_kind : tx_rollup_commit manager @@ -376,6 +379,13 @@ and _ manager_operation = | Set_deposits_limit : Tez_repr.t option -> Kind.set_deposits_limit manager_operation + (* [Increase_paid_storage] allows a sender to pay to increase the paid storage of + some contract by some amount. *) + | Increase_paid_storage : { + amount_in_bytes : Z.t; + destination : Contract_hash.t; + } + -> Kind.increase_paid_storage manager_operation (* [Tx_rollup_origination] allows an implicit contract to originate a new transactional rollup. *) | Tx_rollup_origination : Kind.tx_rollup_origination manager_operation @@ -640,6 +650,8 @@ module Encoding : sig val set_deposits_limit_case : Kind.set_deposits_limit Kind.manager case + val increase_paid_storage_case : Kind.increase_paid_storage Kind.manager case + val tx_rollup_origination_case : Kind.tx_rollup_origination Kind.manager case val tx_rollup_submit_batch_case : @@ -711,6 +723,8 @@ module Encoding : sig val set_deposits_limit_case : Kind.set_deposits_limit case + val increase_paid_storage_case : Kind.increase_paid_storage case + val tx_rollup_origination_case : Kind.tx_rollup_origination case val tx_rollup_submit_batch_case : Kind.tx_rollup_submit_batch case diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index 81808e933b58..5fc59ffcc2fc 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -799,7 +799,8 @@ let bake_n_with_all_balance_updates ?(baking_mode = Application) ?policy ( Transaction_to_contract_result {balance_updates; _} | Transaction_to_tx_rollup_result {balance_updates; _} ) | Origination_result {balance_updates; _} - | Register_global_constant_result {balance_updates; _} -> + | Register_global_constant_result {balance_updates; _} + | Increase_paid_storage_result {balance_updates; _} -> List.rev_append balance_updates balance_updates_rev) balance_updates_rev metadata.implicit_operations_results @@ -823,6 +824,7 @@ let bake_n_with_origination_results ?(baking_mode = Application) ?policy n b = | Successful_manager_result (Transaction_result _) | Successful_manager_result (Register_global_constant_result _) | Successful_manager_result (Set_deposits_limit_result _) + | Successful_manager_result (Increase_paid_storage_result _) | Successful_manager_result (Tx_rollup_origination_result _) | Successful_manager_result (Tx_rollup_submit_batch_result _) | Successful_manager_result (Tx_rollup_commit_result _) diff --git a/src/proto_alpha/lib_protocol/validate_operation.ml b/src/proto_alpha/lib_protocol/validate_operation.ml index 3e3e15afd1d4..0f40584fb8f9 100644 --- a/src/proto_alpha/lib_protocol/validate_operation.ml +++ b/src/proto_alpha/lib_protocol/validate_operation.ml @@ -540,7 +540,8 @@ module Manager = struct consume_decoding_gas remaining_gas script.storage | Register_global_constant {value} -> consume_decoding_gas remaining_gas value - | Delegation _ | Set_deposits_limit _ -> return remaining_gas + | Delegation _ | Set_deposits_limit _ | Increase_paid_storage _ -> + return remaining_gas | Tx_rollup_origination -> let* () = assert_tx_rollup_feature_enabled vi in return remaining_gas -- GitLab From 9aede9564e2a3797fce12890d5eec91951c0e158 Mon Sep 17 00:00:00 2001 From: Jules Viennot Date: Tue, 28 Jun 2022 10:24:14 +0200 Subject: [PATCH 2/3] Proto: test for increase paid storage --- .../lib_protocol/test/helpers/op.ml | 16 ++ .../lib_protocol/test/helpers/op.mli | 12 + .../test/integration/operations/main.ml | 1 + .../operations/test_paid_storage_increase.ml | 247 ++++++++++++++++++ .../precheck/manager_operation_helpers.ml | 36 ++- .../test_manager_operation_precheck.ml | 5 +- 6 files changed, 310 insertions(+), 7 deletions(-) create mode 100644 src/proto_alpha/lib_protocol/test/integration/operations/test_paid_storage_increase.ml diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index d949d5ff8924..051501b69fc5 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -475,6 +475,22 @@ let set_deposits_limit ?force_reveal ?fee ?gas_limit ?storage_limit ?counter Context.Contract.manager ctxt source >|=? fun account -> sign account.sk ctxt sop +let increase_paid_storage ?force_reveal ?counter ?fee ?gas_limit ?storage_limit + ctxt ~source ~destination (amount : Z.t) = + let top = Increase_paid_storage {amount_in_bytes = amount; destination} in + manager_operation + ?force_reveal + ?counter + ?fee + ?gas_limit + ?storage_limit + ~source + ctxt + top + >>=? fun sop -> + Context.Contract.manager ctxt source >|=? fun account -> + sign account.sk ctxt sop + let activation ctxt (pkh : Signature.Public_key_hash.t) activation_code = (match pkh with | Ed25519 edpkh -> return edpkh diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.mli b/src/proto_alpha/lib_protocol/test/helpers/op.mli index 75c54b5bcdd6..cf6badaa56d0 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/op.mli @@ -132,6 +132,18 @@ val set_deposits_limit : Tez.tez option -> Operation.packed tzresult Lwt.t +val increase_paid_storage : + ?force_reveal:bool -> + ?counter:Z.t -> + ?fee:Tez.tez -> + ?gas_limit:gas_limit -> + ?storage_limit:Z.t -> + Context.t -> + source:Contract.t -> + destination:Contract_hash.t -> + Z.t -> + Operation.packed tzresult Lwt.t + (** [revelation ?fee ?gas_limit ?forge_pkh ctxt pkh] Creates a new [Reveal] {!manager_operation} to reveal a public key [pkh] applying to current context [ctxt]. diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/main.ml b/src/proto_alpha/lib_protocol/test/integration/operations/main.ml index 7c4bb9450620..70dff7c9241e 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/main.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/main.ml @@ -39,6 +39,7 @@ let () = ("revelation", Test_reveal.tests); ("transfer", Test_transfer.tests); ("activation", Test_activation.tests); + ("paid storage increase", Test_paid_storage_increase.tests); ("combined", Test_combined_operations.tests); ("failing_noop operation", Test_failing_noop.tests); ("tx rollup", Test_tx_rollup.tests); diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_paid_storage_increase.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_paid_storage_increase.ml new file mode 100644 index 000000000000..6d574b5af9e9 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_paid_storage_increase.ml @@ -0,0 +1,247 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2022 Nomadic Labs *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +(** Testing + ------- + Component: Protocol (increase_paid_storage) + Invocation: dune exec \ + src/proto_alpha/lib_protocol/test/integration/operations/main.exe \ + -- test "^paid storage increase$" + Subject: On increasing a paid amount of contract storage. +*) + +open Protocol +open Alpha_context + +let ten_tez = Test_tez.of_int 10 + +let dummy_script = + "{parameter unit; storage unit; code { CAR ; NIL operation ; PAIR }}" + +let contract_originate block ?(script = dummy_script) + ?(storage = Expr.from_string "Unit") account = + let open Lwt_result_syntax in + let code = Expr.from_string script in + let script = + Alpha_context.Script.{code = lazy_expr code; storage = lazy_expr storage} + in + let source_contract = account in + let baker = Context.Contract.pkh account in + let* op, dst = + Op.contract_origination_hash (B block) source_contract ~fee:Tez.zero ~script + in + let* inc = + Incremental.begin_construction ~policy:Block.(By_account baker) block + in + let* inc = Incremental.add_operation inc op in + let+ b = Incremental.finalize_block inc in + (b, dst) + +(** [test_balances] runs a simple [increase_paid_storage] and verifies that the + source contract balance is correct and that the storage of the + destination contract has been increased by the right amount. *) +let test_balances ~amount = + let open Lwt_result_syntax in + let* b, source = Context.init1 () in + let* b, destination = contract_originate b source in + let* inc = Incremental.begin_construction b in + let* balance_before_op = Context.Contract.balance (I inc) source in + let contract_dst = Contract.Originated destination in + let*! storage_before_op = + Contract.Internal_for_tests.paid_storage_space + (Incremental.alpha_ctxt inc) + contract_dst + in + let* storage_before_op = + Lwt.return (Environment.wrap_tzresult storage_before_op) + in + let* op = + Op.increase_paid_storage ~fee:Tez.zero (I inc) ~source ~destination amount + in + let* inc = Incremental.add_operation inc op in + (* check that after the block has been baked, the source was debited of all + the burned tez *) + let* {parametric = {cost_per_byte; _}; _} = Context.get_constants (I inc) in + let burned_tez = Tez.mul_exn cost_per_byte (Z.to_int amount) in + let* () = + Assert.balance_was_debited + ~loc:__LOC__ + (I inc) + source + balance_before_op + burned_tez + in + (* check that the storage has been increased by the right amount *) + let*! storage = + Contract.Internal_for_tests.paid_storage_space + (Incremental.alpha_ctxt inc) + contract_dst + in + let* storage = Lwt.return (Environment.wrap_tzresult storage) in + let storage_minus_amount = Z.sub storage amount in + Assert.equal_int + ~loc:__LOC__ + (Z.to_int storage_before_op) + (Z.to_int storage_minus_amount) + +(******************************************************) +(* Tests *) +(******************************************************) + +(** Basic test. We test balances in simple cases. *) +let test_balances_simple () = test_balances ~amount:(Z.of_int 100) + +(******************************************************) +(* Errors *) +(******************************************************) + +(** We test the operation when the amount given is null. *) +let test_null_amount () = + let open Lwt_result_syntax in + let*! result = test_balances ~amount:Z.zero in + Assert.proto_error ~loc:__LOC__ result (function + | Fees_storage.Negative_storage_input -> true + | _ -> false) + +(** We test the operation when the amount given is negative. *) +let test_negative_amount () = + let open Lwt_result_syntax in + let amount = Z.of_int (-10) in + let*! result = test_balances ~amount in + Assert.proto_error ~loc:__LOC__ result (function + | Fees_storage.Negative_storage_input -> true + | _ -> false) + +(** We create an implicit account with not enough tez to pay for the + storage increase. *) +let test_no_tez_to_pay () = + let open Lwt_result_syntax in + let* b, (source, baker, receiver) = Context.init3 ~consensus_threshold:0 () in + let* b, destination = contract_originate b source in + let pkh_for_bake = Context.Contract.pkh baker in + let* inc = + Incremental.begin_construction ~policy:Block.(By_account pkh_for_bake) b + in + let* {parametric = {cost_per_byte; _}; _} = Context.get_constants (I inc) in + let increase_amount = + Z.div (Z.of_int 2_000_000) (Z.of_int64 (Tez.to_mutez cost_per_byte)) + in + let* balance = Context.Contract.balance (I inc) source in + let*? tez_to_substract = Test_tez.(balance -? Tez.one) in + let* op = + Op.transaction (I inc) ~fee:Tez.zero source receiver tez_to_substract + in + let* inc = Incremental.add_operation inc op in + let* b = Incremental.finalize_block inc in + let* inc = + Incremental.begin_construction ~policy:Block.(By_account pkh_for_bake) b + in + let* op = + Op.increase_paid_storage (I inc) ~source ~destination increase_amount + in + let*! inc = Incremental.add_operation inc op in + Assert.proto_error ~loc:__LOC__ inc (function + | Fees_storage.Cannot_pay_storage_fee -> true + | _ -> false) + +(** To test when there is no smart contract at the address given. *) +let test_no_contract () = + let open Lwt_result_syntax in + let* b, source = Context.init1 () in + let* inc = Incremental.begin_construction b in + let destination = Contract_helpers.fake_KT1 in + let* op = Op.increase_paid_storage (I inc) ~source ~destination Z.zero in + let*! inc = Incremental.add_operation inc op in + Assert.proto_error ~loc:__LOC__ inc (function + | Raw_context.Storage_error (Missing_key (_, Raw_context.Get)) -> true + | _ -> false) + +(** To test if the increase in storage is effective. *) +let test_effectiveness () = + let open Lwt_result_syntax in + let* b, (source, _contract_source) = + Context.init2 ~consensus_threshold:0 () + in + let script = + "{parameter unit; storage int; code { CDR ; PUSH int 65536 ; MUL ; NIL \ + operation ; PAIR }}" + in + let storage = + Tezos_micheline.Micheline.strip_locations (Expr_common.int Z.one) + in + let* b, destination = contract_originate ~script ~storage b source in + let* inc = Incremental.begin_construction b in + (* We ensure that the transaction can't be made with a 0 burn cap. *) + let contract_dst = Contract.Originated destination in + let* op = + Op.transaction + ~storage_limit:Z.zero + ~fee:Tez.zero + (I inc) + source + contract_dst + Tez.zero + in + let*! inc_test = Incremental.add_operation inc op in + let* () = + Assert.proto_error ~loc:__LOC__ inc_test (function + | Fees.Operation_quota_exceeded -> true + | _ -> false) + in + let* b = Incremental.finalize_block inc in + let* inc = Incremental.begin_construction b in + let* op = + Op.increase_paid_storage + (I inc) + ~fee:Tez.zero + ~source + ~destination + (Z.of_int 10) + in + let* inc = Incremental.add_operation inc op in + let* b = Incremental.finalize_block inc in + let* inc = Incremental.begin_construction b in + (* We test the same transaction to see if increase_paid_storage worked. *) + let* op = + Op.transaction + ~storage_limit:Z.zero + ~fee:Tez.zero + (I inc) + source + contract_dst + Tez.zero + in + let+ _inc = Incremental.add_operation inc op in + () + +let tests = + [ + Tztest.tztest "balances simple" `Quick test_balances_simple; + Tztest.tztest "null amount" `Quick test_null_amount; + Tztest.tztest "negative amount" `Quick test_negative_amount; + Tztest.tztest "not enough tez to pay" `Quick test_no_tez_to_pay; + Tztest.tztest "no contract to bump its paid storage" `Quick test_no_contract; + Tztest.tztest "effectiveness" `Quick test_effectiveness; + ] diff --git a/src/proto_alpha/lib_protocol/test/integration/precheck/manager_operation_helpers.ml b/src/proto_alpha/lib_protocol/test/integration/precheck/manager_operation_helpers.ml index 7be15c0804d5..90fd7a2055e4 100644 --- a/src/proto_alpha/lib_protocol/test/integration/precheck/manager_operation_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/integration/precheck/manager_operation_helpers.ml @@ -40,6 +40,7 @@ type infos = { contract2 : Contract.t; account3 : Account.t; contract3 : Contract.t; + contract_hash : Contract_hash.t; tx_rollup : Tx_rollup.t; sc_rollup : Sc_rollup.t; } @@ -134,11 +135,18 @@ let init_context ?hard_gas_limit_per_block () = contract3 Tez.one in + let* create_contract_hash, contract_hash = + Op.contract_origination_hash + (B b) + contract3 + ~fee:Tez.zero + ~script:Op.dummy_script + in let* operation = Op.batch_operations ~source:bootstrap_contract (B b) - [fund_account1; fund_account2; fund_account3] + [fund_account1; fund_account2; fund_account3; create_contract_hash] in let+ block = Block.bake ~operation b in { @@ -149,6 +157,7 @@ let init_context ?hard_gas_limit_per_block () = contract2; account3; contract3; + contract_hash; tx_rollup; sc_rollup; } @@ -314,6 +323,19 @@ let mk_set_deposits_limit ?counter ?fee ?gas_limit ?storage_limit ?force_reveal source None +let mk_increase_paid_storage ?counter ?fee ?gas_limit ?storage_limit + ?force_reveal ~source (infos : infos) = + Op.increase_paid_storage + ?force_reveal + ?counter + ?fee + ?gas_limit + ?storage_limit + (B infos.block) + ~source + ~destination:infos.contract_hash + Z.one + let mk_reveal ?counter ?fee ?gas_limit ?storage_limit ?force_reveal:_ ~source (infos : infos) = let open Lwt_result_syntax in @@ -663,6 +685,7 @@ type manager_operation_kind = | K_Undelegation | K_Self_delegation | K_Set_deposits_limit + | K_Increase_paid_storage | K_Reveal | K_Tx_rollup_origination | K_Tx_rollup_submit_batch @@ -691,6 +714,7 @@ let select_op = function | K_Undelegation -> mk_undelegation | K_Self_delegation -> mk_self_delegation | K_Set_deposits_limit -> mk_set_deposits_limit + | K_Increase_paid_storage -> mk_increase_paid_storage | K_Reveal -> mk_reveal | K_Tx_rollup_origination -> mk_tx_rollup_origination | K_Tx_rollup_submit_batch -> mk_tx_rollup_submit_batch @@ -719,6 +743,7 @@ let string_of_kind = function | K_Set_deposits_limit -> "Set deposits limit" | K_Origination -> "Origination" | K_Register_global_constant -> "Register global constant" + | K_Increase_paid_storage -> "Increase paid storage" | K_Reveal -> "Revelation" | K_Tx_rollup_origination -> "Tx_rollup_origination" | K_Tx_rollup_submit_batch -> "Tx_rollup_submit_batch" @@ -896,6 +921,7 @@ let subjects = K_Undelegation; K_Self_delegation; K_Set_deposits_limit; + K_Increase_paid_storage; K_Reveal; K_Tx_rollup_origination; K_Tx_rollup_submit_batch; @@ -918,10 +944,10 @@ let subjects = ] let is_consumer = function - | K_Set_deposits_limit | K_Reveal | K_Self_delegation | K_Delegation - | K_Undelegation | K_Tx_rollup_origination | K_Tx_rollup_submit_batch - | K_Tx_rollup_finalize | K_Tx_rollup_commit | K_Tx_rollup_return_bond - | K_Tx_rollup_remove_commitment | K_Tx_rollup_reject + | K_Set_deposits_limit | K_Increase_paid_storage | K_Reveal + | K_Self_delegation | K_Delegation | K_Undelegation | K_Tx_rollup_origination + | K_Tx_rollup_submit_batch | K_Tx_rollup_finalize | K_Tx_rollup_commit + | K_Tx_rollup_return_bond | K_Tx_rollup_remove_commitment | K_Tx_rollup_reject | K_Sc_rollup_add_messages | K_Sc_rollup_origination | K_Sc_rollup_refute | K_Sc_rollup_timeout | K_Sc_rollup_cement | K_Sc_rollup_publish | K_Sc_rollup_execute_outbox_message | K_Sc_rollup_recover_bond diff --git a/src/proto_alpha/lib_protocol/test/integration/precheck/test_manager_operation_precheck.ml b/src/proto_alpha/lib_protocol/test/integration/precheck/test_manager_operation_precheck.ml index 9eadfcd8ca24..79831ff4c608 100644 --- a/src/proto_alpha/lib_protocol/test/integration/precheck/test_manager_operation_precheck.ml +++ b/src/proto_alpha/lib_protocol/test/integration/precheck/test_manager_operation_precheck.ml @@ -61,6 +61,7 @@ let ensure_kind infos kind = | Delegation _, K_Self_delegation | Register_global_constant _, K_Register_global_constant | Set_deposits_limit _, K_Set_deposits_limit + | Increase_paid_storage _, K_Increase_paid_storage | Tx_rollup_origination, K_Tx_rollup_origination | Tx_rollup_submit_batch _, K_Tx_rollup_submit_batch | Tx_rollup_commit _, K_Tx_rollup_commit @@ -81,8 +82,8 @@ let ensure_kind infos kind = | Dal_publish_slot_header _, K_Dal_publish_slot_header -> return_unit | ( ( Transaction _ | Origination _ | Register_global_constant _ - | Delegation _ | Set_deposits_limit _ | Reveal _ - | Tx_rollup_origination | Tx_rollup_submit_batch _ + | Delegation _ | Set_deposits_limit _ | Increase_paid_storage _ + | Reveal _ | Tx_rollup_origination | Tx_rollup_submit_batch _ | Tx_rollup_commit _ | Tx_rollup_return_bond _ | Tx_rollup_finalize_commitment _ | Tx_rollup_remove_commitment _ | Tx_rollup_dispatch_tickets _ | Transfer_ticket _ -- GitLab From 5f783ebcb3d5ed055e367290abba207a4a559968 Mon Sep 17 00:00:00 2001 From: Jules Viennot Date: Tue, 28 Jun 2022 17:33:33 +0200 Subject: [PATCH 3/3] Proto: adding infos to the change log --- docs/protocols/alpha.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index 9f1a7860279f..211c0519b694 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -27,6 +27,11 @@ RPC Changes Operation receipts ------------------ +Increase_paid_storage +--------------------- + +- Increase_paid_storage is a new operation that enable a payer to increase the paid storage of a smart contract by some bytes amount. (MR :gl:`!5605`) + Bug Fixes --------- -- GitLab