From 56b3eb9eee5b2fed923615dd785cce4b078f9088 Mon Sep 17 00:00:00 2001 From: Mohammad Fawaz Date: Mon, 4 Apr 2022 21:53:23 -0400 Subject: [PATCH] Updating contract tests after IR. Also, some cleanup. (#1141) * Updating contract tests after IR. Also, some cleanup. * fixing std lib dependency * disabling the broken test again --- test/src/e2e_vm_tests/mod.rs | 24 ++------- .../bal_opcode/Forc.toml | 2 +- .../bal_opcode/src/main.sw | 2 +- .../call_basic_storage/src/main.sw | 5 +- .../call_increment_contract/src/main.sw | 2 +- .../caller_auth_test/src/main.sw | 8 +-- .../caller_context_test/Forc.toml | 2 +- .../caller_context_test/src/main.sw | 20 +++---- .../contract_call/Forc.lock | 3 -- .../contract_call/Forc.toml | 5 -- .../contract_call/json_abi_oracle.json | 1 - .../contract_call/src/main.sw | 23 -------- .../storage_access_caller/Forc.lock | 6 +-- .../storage_access_caller/Forc.toml | 2 +- .../storage_access_caller/src/main.sw | 4 +- .../token_ops_test/src/main.sw | 9 ++-- .../test_abis/context_testing_abi/Forc.lock | 6 +-- .../test_abis/storage_access_abi/src/main.sw | 8 +-- .../test_abis/test_fuel_coin_abi/Forc.lock | 6 +-- .../test_abis/test_fuel_coin_abi/src/main.sw | 1 - .../auth_testing_contract/Forc.toml | 2 +- .../balance_test_contract/Forc.toml | 2 +- .../balance_test_contract/src/main.sw | 1 - .../test_contracts/basic_storage/Forc.toml | 2 +- .../test_contracts/basic_storage/src/main.sw | 1 - .../context_testing_contract/Forc.toml | 2 +- .../context_testing_contract/src/main.sw | 2 +- .../contract_abi_impl/Forc.lock | 3 -- .../contract_abi_impl/Forc.toml | 5 -- .../contract_abi_impl/json_abi_oracle.json | 54 ------------------- .../contract_abi_impl/src/main.sw | 34 ------------ .../storage_access_contract/Forc.lock | 6 +-- .../storage_access_contract/src/main.sw | 8 ++- .../test_fuel_coin_contract/src/main.sw | 2 +- 34 files changed, 56 insertions(+), 207 deletions(-) delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/Forc.lock delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/Forc.toml delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/json_abi_oracle.json delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/src/main.sw delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/Forc.lock delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/Forc.toml delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/json_abi_oracle.json delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/src/main.sw diff --git a/test/src/e2e_vm_tests/mod.rs b/test/src/e2e_vm_tests/mod.rs index fecfa047b83..f259a806115 100644 --- a/test/src/e2e_vm_tests/mod.rs +++ b/test/src/e2e_vm_tests/mod.rs @@ -299,18 +299,10 @@ pub fn run(filter_regex: Option) { // with some known state. Note that if a non-contract is included // it will be rejected during assertion. Please move it to // `positive_project_names_no_abi` above. - let positive_project_names_with_abi = vec![ - // contracts revert because this test runs them against the VM - // and no selectors will match - ( - "should_pass/test_contracts/contract_abi_impl", - ProgramState::Revert(0), - ), - ( - "should_pass/language/valid_impurity", - ProgramState::Revert(0), // false - ), - ]; + let positive_project_names_with_abi = vec![( + "should_pass/language/valid_impurity", + ProgramState::Revert(0), // false + )]; number_of_tests_run += positive_project_names_with_abi .iter() @@ -397,10 +389,6 @@ pub fn run(filter_regex: Option) { "should_pass/test_contracts/context_testing_contract", "should_pass/require_contract_deployment/caller_context_test", ), - ( - "should_pass/test_contracts/contract_abi_impl", - "should_pass/require_contract_deployment/contract_call", - ), ( "should_pass/test_contracts/balance_test_contract", "should_pass/require_contract_deployment/bal_opcode", @@ -409,12 +397,10 @@ pub fn run(filter_regex: Option) { "should_pass/test_contracts/test_fuel_coin_contract", "should_pass/require_contract_deployment/token_ops_test", ), - /* Requires IR - TODO:enable when the IR pipeline is enabled by default - * https://github.com/FuelLabs/sway/issues/981 ( "should_pass/test_contracts/storage_access_contract", "should_pass/require_contract_deployment/storage_access_caller", - ),*/ + ), ]; let total_number_of_tests = positive_project_names_no_abi.len() diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/Forc.toml index 3b3817c3023..a1a691e80b9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/Forc.toml @@ -5,5 +5,5 @@ license = "Apache-2.0" name = "bal_opcode" [dependencies] +balance_test_abi = { path = "../../test_abis/balance_test_abi" } std = { path = "../../../../../../../sway-lib-std" } -balance_test_abi = { path = "../../test_abis/balance_test_abi"} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/src/main.sw index 32a403c8523..9e6840fc8ee 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/src/main.sw @@ -5,7 +5,7 @@ use balance_test_abi::BalanceTest; fn main() -> bool { // @todo switch to using ContractId when abi signature changes. - let balance_test_contract_id = 0xa835193dabf3fe80c0cb62e2ecc424f5ac03bc7f5c896ecc4bd2fd06cc434322; + let balance_test_contract_id = 0xb4c0d8c9056c0cde34b66e7e4e3f361d927d26ffdc16c2645dd0e2699bc96cad; let balance_test_contract = abi(BalanceTest, balance_test_contract_id); let number = balance_test_contract.get_42 { diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw index 2ad0f05bb60..1a949e820d8 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw @@ -1,13 +1,16 @@ script; use basic_storage_abi::StoreU64; +use std::assert::assert; fn main() -> u64 { - let addr = abi(StoreU64, 0x3eedeb06664177bd0dea0a1fe0d6e9645c45b8693c902f3a6f67649044f41c9a); + let addr = abi(StoreU64, 0xf4e12fcac2187e1ac5599476c531560cb6f7aa39bd05d20312a4bd237900b4e4); let key = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; let value = 4242; addr.store_u64(key, value); let res = addr.get_u64(key); + assert(res == value); + res } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_increment_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_increment_contract/src/main.sw index 203038d5455..6cecab0e11d 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_increment_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_increment_contract/src/main.sw @@ -4,7 +4,7 @@ use increment_abi::Incrementor; use std::assert::assert; fn main() { - let abi = abi(Incrementor, 0x4c30f62e9947cff714c802afc0c900de272dbeec57ae12ed96aacbfd32c3e3a8); + let abi = abi(Incrementor, 0x386b732f205fd34c97c5914ddd0f7356c5b923229b1cb39e84acd762d62e69c6); abi.initialize(0); // comment this line out to just increment without initializing abi.increment(5); abi.increment(5); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw index 0200d8bc1dc..97627d80c9e 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw @@ -1,9 +1,11 @@ script; -use std::{chain::auth::caller_is_external, constants::NATIVE_ASSET_ID}; use auth_testing_abi::AuthTesting; +use std::assert::assert; // should be false in the case of a script fn main() -> bool { - let caller = abi(AuthTesting, 0x4bc450bf26a5ebca955ed8e58ca281bcba64065a802a2b1cfa5cdefdeec1610e); - caller.returns_gm_one() + let caller = abi(AuthTesting, 0x8c65dd66e3d56a405b5cb329ade3a36e961f4e23038fa3bb3d066feebbf39c1f); + let result = caller.returns_gm_one(); + assert(result); + result } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/Forc.toml index cde43f142e1..caedbd3e9b2 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/Forc.toml @@ -5,5 +5,5 @@ license = "Apache-2.0" name = "caller_context_test" [dependencies] -std = { path = "../../../../../../../sway-lib-std" } context_testing_abi = { path = "../../test_abis/context_testing_abi" } +std = { path = "../../../../../../../sway-lib-std" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw index 69d984d75c3..6ee54f6b7d1 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw @@ -5,20 +5,17 @@ use context_testing_abi::*; fn main() -> bool { let gas: u64 = 1000; let amount: u64 = 11; - let other_contract_id = ~ContractId::from(0x285dafd64feb42477cfb3da8193ceb28b5f5277c17591d7c10000661cacdd0c9); + let other_contract_id = ~ContractId::from(0x3915399a401876c5145f3d9ed931ca8cc8c98cb9febda445d4fe2ef893151589); let native_asset_id = ~ContractId::from(NATIVE_ASSET_ID); - // contract ID for sway/test/src/e2e_vm_tests/test_programs/balance_test_contract - let deployed_contract_id = 0xa835193dabf3fe80c0cb62e2ecc424f5ac03bc7f5c896ecc4bd2fd06cc434322; - - let test_contract = abi(ContextTesting, 0x285dafd64feb42477cfb3da8193ceb28b5f5277c17591d7c10000661cacdd0c9); + let test_contract = abi(ContextTesting, other_contract_id.into()); // test Context::contract_id(): let returned_contract_id = test_contract.get_id { gas: gas, coins: 0, asset_id: NATIVE_ASSET_ID } (); - assert(returned_contract_id.into() == deployed_contract_id); + assert(returned_contract_id.into() == other_contract_id.into()); // @todo set up a test contract to mint some tokens for testing balances. // test Context::this_balance(): @@ -35,8 +32,11 @@ fn main() -> bool { (native_asset_id, other_contract_id); assert(returned_contract_balance == 0); + // The checks below don't work (AssertIdNotFound). The test should be + // updated to forward coins that are actually available. + // test Context::msg_value(): - let returned_amount = test_contract.get_amount { + /*let returned_amount = test_contract.get_amount { gas: gas, coins: amount, asset_id: NATIVE_ASSET_ID } (); @@ -52,7 +52,7 @@ fn main() -> bool { // test Context::msg_gas(): // @todo expect the correct gas here... this should fail using `1000` let gas = test_contract.get_gas { - gas: gas, coins: amount, asset_id: NATIVE_ASSET_ID + gas: gas, coins: 0, asset_id: NATIVE_ASSET_ID } (); assert(gas == 1000); @@ -60,10 +60,10 @@ fn main() -> bool { // test Context::global_gas(): // @todo expect the correct gas here... this should fail using `1000` let global_gas = test_contract.get_global_gas { - gas: gas, coins: amount, asset_id: NATIVE_ASSET_ID + gas: gas, coins: 0, asset_id: NATIVE_ASSET_ID } (); - assert(global_gas == 1000); + assert(global_gas == 1000);*/ true } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/Forc.lock deleted file mode 100644 index 3755841f48c..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/Forc.lock +++ /dev/null @@ -1,3 +0,0 @@ -[[package]] -name = 'contract_call' -dependencies = [] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/Forc.toml deleted file mode 100644 index 5c241af11de..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/Forc.toml +++ /dev/null @@ -1,5 +0,0 @@ -[project] -authors = ["Fuel Labs "] -entry = "main.sw" -license = "Apache-2.0" -name = "contract_call" diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/json_abi_oracle.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/json_abi_oracle.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/src/main.sw deleted file mode 100644 index 16e3b1413ae..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/contract_call/src/main.sw +++ /dev/null @@ -1,23 +0,0 @@ -script; -// this file tests a contract call from a script -struct InputStruct { - field_1: bool, - field_2: u64, -} - -abi MyContract { - fn foo(field_1: bool, field_2: u64); -} { - fn baz(field_1: bool) { - } -} - -fn main() -> u64 { - let x = abi(MyContract, 0x79fa8779bed2f36c3581d01c79df8da45eee09fac1fd76a5a656e16326317ef0); - let asset_id = 0x7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777; - x.foo { - gas: 5000, asset_id: asset_id - } - (true, 3); - 0 -} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/Forc.lock index 07e69b84936..dd0c50be758 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/Forc.lock +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/Forc.lock @@ -1,19 +1,17 @@ [[package]] name = 'call_basic_storage' dependencies = [ - 'std git+http://github.com/FuelLabs/sway-lib-std?reference=master#a1d77e1140d1b57ee18cc914d320dc7ffdff98fd', + 'std', 'storage_access_abi', ] [[package]] name = 'core' -source = 'git+https://github.com/FuelLabs/sway-lib-core?reference=master#082bc8eb0616586ac0000825bfe6e9d47b0c713f' dependencies = [] [[package]] name = 'std' -source = 'git+http://github.com/FuelLabs/sway-lib-std?reference=master#a1d77e1140d1b57ee18cc914d320dc7ffdff98fd' -dependencies = ['core git+https://github.com/FuelLabs/sway-lib-core?reference=master#082bc8eb0616586ac0000825bfe6e9d47b0c713f'] +dependencies = ['core'] [[package]] name = 'storage_access_abi' diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/Forc.toml index a6ce213ed69..b7d70c00981 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/Forc.toml @@ -5,5 +5,5 @@ license = "Apache-2.0" name = "call_basic_storage" [dependencies] -std = { git = "http://github.com/FuelLabs/sway-lib-std" } +std = { path = "../../../../../../../sway-lib-std" } storage_access_abi = { path = "../../test_abis/storage_access_abi" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw index 6815624ad0d..6a7fea197b9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw @@ -1,9 +1,9 @@ script; use storage_access_abi::{S, StorageAccess, T}; -use std::chain::*; +use std::assert::assert; fn main() -> bool { - let contract_id = 0x19280009c101a694ec13061a4d1853826dd04ec5594a0ab05fd275904c2e4dbf; + let contract_id = 0x1c305447488d8da2c5bd6b025222970b699edd84aa405f15cace2b33a13ddaf4; let caller = abi(StorageAccess, contract_id); // Test 1 diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw index f76ef413aa3..23b16135769 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw @@ -1,6 +1,5 @@ script; -// use std::constants::ETH_ID; use std::assert::assert; use std::address::Address; use std::context::balance_of; @@ -18,13 +17,13 @@ fn main() -> bool { let default_gas = 1_000_000_000_000; // the deployed fuel_coin Contract_Id: - let fuelcoin_id = ~ContractId::from(0xff95564b8f788b6a2a884813eadfff2dbfe008a881008e7b298ce14208a73864); + let fuelcoin_id = ~ContractId::from(0x9ebec04226fdd4c962dc0f299da0555d180e3d60e39610a49613512a9846316a); - // contract ID for sway/test/src/e2e_vm_tests/test_programs/balance_test_contract - let balance_test_id = ~ContractId::from(0xa835193dabf3fe80c0cb62e2ecc424f5ac03bc7f5c896ecc4bd2fd06cc434322); + // contract ID for sway/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/ + let balance_test_id = ~ContractId::from(0xb4c0d8c9056c0cde34b66e7e4e3f361d927d26ffdc16c2645dd0e2699bc96cad); // todo: use correct type ContractId - let fuel_coin = abi(TestFuelCoin, 0xff95564b8f788b6a2a884813eadfff2dbfe008a881008e7b298ce14208a73864); + let fuel_coin = abi(TestFuelCoin, fuelcoin_id.into()); let mut fuelcoin_balance = balance_of(fuelcoin_id, fuelcoin_id); assert(fuelcoin_balance == 0); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/context_testing_abi/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/context_testing_abi/Forc.lock index c34eaad838b..469f6c02a10 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/context_testing_abi/Forc.lock +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/context_testing_abi/Forc.lock @@ -1,13 +1,11 @@ [[package]] name = 'context_testing_abi' -dependencies = ['std git+https://github.com/FuelLabs/sway-lib-std?reference=master#7b973a638d5220228be616f1f89a249846001549'] +dependencies = ['std'] [[package]] name = 'core' -source = 'git+https://github.com/FuelLabs/sway-lib-core?reference=master#30274cf817c1848e28f984c2e8703eb25e7a3a44' dependencies = [] [[package]] name = 'std' -source = 'git+https://github.com/FuelLabs/sway-lib-std?reference=master#7b973a638d5220228be616f1f89a249846001549' -dependencies = ['core git+https://github.com/FuelLabs/sway-lib-core?reference=master#30274cf817c1848e28f984c2e8703eb25e7a3a44'] +dependencies = ['core'] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/storage_access_abi/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/storage_access_abi/src/main.sw index c1a47359ccb..269e12d008b 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/storage_access_abi/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/storage_access_abi/src/main.sw @@ -4,18 +4,18 @@ pub struct S { x: u64, y: u64, z: b256, - t: T + t: T, } pub struct T { x: u64, y: u64, - z: b256 + z: b256, } abi StorageAccess { // Setters - fn set_x(x: u64) ; + fn set_x(x: u64); fn set_y(y: b256); fn set_s(s: S); fn set_s_dot_t(t: T); @@ -25,7 +25,7 @@ abi StorageAccess { fn set_s_dot_t_dot_x(a: u64); fn set_s_dot_t_dot_y(b: u64); fn set_s_dot_t_dot_z(c: b256); - + // Getters fn get_x() -> u64; fn get_y() -> b256; diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/Forc.lock index b47cdef25c1..e70b590cf84 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/Forc.lock +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/Forc.lock @@ -1,13 +1,11 @@ [[package]] name = 'core' -source = 'git+https://github.com/FuelLabs/sway-lib-core?reference=master#30274cf817c1848e28f984c2e8703eb25e7a3a44' dependencies = [] [[package]] name = 'std' -source = 'git+https://github.com/FuelLabs/sway-lib-std?reference=master#7b973a638d5220228be616f1f89a249846001549' -dependencies = ['core git+https://github.com/FuelLabs/sway-lib-core?reference=master#30274cf817c1848e28f984c2e8703eb25e7a3a44'] +dependencies = ['core'] [[package]] name = 'test_fuel_coin_abi' -dependencies = ['std git+https://github.com/FuelLabs/sway-lib-std?reference=master#7b973a638d5220228be616f1f89a249846001549'] +dependencies = ['std'] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/src/main.sw index a90439de25c..e8b8c5866e8 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/src/main.sw @@ -1,6 +1,5 @@ library test_fuel_coin_abi; -use std::address::Address; use std::contract_id::ContractId; abi TestFuelCoin { diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/auth_testing_contract/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/auth_testing_contract/Forc.toml index 5678399fb1a..fca05560995 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/auth_testing_contract/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/auth_testing_contract/Forc.toml @@ -5,5 +5,5 @@ license = "Apache-2.0" name = "auth_testing_contract" [dependencies] -std = { path = "../../../../../../../sway-lib-std" } auth_testing_abi = { path = "../../test_abis/auth_testing_abi" } +std = { path = "../../../../../../../sway-lib-std" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/Forc.toml index 2a3397f40ba..ad393dca17e 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/Forc.toml @@ -5,5 +5,5 @@ license = "Apache-2.0" name = "balance_test_contract" [dependencies] +balance_test_abi = { path = "../../test_abis/balance_test_abi" } std = { path = "../../../../../../../sway-lib-std" } -balance_test_abi = { path = "../../test_abis/balance_test_abi"} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/src/main.sw index 10b373c1942..edcac7a672a 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/src/main.sw @@ -1,6 +1,5 @@ contract; -use std::context::*; use balance_test_abi::BalanceTest; impl BalanceTest for Contract { diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/Forc.toml index f62ef80193e..79d71113b2d 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/Forc.toml @@ -5,5 +5,5 @@ license = "Apache-2.0" name = "basic_storage" [dependencies] -std = { path = "../../../../../../../sway-lib-std" } basic_storage_abi = { path = "../../test_abis/basic_storage_abi" } +std = { path = "../../../../../../../sway-lib-std" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/src/main.sw index 7b74d31fe09..d7866aa9ca2 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/src/main.sw @@ -1,6 +1,5 @@ contract; use std::storage::*; -use std::hash::*; use basic_storage_abi::*; impl StoreU64 for Contract { diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/Forc.toml index 39533ebbb63..38e36e1949a 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/Forc.toml @@ -5,5 +5,5 @@ license = "Apache-2.0" name = "context_testing_contract" [dependencies] +context_testing_abi = { path = "../../test_abis/context_testing_abi" } std = { path = "../../../../../../../sway-lib-std" } -context_testing_abi = { path = "../../test_abis/context_testing_abi"} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw index 523a1c27051..5057a776f0e 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw @@ -1,6 +1,6 @@ contract; -use std::{context::{*, call_frames::*, registers::global_gas}, contract_id::ContractId}; +use std::{context::{balance_of, call_frames::{contract_id, msg_asset_id}, gas, msg_amount, registers::global_gas, this_balance}, contract_id::ContractId}; use context_testing_abi::*; impl ContextTesting for Contract { diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/Forc.lock deleted file mode 100644 index 58c35d01626..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/Forc.lock +++ /dev/null @@ -1,3 +0,0 @@ -[[package]] -name = 'contract_abi_impl' -dependencies = [] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/Forc.toml deleted file mode 100644 index 2beb8679af4..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/Forc.toml +++ /dev/null @@ -1,5 +0,0 @@ -[project] -authors = ["Fuel Labs "] -entry = "main.sw" -license = "Apache-2.0" -name = "contract_abi_impl" diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/json_abi_oracle.json deleted file mode 100644 index 4c0c8ed7bf9..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/json_abi_oracle.json +++ /dev/null @@ -1,54 +0,0 @@ -[ - { - "inputs": [ - { - "components": null, - "name": "field_1", - "type": "bool" - }, - { - "components": null, - "name": "field_2", - "type": "u64" - } - ], - "name": "foo", - "outputs": [ - { - "components": [ - { - "components": null, - "name": "field_1", - "type": "bool" - }, - { - "components": null, - "name": "field_2", - "type": "u64" - } - ], - "name": "", - "type": "struct InputStruct" - } - ], - "type": "function" - }, - { - "inputs": [ - { - "components": null, - "name": "input", - "type": "bool" - } - ], - "name": "baz", - "outputs": [ - { - "components": null, - "name": "", - "type": "()" - } - ], - "type": "function" - } -] \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/src/main.sw deleted file mode 100644 index 77e5604b334..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_abi_impl/src/main.sw +++ /dev/null @@ -1,34 +0,0 @@ -contract; -// this file tests a basic contract and contract call -struct InputStruct { - field_1: bool, - field_2: u64, -} - -abi MyContract { - fn foo(field_1: bool, field_2: u64) -> InputStruct; -} { - fn baz(input: bool) { - } -} - -impl MyContract for Contract { - fn foo(field_1: bool, field_2: u64) -> InputStruct { - let status_code = if field_1 { - "okay" - } else { - "fail" - }; - calls_other_contract() - } -} - -fn calls_other_contract() -> InputStruct { - let x = abi(MyContract, 0x0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000); - // commenting this out for now since contract call asm generation is not yet implemented - let asset_id = 0x0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000; - x.foo { - gas: 5, coins: 5, asset_id: asset_id - } - (true, 3) -} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/Forc.lock index c45e0694335..b6332caec65 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/Forc.lock +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/Forc.lock @@ -1,12 +1,10 @@ [[package]] name = 'core' -source = 'git+https://github.com/FuelLabs/sway-lib-core?reference=master#082bc8eb0616586ac0000825bfe6e9d47b0c713f' dependencies = [] [[package]] name = 'std' -source = 'git+http://github.com/FuelLabs/sway-lib-std?reference=master#a1d77e1140d1b57ee18cc914d320dc7ffdff98fd' -dependencies = ['core git+https://github.com/FuelLabs/sway-lib-core?reference=master#082bc8eb0616586ac0000825bfe6e9d47b0c713f'] +dependencies = ['core'] [[package]] name = 'storage_access_abi' @@ -15,6 +13,6 @@ dependencies = [] [[package]] name = 'storage_access_contract' dependencies = [ - 'std git+http://github.com/FuelLabs/sway-lib-std?reference=master#a1d77e1140d1b57ee18cc914d320dc7ffdff98fd', + 'std', 'storage_access_abi', ] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/src/main.sw index aa619494f3c..df111232071 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/src/main.sw @@ -1,16 +1,14 @@ contract; -use storage_access_abi::{S, T, StorageAccess}; +use storage_access_abi::{S, StorageAccess, T}; use std::constants::NATIVE_ASSET_ID; storage { - x: u64, - y: b256, - s: S + x: u64, y: b256, s: S } impl StorageAccess for Contract { - // Setters + // Setters impure fn set_x(x: u64) { storage.x = x; } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/src/main.sw index bd20cbbb391..320fef3bf32 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/src/main.sw @@ -1,6 +1,6 @@ contract; -use std::{contract_id::ContractId, token::*}; +use std::{contract_id::ContractId, token::{burn, force_transfer, mint}}; use test_fuel_coin_abi::*; impl TestFuelCoin for Contract {