diff --git a/src/bin_client/test/test_contracts.sh b/src/bin_client/test/test_contracts.sh index adffbdbfd..2f70690ef 100755 --- a/src/bin_client/test/test_contracts.sh +++ b/src/bin_client/test/test_contracts.sh @@ -412,12 +412,19 @@ assert_fails $client transfer 0 from bootstrap1 to replay # Tests create_account init_with_transfer $contract_dir/create_account.tz $key2 None 1,000 bootstrap1 -$client transfer 100 from bootstrap1 to create_account \ - -arg '(Left "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx")' | assert_in_output "New contract" +assert_balance create_account "1000 ꜩ" +created_account=\ +`$client transfer 100 from bootstrap1 to create_account -arg '(Left "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx")' \ +| grep 'New contract' \ +| sed -E 's/.*(KT1[a-zA-Z0-9]+).*/\1/' \ +| head -1` bake +assert_balance $created_account "100 ꜩ" +assert_balance create_account "1000 ꜩ" # Creates a contract, transfers data to it and stores the data init_with_transfer $contract_dir/create_contract.tz $key2 Unit 1,000 bootstrap1 +assert_balance create_contract "1000 ꜩ" created_contract=\ `$client transfer 0 from bootstrap1 to create_contract -arg '(Left "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx")' \ | grep 'New contract' \ @@ -425,6 +432,8 @@ created_contract=\ | head -1` bake assert_storage_contains $created_contract '"abcdefg"' +assert_balance $created_contract "100 ꜩ" +assert_balance create_contract "900 ꜩ" # Test IMPLICIT_ACCOUNT init_with_transfer $contract_dir/default_account.tz $key1 \ diff --git a/src/proto_alpha/lib_protocol/src/script_interpreter.ml b/src/proto_alpha/lib_protocol/src/script_interpreter.ml index a8a1bc672..5c569f123 100644 --- a/src/proto_alpha/lib_protocol/src/script_interpreter.ml +++ b/src/proto_alpha/lib_protocol/src/script_interpreter.ml @@ -725,7 +725,6 @@ let rec interp Prim (0, K_code, [ Micheline.root code ], []) ])) in unparse_data ctxt Optimized storage_type init >>=? fun (storage, ctxt) -> let storage = Micheline.strip_locations storage in - Contract.spend_from_script ctxt self credit >>=? fun ctxt -> Contract.fresh_contract_from_current_nonce ctxt >>=? fun (ctxt, contract) -> let operation = Origination