Skip to content

Commit 5f95c72

Browse files
Bump to fuels 0.17.0 (#2273)
1 parent b161e82 commit 5f95c72

File tree

17 files changed

+143
-64
lines changed

17 files changed

+143
-64
lines changed

forc/src/utils/defaults.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ edition = "2021"
3030
license = "Apache-2.0"
3131
3232
[dependencies]
33-
fuels = {{ version = "0.16", features = ["fuel-core-lib"] }}
33+
fuels = {{ version = "0.17", features = ["fuel-core-lib"] }}
3434
tokio = {{ version = "1.12", features = ["rt", "macros"] }}
3535
3636
[[test]]
@@ -90,7 +90,7 @@ fn main() -> bool {
9090
// to provide further information for writing tests/working with sway
9191
pub(crate) fn default_test_program(project_name: &str) -> String {
9292
format!(
93-
"{}{}{}{}{}",
93+
"{}{}{}{}{}{}{}",
9494
r#"use fuels::{prelude::*, tx::ContractId};
9595
9696
// Load abi from json
@@ -100,13 +100,22 @@ abigen!(MyContract, "out/debug/"#,
100100
101101
async fn get_contract_instance() -> (MyContract, ContractId) {
102102
// Launch a local network and deploy the contract
103-
let wallet = launch_provider_and_get_single_wallet().await;
103+
let wallet = launch_provider_and_get_wallet().await;
104104
105-
let id = Contract::deploy("./out/debug/"#,
105+
let id = Contract::deploy(
106+
"./out/debug/"#,
106107
project_name,
107-
r#".bin", &wallet, TxParameters::default())
108-
.await
109-
.unwrap();
108+
r#".bin",
109+
&wallet,
110+
TxParameters::default(),
111+
StorageConfiguration::with_storage_path(Some(
112+
"./out/debug/"#,
113+
project_name,
114+
r#"-storage_slots.json".to_string(),
115+
)),
116+
)
117+
.await
118+
.unwrap();
110119
111120
let instance = MyContract::new(id.to_string(), wallet);
112121

test/src/sdk-harness/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fuel-core = { version = "0.9", default-features = false }
1111
fuel-gql-client = { version = "0.9", default-features = false }
1212
fuel-types = "0.5"
1313
fuel-vm = "0.12"
14-
fuels = { version = "0.16", features = ["fuel-core-lib"] }
14+
fuels = { version = "0.17", features = ["fuel-core-lib"] }
1515
hex = "0.4.3"
1616
sha2 = "0.10"
1717
sha3 = "0.10.1"

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,17 @@ async fn get_contracts() -> (
5050
ContractId,
5151
LocalWallet,
5252
) {
53-
let wallet = launch_provider_and_get_single_wallet().await;
53+
let wallet = launch_provider_and_get_wallet().await;
5454

5555
let id_1 = Contract::deploy(
5656
"test_artifacts/auth_testing_contract/out/debug/auth_testing_contract.bin",
5757
&wallet,
5858
TxParameters::default(),
59+
StorageConfiguration::with_storage_path(
60+
Some(
61+
"test_artifacts/auth_testing_contract/out/debug/auth_testing_contract-storage_slots.json".to_string(),
62+
)
63+
)
5964
)
6065
.await
6166
.unwrap();
@@ -64,6 +69,10 @@ async fn get_contracts() -> (
6469
"test_artifacts/auth_caller_contract/out/debug/auth_caller_contract.bin",
6570
&wallet,
6671
TxParameters::default(),
72+
StorageConfiguration::with_storage_path(Some(
73+
"test_artifacts/auth_caller_contract/out/debug/auth_caller_contract-storage_slots.json"
74+
.to_string(),
75+
)),
6776
)
6877
.await
6978
.unwrap();

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ abigen!(
77
);
88

99
async fn get_call_frames_instance() -> (CallFramesTestContract, ContractId) {
10-
let wallet = launch_provider_and_get_single_wallet().await;
10+
let wallet = launch_provider_and_get_wallet().await;
1111
let id = Contract::deploy(
1212
"test_projects/call_frames/out/debug/call_frames.bin",
1313
&wallet,
1414
TxParameters::default(),
15+
StorageConfiguration::with_storage_path(Some(
16+
"test_artifacts/call_frames/out/debug/call_frames-storage_slots.json".to_string(),
17+
)),
1518
)
1619
.await
1720
.unwrap();

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,24 @@ async fn get_contracts() -> (
2020
TestContextCallerContract,
2121
ContractId,
2222
) {
23-
let wallet = launch_provider_and_get_single_wallet().await;
23+
let wallet = launch_provider_and_get_wallet().await;
2424
let id_1 = Contract::deploy(
2525
"test_projects/context/out/debug/context.bin",
2626
&wallet,
2727
TxParameters::default(),
28+
StorageConfiguration::with_storage_path(Some(
29+
"test_artifacts/context/out/debug/context-storage_slots.json".to_string(),
30+
)),
2831
)
2932
.await
3033
.unwrap();
3134
let id_2 = Contract::deploy(
3235
"test_artifacts/context_caller_contract/out/debug/context_caller_contract.bin",
3336
&wallet,
3437
TxParameters::default(),
38+
StorageConfiguration::with_storage_path(Some(
39+
"test_artifacts/context_caller_contract/out/debug/context_caller_contract-storage_slots.json".to_string(),
40+
)),
3541
)
3642
.await
3743
.unwrap();
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
use fuels::{prelude::*, tx::ContractId};
22

3-
abigen!(
4-
EvmTestContract,
5-
"test_projects/evm/out/debug/evm-abi.json"
6-
);
3+
abigen!(EvmTestContract, "test_projects/evm/out/debug/evm-abi.json");
74

85
async fn get_evm_test_instance() -> (EvmTestContract, ContractId) {
9-
let wallet = launch_provider_and_get_single_wallet().await;
6+
let wallet = launch_provider_and_get_wallet().await;
107
let id = Contract::deploy(
118
"test_projects/evm/out/debug/evm.bin",
129
&wallet,
1310
TxParameters::default(),
11+
StorageConfiguration::with_storage_path(Some(
12+
"test_artifacts/evm/out/debug/evm-storage_slots.json".to_string(),
13+
)),
1414
)
1515
.await
1616
.unwrap();
@@ -22,7 +22,7 @@ async fn get_evm_test_instance() -> (EvmTestContract, ContractId) {
2222
#[tokio::test]
2323
async fn can_call_from_literal() {
2424
let (instance, _) = get_evm_test_instance().await;
25-
25+
2626
let raw_address = [6; 32]; // hardcoded in the contract to test calling `from()` with a literal
2727
let result = instance.evm_address_from_literal().call().await.unwrap();
2828
assert_eq!(result.value.value[0..12], [0; 12]);
@@ -32,9 +32,13 @@ async fn can_call_from_literal() {
3232
#[tokio::test]
3333
async fn can_call_from_argument() {
3434
let (instance, _) = get_evm_test_instance().await;
35-
35+
3636
let raw_address = [7; 32];
37-
let result = instance.evm_address_from_argument(raw_address.into()).call().await.unwrap();
37+
let result = instance
38+
.evm_address_from_argument(raw_address.into())
39+
.call()
40+
.await
41+
.unwrap();
3842
assert_eq!(result.value.value[0..12], [0; 12]);
3943
assert_eq!(result.value.value[12..32], raw_address[12..32]);
4044
}

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ abigen!(TestPowContract, "test_artifacts/pow/out/debug/pow-abi.json");
77
#[tokio::test]
88
#[should_panic(expected = "ArithmeticOverflow")]
99
async fn overflowing_pow_u64_panics() {
10-
let wallet = launch_provider_and_get_single_wallet().await;
10+
let wallet = launch_provider_and_get_wallet().await;
1111
let (pow_instance, _) = get_pow_test_instance(wallet).await;
1212
pow_instance
1313
.u64_overflow(100u64, 100u64)
@@ -20,7 +20,7 @@ async fn overflowing_pow_u64_panics() {
2020
// TODO won't overflow until https://github.com/FuelLabs/fuel-specs/issues/90 lands
2121
// #[should_panic(expected = "ArithmeticOverflow")]
2222
async fn overflowing_pow_u32_panics() {
23-
let wallet = launch_provider_and_get_single_wallet().await;
23+
let wallet = launch_provider_and_get_wallet().await;
2424
let (pow_instance, _) = get_pow_test_instance(wallet).await;
2525
pow_instance
2626
.u32_overflow(10u32, 11u32)
@@ -32,7 +32,7 @@ async fn overflowing_pow_u32_panics() {
3232
#[tokio::test]
3333
#[should_panic(expected = "ArithmeticOverflow")]
3434
async fn overflowing_pow_u32_panics_max() {
35-
let wallet = launch_provider_and_get_single_wallet().await;
35+
let wallet = launch_provider_and_get_wallet().await;
3636
let (pow_instance, _) = get_pow_test_instance(wallet).await;
3737
pow_instance
3838
.u32_overflow(u32::MAX, u32::MAX)
@@ -45,15 +45,15 @@ async fn overflowing_pow_u32_panics_max() {
4545
// TODO won't overflow until https://github.com/FuelLabs/fuel-specs/issues/90 lands
4646
// #[should_panic(expected = "ArithmeticOverflow")]
4747
async fn overflowing_pow_u16_panics() {
48-
let wallet = launch_provider_and_get_single_wallet().await;
48+
let wallet = launch_provider_and_get_wallet().await;
4949
let (pow_instance, _) = get_pow_test_instance(wallet).await;
5050
pow_instance.u16_overflow(10u16, 5u16).call().await.unwrap();
5151
}
5252

5353
#[tokio::test]
5454
#[should_panic(expected = "ArithmeticOverflow")]
5555
async fn overflowing_pow_u16_panics_max() {
56-
let wallet = launch_provider_and_get_single_wallet().await;
56+
let wallet = launch_provider_and_get_wallet().await;
5757
let (pow_instance, _) = get_pow_test_instance(wallet).await;
5858
pow_instance
5959
.u16_overflow(u16::MAX, u16::MAX)
@@ -66,15 +66,15 @@ async fn overflowing_pow_u16_panics_max() {
6666
// TODO won't overflow until https://github.com/FuelLabs/fuel-specs/issues/90 lands
6767
// #[should_panic(expected = "ArithmeticOverflow")]
6868
async fn overflowing_pow_u8_panics() {
69-
let wallet = launch_provider_and_get_single_wallet().await;
69+
let wallet = launch_provider_and_get_wallet().await;
7070
let (pow_instance, _) = get_pow_test_instance(wallet).await;
7171
pow_instance.u8_overflow(10u8, 3u8).call().await.unwrap();
7272
}
7373

7474
#[tokio::test]
7575
#[should_panic(expected = "ArithmeticOverflow")]
7676
async fn overflowing_pow_u8_panics_max() {
77-
let wallet = launch_provider_and_get_single_wallet().await;
77+
let wallet = launch_provider_and_get_wallet().await;
7878
let (pow_instance, _) = get_pow_test_instance(wallet).await;
7979
pow_instance
8080
.u8_overflow(u8::MAX, u8::MAX)
@@ -88,6 +88,9 @@ async fn get_pow_test_instance(wallet: LocalWallet) -> (TestPowContract, Contrac
8888
"test_artifacts/pow/out/debug/pow.bin",
8989
&wallet,
9090
TxParameters::default(),
91+
StorageConfiguration::with_storage_path(Some(
92+
"test_artifacts/pow/out/debug/pow-storage_slots.json".to_string(),
93+
)),
9194
)
9295
.await
9396
.unwrap();

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,15 @@ fn hash_struct(arr: [u8; 80], algorithm: Hash) -> [u8; 32] {
121121
}
122122

123123
async fn get_hashing_instance() -> (HashingTestContract, ContractId) {
124-
let wallet = launch_provider_and_get_single_wallet().await;
124+
let wallet = launch_provider_and_get_wallet().await;
125125

126126
let id = Contract::deploy(
127127
"test_projects/hashing/out/debug/hashing.bin",
128128
&wallet,
129129
TxParameters::default(),
130+
StorageConfiguration::with_storage_path(Some(
131+
"test_artifacts/hashing/out/debug/hashing-storage_slots.json".to_string(),
132+
)),
130133
)
131134
.await
132135
.unwrap();

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ abigen!(
88

99
#[tokio::test]
1010
async fn run_methods_test() {
11-
let wallet = launch_provider_and_get_single_wallet().await;
11+
let wallet = launch_provider_and_get_wallet().await;
1212
let instance = get_methods_instance(wallet).await;
1313

1414
let result = instance.test_function().call().await.unwrap();
@@ -20,6 +20,10 @@ async fn get_methods_instance(wallet: Wallet) -> MethodsContract {
2020
"test_artifacts/methods_contract/out/debug/methods_contract.bin",
2121
&wallet,
2222
TxParameters::default(),
23+
StorageConfiguration::with_storage_path(Some(
24+
"test_artifacts/methods_contract/out/debug/methods_contract-storage_slots.json"
25+
.to_string(),
26+
)),
2327
)
2428
.await
2529
.unwrap();

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
use fuel_core::service::Config;
22
use fuel_vm::consts::*;
33
use fuel_vm::prelude::Opcode;
4+
use fuels::contract::abi_encoder::ABIEncoder;
45
use fuels::contract::script::Script;
56
use fuels::prelude::*;
67
use fuels::signers::wallet::Wallet;
7-
use fuels::contract::abi_encoder::ABIEncoder;
88
use fuels::tx::{Address, AssetId, Contract, Input, Output, Transaction, UtxoId};
99
use std::str::FromStr;
1010

1111
async fn setup() -> (Vec<u8>, Address, Wallet, u64, AssetId) {
12-
let predicate_code = std::fs::read("test_projects/predicate_data_simple/out/debug/predicate_data_simple.bin").unwrap();
12+
let predicate_code =
13+
std::fs::read("test_projects/predicate_data_simple/out/debug/predicate_data_simple.bin")
14+
.unwrap();
1315
let predicate_address = (*Contract::root_from_code(&predicate_code)).into();
1416

15-
let wallet = launch_custom_provider_and_get_single_wallet(Some(Config {
16-
predicates: true,
17-
utxo_validation: true,
18-
..Config::local_node()
19-
}))
17+
let wallets = launch_custom_provider_and_get_wallets(
18+
WalletsConfig::default(),
19+
Some(Config {
20+
predicates: true,
21+
utxo_validation: true,
22+
..Config::local_node()
23+
}),
24+
)
2025
.await;
2126

2227
(
2328
predicate_code,
2429
predicate_address,
25-
wallet,
30+
wallets[0].clone(),
2631
1000,
2732
AssetId::default(),
2833
)
@@ -167,7 +172,7 @@ async fn invalid_predicate_data_simple() {
167172
let arg = Token::U32(1001_u32);
168173
let args: Vec<Token> = vec![arg];
169174
let predicate_data = ABIEncoder::encode(&args).unwrap();
170-
175+
171176
let receiver_address =
172177
Address::from_str("0xde97d8624a438121b86a1956544bd72ed68cd69f2c99555b08b1e8c51ffd511c")
173178
.unwrap();

0 commit comments

Comments
 (0)