diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 1c9a7ed52b97c9cdbc58dbeb1ba1a9f83c5b7f7b..2573191328e3cd36bc1180ab177cf25da37ef5ec 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -1596,6 +1596,8 @@ end module Contract : sig type t = Implicit of public_key_hash | Originated of Contract_hash.t + (** Functions related to contracts address. *) + type error += Non_existing_contract of t include BASIC_DATA with type t := t @@ -1612,6 +1614,8 @@ module Contract : sig val of_b58check : string -> t tzresult + (** Functions related to contracts existence. *) + val exists : context -> t -> bool Lwt.t val must_exist : context -> t -> unit tzresult Lwt.t @@ -1622,6 +1626,19 @@ module Contract : sig val list : context -> t list Lwt.t + (** Functions related to both implicit accounts and originated contracts. *) + + (** See {!Contract_storage.get_balance}. *) + val get_balance : context -> t -> Tez.t tzresult Lwt.t + + val get_balance_carbonated : context -> t -> (context * Tez.t) tzresult Lwt.t + + val get_frozen_bonds : context -> t -> Tez.t tzresult Lwt.t + + val get_balance_and_frozen_bonds : context -> t -> Tez.t tzresult Lwt.t + + (** Functions related to implicit accounts. *) + (** See {!Contract_manager_storage.get_manager_key}. *) val get_manager_key : ?error:error -> context -> public_key_hash -> public_key tzresult Lwt.t @@ -1641,28 +1658,44 @@ module Contract : sig public_key -> context tzresult Lwt.t + val get_counter : context -> public_key_hash -> Z.t tzresult Lwt.t + + val increment_counter : context -> public_key_hash -> context tzresult Lwt.t + + val check_counter_increment : + context -> public_key_hash -> Z.t -> unit tzresult Lwt.t + + (** See {!Contract_storage.check_allocated_and_get_balance}. *) + val check_allocated_and_get_balance : + context -> public_key_hash -> Tez.t tzresult Lwt.t + + (** See {!Contract_storage.simulate_spending}. *) + val simulate_spending : + context -> + balance:Tez.t -> + amount:Tez.t -> + public_key_hash -> + (Tez.t * bool) tzresult Lwt.t + + (** Functions related to smart contracts. *) + val get_script_code : - context -> t -> (context * Script.lazy_expr option) tzresult Lwt.t + context -> + Contract_hash.t -> + (context * Script.lazy_expr option) tzresult Lwt.t val get_script : context -> Contract_hash.t -> (context * Script.t option) tzresult Lwt.t val get_storage : - context -> t -> (context * Script.expr option) tzresult Lwt.t + context -> Contract_hash.t -> (context * Script.expr option) tzresult Lwt.t - val get_counter : context -> public_key_hash -> Z.t tzresult Lwt.t - - (** See {Contract_storage.get_balance}. *) - val get_balance : context -> t -> Tez.t tzresult Lwt.t - - val get_balance_carbonated : context -> t -> (context * Tez.t) tzresult Lwt.t + val used_storage_space : context -> t -> Z.t tzresult Lwt.t - (** See {Contract_storage.check_allocated_and_get_balance}. *) - val check_allocated_and_get_balance : - context -> public_key_hash -> Tez.t tzresult Lwt.t + val paid_storage_space : context -> t -> Z.t tzresult Lwt.t val increase_paid_storage : - context -> t -> amount_in_bytes:Z.t -> context tzresult Lwt.t + context -> Contract_hash.t -> amount_in_bytes:Z.t -> context tzresult Lwt.t val fresh_contract_from_current_nonce : context -> (context * Contract_hash.t) tzresult @@ -1670,9 +1703,19 @@ module Contract : sig val originated_from_current_nonce : since:context -> until:context -> Contract_hash.t list tzresult Lwt.t - val get_frozen_bonds : context -> t -> Tez.t tzresult Lwt.t + val update_script_storage : + context -> + Contract_hash.t -> + Script.expr -> + Lazy_storage.diffs option -> + context tzresult Lwt.t - val get_balance_and_frozen_bonds : context -> t -> Tez.t tzresult Lwt.t + val raw_originate : + context -> + prepaid_bootstrap_storage:bool -> + Contract_hash.t -> + script:Script.t * Lazy_storage.diffs option -> + context tzresult Lwt.t module Legacy_big_map_diff : sig type item = private @@ -1695,37 +1738,6 @@ module Contract : sig val of_lazy_storage_diff : Lazy_storage.diffs -> t end - val update_script_storage : - context -> - t -> - Script.expr -> - Lazy_storage.diffs option -> - context tzresult Lwt.t - - val used_storage_space : context -> t -> Z.t tzresult Lwt.t - - val paid_storage_space : context -> t -> Z.t tzresult Lwt.t - - val increment_counter : context -> public_key_hash -> context tzresult Lwt.t - - val check_counter_increment : - context -> public_key_hash -> Z.t -> unit tzresult Lwt.t - - (** See {Contract_storage.simulate_spending}. *) - val simulate_spending : - context -> - balance:Tez.t -> - amount:Tez.t -> - public_key_hash -> - (Tez.t * bool) tzresult Lwt.t - - val raw_originate : - context -> - prepaid_bootstrap_storage:bool -> - Contract_hash.t -> - script:Script.t * Lazy_storage.diffs option -> - context tzresult Lwt.t - (** Functions for handling the delegate of a contract.*) module Delegate : sig (** See {!Contract_delegate_storage.find}. *) @@ -5001,7 +5013,7 @@ end (** This module re-exports definitions from {!Fees_storage}. *) module Fees : sig val record_paid_storage_space : - context -> Contract.t -> (context * Z.t * Z.t) tzresult Lwt.t + context -> Contract_hash.t -> (context * Z.t * Z.t) tzresult Lwt.t val record_global_constant_storage_space : context -> Z.t -> context * Z.t diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 95e8eb0ea38965bd4c3381a3570844e80acd04e9..71cc2bda7be357b6911df85a9d0fa59df1aaee05 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -286,6 +286,7 @@ let update_script_storage_and_ticket_balances ctxt ~self_contract storage lazy_storage_diff ticket_diffs operations = Contract.update_script_storage ctxt self_contract storage lazy_storage_diff >>=? fun ctxt -> + let self_contract = Contract.Originated self_contract in Ticket_accounting.update_ticket_balances ctxt ~self_contract @@ -391,7 +392,7 @@ let apply_transaction_to_smart_contract ~ctxt ~source ~contract_hash ~amount ctxt ) -> update_script_storage_and_ticket_balances ctxt - ~self_contract:contract + ~self_contract:contract_hash storage lazy_storage_diff ticket_diffs @@ -401,7 +402,7 @@ let apply_transaction_to_smart_contract ~ctxt ~source ~contract_hash ~amount ctxt ~storage_diff:ticket_table_size_diff >>=? fun (ticket_paid_storage_diff, ctxt) -> - Fees.record_paid_storage_space ctxt contract + Fees.record_paid_storage_space ctxt contract_hash >>=? fun (ctxt, new_size, contract_paid_storage_size_diff) -> Contract.originated_from_current_nonce ~since:before_operation ~until:ctxt >>=? fun originated_contracts -> @@ -530,7 +531,7 @@ let apply_origination ~ctxt ~storage_type ~storage ~unparsed_code >>=? fun ctxt -> Token.transfer ctxt (`Contract source) (`Contract contract) credit >>=? fun (ctxt, balance_updates) -> - Fees.record_paid_storage_space ctxt contract + Fees.record_paid_storage_space ctxt contract_hash >|=? fun (ctxt, size, paid_storage_size_diff) -> let result = { @@ -707,7 +708,6 @@ let apply_manager_operation : Lwt.t = fun ctxt_before_op ~source ~chain_id operation -> let source_contract = Contract.Implicit source in - Contract.must_exist ctxt_before_op source_contract >>=? fun () -> Gas.consume ctxt_before_op Michelson_v1_gas.Cost_of.manager_operation >>?= fun ctxt -> (* Note that [ctxt_before_op] will be used again later to compute @@ -1035,8 +1035,7 @@ let apply_manager_operation : {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 + Contract.increase_paid_storage ctxt destination ~amount_in_bytes >>=? fun ctxt -> let payer = `Contract (Contract.Implicit source) in Fees.burn_storage_increase_fees ctxt ~payer amount_in_bytes @@ -2410,7 +2409,7 @@ let apply_liquidity_baking_subsidy ctxt ~toggle_vote = (* update CPMM storage *) update_script_storage_and_ticket_balances ctxt - ~self_contract:liquidity_baking_cpmm_contract + ~self_contract:liquidity_baking_cpmm_contract_hash storage lazy_storage_diff ticket_diffs @@ -2418,7 +2417,7 @@ let apply_liquidity_baking_subsidy ctxt ~toggle_vote = >>=? fun (ticket_table_size_diff, ctxt) -> Fees.record_paid_storage_space ctxt - liquidity_baking_cpmm_contract + liquidity_baking_cpmm_contract_hash >>=? fun (ctxt, new_size, paid_storage_size_diff) -> Ticket_balance.adjust_storage_space ctxt diff --git a/src/proto_alpha/lib_protocol/contract_services.ml b/src/proto_alpha/lib_protocol/contract_services.ml index 5f5b18efb5329c5889fa65bb48e0d11c63ccfc89..b55fa2740e7b1370a78ee33588a5294864e1cb6a 100644 --- a/src/proto_alpha/lib_protocol/contract_services.ml +++ b/src/proto_alpha/lib_protocol/contract_services.ml @@ -429,7 +429,7 @@ let register () = (fun ctxt v entrypoint {normalize_types} () -> match (v : Contract.t) with | Implicit _ -> return_none - | Originated _ -> ( + | Originated v -> ( Contract.get_script_code ctxt v >>=? fun (_, expr) -> match expr with | None -> return_none @@ -469,7 +469,7 @@ let register () = (fun ctxt v {normalize_types} () -> match (v : Contract.t) with | Implicit _ -> return_none - | Originated _ -> ( + | Originated v -> ( Contract.get_script_code ctxt v >>=? fun (_, expr) -> match expr with | None -> return_none diff --git a/src/proto_alpha/lib_protocol/contract_storage.ml b/src/proto_alpha/lib_protocol/contract_storage.ml index ff38861ab5e99162d3792771e44c4ed442b30cca..4f11a9171a4d4425e1ff5064c37f54a738ec23f3 100644 --- a/src/proto_alpha/lib_protocol/contract_storage.ml +++ b/src/proto_alpha/lib_protocol/contract_storage.ml @@ -501,7 +501,9 @@ let increment_counter c manager = Storage.Contract.Counter.get c contract >>=? fun contract_counter -> Storage.Contract.Counter.update c contract (Z.succ contract_counter) -let get_script_code c contract = Storage.Contract.Code.find c contract +let get_script_code c contract_hash = + let contract = Contract_repr.Originated contract_hash in + Storage.Contract.Code.find c contract let get_script c contract_hash = let contract = Contract_repr.Originated contract_hash in @@ -512,7 +514,8 @@ let get_script c contract_hash = | Some code, Some storage -> return (c, Some {Script_repr.code; storage}) | None, Some _ | Some _, None -> failwith "get_script" -let get_storage ctxt contract = +let get_storage ctxt contract_hash = + let contract = Contract_repr.Originated contract_hash in Storage.Contract.Storage.find ctxt contract >>=? function | ctxt, None -> return (ctxt, None) | ctxt, Some storage -> @@ -555,7 +558,8 @@ let check_allocated_and_get_balance c pkh = | None -> fail (Empty_implicit_contract pkh) | Some balance -> return balance -let update_script_storage c contract storage lazy_storage_diff = +let update_script_storage c contract_hash storage lazy_storage_diff = + let contract = Contract_repr.Originated contract_hash in let storage = Script_repr.lazy_expr storage in update_script_lazy_storage c lazy_storage_diff >>=? fun (c, lazy_storage_size_diff) -> @@ -634,7 +638,8 @@ 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 = +let increase_paid_storage c contract_hash ~amount_in_bytes:storage_incr = + let contract = Contract_repr.Originated contract_hash in Storage.Contract.Paid_storage_space.get c contract >>=? fun already_paid_space -> let new_storage_space = Z.add already_paid_space storage_incr in diff --git a/src/proto_alpha/lib_protocol/contract_storage.mli b/src/proto_alpha/lib_protocol/contract_storage.mli index c08e7b45fb5797bfdf19c545da4008764bdec865..2f97c357c19e8132c71a8cda7bbc2e646f30349e 100644 --- a/src/proto_alpha/lib_protocol/contract_storage.mli +++ b/src/proto_alpha/lib_protocol/contract_storage.mli @@ -103,7 +103,7 @@ val get_counter : val get_script_code : Raw_context.t -> - Contract_repr.t -> + Contract_hash.t -> (Raw_context.t * Script_repr.lazy_expr option) tzresult Lwt.t val get_script : @@ -113,7 +113,7 @@ val get_script : val get_storage : Raw_context.t -> - Contract_repr.t -> + Contract_hash.t -> (Raw_context.t * Script_repr.expr option) tzresult Lwt.t module Legacy_big_map_diff : sig @@ -143,7 +143,7 @@ end val update_script_storage : Raw_context.t -> - Contract_repr.t -> + Contract_hash.t -> Script_repr.expr -> Lazy_storage_diff.diffs option -> Raw_context.t tzresult Lwt.t @@ -192,7 +192,7 @@ val set_paid_storage_space_and_return_fees_to_pay : (** Enable a payer to increase the paid storage of a contract by some amount. *) val increase_paid_storage : Raw_context.t -> - Contract_repr.t -> + Contract_hash.t -> amount_in_bytes:Z.t -> Raw_context.t tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/fees_storage.ml b/src/proto_alpha/lib_protocol/fees_storage.ml index 364ba8d59ab0bdab4a784ea5d61bfaa4544239df..d09f06b5ed9ed8a12432365600416b93e98cc523 100644 --- a/src/proto_alpha/lib_protocol/fees_storage.ml +++ b/src/proto_alpha/lib_protocol/fees_storage.ml @@ -78,7 +78,8 @@ let record_global_constant_storage_space context size = let to_be_paid = Z.add size cost_of_key in (context, to_be_paid) -let record_paid_storage_space ctxt contract = +let record_paid_storage_space ctxt contract_hash = + let contract = Contract_repr.Originated contract_hash in (* Get the new size of the contract's storage. *) Contract_storage.used_storage_space ctxt contract >>=? fun new_storage_size -> Contract_storage.set_paid_storage_space_and_return_fees_to_pay diff --git a/src/proto_alpha/lib_protocol/fees_storage.mli b/src/proto_alpha/lib_protocol/fees_storage.mli index e66babbd7f9f5beb3e51e4c91275dd80e6fd7e4d..78a13395d9775a40d64ab8ce4ac8871bed5de0a9 100644 --- a/src/proto_alpha/lib_protocol/fees_storage.mli +++ b/src/proto_alpha/lib_protocol/fees_storage.mli @@ -47,7 +47,7 @@ val record_global_constant_storage_space : and the additional (and unpaid) space consumed since the last call of this function on this [contract]. *) val record_paid_storage_space : - Raw_context.t -> Contract_repr.t -> (Raw_context.t * Z.t * Z.t) tzresult Lwt.t + Raw_context.t -> Contract_hash.t -> (Raw_context.t * Z.t * Z.t) tzresult Lwt.t (** [check_storage_limit ctxt ~storage_limit] raises the [Storage_limit_too_high] error iff [storage_limit] is negative or greater the constant diff --git a/src/proto_alpha/lib_protocol/script_ir_translator.ml b/src/proto_alpha/lib_protocol/script_ir_translator.ml index 323b16ae293f571eca41352590eea1abba09ee38..41453d7ec67e6b181a8241ae6a96cafa3b843149 100644 --- a/src/proto_alpha/lib_protocol/script_ir_translator.ml +++ b/src/proto_alpha/lib_protocol/script_ir_translator.ml @@ -4514,7 +4514,8 @@ and parse_contract : | Originated contract_hash -> trace (Invalid_contract (loc, contract)) - ( Contract.get_script_code ctxt contract >>=? fun (ctxt, code) -> + ( Contract.get_script_code ctxt contract_hash + >>=? fun (ctxt, code) -> Lwt.return (match code with | None -> diff --git a/src/proto_alpha/lib_protocol/test/helpers/big_map_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/big_map_helpers.ml index 45d025ea31dcff30207feffa8b444a06c911801a..23a2b146034ccb7827a6cc44ac7c22a95ba17cf3 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/big_map_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/big_map_helpers.ml @@ -33,7 +33,7 @@ let make_big_map block ~source ~key_type ~value_type key_values = let key_type = Expr.from_string key_type in let value_type = Expr.from_string value_type in let* operation, originated = - Op.contract_origination (B block) source ~script:Op.dummy_script + Op.contract_origination_hash (B block) source ~script:Op.dummy_script in let* block = Block.bake ~operation block in let* incr = Incremental.begin_construction block in diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_accounting.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_accounting.ml index 724e401da45d44309a7762f3d96eb078486181fb..2a9b1945703d1388cae295083957ef7a8d0f20c3 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_accounting.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_accounting.ml @@ -182,7 +182,7 @@ let init () = let open Lwt_result_syntax in let* block, source = Context.init1 () in let* operation, originated = - Op.contract_origination (B block) source ~script:Op.dummy_script + Op.contract_origination_hash (B block) source ~script:Op.dummy_script in let* block = Block.bake ~operation block in let* inc = Incremental.begin_construction block in @@ -452,7 +452,7 @@ let assert_ticket_diffs ctxt ~loc ~self_contract ~arg_type ~storage_type ~arg wrap (Ticket_accounting.ticket_diffs ctxt - ~self_contract + ~self_contract:(Originated self_contract) ~arg_type_has_tickets ~storage_type_has_tickets ~arg @@ -464,6 +464,17 @@ let assert_ticket_diffs ctxt ~loc ~self_contract ~arg_type ~storage_type ~arg Environment.wrap_tzresult @@ Ticket_token_map.to_list ctxt ticket_diff in let* () = assert_equal_ticket_diffs ~loc ctxt ticket_diffs expected_diff in + let expected_receipt = + List.map + (fun (contract, contents, amounts) -> + let amounts = + List.map + (fun (contract, amount) -> (Contract.Originated contract, amount)) + amounts + in + (contract, contents, amounts)) + expected_receipt + in assert_equal_ticket_receipt ~loc ticket_receipt expected_receipt let assert_balance = Ticket_helpers.assert_balance diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_lazy_storage_diff.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_lazy_storage_diff.ml index 475856ed43277e558754eb7ba0e4b1644c513024..754a4079cf2bb06bb9e84f7f557f803666bd6e28 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_lazy_storage_diff.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_lazy_storage_diff.ml @@ -134,7 +134,7 @@ let make_alloc big_map_id alloc updates = let init () = let* block, source = Context.init1 () in let* operation, originated = - Op.contract_origination (B block) source ~script:Op.dummy_script + Op.contract_origination_hash (B block) source ~script:Op.dummy_script in let* block = Block.bake ~operation block in let* inc = Incremental.begin_construction block in diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml index 4589cab693891e385f8f175ed677dc1d848a1f08..81c853bff6c0c482428b0183d081ded3fb328d1d 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_operations_diff.ml @@ -1040,7 +1040,7 @@ let test_originate_and_transfer () = let test_originate_big_map_with_tickets () = let* baker, ticketer, block = init () in let* operation, originated = - Op.contract_origination (B block) ticketer ~script:Op.dummy_script + Op.contract_origination_hash (B block) ticketer ~script:Op.dummy_script in let* block = Block.bake ~operation block in let* incr = Incremental.begin_construction block in @@ -1098,7 +1098,10 @@ let test_originate_big_map_with_tickets () = let test_transfer_big_map_with_tickets () = let* baker, ticketer_contract, block = init () in let* operation, originated = - Op.contract_origination (B block) ticketer_contract ~script:Op.dummy_script + Op.contract_origination_hash + (B block) + ticketer_contract + ~script:Op.dummy_script in let* block = Block.bake ~operation block in let* incr = Incremental.begin_construction block in diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_scanner.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_scanner.ml index 642318c089c365c8c0b284710c0d6dfa6797bdc5..f8e662e07c8ea46cdd64efccea0a233132879b52 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_scanner.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_scanner.ml @@ -186,7 +186,7 @@ let make_string_tickets ctxt ticketer_amounts = let tickets_from_big_map_ref ~pre_populated value_exp = let* block, source = Context.init1 () in let* operation, originated = - Op.contract_origination (B block) source ~script:Op.dummy_script + Op.contract_origination_hash (B block) source ~script:Op.dummy_script in let* block = Block.bake ~operation block in let* inc = Incremental.begin_construction block in diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_timelock.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_timelock.ml index 7e548766f55d9d0f39ff06c8cae1d1c475bc88da..bfb059e6f9b4ab6dad3b9f16df9773a4858cdaff 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_timelock.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_timelock.ml @@ -86,7 +86,7 @@ let contract_test () = let storage = "0xdeadbeef" in let script = Contract_helpers.read_file "./contracts/timelock.tz" in let* dst, _script, block = - Contract_helpers.originate_contract_from_string + Contract_helpers.originate_contract_from_string_hash ~script ~storage ~source_contract @@ -129,7 +129,7 @@ let contract_test () = ~fee (B block) source_contract - dst + (Originated dst) (Test_tez.of_int 3) ~parameters >>=? fun operation -> diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_typechecking.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_typechecking.ml index 723b75343c83bb063229681254759ea1723e7698..eacf459e588f242a6971f16d193951842669f519 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_typechecking.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_typechecking.ml @@ -107,7 +107,7 @@ let test_context_with_nat_nat_big_map ?(sc_rollup_enable = false) () = }; } >>=? fun (b, source) -> - Op.contract_origination (B b) source ~script:Op.dummy_script + Op.contract_origination_hash (B b) source ~script:Op.dummy_script >>=? fun (operation, originated) -> Block.bake ~operation b >>=? fun b -> Incremental.begin_construction b >>=? fun v -> diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml index 1455ce742ca0c7a65e8d373f958fc989b3d1bb5c..7544d1caac1f0938b1053022730270d84585e7f7 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml @@ -4081,7 +4081,7 @@ module Withdraw = struct Nat_ticket.init_deposit amount block tx_rollup account1 >>=? fun (operation, block, deposit_contract) -> Block.bake ~operation block >>=? fun block -> - Contract_helpers.originate_contract_from_string + Contract_helpers.originate_contract_from_string_hash ~script: (Format.sprintf {| parameter (ticket %s); @@ -4123,7 +4123,7 @@ module Withdraw = struct (account1, account2, tx_rollup, deposit_contract, withdraw_contract, b) let originate_forge_withdraw_deposit_contract account block = - Contract_helpers.originate_contract_from_string + Contract_helpers.originate_contract_from_string_hash ~script: {| parameter (or (pair %default nat nat) (or (ticket %withdraw nat) @@ -4256,7 +4256,7 @@ module Withdraw = struct deposit_contract, withdraw_contract, block ) -> - Contract_helpers.originate_contract_from_string + Contract_helpers.originate_contract_from_string_hash ~script: (Format.sprintf {| parameter (ticket %s); @@ -4282,7 +4282,7 @@ module Withdraw = struct ~loc:__LOC__ block token_one - (Contract withdraw_contract) + (Contract (Originated withdraw_contract)) None >>=? fun () -> assert_ticket_balance ~loc:__LOC__ block token_one (Contract account1) None @@ -4380,7 +4380,7 @@ module Withdraw = struct ~loc:__LOC__ block token_one - (Contract withdraw_contract) + (Contract (Originated withdraw_contract)) None >>=? fun () -> assert_ticket_balance @@ -4417,7 +4417,7 @@ module Withdraw = struct (WithExceptions.Option.get ~loc:__LOC__ @@ Ticket_amount.of_z @@ Script_int.of_int64 int64_half_amount) - ~destination:withdraw_contract + ~destination:(Originated withdraw_contract) ~entrypoint >>=? fun operation -> Block.bake ~operation block >>=? fun block -> @@ -4462,7 +4462,7 @@ module Withdraw = struct ~loc:__LOC__ block token_one - (Contract withdraw_contract) + (Contract (Originated withdraw_contract)) (Some (Int64.to_int int64_half_amount)) >>=? fun () -> assert_ticket_balance ~loc:__LOC__ block token_one (Contract account1) None @@ -4492,7 +4492,7 @@ module Withdraw = struct (WithExceptions.Option.get ~loc:__LOC__ @@ Ticket_amount.of_z @@ Script_int.of_int64 int64_half_amount) - ~destination:withdraw_dropping_contract + ~destination:(Originated withdraw_dropping_contract) ~entrypoint >>=? fun operation -> Block.bake ~operation block >>=? fun block -> @@ -4517,7 +4517,7 @@ module Withdraw = struct ~loc:__LOC__ block token_one - (Contract withdraw_contract) + (Contract (Originated withdraw_contract)) (Some (Int64.to_int int64_half_amount)) >>=? fun () -> assert_ticket_balance ~loc:__LOC__ block token_one (Contract account1) None @@ -4737,7 +4737,7 @@ module Withdraw = struct tx_rollup committed_level context_hash - [{ticket_info with ticketer = withdraw_contract}] + [{ticket_info with ticketer = Originated withdraw_contract}] >>=? fun operation -> Incremental.add_operation ~expect_apply_failure: @@ -4904,7 +4904,7 @@ module Withdraw = struct ~ty:(Script.lazy_expr Nat_ticket.ty) ~ticketer:deposit_contract ~amount:qty - ~destination:withdraw_contract + ~destination:(Originated withdraw_contract) ~entrypoint:Entrypoint.default in (* Execute withdraw with half amount *) @@ -5460,7 +5460,7 @@ module Withdraw = struct |> Tezos_micheline.Micheline.strip_locations |> Script.lazy_expr) ~fee:Tez.one account - forge_withdraw_deposit_contract + (Originated forge_withdraw_deposit_contract) (Tez.of_mutez_exn 0L) >>=? fun operation -> Block.bake ~operation block in @@ -5478,14 +5478,14 @@ module Withdraw = struct |> Tezos_micheline.Micheline.strip_locations |> Script.lazy_expr) ~fee:Tez.one account - forge_withdraw_deposit_contract + (Originated forge_withdraw_deposit_contract) (Tez.of_mutez_exn 0L) >>=? fun operation -> Block.bake ~operation block in let dispatch_ticket block = Nat_ticket.withdrawal (B block) - ~ticketer:forge_withdraw_deposit_contract + ~ticketer:(Originated forge_withdraw_deposit_contract) ~claimer:account tx_rollup >>=? fun (withdraw, ticket_info) -> @@ -5522,24 +5522,24 @@ module Withdraw = struct ~source:account ~contents:(Script.lazy_expr Nat_ticket.contents) ~ty:(Script.lazy_expr Nat_ticket.ty) - ~ticketer:forge_withdraw_deposit_contract + ~ticketer:(Originated forge_withdraw_deposit_contract) ~amount: (WithExceptions.Option.get ~loc:__LOC__ @@ Ticket_amount.of_zint @@ Tx_rollup_l2_qty.to_z Nat_ticket.amount) - ~destination:forge_withdraw_deposit_contract + ~destination:(Originated forge_withdraw_deposit_contract) ~entrypoint:(Entrypoint.of_string_strict_exn "withdraw") >>=? fun operation -> Block.bake ~operation block in let token_one = - Nat_ticket.ex_token ~ticketer:forge_withdraw_deposit_contract + Nat_ticket.ex_token ~ticketer:(Originated forge_withdraw_deposit_contract) in let assert_contract_ticket_balance ~__LOC__ block balance = assert_ticket_balance ~loc:__LOC__ block token_one - (Contract forge_withdraw_deposit_contract) + (Contract (Originated forge_withdraw_deposit_contract)) balance in let assert_account_ticket_balance ~__LOC__ block balance =