Skip to content

Commit e43b077

Browse files
authored
Merge branch 'master' into vaivaswatha/ir_switch
2 parents b71da1e + 0d8fbc8 commit e43b077

File tree

67 files changed

+252
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+252
-218
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ jobs:
217217

218218
- name: Read and compare versions
219219
env:
220-
PACKAGE_NAMES: "fuel-core-client" # multiple packages can be specified delimeted with `,`.
220+
PACKAGE_NAMES: "fuel-core-client" # multiple packages can be specified delimited with `,`.
221221
run: |
222222
.github/workflows/scripts/check-sdk-harness-version.sh
223223
@@ -448,17 +448,29 @@ jobs:
448448
- uses: Swatinem/rust-cache@v2
449449
with:
450450
cache-provider: "warpbuild"
451-
- name: Build All Tests
452-
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness
453-
- name: Test All Tests
454-
run: cargo run --locked --release -p forc -- test --release --locked --path ./test/src/sdk-harness
455-
- name: Cargo Test sway-lib-std
451+
- name: Build All Test Projects (Debug)
452+
run: cargo run --locked --release -p forc -- build --locked --path ./test/src/sdk-harness --output-directory ./test/src/sdk-harness/out
453+
- name: Run All SDK Tests (Debug)
454+
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --skip can_get_predicate_address --nocapture
455+
- name: Build All Test Projects (Release)
456+
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness --output-directory ./test/src/sdk-harness/out
457+
- name: Run All SDK Tests (Release)
456458
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture
457-
- name: Build All Tests - Experimental Feature 'new_hashing' disabled
458-
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness --no-experimental new_hashing
459-
- name: Test All Tests - Experimental Feature 'new_hashing' disabled
460-
run: cargo run --locked --release -p forc -- test --release --locked --path ./test/src/sdk-harness --no-experimental new_hashing
461-
- name: Cargo Test sway-lib-std - Experimental Feature 'new_hashing' disabled
459+
- name: Build All Test Projects - ['new_hashing' disabled] (Debug)
460+
run: cargo run --locked --release -p forc -- build --locked --path ./test/src/sdk-harness --no-experimental new_hashing --output-directory ./test/src/sdk-harness/out
461+
- name: Run All SDK Tests - ['new_hashing' disabled] (Debug)
462+
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --skip can_get_predicate_address --nocapture
463+
- name: Build All Test Projects - ['new_hashing' disabled] (Release)
464+
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness --no-experimental new_hashing --output-directory ./test/src/sdk-harness/out
465+
- name: Run All SDK Tests - ['new_hashing' disabled] (Release)
466+
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture
467+
- name: Build All Test Projects - ['str_array_no_padding' enabled] (Debug)
468+
run: cargo run --locked --release -p forc -- build --locked --path ./test/src/sdk-harness --experimental str_array_no_padding --output-directory ./test/src/sdk-harness/out
469+
- name: Run All SDK Tests - ['str_array_no_padding' enabled] (Debug)
470+
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --skip can_get_predicate_address --nocapture
471+
- name: Build All Test Projects - ['str_array_no_padding' enabled] (Release)
472+
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness --experimental str_array_no_padding --output-directory ./test/src/sdk-harness/out
473+
- name: Run All SDK Tests - ['str_array_no_padding' enabled] (Release)
462474
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture
463475

464476
forc-run-benchmarks:
@@ -526,34 +538,26 @@ jobs:
526538
run: forc test --path sway-lib-std
527539
- name: Run Std Unit Tests (Release)
528540
run: forc test --release --path sway-lib-std
529-
- name: Run Std Unit Tests - Experimental feature 'const_generics' (Debug)
530-
run: forc test --path sway-lib-std --experimental const_generics
531-
- name: Run Std Unit Tests - Experimental feature 'const_generics' (Release)
532-
run: forc test --release --path sway-lib-std --experimental const_generics
533-
- name: Run Std Unit Tests - Experimental feature 'new_hashing' (Debug)
541+
- name: Run Std Unit Tests - ['new_hashing' disabled] (Debug)
534542
run: forc test --path sway-lib-std --no-experimental new_hashing
535-
- name: Run Std Unit Tests - Experimental feature 'new_hashing' (Release)
543+
- name: Run Std Unit Tests - ['new_hashing' disabled] (Release)
536544
run: forc test --release --path sway-lib-std --no-experimental new_hashing
537-
- name: Run Std Unit Tests - Experimental feature 'const_generics,new_hashing' (Debug)
538-
run: forc test --path sway-lib-std --experimental const_generics --no-experimental new_hashing
539-
- name: Run Std Unit Tests - Experimental feature 'const_generics,new_hashing' (Release)
540-
run: forc test --release --path sway-lib-std --experimental const_generics --no-experimental new_hashing
545+
- name: Run Std Unit Tests - ['str_array_no_padding' enabled] (Debug)
546+
run: forc test --path sway-lib-std --experimental str_array_no_padding
547+
- name: Run Std Unit Tests - ['str_array_no_padding' enabled] (Release)
548+
run: forc test --release --path sway-lib-std --experimental str_array_no_padding
541549
- name: Run In Language Unit Tests (Debug)
542550
run: forc test --error-on-warnings --path test/src/in_language_tests
543551
- name: Run In Language Unit Tests (Release)
544552
run: forc test --error-on-warnings --release --path test/src/in_language_tests
545-
- name: Run In Language Unit Tests - Experimental feature 'const_generics' (Debug)
546-
run: forc test --error-on-warnings --path test/src/in_language_tests --experimental const_generics
547-
- name: Run In Language Unit Tests - Experimental feature 'const_generics' (Release)
548-
run: forc test --error-on-warnings --release --path test/src/in_language_tests --experimental const_generics
549-
- name: Run In Language Unit Tests - Experimental feature 'new_hashing' (Debug)
553+
- name: Run In Language Unit Tests - ['new_hashing' disabled] (Debug)
550554
run: forc test --error-on-warnings --path test/src/in_language_tests --no-experimental new_hashing
551-
- name: Run In Language Unit Tests - Experimental feature 'new_hashing' (Release)
555+
- name: Run In Language Unit Tests - ['new_hashing' disabled] (Release)
552556
run: forc test --error-on-warnings --release --path test/src/in_language_tests --no-experimental new_hashing
553-
- name: Run In Language Unit Tests - Experimental feature 'const_generics,new_hashing' (Debug)
554-
run: forc test --error-on-warnings --path test/src/in_language_tests --experimental const_generics --no-experimental new_hashing
555-
- name: Run In Language Unit Tests - Experimental feature 'const_generics,new_hashing' (Release)
556-
run: forc test --error-on-warnings --release --path test/src/in_language_tests --experimental const_generics --no-experimental new_hashing
557+
- name: Run In Language Unit Tests - ['str_array_no_padding' enabled] (Debug)
558+
run: forc test --error-on-warnings --path test/src/in_language_tests --experimental str_array_no_padding
559+
- name: Run In Language Unit Tests - ['str_array_no_padding' enabled] (Release)
560+
run: forc test --error-on-warnings --release --path test/src/in_language_tests --experimental str_array_no_padding
557561

558562
forc-pkg-fuels-deps-check:
559563
runs-on: ubuntu-latest

test/src/in_language_tests/test_programs/primitive_conversions_str_inline_tests/src/main.sw

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,28 @@ library;
22

33
use std::primitive_conversions::str::*;
44

5+
#[cfg(experimental_str_array_no_padding = false)]
56
#[test]
67
fn str_slice_to_str_array() {
78
let a = "abcd";
89
let b: str[4] = a.try_as_str_array().unwrap();
9-
assert(__size_of_str_array::<str[4]>() == a.len() && __size_of_val(b) == 8);
10+
assert_eq(__size_of_str_array::<str[4]>(), a.len());
11+
assert_eq(__size_of_val(b), 8);
1012

1113
let c = from_str_array(b);
1214

13-
assert(a == c);
15+
assert_eq(a, c);
16+
}
17+
18+
#[cfg(experimental_str_array_no_padding = true)]
19+
#[test]
20+
fn str_slice_to_str_array() {
21+
let a = "abcd";
22+
let b: str[4] = a.try_as_str_array().unwrap();
23+
assert_eq(__size_of_str_array::<str[4]>(), a.len());
24+
assert_eq(__size_of_val(b), a.len());
25+
26+
let c = from_str_array(b);
27+
28+
assert_eq(a, c);
1429
}

test/src/sdk-harness/test_projects/abi_impl_methods_callable/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ use fuels::prelude::*;
22

33
abigen!(Contract(
44
name = "AbiImplMethodsCallable",
5-
abi = "test_projects/abi_impl_methods_callable/out/release/abi_impl_methods_callable-abi.json"
5+
abi = "out/abi_impl_methods_callable-abi.json"
66
));
77

88
async fn get_abi_impl_methods_callable_instance() -> AbiImplMethodsCallable<Wallet> {
99
let wallet = launch_provider_and_get_wallet().await.unwrap();
1010
let id = Contract::load_from(
11-
"test_projects/abi_impl_methods_callable/out/release/abi_impl_methods_callable.bin",
11+
"out/abi_impl_methods_callable.bin",
1212
LoadConfiguration::default(),
1313
)
1414
.unwrap()

test/src/sdk-harness/test_projects/asset_id/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use fuels::prelude::*;
22

33
abigen!(Contract(
44
name = "TestAssetId",
5-
abi = "test_projects/asset_id/out/release/asset_id-abi.json"
5+
abi = "out/asset_id-abi.json"
66
));
77

88
#[tokio::test]
@@ -25,7 +25,7 @@ async fn can_get_base_asset_id() {
2525

2626
async fn get_instance(wallet: Wallet) -> (TestAssetId<Wallet>, ContractId) {
2727
let fuelcontract_id = Contract::load_from(
28-
"test_projects/asset_id/out/release/asset_id.bin",
28+
"out/asset_id.bin",
2929
LoadConfiguration::default(),
3030
)
3131
.unwrap()

test/src/sdk-harness/test_projects/asset_ops/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::str::FromStr;
77

88
abigen!(Contract(
99
name = "TestFuelCoinContract",
10-
abi = "test_projects/asset_ops/out/release/asset_ops-abi.json"
10+
abi = "out/asset_ops-abi.json"
1111
));
1212

1313
#[tokio::test]
@@ -502,7 +502,7 @@ async fn can_send_message_output_without_data() {
502502

503503
async fn get_fuelcoin_instance(wallet: Wallet) -> (TestFuelCoinContract<Wallet>, ContractId) {
504504
let fuelcontract_id = Contract::load_from(
505-
"test_projects/asset_ops/out/release/asset_ops.bin",
505+
"out/asset_ops.bin",
506506
LoadConfiguration::default(),
507507
)
508508
.unwrap()
@@ -522,7 +522,7 @@ async fn get_fuelcoin_instance(wallet: Wallet) -> (TestFuelCoinContract<Wallet>,
522522

523523
async fn get_balance_contract_id(wallet: Wallet) -> ContractId {
524524
let balance_id = Contract::load_from(
525-
"test_artifacts/balance_contract/out/release/balance_contract.bin",
525+
"out/balance_contract.bin",
526526
LoadConfiguration::default(),
527527
)
528528
.unwrap()

test/src/sdk-harness/test_projects/auth/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ use std::str::FromStr;
1515
abigen!(
1616
Contract(
1717
name = "AuthContract",
18-
abi = "test_artifacts/auth_testing_contract/out/release/auth_testing_contract-abi.json"
18+
abi = "out/auth_testing_contract-abi.json"
1919
),
2020
Contract(
2121
name = "AuthCallerContract",
22-
abi = "test_artifacts/auth_caller_contract/out/release/auth_caller_contract-abi.json"
22+
abi = "out/auth_caller_contract-abi.json"
2323
),
2424
Predicate(
2525
name = "AuthPredicate",
26-
abi = "test_artifacts/auth_predicate/out/release/auth_predicate-abi.json"
26+
abi = "out/auth_predicate-abi.json"
2727
),
2828
);
2929

@@ -95,7 +95,7 @@ async fn input_message_msg_sender_from_contract() {
9595

9696
// Setup contract
9797
let id = Contract::load_from(
98-
"test_artifacts/auth_testing_contract/out/release/auth_testing_contract.bin",
98+
"out/auth_testing_contract.bin",
9999
LoadConfiguration::default(),
100100
)
101101
.unwrap()
@@ -198,7 +198,7 @@ async fn caller_addresses_from_messages() {
198198
let wallet4 = Wallet::new(signer_4, provider.clone());
199199

200200
let id_1 = Contract::load_from(
201-
"test_artifacts/auth_testing_contract/out/release/auth_testing_contract.bin",
201+
"out/auth_testing_contract.bin",
202202
LoadConfiguration::default(),
203203
)
204204
.unwrap()
@@ -325,7 +325,7 @@ async fn caller_addresses_from_coins() {
325325
let wallet4 = Wallet::new(signer_4, provider.clone());
326326

327327
let id_1 = Contract::load_from(
328-
"test_artifacts/auth_testing_contract/out/release/auth_testing_contract.bin",
328+
"out/auth_testing_contract.bin",
329329
LoadConfiguration::default(),
330330
)
331331
.unwrap()
@@ -454,7 +454,7 @@ async fn caller_addresses_from_coins_and_messages() {
454454
let wallet4 = Wallet::new(signer_4, provider.clone());
455455

456456
let id_1 = Contract::load_from(
457-
"test_artifacts/auth_testing_contract/out/release/auth_testing_contract.bin",
457+
"out/auth_testing_contract.bin",
458458
LoadConfiguration::default(),
459459
)
460460
.unwrap()
@@ -538,7 +538,7 @@ async fn get_contracts() -> (
538538
let wallet = launch_provider_and_get_wallet().await.unwrap();
539539

540540
let id_1 = Contract::load_from(
541-
"test_artifacts/auth_testing_contract/out/release/auth_testing_contract.bin",
541+
"out/auth_testing_contract.bin",
542542
LoadConfiguration::default(),
543543
)
544544
.unwrap()
@@ -548,7 +548,7 @@ async fn get_contracts() -> (
548548
.contract_id;
549549

550550
let id_2 = Contract::load_from(
551-
"test_artifacts/auth_caller_contract/out/release/auth_caller_contract.bin",
551+
"out/auth_caller_contract.bin",
552552
LoadConfiguration::default(),
553553
)
554554
.unwrap()
@@ -592,7 +592,7 @@ async fn can_get_predicate_address() {
592592
.encode_data(predicate_address)
593593
.unwrap();
594594
let predicate: Predicate =
595-
Predicate::load_from("test_artifacts/auth_predicate/out/release/auth_predicate.bin")
595+
Predicate::load_from("out/auth_predicate.bin")
596596
.unwrap()
597597
.with_provider(first_wallet.try_provider().unwrap().clone())
598598
.with_data(predicate_data);
@@ -672,7 +672,7 @@ async fn when_incorrect_predicate_address_passed() {
672672
.encode_data(predicate_address)
673673
.unwrap();
674674
let predicate: Predicate =
675-
Predicate::load_from("test_artifacts/auth_predicate/out/release/auth_predicate.bin")
675+
Predicate::load_from("out/auth_predicate.bin")
676676
.unwrap()
677677
.with_provider(first_wallet.try_provider().unwrap().clone())
678678
.with_data(predicate_data);
@@ -751,7 +751,7 @@ async fn can_get_predicate_address_in_message() {
751751
.encode_data(predicate_address)
752752
.unwrap();
753753
let predicate: Predicate =
754-
Predicate::load_from("test_artifacts/auth_predicate/out/release/auth_predicate.bin")
754+
Predicate::load_from("out/auth_predicate.bin")
755755
.unwrap()
756756
.with_provider(wallet.try_provider().unwrap().clone())
757757
.with_data(predicate_data);

test/src/sdk-harness/test_projects/block/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ use tokio::time::{sleep, Duration};
44

55
abigen!(Contract(
66
name = "BlockTestContract",
7-
abi = "test_projects/block/out/release/block-abi.json"
7+
abi = "out/block-abi.json"
88
));
99

1010
async fn get_block_instance() -> (BlockTestContract<Wallet>, ContractId, Provider) {
1111
let wallet = launch_provider_and_get_wallet().await.unwrap();
1212
let provider = wallet.provider();
1313
let id = Contract::load_from(
14-
"test_projects/block/out/release/block.bin",
14+
"out/block.bin",
1515
LoadConfiguration::default(),
1616
)
1717
.unwrap()

test/src/sdk-harness/test_projects/call_frames/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ use fuels::{prelude::*, types::ContractId};
22

33
abigen!(Contract(
44
name = "CallFramesTestContract",
5-
abi = "test_projects/call_frames/out/release/call_frames-abi.json"
5+
abi = "out/call_frames-abi.json"
66
));
77

88
async fn get_call_frames_instance() -> (CallFramesTestContract<Wallet>, ContractId) {
99
let wallet = launch_provider_and_get_wallet().await.unwrap();
1010
let id = Contract::load_from(
11-
"test_projects/call_frames/out/release/call_frames.bin",
11+
"out/call_frames.bin",
1212
LoadConfiguration::default(),
1313
)
1414
.unwrap()

test/src/sdk-harness/test_projects/configurables_in_contract/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ async fn contract_uses_default_configurables() -> Result<()> {
88
abigen!(Contract(
99
name = "MyContract",
1010
abi =
11-
"test_projects/configurables_in_contract/out/release/configurables_in_contract-abi.json"
11+
"out/configurables_in_contract-abi.json"
1212
));
1313

1414
let wallet = launch_provider_and_get_wallet().await.unwrap();
1515

1616
let contract_id = Contract::load_from(
17-
"test_projects/configurables_in_contract/out/release/configurables_in_contract.bin",
17+
"out/configurables_in_contract.bin",
1818
LoadConfiguration::default(),
1919
)
2020
.unwrap()
@@ -57,7 +57,7 @@ async fn contract_configurables() -> Result<()> {
5757
abigen!(Contract(
5858
name = "MyContract",
5959
abi =
60-
"test_projects/configurables_in_contract/out/release/configurables_in_contract-abi.json"
60+
"out/configurables_in_contract-abi.json"
6161
));
6262

6363
let wallet = launch_provider_and_get_wallet().await.unwrap();
@@ -79,7 +79,7 @@ async fn contract_configurables() -> Result<()> {
7979
.with_MY_CONTRACT_ID(new_contract_id.clone())?;
8080

8181
let contract_id = Contract::load_from(
82-
"test_projects/configurables_in_contract/out/release/configurables_in_contract.bin",
82+
"out/configurables_in_contract.bin",
8383
LoadConfiguration::default().with_configurables(configurables),
8484
)?
8585
.deploy(&wallet, TxPolicies::default())

test/src/sdk-harness/test_projects/configurables_in_script/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use fuels::{prelude::*, types::SizedAsciiString};
77
async fn script_uses_default_configurables() -> Result<()> {
88
abigen!(Script(
99
name = "MyScript",
10-
abi = "test_projects/configurables_in_script/out/release/configurables_in_script-abi.json"
10+
abi = "out/configurables_in_script-abi.json"
1111
));
1212

1313
let wallet = launch_provider_and_get_wallet().await.unwrap();
14-
let bin_path = "test_projects/configurables_in_script/out/release/configurables_in_script.bin";
14+
let bin_path = "out/configurables_in_script.bin";
1515
let instance = MyScript::new(wallet, bin_path);
1616

1717
let response = instance.main().call().await?;
@@ -40,11 +40,11 @@ async fn script_uses_default_configurables() -> Result<()> {
4040
async fn script_configurables() -> Result<()> {
4141
abigen!(Script(
4242
name = "MyScript",
43-
abi = "test_projects/configurables_in_script/out/release/configurables_in_script-abi.json"
43+
abi = "out/configurables_in_script-abi.json"
4444
));
4545

4646
let wallet = launch_provider_and_get_wallet().await.unwrap();
47-
let bin_path = "test_projects/configurables_in_script/out/release/configurables_in_script.bin";
47+
let bin_path = "out/configurables_in_script.bin";
4848
let instance = MyScript::new(wallet, bin_path);
4949

5050
let new_str: SizedAsciiString<4> = "FUEL".try_into()?;

0 commit comments

Comments
 (0)