From e898aea95a4552fe2c9647aeaca9c87224cbd1d4 Mon Sep 17 00:00:00 2001 From: Oleksii Filonenko <12615679+Br1ght0ne@users.noreply.github.com> Date: Fri, 3 May 2024 10:37:34 +0100 Subject: [PATCH] chore!: use release paths for sway projects (#1275) BREAKING CHANGE: - `setup_program_test` now expects `release` paths to work ### Checklist - [ ] I have linked to any relevant issues. - [ ] I have updated the documentation. - [ ] I have added tests that prove my fix is effective or that my feature works. - [x] I have added necessary labels. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. --- .github/workflows/ci.yml | 4 +- README.md | 4 +- ci_checks.sh | 4 +- docs/src/abigen/the-json-abi-file.md | 2 +- docs/src/deploying/the-fuelvm-binary-file.md | 4 +- docs/src/getting-started.md | 2 +- .../testing/the-setup-program-test-macro.md | 3 +- examples/contracts/src/lib.rs | 54 ++++++------ examples/cookbook/src/lib.rs | 7 +- examples/debugging/src/lib.rs | 4 +- examples/macros/src/lib.rs | 8 +- examples/predicates/src/lib.rs | 9 +- examples/wallets/src/lib.rs | 2 +- packages/fuels-macros/src/lib.rs | 2 +- .../src/setup_program_test/code_gen.rs | 2 +- packages/fuels/tests/configurables.rs | 15 ++-- packages/fuels/tests/contracts.rs | 20 ++--- packages/fuels/tests/logs.rs | 12 +-- packages/fuels/tests/predicates.rs | 83 ++++++++++--------- packages/fuels/tests/providers.rs | 22 ++--- packages/fuels/tests/scripts.rs | 8 +- packages/fuels/tests/storage.rs | 12 +-- packages/fuels/tests/types_contracts.rs | 8 +- packages/fuels/tests/types_predicates.rs | 32 +++---- 24 files changed, 165 insertions(+), 158 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 596abe42e8..3dcf78e25b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: working-directory: packages/fuels - name: Build Sway test projects - run: forc build --terse --error-on-warnings + run: forc build --release --terse --error-on-warnings working-directory: packages/fuels - uses: actions/upload-artifact@v2 @@ -82,7 +82,7 @@ jobs: # TODO: To be removed once https://github.com/FuelLabs/fuels-rs/issues/881 is unblocked. - name: Build Sway test projects w type paths - run: forc build --terse --error-on-warnings --json-abi-with-callpaths + run: forc build --release --terse --error-on-warnings --json-abi-with-callpaths working-directory: packages/fuels - uses: actions/upload-artifact@v2 diff --git a/README.md b/README.md index b2a57e5471..b5b43d6d8e 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ See [the `fuels-rs` book](https://fuellabs.github.io/fuels-rs/latest/) First, build the test projects using `forc`: ```shell -forc build --path packages/fuels +forc build --release --path packages/fuels ``` Then you can run the SDK tests with: @@ -73,7 +73,7 @@ Before doing anything else, try all these commands: ```shell cargo clean rm Cargo.lock -forc build --path packages/fuels +forc build --release --path packages/fuels cargo test ``` diff --git a/ci_checks.sh b/ci_checks.sh index 71969fa479..cdea15e6df 100755 --- a/ci_checks.sh +++ b/ci_checks.sh @@ -9,8 +9,8 @@ cargo fmt --all -- --check && forc fmt --check --path packages/fuels && -forc build --terse --path packages/fuels && -forc build --terse --json-abi-with-callpaths --path packages/fuels && +forc build --release --terse --path packages/fuels && +forc build --release --terse --json-abi-with-callpaths --path packages/fuels && cargo clippy --all-targets && cargo clippy --all-targets --all-features && cargo test --all-targets --all-features && diff --git a/docs/src/abigen/the-json-abi-file.md b/docs/src/abigen/the-json-abi-file.md index 030d483e2b..0bb7db07a1 100644 --- a/docs/src/abigen/the-json-abi-file.md +++ b/docs/src/abigen/the-json-abi-file.md @@ -24,7 +24,7 @@ impl MyContract for Contract { The JSON ABI file looks like this: ```json -$ cat out/debug/my-test-abi.json +$ cat out/release/my-test-abi.json [ { "type": "function", diff --git a/docs/src/deploying/the-fuelvm-binary-file.md b/docs/src/deploying/the-fuelvm-binary-file.md index e6c14055de..cb0cdedaee 100644 --- a/docs/src/deploying/the-fuelvm-binary-file.md +++ b/docs/src/deploying/the-fuelvm-binary-file.md @@ -19,7 +19,7 @@ impl MyContract for Contract { After `forc build`, will have a binary file that contains: ```terminal -$ cat out/debug/my-test.bin +$ cat out/release/my-test.bin G4]�]D`I]C�As@ 6]C�$@!QK% ``` @@ -27,7 +27,7 @@ G4]�]D`I]C�As@ This seems very unreadable! But, `forc` has a nice interpreter for this bytecode: `forc parse-bytecode`, which will interpret that binary data and output the equivalent FuelVM assembly: ```terminal -$ forc parse-bytecode out/debug/my-test.bin +$ forc parse-bytecode out/release/my-test.bin half-word byte op raw notes 0 0 JI(4) 90 00 00 04 jump to byte 16 1 4 NOOP 47 00 00 00 diff --git a/docs/src/getting-started.md b/docs/src/getting-started.md index de1cab23a4..3a686958a1 100644 --- a/docs/src/getting-started.md +++ b/docs/src/getting-started.md @@ -101,7 +101,7 @@ Another way to experience the SDK is to look at the source code. The `packages/f > To build these tests, run the following command: ```shell -forc build --path packages/fuels +forc build --release --path packages/fuels ``` > `forc` can also be used to clean and format the test projects. Check the `help` output for more info. diff --git a/docs/src/testing/the-setup-program-test-macro.md b/docs/src/testing/the-setup-program-test-macro.md index 81dcf57959..b7a252b3b4 100644 --- a/docs/src/testing/the-setup-program-test-macro.md +++ b/docs/src/testing/the-setup-program-test-macro.md @@ -53,8 +53,7 @@ Abigen( ) ``` -Description: Generates the program bindings under the name `name`. `project` -should point to root of the `forc` project. +Description: Generates the program bindings under the name `name`. `project` should point to root of the `forc` project. The project must be compiled in `release` mode (`--release` flag) for `Abigen` command to work. Cardinality: 0 or N. diff --git a/examples/contracts/src/lib.rs b/examples/contracts/src/lib.rs index 6af8191936..ce48389cf1 100644 --- a/examples/contracts/src/lib.rs +++ b/examples/contracts/src/lib.rs @@ -41,7 +41,7 @@ mod tests { // This will load and deploy your contract binary to the chain so that its ID can // be used to initialize the instance let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -89,13 +89,13 @@ mod tests { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -113,7 +113,7 @@ mod tests { .await?; // ANCHOR_END: contract_call_cost_estimation - let expected_gas = 2662; + let expected_gas = 2206; assert_eq!(transaction_cost.gas_used, expected_gas); @@ -128,7 +128,7 @@ mod tests { let wallet = launch_provider_and_get_wallet().await?; let contract_id_1 = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -158,7 +158,7 @@ mod tests { .with_maturity(0); let contract_id_2 = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", configuration, )? .deploy(&wallet, tx_policies) @@ -176,7 +176,7 @@ mod tests { // ANCHOR: abigen_example abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); // ANCHOR_END: abigen_example @@ -221,14 +221,14 @@ mod tests { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let wallets = launch_custom_provider_and_get_wallets(WalletsConfig::default(), None, None).await?; let contract_id_1 = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallets[0], TxPolicies::default()) @@ -247,7 +247,7 @@ mod tests { assert_eq!(42, response.value); let contract_id_2 = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default().with_salt([1; 32]), )? .deploy(&wallets[1], TxPolicies::default()) @@ -273,13 +273,13 @@ mod tests { use fuels::prelude::*; abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -342,13 +342,13 @@ mod tests { use fuels::prelude::*; abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/token_ops/out/debug/token_ops-abi.json" + abi = "packages/fuels/tests/contracts/token_ops/out/release/token_ops-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/token_ops/out/debug/token_ops\ + "../../packages/fuels/tests/contracts/token_ops/out/release/token_ops\ .bin", LoadConfiguration::default(), )? @@ -382,20 +382,20 @@ mod tests { use fuels::prelude::*; abigen!( Contract(name="MyContract", - abi="packages/fuels/tests/contracts/lib_contract_caller/out/debug/lib_contract_caller-abi.json" + abi="packages/fuels/tests/contracts/lib_contract_caller/out/release/lib_contract_caller-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; let called_contract_id: ContractId = Contract::load_from( - "../../packages/fuels/tests/contracts/lib_contract/out/debug/lib_contract.bin", + "../../packages/fuels/tests/contracts/lib_contract/out/release/lib_contract.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) .await? .into(); - let bin_path = "../../packages/fuels/tests/contracts/lib_contract_caller/out/debug/lib_contract_caller.bin"; + let bin_path = "../../packages/fuels/tests/contracts/lib_contract_caller/out/release/lib_contract_caller.bin"; let caller_contract_id = Contract::load_from(bin_path, LoadConfiguration::default())? .deploy(&wallet, TxPolicies::default()) .await?; @@ -455,7 +455,7 @@ mod tests { abigen!(Contract( name = "MyContract", // Replace with your contract ABI.json path - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let wallet_original = launch_provider_and_get_wallet().await?; @@ -485,13 +485,13 @@ mod tests { use fuels::prelude::*; abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -523,13 +523,13 @@ mod tests { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -579,13 +579,13 @@ mod tests { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -610,7 +610,7 @@ mod tests { .await?; // ANCHOR_END: multi_call_cost_estimation - let expected_gas = 4152; + let expected_gas = 3378; assert_eq!(transaction_cost.gas_used, expected_gas); @@ -623,7 +623,7 @@ mod tests { use fuels::prelude::*; abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let config = WalletsConfig::new(Some(2), Some(1), Some(DEFAULT_COIN_AMOUNT)); @@ -632,7 +632,7 @@ mod tests { let wallet_2 = wallets.pop().unwrap(); let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet_1, TxPolicies::default()) diff --git a/examples/cookbook/src/lib.rs b/examples/cookbook/src/lib.rs index f47661bf5d..429e67e252 100644 --- a/examples/cookbook/src/lib.rs +++ b/examples/cookbook/src/lib.rs @@ -28,7 +28,8 @@ mod tests { // ANCHOR: liquidity_abigen abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/liquidity_pool/out/debug/liquidity_pool-abi.json" + abi = + "packages/fuels/tests/contracts/liquidity_pool/out/release/liquidity_pool-abi.json" )); // ANCHOR_END: liquidity_abigen @@ -52,7 +53,7 @@ mod tests { // ANCHOR: liquidity_deploy let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/liquidity_pool/out/debug/liquidity_pool.bin", + "../../packages/fuels/tests/contracts/liquidity_pool/out/release/liquidity_pool.bin", LoadConfiguration::default(), )? .deploy(wallet, TxPolicies::default()) @@ -225,7 +226,7 @@ mod tests { let mut hot_wallet = WalletUnlocked::new_random(None); let mut cold_wallet = WalletUnlocked::new_random(None); - let code_path = "../../packages/fuels/tests/predicates/swap/out/debug/swap.bin"; + let code_path = "../../packages/fuels/tests/predicates/swap/out/release/swap.bin"; let mut predicate = Predicate::load_from(code_path)?; let num_coins = 5; diff --git a/examples/debugging/src/lib.rs b/examples/debugging/src/lib.rs index 5864577a81..ecad774668 100644 --- a/examples/debugging/src/lib.rs +++ b/examples/debugging/src/lib.rs @@ -30,11 +30,11 @@ mod tests { fn decoded_debug_matches_rust_debug() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/types/contracts/generics/out/debug/generics-abi.json" + abi = "packages/fuels/tests/types/contracts/generics/out/release/generics-abi.json" )); let json_abi_file = - "../../packages/fuels/tests/types/contracts/generics/out/debug/generics-abi.json"; + "../../packages/fuels/tests/types/contracts/generics/out/release/generics-abi.json"; let abi_file_contents = std::fs::read_to_string(json_abi_file)?; let parsed_abi: ProgramABI = serde_json::from_str(&abi_file_contents)?; diff --git a/examples/macros/src/lib.rs b/examples/macros/src/lib.rs index 1a95404059..80f4c5c792 100644 --- a/examples/macros/src/lib.rs +++ b/examples/macros/src/lib.rs @@ -8,10 +8,10 @@ mod tests { fn example_of_abigen_usage() { // ANCHOR: multiple_abigen_program_types abigen!( - Contract(name="ContractA", abi="packages/fuels/tests/bindings/sharing_types/contract_a/out/debug/contract_a-abi.json"), - Contract(name="ContractB", abi="packages/fuels/tests/bindings/sharing_types/contract_b/out/debug/contract_b-abi.json"), - Script(name="MyScript", abi="packages/fuels/tests/scripts/arguments/out/debug/arguments-abi.json"), - Predicate(name="MyPredicateEncoder", abi="packages/fuels/tests/predicates/basic_predicate/out/debug/basic_predicate-abi.json"), + Contract(name="ContractA", abi="packages/fuels/tests/bindings/sharing_types/contract_a/out/release/contract_a-abi.json"), + Contract(name="ContractB", abi="packages/fuels/tests/bindings/sharing_types/contract_b/out/release/contract_b-abi.json"), + Script(name="MyScript", abi="packages/fuels/tests/scripts/arguments/out/release/arguments-abi.json"), + Predicate(name="MyPredicateEncoder", abi="packages/fuels/tests/predicates/basic_predicate/out/release/basic_predicate-abi.json"), ); // ANCHOR_END: multiple_abigen_program_types } diff --git a/examples/predicates/src/lib.rs b/examples/predicates/src/lib.rs index 78ab31c712..eea556a61a 100644 --- a/examples/predicates/src/lib.rs +++ b/examples/predicates/src/lib.rs @@ -56,11 +56,12 @@ mod tests { // ANCHOR: predicate_load abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/predicates/signatures/out/debug/signatures-abi.json" + abi = "packages/fuels/tests/predicates/signatures/out/release/signatures-abi.json" )); let predicate_data = MyPredicateEncoder::default().encode_data(signatures)?; - let code_path = "../../packages/fuels/tests/predicates/signatures/out/debug/signatures.bin"; + let code_path = + "../../packages/fuels/tests/predicates/signatures/out/release/signatures.bin"; let predicate: Predicate = Predicate::load_from(code_path)? .with_provider(provider) @@ -124,13 +125,13 @@ mod tests { let first_wallet = &wallets[0]; let second_wallet = &wallets[1]; - abigen!(Predicate(name="MyPredicate", abi="packages/fuels/tests/predicates/basic_predicate/out/debug/basic_predicate-abi.json")); + abigen!(Predicate(name="MyPredicate", abi="packages/fuels/tests/predicates/basic_predicate/out/release/basic_predicate-abi.json")); // ANCHOR_END: predicate_data_setup // ANCHOR: with_predicate_data let predicate_data = MyPredicateEncoder::default().encode_data(4096, 4096)?; let code_path = - "../../packages/fuels/tests/predicates/basic_predicate/out/debug/basic_predicate.bin"; + "../../packages/fuels/tests/predicates/basic_predicate/out/release/basic_predicate.bin"; let predicate: Predicate = Predicate::load_from(code_path)? .with_provider(first_wallet.try_provider()?.clone()) diff --git a/examples/wallets/src/lib.rs b/examples/wallets/src/lib.rs index 2284a59d36..0952dd6950 100644 --- a/examples/wallets/src/lib.rs +++ b/examples/wallets/src/lib.rs @@ -175,7 +175,7 @@ mod tests { .unwrap(); let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) diff --git a/packages/fuels-macros/src/lib.rs b/packages/fuels-macros/src/lib.rs index 237628446f..e9758eab74 100644 --- a/packages/fuels-macros/src/lib.rs +++ b/packages/fuels-macros/src/lib.rs @@ -27,7 +27,7 @@ mod setup_program_test; ///```text /// abigen!(Contract( /// name = "MyContract", -/// abi = "packages/fuels/tests/contracts/token_ops/out/debug/token_ops-abi.json" +/// abi = "packages/fuels/tests/contracts/token_ops/out/release/token_ops-abi.json" /// )); ///``` /// diff --git a/packages/fuels-macros/src/setup_program_test/code_gen.rs b/packages/fuels-macros/src/setup_program_test/code_gen.rs index 9b528e238d..1fc3391dfd 100644 --- a/packages/fuels-macros/src/setup_program_test/code_gen.rs +++ b/packages/fuels-macros/src/setup_program_test/code_gen.rs @@ -197,7 +197,7 @@ impl Project { fn compile_file_path(&self, suffix: &str, description: &str) -> String { self.path - .join(["out/debug/", self.project_name(), suffix].concat()) + .join(["out/release/", self.project_name(), suffix].concat()) .to_str() .unwrap_or_else(|| panic!("could not join path for {description}")) .to_string() diff --git a/packages/fuels/tests/configurables.rs b/packages/fuels/tests/configurables.rs index d2c8d56fc5..ba099bd1ca 100644 --- a/packages/fuels/tests/configurables.rs +++ b/packages/fuels/tests/configurables.rs @@ -5,13 +5,13 @@ use fuels_core::codec::EncoderConfig; async fn contract_uses_default_configurables() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/configurables/out/debug/configurables-abi.json" + abi = "packages/fuels/tests/contracts/configurables/out/release/configurables-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; let contract_id = Contract::load_from( - "tests/contracts/configurables/out/debug/configurables.bin", + "tests/contracts/configurables/out/release/configurables.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -81,7 +81,7 @@ async fn contract_configurables() -> Result<()> { // ANCHOR: contract_configurables abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/configurables/out/debug/configurables-abi.json" + abi = "packages/fuels/tests/contracts/configurables/out/release/configurables-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; @@ -100,7 +100,7 @@ async fn contract_configurables() -> Result<()> { .with_ENUM(new_enum.clone())?; let contract_id = Contract::load_from( - "tests/contracts/configurables/out/debug/configurables.bin", + "tests/contracts/configurables/out/release/configurables.bin", LoadConfiguration::default().with_configurables(configurables), )? .deploy(&wallet, TxPolicies::default()) @@ -132,10 +132,11 @@ async fn contract_configurables() -> Result<()> { #[tokio::test] async fn script_configurables() -> Result<()> { // ANCHOR: script_configurables - abigen!(Script(name="MyScript", abi="packages/fuels/tests/scripts/script_configurables/out/debug/script_configurables-abi.json")); + abigen!(Script(name="MyScript", abi="packages/fuels/tests/scripts/script_configurables/out/release/script_configurables-abi.json")); let wallet = launch_provider_and_get_wallet().await?; - let bin_path = "../fuels/tests/scripts/script_configurables/out/debug/script_configurables.bin"; + let bin_path = + "../fuels/tests/scripts/script_configurables/out/release/script_configurables.bin"; let instance = MyScript::new(wallet, bin_path); let new_str: SizedAsciiString<4> = "FUEL".try_into()?; @@ -176,7 +177,7 @@ async fn script_configurables() -> Result<()> { #[tokio::test] async fn configurable_encoder_config_is_applied() { - abigen!(Script(name="MyScript", abi="packages/fuels/tests/scripts/script_configurables/out/debug/script_configurables-abi.json")); + abigen!(Script(name="MyScript", abi="packages/fuels/tests/scripts/script_configurables/out/release/script_configurables-abi.json")); let new_struct = StructWithGeneric { field_1: 16u8, diff --git a/packages/fuels/tests/contracts.rs b/packages/fuels/tests/contracts.rs index 8eddb0c850..3c052e0df1 100644 --- a/packages/fuels/tests/contracts.rs +++ b/packages/fuels/tests/contracts.rs @@ -657,7 +657,7 @@ async fn setup_output_variable_estimation_test() -> Result<( let wallets = launch_custom_provider_and_get_wallets(wallet_config, None, None).await?; let contract_id = Contract::load_from( - "tests/contracts/token_ops/out/debug/token_ops.bin", + "tests/contracts/token_ops/out/release/token_ops.bin", LoadConfiguration::default(), )? .deploy(&wallets[0], TxPolicies::default()) @@ -678,7 +678,7 @@ async fn setup_output_variable_estimation_test() -> Result<( async fn test_output_variable_estimation() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/token_ops/out/debug/token_ops-abi.json" + abi = "packages/fuels/tests/contracts/token_ops/out/release/token_ops-abi.json" )); let (wallets, addresses, mint_asset_id, contract_id) = @@ -736,7 +736,7 @@ async fn test_output_variable_estimation() -> Result<()> { async fn test_output_variable_estimation_default_attempts() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/token_ops/out/debug/token_ops-abi.json" + abi = "packages/fuels/tests/contracts/token_ops/out/release/token_ops-abi.json" )); let (wallets, addresses, mint_asset_id, contract_id) = @@ -765,7 +765,7 @@ async fn test_output_variable_estimation_default_attempts() -> Result<()> { async fn test_output_variable_estimation_multicall() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/token_ops/out/debug/token_ops-abi.json" + abi = "packages/fuels/tests/contracts/token_ops/out/release/token_ops-abi.json" )); let (wallets, addresses, mint_asset_id, contract_id) = @@ -1129,7 +1129,7 @@ async fn test_add_custom_assets() -> Result<()> { #[tokio::test] async fn contract_load_error_messages() { { - let binary_path = "tests/contracts/contract_test/out/debug/no_file_on_path.bin"; + let binary_path = "tests/contracts/contract_test/out/release/no_file_on_path.bin"; let expected_error = format!("io: file \"{binary_path}\" does not exist"); let error = Contract::load_from(binary_path, LoadConfiguration::default()) @@ -1138,7 +1138,7 @@ async fn contract_load_error_messages() { assert_eq!(error.to_string(), expected_error); } { - let binary_path = "tests/contracts/contract_test/out/debug/contract_test-abi.json"; + let binary_path = "tests/contracts/contract_test/out/release/contract_test-abi.json"; let expected_error = format!("expected \"{binary_path}\" to have '.bin' extension"); let error = Contract::load_from(binary_path, LoadConfiguration::default()) @@ -1203,7 +1203,7 @@ async fn multi_call_from_calls_with_different_account_types() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let wallet = WalletUnlocked::new_random(None); @@ -1642,7 +1642,7 @@ async fn heap_types_correctly_offset_in_create_transactions_w_storage_slots() -> let provider = wallet.try_provider()?.clone(); let data = MyPredicateEncoder::default().encode_data(18, 24, vec![2, 4, 42])?; let predicate = Predicate::load_from( - "tests/types/predicates/predicate_vector/out/debug/predicate_vector.bin", + "tests/types/predicates/predicate_vector/out/release/predicate_vector.bin", )? .with_data(data) .with_provider(provider); @@ -1660,7 +1660,7 @@ async fn heap_types_correctly_offset_in_create_transactions_w_storage_slots() -> // the offsets were setup correctly since the predicate uses heap types in its arguments. // Storage slots were loaded automatically by default Contract::load_from( - "tests/contracts/storage/out/debug/storage.bin", + "tests/contracts/storage/out/release/storage.bin", LoadConfiguration::default(), )? .deploy(&predicate, TxPolicies::default()) @@ -1787,7 +1787,7 @@ async fn contract_encoder_config_is_applied() -> Result<()> { Wallets("wallet") ); let contract_id = Contract::load_from( - "tests/contracts/contract_test/out/debug/contract_test.bin", + "tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) diff --git a/packages/fuels/tests/logs.rs b/packages/fuels/tests/logs.rs index 38fad9d1ad..1a78a98a66 100644 --- a/packages/fuels/tests/logs.rs +++ b/packages/fuels/tests/logs.rs @@ -379,7 +379,7 @@ async fn test_multi_call_contract_with_contract_logs() -> Result<()> { ); let contract_id = Contract::load_from( - "../../packages/fuels/tests/logs/contract_logs/out/debug/contract_logs.bin", + "../../packages/fuels/tests/logs/contract_logs/out/release/contract_logs.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -613,11 +613,11 @@ async fn test_script_decode_logs() -> Result<()> { // ANCHOR: script_logs abigen!(Script( name = "log_script", - abi = "packages/fuels/tests/logs/script_logs/out/debug/script_logs-abi.json" + abi = "packages/fuels/tests/logs/script_logs/out/release/script_logs-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; - let bin_path = "../fuels/tests/logs/script_logs/out/debug/script_logs.bin"; + let bin_path = "../fuels/tests/logs/script_logs/out/release/script_logs.bin"; let instance = log_script::new(wallet.clone(), bin_path); let response = instance.main().call().await?; @@ -697,7 +697,7 @@ async fn test_contract_with_contract_logs() -> Result<()> { ); let contract_id = Contract::load_from( - "../../packages/fuels/tests/logs/contract_logs/out/debug/contract_logs.bin", + "../../packages/fuels/tests/logs/contract_logs/out/release/contract_logs.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -959,7 +959,7 @@ async fn test_contract_require_from_contract() -> Result<()> { ); let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/lib_contract/out/debug/lib_contract.bin", + "../../packages/fuels/tests/contracts/lib_contract/out/release/lib_contract.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -1011,7 +1011,7 @@ async fn test_multi_call_contract_require_from_contract() -> Result<()> { ); let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/lib_contract/out/debug/lib_contract.bin", + "../../packages/fuels/tests/contracts/lib_contract/out/release/lib_contract.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) diff --git a/packages/fuels/tests/predicates.rs b/packages/fuels/tests/predicates.rs index 6782d828d9..d1b3111e5f 100644 --- a/packages/fuels/tests/predicates.rs +++ b/packages/fuels/tests/predicates.rs @@ -117,7 +117,7 @@ async fn transfer_coins_and_messages_to_predicate() -> Result<()> { wallet.set_provider(provider.clone()); let predicate = - Predicate::load_from("tests/predicates/basic_predicate/out/debug/basic_predicate.bin")? + Predicate::load_from("tests/predicates/basic_predicate/out/release/basic_predicate.bin")? .with_provider(provider.clone()); wallet @@ -138,13 +138,14 @@ async fn transfer_coins_and_messages_to_predicate() -> Result<()> { async fn spend_predicate_coins_messages_basic() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/predicates/basic_predicate/out/debug/basic_predicate-abi.json" + abi = + "packages/fuels/tests/predicates/basic_predicate/out/release/basic_predicate-abi.json" )); let predicate_data = MyPredicateEncoder::default().encode_data(4097, 4097)?; let mut predicate: Predicate = - Predicate::load_from("tests/predicates/basic_predicate/out/debug/basic_predicate.bin")? + Predicate::load_from("tests/predicates/basic_predicate/out/release/basic_predicate.bin")? .with_data(predicate_data); let num_coins = 4; @@ -184,18 +185,18 @@ async fn pay_with_predicate() -> Result<()> { abigen!( Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" ), Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/u64/out/debug/u64-abi.json" + abi = "packages/fuels/tests/types/predicates/u64/out/release/u64-abi.json" ) ); let predicate_data = MyPredicateEncoder::default().encode_data(32768)?; let mut predicate: Predicate = - Predicate::load_from("tests/types/predicates/u64/out/debug/u64.bin")? + Predicate::load_from("tests/types/predicates/u64/out/release/u64.bin")? .with_data(predicate_data); let num_coins = 4; @@ -207,7 +208,7 @@ async fn pay_with_predicate() -> Result<()> { predicate.set_provider(provider.clone()); let contract_id = Contract::load_from( - "tests/contracts/contract_test/out/debug/contract_test.bin", + "tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&predicate, TxPolicies::default()) @@ -247,19 +248,19 @@ async fn pay_with_predicate_vector_data() -> Result<()> { abigen!( Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" ), Predicate( name = "MyPredicate", abi = - "packages/fuels/tests/types/predicates/predicate_vector/out/debug/predicate_vector-abi.json" + "packages/fuels/tests/types/predicates/predicate_vector/out/release/predicate_vector-abi.json" ) ); let predicate_data = MyPredicateEncoder::default().encode_data(12, 30, vec![2, 4, 42])?; let mut predicate: Predicate = Predicate::load_from( - "tests/types/predicates/predicate_vector/out/debug/predicate_vector.bin", + "tests/types/predicates/predicate_vector/out/release/predicate_vector.bin", )? .with_data(predicate_data); @@ -272,7 +273,7 @@ async fn pay_with_predicate_vector_data() -> Result<()> { predicate.set_provider(provider.clone()); let contract_id = Contract::load_from( - "tests/contracts/contract_test/out/debug/contract_test.bin", + "tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&predicate, TxPolicies::default()) @@ -312,13 +313,13 @@ async fn predicate_contract_transfer() -> Result<()> { abigen!(Predicate( name = "MyPredicate", abi = - "packages/fuels/tests/types/predicates/predicate_vector/out/debug/predicate_vector-abi.json" + "packages/fuels/tests/types/predicates/predicate_vector/out/release/predicate_vector-abi.json" )); let predicate_data = MyPredicateEncoder::default().encode_data(2, 40, vec![2, 4, 42])?; let mut predicate: Predicate = Predicate::load_from( - "tests/types/predicates/predicate_vector/out/debug/predicate_vector.bin", + "tests/types/predicates/predicate_vector/out/release/predicate_vector.bin", )? .with_data(predicate_data); @@ -331,7 +332,7 @@ async fn predicate_contract_transfer() -> Result<()> { predicate.set_provider(provider.clone()); let contract_id = Contract::load_from( - "tests/contracts/contract_test/out/debug/contract_test.bin", + "tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&predicate, TxPolicies::default()) @@ -369,13 +370,13 @@ async fn predicate_transfer_to_base_layer() -> Result<()> { abigen!(Predicate( name = "MyPredicate", abi = - "packages/fuels/tests/types/predicates/predicate_vector/out/debug/predicate_vector-abi.json" + "packages/fuels/tests/types/predicates/predicate_vector/out/release/predicate_vector-abi.json" )); let predicate_data = MyPredicateEncoder::default().encode_data(22, 20, vec![2, 4, 42])?; let mut predicate: Predicate = Predicate::load_from( - "tests/types/predicates/predicate_vector/out/debug/predicate_vector.bin", + "tests/types/predicates/predicate_vector/out/release/predicate_vector.bin", )? .with_data(predicate_data); @@ -416,13 +417,13 @@ async fn predicate_transfer_with_signed_resources() -> Result<()> { abigen!(Predicate( name = "MyPredicate", abi = - "packages/fuels/tests/types/predicates/predicate_vector/out/debug/predicate_vector-abi.json" + "packages/fuels/tests/types/predicates/predicate_vector/out/release/predicate_vector-abi.json" )); let predicate_data = MyPredicateEncoder::default().encode_data(2, 40, vec![2, 4, 42])?; let mut predicate: Predicate = Predicate::load_from( - "tests/types/predicates/predicate_vector/out/debug/predicate_vector.bin", + "tests/types/predicates/predicate_vector/out/release/predicate_vector.bin", )? .with_data(predicate_data); @@ -495,19 +496,19 @@ async fn contract_tx_and_call_params_with_predicate() -> Result<()> { abigen!( Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" ), Predicate( name = "MyPredicate", abi = - "packages/fuels/tests/types/predicates/predicate_vector/out/debug/predicate_vector-abi.json" + "packages/fuels/tests/types/predicates/predicate_vector/out/release/predicate_vector-abi.json" ) ); let predicate_data = MyPredicateEncoder::default().encode_data(22, 20, vec![2, 4, 42])?; let mut predicate: Predicate = Predicate::load_from( - "tests/types/predicates/predicate_vector/out/debug/predicate_vector.bin", + "tests/types/predicates/predicate_vector/out/release/predicate_vector.bin", )? .with_data(predicate_data); @@ -520,7 +521,7 @@ async fn contract_tx_and_call_params_with_predicate() -> Result<()> { predicate.set_provider(provider.clone()); let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&predicate, TxPolicies::default()) @@ -570,19 +571,19 @@ async fn diff_asset_predicate_payment() -> Result<()> { abigen!( Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" ), Predicate( name = "MyPredicate", abi = - "packages/fuels/tests/types/predicates/predicate_vector/out/debug/predicate_vector-abi.json" + "packages/fuels/tests/types/predicates/predicate_vector/out/release/predicate_vector-abi.json" ) ); let predicate_data = MyPredicateEncoder::default().encode_data(28, 14, vec![2, 4, 42])?; let mut predicate: Predicate = Predicate::load_from( - "tests/types/predicates/predicate_vector/out/debug/predicate_vector.bin", + "tests/types/predicates/predicate_vector/out/release/predicate_vector.bin", )? .with_data(predicate_data); @@ -595,7 +596,7 @@ async fn diff_asset_predicate_payment() -> Result<()> { predicate.set_provider(provider.clone()); let contract_id = Contract::load_from( - "../../packages/fuels/tests/contracts/contract_test/out/debug/contract_test.bin", + "../../packages/fuels/tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&predicate, TxPolicies::default()) @@ -621,7 +622,7 @@ async fn predicate_configurables() -> Result<()> { // ANCHOR: predicate_configurables abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/predicates/predicate_configurables/out/debug/predicate_configurables-abi.json" + abi = "packages/fuels/tests/predicates/predicate_configurables/out/release/predicate_configurables-abi.json" )); let new_struct = StructWithGeneric { @@ -638,7 +639,7 @@ async fn predicate_configurables() -> Result<()> { MyPredicateEncoder::default().encode_data(8u8, true, new_struct, new_enum)?; let mut predicate: Predicate = Predicate::load_from( - "tests/predicates/predicate_configurables/out/debug/predicate_configurables.bin", + "tests/predicates/predicate_configurables/out/release/predicate_configurables.bin", )? .with_data(predicate_data) .with_configurables(configurables); @@ -680,13 +681,14 @@ async fn predicate_configurables() -> Result<()> { async fn predicate_adjust_fee_persists_message_w_data() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/predicates/basic_predicate/out/debug/basic_predicate-abi.json" + abi = + "packages/fuels/tests/predicates/basic_predicate/out/release/basic_predicate-abi.json" )); let predicate_data = MyPredicateEncoder::default().encode_data(4097, 4097)?; let mut predicate: Predicate = - Predicate::load_from("tests/predicates/basic_predicate/out/debug/basic_predicate.bin")? + Predicate::load_from("tests/predicates/basic_predicate/out/release/basic_predicate.bin")? .with_data(predicate_data); let amount = 1000; @@ -719,13 +721,14 @@ async fn predicate_adjust_fee_persists_message_w_data() -> Result<()> { async fn predicate_transfer_non_base_asset() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/predicates/basic_predicate/out/debug/basic_predicate-abi.json" + abi = + "packages/fuels/tests/predicates/basic_predicate/out/release/basic_predicate-abi.json" )); let predicate_data = MyPredicateEncoder::default().encode_data(32, 32)?; let mut predicate: Predicate = - Predicate::load_from("tests/predicates/basic_predicate/out/debug/basic_predicate.bin")? + Predicate::load_from("tests/predicates/basic_predicate/out/release/basic_predicate.bin")? .with_data(predicate_data); let mut wallet = WalletUnlocked::new_random(None); @@ -781,13 +784,13 @@ async fn predicate_transfer_non_base_asset() -> Result<()> { async fn predicate_can_access_manually_added_witnesses() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/predicates/predicate_witnesses/out/debug/predicate_witnesses-abi.json" + abi = "packages/fuels/tests/predicates/predicate_witnesses/out/release/predicate_witnesses-abi.json" )); let predicate_data = MyPredicateEncoder::default().encode_data(0, 1)?; let mut predicate: Predicate = Predicate::load_from( - "tests/predicates/predicate_witnesses/out/debug/predicate_witnesses.bin", + "tests/predicates/predicate_witnesses/out/release/predicate_witnesses.bin", )? .with_data(predicate_data); @@ -852,13 +855,13 @@ async fn predicate_can_access_manually_added_witnesses() -> Result<()> { async fn tx_id_not_changed_after_adding_witnesses() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/predicates/predicate_witnesses/out/debug/predicate_witnesses-abi.json" + abi = "packages/fuels/tests/predicates/predicate_witnesses/out/release/predicate_witnesses-abi.json" )); let predicate_data = MyPredicateEncoder::default().encode_data(0, 1)?; let mut predicate: Predicate = Predicate::load_from( - "tests/predicates/predicate_witnesses/out/debug/predicate_witnesses.bin", + "tests/predicates/predicate_witnesses/out/release/predicate_witnesses.bin", )? .with_data(predicate_data); @@ -911,7 +914,8 @@ async fn tx_id_not_changed_after_adding_witnesses() -> Result<()> { async fn predicate_encoder_config_is_applied() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/predicates/basic_predicate/out/debug/basic_predicate-abi.json" + abi = + "packages/fuels/tests/predicates/basic_predicate/out/release/basic_predicate-abi.json" )); { let _encoding_ok = MyPredicateEncoder::default() @@ -966,10 +970,11 @@ async fn predicate_validation() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/predicates/basic_predicate/out/debug/basic_predicate-abi.json" + abi = + "packages/fuels/tests/predicates/basic_predicate/out/release/basic_predicate-abi.json" )); let code_path = - "../../packages/fuels/tests/predicates/basic_predicate/out/debug/basic_predicate.bin"; + "../../packages/fuels/tests/predicates/basic_predicate/out/release/basic_predicate.bin"; // the predicate evaluates to true if the two arguments are equal let correct_predicate_data = MyPredicateEncoder::default().encode_data(4096, 4096)?; diff --git a/packages/fuels/tests/providers.rs b/packages/fuels/tests/providers.rs index bb12d07027..5ca9aaf143 100644 --- a/packages/fuels/tests/providers.rs +++ b/packages/fuels/tests/providers.rs @@ -23,7 +23,7 @@ use fuels::{ async fn test_provider_launch_and_connect() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let mut wallet = WalletUnlocked::new_random(None); @@ -38,7 +38,7 @@ async fn test_provider_launch_and_connect() -> Result<()> { wallet.set_provider(provider.clone()); let contract_id = Contract::load_from( - "tests/contracts/contract_test/out/debug/contract_test.bin", + "tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -69,7 +69,7 @@ async fn test_provider_launch_and_connect() -> Result<()> { async fn test_network_error() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let mut wallet = WalletUnlocked::new_random(None); @@ -86,7 +86,7 @@ async fn test_network_error() -> Result<()> { service.stop().await.unwrap(); let response = Contract::load_from( - "tests/contracts/contract_test/out/debug/contract_test.bin", + "tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -173,11 +173,11 @@ async fn test_input_message_pays_fee() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); let contract_id = Contract::load_from( - "tests/contracts/contract_test/out/debug/contract_test.bin", + "tests/contracts/contract_test/out/release/contract_test.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -280,7 +280,7 @@ async fn can_retrieve_latest_block_time() -> Result<()> { #[tokio::test] async fn contract_deployment_respects_maturity() -> Result<()> { - abigen!(Contract(name="MyContract", abi="packages/fuels/tests/contracts/transaction_block_height/out/debug/transaction_block_height-abi.json")); + abigen!(Contract(name="MyContract", abi="packages/fuels/tests/contracts/transaction_block_height/out/release/transaction_block_height-abi.json")); let wallets = launch_custom_provider_and_get_wallets(WalletsConfig::default(), None, None).await?; @@ -289,7 +289,7 @@ async fn contract_deployment_respects_maturity() -> Result<()> { let deploy_w_maturity = |maturity| { Contract::load_from( - "tests/contracts/transaction_block_height/out/debug/transaction_block_height.bin", + "tests/contracts/transaction_block_height/out/release/transaction_block_height.bin", LoadConfiguration::default(), ) .map(|loaded_contract| { @@ -330,7 +330,7 @@ async fn test_gas_forwarded_defaults_to_tx_limit() -> Result<()> { ); // The gas used by the script to call a contract and forward remaining gas limit. - let gas_used_by_script = 305; + let gas_used_by_script = 253; let gas_limit = 225_883; let response = contract_instance .methods() @@ -596,7 +596,7 @@ async fn testnet_hello_world() -> Result<()> { // the testnet. But, if it becomes too problematic, we should remove it. abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/contract_test/out/debug/contract_test-abi.json" + abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json" )); // Create a provider pointing to the testnet. @@ -617,7 +617,7 @@ async fn testnet_hello_world() -> Result<()> { let tx_policies = TxPolicies::default().with_script_gas_limit(2000); let contract_id = Contract::load_from( - "tests/contracts/contract_test/out/debug/contract_test.bin", + "tests/contracts/contract_test/out/release/contract_test.bin", configuration, )? .deploy(&wallet, tx_policies) diff --git a/packages/fuels/tests/scripts.rs b/packages/fuels/tests/scripts.rs index 735af81c6e..a84918569a 100644 --- a/packages/fuels/tests/scripts.rs +++ b/packages/fuels/tests/scripts.rs @@ -10,10 +10,10 @@ async fn main_function_arguments() -> Result<()> { // The abigen is used for the same purpose as with contracts (Rust bindings) abigen!(Script( name = "MyScript", - abi = "packages/fuels/tests/scripts/arguments/out/debug/arguments-abi.json" + abi = "packages/fuels/tests/scripts/arguments/out/release/arguments-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; - let bin_path = "../fuels/tests/scripts/arguments/out/debug/arguments.bin"; + let bin_path = "../fuels/tests/scripts/arguments/out/release/arguments.bin"; let script_instance = MyScript::new(wallet, bin_path); let bim = Bimbam { val: 90 }; @@ -378,10 +378,10 @@ async fn test_script_transaction_builder() -> Result<()> { async fn script_encoder_config_is_applied() { abigen!(Script( name = "MyScript", - abi = "packages/fuels/tests/scripts/basic_script/out/debug/basic_script-abi.json" + abi = "packages/fuels/tests/scripts/basic_script/out/release/basic_script-abi.json" )); let wallet = launch_provider_and_get_wallet().await.expect(""); - let bin_path = "../fuels/tests/scripts/basic_script/out/debug/basic_script.bin"; + let bin_path = "../fuels/tests/scripts/basic_script/out/release/basic_script.bin"; let script_instance_without_encoder_config = MyScript::new(wallet.clone(), bin_path); { diff --git a/packages/fuels/tests/storage.rs b/packages/fuels/tests/storage.rs index 04f812bb5f..6d7719a623 100644 --- a/packages/fuels/tests/storage.rs +++ b/packages/fuels/tests/storage.rs @@ -10,7 +10,7 @@ use fuels::{ async fn test_storage_initialization() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/storage/out/debug/storage-abi.json" + abi = "packages/fuels/tests/contracts/storage/out/release/storage-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; @@ -22,7 +22,7 @@ async fn test_storage_initialization() -> Result<()> { let storage_configuration = StorageConfiguration::default().add_slot_overrides(storage_vec); let contract_id = Contract::load_from( - "tests/contracts/storage/out/debug/storage.bin", + "tests/contracts/storage/out/release/storage.bin", LoadConfiguration::default().with_storage_configuration(storage_configuration), )? .deploy(&wallet, TxPolicies::default()) @@ -45,13 +45,13 @@ async fn test_storage_initialization() -> Result<()> { async fn test_init_storage_automatically() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/contracts/storage/out/debug/storage-abi.json" + abi = "packages/fuels/tests/contracts/storage/out/release/storage-abi.json" )); let wallet = launch_provider_and_get_wallet().await?; let contract_id = Contract::load_from( - "tests/contracts/storage/out/debug/storage.bin", + "tests/contracts/storage/out/release/storage.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -85,7 +85,7 @@ async fn test_init_storage_automatically() -> Result<()> { #[tokio::test] async fn storage_load_error_messages() { { - let json_path = "tests/contracts/storage/out/debug/no_file_on_path.json"; + let json_path = "tests/contracts/storage/out/release/no_file_on_path.json"; let expected_error = format!("io: file \"{json_path}\" does not exist"); let error = StorageConfiguration::default() @@ -95,7 +95,7 @@ async fn storage_load_error_messages() { assert_eq!(error.to_string(), expected_error); } { - let json_path = "tests/contracts/storage/out/debug/storage.bin"; + let json_path = "tests/contracts/storage/out/release/storage.bin"; let expected_error = format!("expected \"{json_path}\" to have '.json' extension"); let error = StorageConfiguration::default() diff --git a/packages/fuels/tests/types_contracts.rs b/packages/fuels/tests/types_contracts.rs index 50e3edb3c2..7634db8a2a 100644 --- a/packages/fuels/tests/types_contracts.rs +++ b/packages/fuels/tests/types_contracts.rs @@ -62,7 +62,7 @@ async fn call_with_structs() -> Result<()> { // The generated bindings can be accessed through `MyContract`. // ANCHOR: struct_generation abigen!(Contract(name="MyContract", - abi="packages/fuels/tests/types/contracts/complex_types_contract/out/debug/complex_types_contract-abi.json")); + abi="packages/fuels/tests/types/contracts/complex_types_contract/out/release/complex_types_contract-abi.json")); // Here we can use `CounterConfig`, a struct originally // defined in the contract. @@ -75,7 +75,7 @@ async fn call_with_structs() -> Result<()> { let wallet = launch_provider_and_get_wallet().await?; let contract_id = Contract::load_from( - "tests/types/contracts/complex_types_contract/out/debug/complex_types_contract.bin", + "tests/types/contracts/complex_types_contract/out/release/complex_types_contract.bin", LoadConfiguration::default(), )? .deploy(&wallet, TxPolicies::default()) @@ -220,7 +220,7 @@ async fn calls_with_empty_struct() -> Result<()> { async fn can_use_try_into_to_construct_struct_from_bytes() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/types/contracts/enum_inside_struct/out/debug\ + abi = "packages/fuels/tests/types/contracts/enum_inside_struct/out/release\ /enum_inside_struct-abi.json" )); let cocktail_in_bytes: Vec = vec![ @@ -711,7 +711,7 @@ async fn enum_as_input() -> Result<()> { async fn can_use_try_into_to_construct_enum_from_bytes() -> Result<()> { abigen!(Contract( name = "MyContract", - abi = "packages/fuels/tests/types/contracts/enum_inside_struct/out/debug\ + abi = "packages/fuels/tests/types/contracts/enum_inside_struct/out/release\ /enum_inside_struct-abi.json" )); let shaker_in_bytes: Vec = vec![0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2]; diff --git a/packages/fuels/tests/types_predicates.rs b/packages/fuels/tests/types_predicates.rs index 132732289f..67581934ae 100644 --- a/packages/fuels/tests/types_predicates.rs +++ b/packages/fuels/tests/types_predicates.rs @@ -57,7 +57,7 @@ fn project_binary(project_root: impl AsRef) -> String { .unwrap(); project_root - .join(format!("out/debug/{project_name}.bin")) + .join(format!("out/release/{project_name}.bin")) .display() .to_string() } @@ -131,7 +131,7 @@ async fn setup_predicate_test( async fn spend_predicate_coins_messages_single_u64() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/u64/out/debug/u64-abi.json" + abi = "packages/fuels/tests/types/predicates/u64/out/release/u64-abi.json" )); let data = MyPredicateEncoder::default().encode_data(32768)?; @@ -145,7 +145,7 @@ async fn spend_predicate_coins_messages_single_u64() -> Result<()> { async fn spend_predicate_coins_messages_address() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/address/out/debug/address-abi.json" + abi = "packages/fuels/tests/types/predicates/address/out/release/address-abi.json" )); let addr: Address = @@ -162,7 +162,7 @@ async fn spend_predicate_coins_messages_address() -> Result<()> { async fn spend_predicate_coins_messages_enums() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/enums/out/debug/enums-abi.json" + abi = "packages/fuels/tests/types/predicates/enums/out/release/enums-abi.json" )); let data = @@ -177,7 +177,7 @@ async fn spend_predicate_coins_messages_enums() -> Result<()> { async fn spend_predicate_coins_messages_structs() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/structs/out/debug/structs-abi.json" + abi = "packages/fuels/tests/types/predicates/structs/out/release/structs-abi.json" )); let data = MyPredicateEncoder::default().encode_data( @@ -197,7 +197,7 @@ async fn spend_predicate_coins_messages_structs() -> Result<()> { async fn spend_predicate_coins_messages_tuple() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/predicate_tuples/out/debug/predicate_tuples-abi.json" + abi = "packages/fuels/tests/types/predicates/predicate_tuples/out/release/predicate_tuples-abi.json" )); let data = MyPredicateEncoder::default() @@ -213,7 +213,7 @@ async fn spend_predicate_coins_messages_vector() -> Result<()> { abigen!(Predicate( name = "MyPredicate", abi = - "packages/fuels/tests/types/predicates/predicate_vector/out/debug/predicate_vector-abi.json" + "packages/fuels/tests/types/predicates/predicate_vector/out/release/predicate_vector-abi.json" )); let data = MyPredicateEncoder::default().encode_data(18, 24, vec![2, 4, 42])?; @@ -225,7 +225,7 @@ async fn spend_predicate_coins_messages_vector() -> Result<()> { #[tokio::test] async fn spend_predicate_coins_messages_vectors() -> Result<()> { - abigen!(Predicate(name="MyPredicate", abi="packages/fuels/tests/types/predicates/predicate_vectors/out/debug/predicate_vectors-abi.json")); + abigen!(Predicate(name="MyPredicate", abi="packages/fuels/tests/types/predicates/predicate_vectors/out/release/predicate_vectors-abi.json")); let u32_vec = vec![0, 4, 3]; let vec_in_vec = vec![vec![0, 2, 2], vec![0, 1, 2]]; @@ -270,7 +270,7 @@ async fn spend_predicate_coins_messages_vectors() -> Result<()> { #[tokio::test] async fn spend_predicate_coins_messages_generics() -> Result<()> { - abigen!(Predicate(name="MyPredicate", abi="packages/fuels/tests/types/predicates/predicate_generics/out/debug/predicate_generics-abi.json")); + abigen!(Predicate(name="MyPredicate", abi="packages/fuels/tests/types/predicates/predicate_generics/out/release/predicate_generics-abi.json")); let data = MyPredicateEncoder::default().encode_data( GenericStruct { value: 64u8 }, @@ -286,7 +286,7 @@ async fn spend_predicate_coins_messages_generics() -> Result<()> { async fn spend_predicate_coins_messages_bytes_hash() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/predicate_bytes_hash/out/debug/predicate_bytes_hash-abi.json" + abi = "packages/fuels/tests/types/predicates/predicate_bytes_hash/out/release/predicate_bytes_hash-abi.json" )); @@ -309,7 +309,7 @@ async fn spend_predicate_coins_messages_bytes_hash() -> Result<()> { async fn spend_predicate_coins_messages_bytes() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/predicate_bytes/out/debug/predicate_bytes-abi.json" + abi = "packages/fuels/tests/types/predicates/predicate_bytes/out/release/predicate_bytes-abi.json" )); let bytes = Bytes(vec![40, 41, 42]); @@ -329,7 +329,7 @@ async fn spend_predicate_coins_messages_bytes() -> Result<()> { async fn spend_predicate_coins_messages_raw_slice() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/predicate_raw_slice/out/debug/predicate_raw_slice-abi.json" + abi = "packages/fuels/tests/types/predicates/predicate_raw_slice/out/release/predicate_raw_slice-abi.json" )); let raw_slice = RawSlice(vec![40, 41, 42]); @@ -357,7 +357,7 @@ fn u128_from(parts: (u64, u64)) -> u128 { async fn predicate_handles_u128() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/predicate_u128/out/debug/predicate_u128-abi.json" + abi = "packages/fuels/tests/types/predicates/predicate_u128/out/release/predicate_u128-abi.json" )); let data = MyPredicateEncoder::default().encode_data(u128_from((8, 2)))?; @@ -370,7 +370,7 @@ async fn predicate_handles_u128() -> Result<()> { async fn predicate_handles_b256() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/predicate_b256/out/debug/predicate_b256-abi.json" + abi = "packages/fuels/tests/types/predicates/predicate_b256/out/release/predicate_b256-abi.json" )); let data = MyPredicateEncoder::default().encode_data(Bits256([1; 32]))?; @@ -396,7 +396,7 @@ fn u256_from(parts: (u64, u64, u64, u64)) -> U256 { async fn predicate_handles_u256() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/predicate_u256/out/debug/predicate_u256-abi.json" + abi = "packages/fuels/tests/types/predicates/predicate_u256/out/release/predicate_u256-abi.json" )); let data = MyPredicateEncoder::default().encode_data(u256_from((10, 11, 12, 13)))?; @@ -409,7 +409,7 @@ async fn predicate_handles_u256() -> Result<()> { async fn predicate_handles_std_string() -> Result<()> { abigen!(Predicate( name = "MyPredicate", - abi = "packages/fuels/tests/types/predicates/predicate_std_lib_string/out/debug/predicate_std_lib_string-abi.json" + abi = "packages/fuels/tests/types/predicates/predicate_std_lib_string/out/release/predicate_std_lib_string-abi.json" )); let data = MyPredicateEncoder::default().encode_data(10, 11, String::from("Hello World"))?;