diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5baf7f205..9e2e3cbd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,10 +16,10 @@ env: CARGO_TERM_COLOR: always DASEL_VERSION: https://github.com/TomWright/dasel/releases/download/v1.24.3/dasel_linux_amd64 RUSTFLAGS: "-D warnings" - FUEL_CORE_VERSION: 0.19.1 + FUEL_CORE_VERSION: 0.20.3 RUST_VERSION: 1.70.0 FORC_VERSION: 0.42.1 - FORC_PATCH_BRANCH: "" + FORC_PATCH_BRANCH: "upgrade/fuel-core-v0.20.1" FORC_PATCH_REVISION: "" jobs: diff --git a/Cargo.toml b/Cargo.toml index 6aff3792a..966a02d8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,17 +45,6 @@ chrono = "0.4.24" elliptic-curve = { version = "0.13.4", default-features = false } eth-keystore = "0.5.0" fuel-abi-types = "0.3.0" -fuel-core = { version = "0.19.1", default-features = false } -fuel-core-chain-config = { version = "0.19.1", default-features = false } -fuel-core-client = { version = "0.19.1", default-features = false } -fuel-core-types = { version = "0.19.1", default-features = false } -fuel-asm = "0.34.0" -fuel-crypto = "0.34.0" -fuel-merkle = "0.34.0" -fuel-storage = "0.34.0" -fuel-tx = "0.34.0" -fuel-types = { version = "0.34.0", default-features = false } -fuel-vm = "0.34.0" fuels = { version = "0.44.0", path = "./packages/fuels" } fuels-accounts = { version = "0.44.0", path = "./packages/fuels-accounts", default-features = false } fuels-code-gen = { version = "0.44.0", path = "./packages/fuels-code-gen", default-features = false } @@ -84,3 +73,18 @@ thiserror = { version = "1.0.40", default-features = false } tokio = { version = "1.27.0", default-features = false } trybuild = "1.0.80" which = { version = "4.4", default-features = false } + +# Dependencies from the `fuel-core` repository: +fuel-core = { version = "0.20.3", default-features = false } +fuel-core-chain-config = { version = "0.20.3", default-features = false } +fuel-core-client = { version = "0.20.3", default-features = false } +fuel-core-types = { version = "0.20.3", default-features = false } + +# Dependencies from the `fuel-vm` repository: +fuel-asm = "0.35.3" +fuel-crypto = "0.35.3" +fuel-merkle = "0.35.3" +fuel-storage = "0.35.3" +fuel-tx = "0.35.3" +fuel-types = { version = "0.35.3", default-features = false } +fuel-vm = "0.35.3" diff --git a/examples/contracts/src/lib.rs b/examples/contracts/src/lib.rs index 776889b22..b6f7eab32 100644 --- a/examples/contracts/src/lib.rs +++ b/examples/contracts/src/lib.rs @@ -1,6 +1,7 @@ #[cfg(test)] mod tests { use fuels::types::errors::{error, Error, Result}; + use fuels::types::Bits256; #[tokio::test] async fn instantiate_client() -> Result<()> { @@ -104,7 +105,7 @@ mod tests { .await?; // ANCHOR_END: contract_call_cost_estimation - assert_eq!(transaction_cost.gas_used, 499); + assert_eq!(transaction_cost.gas_used, 333); Ok(()) } @@ -344,10 +345,11 @@ mod tests { let response = contract_methods.mint_coins(1_000_000).call().await?; // ANCHOR: variable_outputs let address = wallet.address(); + let asset_id = contract_id.asset_id(&Bits256::zeroed()).into(); // withdraw some tokens to wallet let response = contract_methods - .transfer_coins_to_output(1_000_000, contract_id, address) + .transfer_coins_to_output(1_000_000, asset_id, address) .append_variable_outputs(1) .call() .await?; @@ -406,7 +408,7 @@ mod tests { .await?; // ANCHOR_END: dependency_estimation_manual - let asset_id = AssetId::from(*caller_contract_id.hash()); + let asset_id = caller_contract_id.asset_id(&Bits256::zeroed()); let balance = wallet.get_asset_balance(&asset_id).await?; assert_eq!(balance, amount); @@ -527,10 +529,10 @@ mod tests { let contract_methods = MyContract::new(contract_id, wallet.clone()).methods(); // ANCHOR: call_params_gas - // Set the transaction `gas_limit` to 10_000 and `gas_forwarded` to 4300 to specify that - // the contract call transaction may consume up to 10_000 gas, while the actual call may + // Set the transaction `gas_limit` to 1_000_000 and `gas_forwarded` to 4300 to specify that + // the contract call transaction may consume up to 1_000_000 gas, while the actual call may // only use 4300 gas - let tx_params = TxParameters::default().set_gas_limit(10_000); + let tx_params = TxParameters::default().set_gas_limit(1_000_000); let call_params = CallParameters::default().set_gas_forwarded(4300); let response = contract_methods @@ -628,7 +630,7 @@ mod tests { .await?; // ANCHOR_END: multi_call_cost_estimation - assert_eq!(transaction_cost.gas_used, 786); + assert_eq!(transaction_cost.gas_used, 546); Ok(()) } diff --git a/examples/cookbook/src/lib.rs b/examples/cookbook/src/lib.rs index 79cbace5b..a388ea050 100644 --- a/examples/cookbook/src/lib.rs +++ b/examples/cookbook/src/lib.rs @@ -1,5 +1,6 @@ #[cfg(test)] mod tests { + use fuels::types::Bits256; use fuels::{ prelude::Result, types::transaction_builders::{ScriptTransactionBuilder, TransactionBuilder}, @@ -65,7 +66,7 @@ mod tests { // ANCHOR_END: liquidity_deposit // ANCHOR: liquidity_withdraw - let lp_asset_id = AssetId::from(*contract_id.hash()); + let lp_asset_id = contract_id.asset_id(&Bits256::zeroed()); let lp_token_balance = wallet.get_asset_balance(&lp_asset_id).await?; let call_params = CallParameters::default() diff --git a/packages/fuels-accounts/src/lib.rs b/packages/fuels-accounts/src/lib.rs index 956f13113..a3534de64 100644 --- a/packages/fuels-accounts/src/lib.rs +++ b/packages/fuels-accounts/src/lib.rs @@ -405,7 +405,7 @@ mod tests { let message = Message::from_bytes(*tx.id(consensus_parameters.chain_id.into())); // Check if signature is what we expect it to be - assert_eq!(signature, Signature::from_str("13ce336c5f239a748f20f39323e3df3237ccfe104b04f128be66f26a49abd09d3b4b19c7f07efbb708c442371feb5fc6545f2b614e1f9f336702cca3e62d0cc8")?); + assert_eq!(signature, Signature::from_str("df91e8ae723165f9a28b70910e3da41300da413607065618522f3084c9f051114acb1b51a836bd63c3d84a1ac904bf37b82ef03973c19026b266d04872f170a6")?); // Recover address that signed the transaction let recovered_address = signature.recover(&message)?; diff --git a/packages/fuels-core/src/types.rs b/packages/fuels-core/src/types.rs index bdf08d5c6..a29db7ad1 100644 --- a/packages/fuels-core/src/types.rs +++ b/packages/fuels-core/src/types.rs @@ -23,7 +23,7 @@ pub type ByteArray = [u8; 8]; pub type Selector = ByteArray; pub type EnumSelector = (u8, Token, EnumVariants); -#[derive(Debug, Clone, PartialEq, Eq, Default)] +#[derive(Debug, Clone, PartialEq, Eq, Default, serde::Serialize, serde::Deserialize)] pub struct StringToken { data: String, expected_len: Option, @@ -70,7 +70,7 @@ impl TryFrom for String { } } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub enum Token { // Used for unit type variants in Enum. An "empty" enum is not represented as Enum, // because this way we can have both unit and non-unit type variants. diff --git a/packages/fuels-core/src/types/bech32.rs b/packages/fuels-core/src/types/bech32.rs index 0ced1d959..56faf974e 100644 --- a/packages/fuels-core/src/types/bech32.rs +++ b/packages/fuels-core/src/types/bech32.rs @@ -3,8 +3,10 @@ use std::{ str::FromStr, }; +use crate::types::Bits256; use bech32::{FromBase32, ToBase32, Variant::Bech32m}; -use fuel_tx::{Address, Bytes32, ContractId}; +use fuel_tx::{Address, Bytes32, ContractId, ContractIdExt}; +use fuel_types::AssetId; use crate::types::errors::{Error, Result}; @@ -128,6 +130,14 @@ impl From for Bech32ContractId { } } +impl Bech32ContractId { + /// Creates an `AssetId` from the `Bech32ContractId` and `sub_id`. + pub fn asset_id(&self, sub_id: &Bits256) -> AssetId { + let sub_id = Bytes32::from(sub_id.0); + ContractId::from(self).asset_id(&sub_id) + } +} + #[cfg(test)] mod test { use super::*; diff --git a/packages/fuels-core/src/types/core/bits.rs b/packages/fuels-core/src/types/core/bits.rs index 75234f723..8234232b6 100644 --- a/packages/fuels-core/src/types/core/bits.rs +++ b/packages/fuels-core/src/types/core/bits.rs @@ -1,3 +1,4 @@ +use fuel_types::AssetId; use fuels_macros::{Parameterize, Tokenizable, TryFrom}; use crate::types::errors::{error, Error, Result}; @@ -9,6 +10,11 @@ use crate::types::errors::{error, Error, Result}; pub struct Bits256(pub [u8; 32]); impl Bits256 { + /// Returns `Self` with zeroes inside. + pub fn zeroed() -> Self { + Self([0; 32]) + } + /// Create a new `Bits256` from a string representation of a hex. /// Accepts both `0x` prefixed and non-prefixed hex strings. pub fn from_hex_str(hex: &str) -> Result { @@ -29,6 +35,12 @@ impl Bits256 { } } +impl From for Bits256 { + fn from(value: AssetId) -> Self { + Self(value.into()) + } +} + // A simple wrapper around [Bits256; 2] representing the `B512` type. #[derive(Debug, PartialEq, Eq, Copy, Clone, Parameterize, Tokenizable, TryFrom)] #[FuelsCorePath = "crate"] diff --git a/packages/fuels-core/src/types/enum_variants.rs b/packages/fuels-core/src/types/enum_variants.rs index cc7efeb06..ef532bd87 100644 --- a/packages/fuels-core/src/types/enum_variants.rs +++ b/packages/fuels-core/src/types/enum_variants.rs @@ -6,7 +6,7 @@ use crate::{ }, }; -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct EnumVariants { param_types: Vec, } diff --git a/packages/fuels-core/src/types/param_types.rs b/packages/fuels-core/src/types/param_types.rs index fe4538f86..632e6d8a8 100644 --- a/packages/fuels-core/src/types/param_types.rs +++ b/packages/fuels-core/src/types/param_types.rs @@ -14,7 +14,7 @@ use crate::{ }, }; -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub enum ParamType { U8, U16, diff --git a/packages/fuels-core/src/utils/constants.rs b/packages/fuels-core/src/utils/constants.rs index c189a6664..888005986 100644 --- a/packages/fuels-core/src/utils/constants.rs +++ b/packages/fuels-core/src/utils/constants.rs @@ -6,7 +6,7 @@ pub const WORD_SIZE: usize = core::mem::size_of::(); // ANCHOR: default_tx_parameters pub const DEFAULT_GAS_PRICE: u64 = 0; -pub const DEFAULT_GAS_LIMIT: u64 = 1_000_000; +pub const DEFAULT_GAS_LIMIT: u64 = 100_000_000; pub const DEFAULT_MATURITY: u32 = 0; // ANCHOR_END: default_tx_parameters diff --git a/packages/fuels-programs/src/logs.rs b/packages/fuels-programs/src/logs.rs index 45a3d9e9e..0b3a9fdfa 100644 --- a/packages/fuels-programs/src/logs.rs +++ b/packages/fuels-programs/src/logs.rs @@ -179,7 +179,12 @@ impl<'a, I: Iterator> ExtractLogIdData for I { type Output = FilterMap Option<(LogId, Vec)>>; fn extract_log_id_and_data(self) -> Self::Output { self.filter_map(|r| match r { - Receipt::LogData { rb, data, id, .. } => Some((LogId(*id, *rb), data.clone())), + Receipt::LogData { + rb, + data: Some(data), + id, + .. + } => Some((LogId(*id, *rb), data.clone())), Receipt::Log { ra, rb, id, .. } => Some((LogId(*id, *rb), ra.to_be_bytes().to_vec())), _ => None, }) diff --git a/packages/fuels-programs/src/receipt_parser.rs b/packages/fuels-programs/src/receipt_parser.rs index 0b14b3665..3bdefff87 100644 --- a/packages/fuels-programs/src/receipt_parser.rs +++ b/packages/fuels-programs/src/receipt_parser.rs @@ -71,7 +71,12 @@ impl ReceiptParser { fn extract_return_data(&mut self, contract_id: &ContractId) -> Option> { for (index, receipt) in self.receipts.iter_mut().enumerate() { - if let Receipt::ReturnData { id, data, .. } = receipt { + if let Receipt::ReturnData { + id, + data: Some(data), + .. + } = receipt + { if id == contract_id { let data = std::mem::take(data); self.receipts.remove(index); @@ -134,10 +139,10 @@ impl ReceiptParser { .. }, ) if *first_id == *contract_id - && !first_data.is_empty() + && first_data.is_some() && *second_id == ContractId::zeroed() => { - Some(vec_data) + vec_data.as_ref() } _ => None, } @@ -176,7 +181,7 @@ mod tests { ptr: Default::default(), len: Default::default(), digest: Default::default(), - data: data.to_vec(), + data: Some(data.to_vec()), pc: Default::default(), is: Default::default(), } diff --git a/packages/fuels/src/lib.rs b/packages/fuels/src/lib.rs index 98fe9f1a3..2e8334914 100644 --- a/packages/fuels/src/lib.rs +++ b/packages/fuels/src/lib.rs @@ -14,8 +14,8 @@ pub mod tx { pub use fuel_tx::{ - field, Bytes32, ConsensusParameters, Receipt, Salt, ScriptExecutionResult, StorageSlot, - Transaction as FuelTransaction, TxId, + field, Bytes32, ConsensusParameters, ContractIdExt, Receipt, Salt, ScriptExecutionResult, + StorageSlot, Transaction as FuelTransaction, TxId, }; } diff --git a/packages/fuels/tests/bindings/sharing_types/contract_a/Forc.toml b/packages/fuels/tests/bindings/sharing_types/contract_a/Forc.toml index 3044ac0e3..348af0004 100644 --- a/packages/fuels/tests/bindings/sharing_types/contract_a/Forc.toml +++ b/packages/fuels/tests/bindings/sharing_types/contract_a/Forc.toml @@ -6,3 +6,4 @@ name = "contract_a" [dependencies] shared_lib = { path = "../shared_lib" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/bindings/sharing_types/contract_b/Forc.toml b/packages/fuels/tests/bindings/sharing_types/contract_b/Forc.toml index 99f9fbfd0..10af8dbb6 100644 --- a/packages/fuels/tests/bindings/sharing_types/contract_b/Forc.toml +++ b/packages/fuels/tests/bindings/sharing_types/contract_b/Forc.toml @@ -6,3 +6,4 @@ name = "contract_b" [dependencies] shared_lib = { path = "../shared_lib" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/bindings/sharing_types/shared_lib/Forc.toml b/packages/fuels/tests/bindings/sharing_types/shared_lib/Forc.toml index a5107fb5f..9569a6424 100644 --- a/packages/fuels/tests/bindings/sharing_types/shared_lib/Forc.toml +++ b/packages/fuels/tests/bindings/sharing_types/shared_lib/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "shared_lib" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/bindings/simple_contract/Forc.toml b/packages/fuels/tests/bindings/simple_contract/Forc.toml index c0657fd85..df267c2a1 100644 --- a/packages/fuels/tests/bindings/simple_contract/Forc.toml +++ b/packages/fuels/tests/bindings/simple_contract/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "simple_contract" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/bindings/type_paths/Forc.toml b/packages/fuels/tests/bindings/type_paths/Forc.toml index f01d6008f..23a2d64a4 100644 --- a/packages/fuels/tests/bindings/type_paths/Forc.toml +++ b/packages/fuels/tests/bindings/type_paths/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "type_paths" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts.rs b/packages/fuels/tests/contracts.rs index abf5f1361..4a75bdf8a 100644 --- a/packages/fuels/tests/contracts.rs +++ b/packages/fuels/tests/contracts.rs @@ -280,7 +280,7 @@ async fn test_contract_call_fee_estimation() -> Result<()> { let tolerance = 0.2; let expected_min_gas_price = 0; // This is the default min_gas_price from the ConsensusParameters - let expected_gas_used = 598; + let expected_gas_used = 399; let expected_metered_bytes_size = 728; let expected_total_fee = 372; @@ -620,7 +620,7 @@ async fn test_connect_wallet() -> Result<()> { // pay for call with wallet let tx_params = TxParameters::default() .set_gas_price(10) - .set_gas_limit(10000); + .set_gas_limit(1_000_000); contract_instance .methods() .initialize_counter(42) @@ -661,7 +661,7 @@ async fn setup_output_variable_estimation_test( .deploy(&wallets[0], TxParameters::default()) .await?; - let mint_asset_id = AssetId::from(*contract_id.hash()); + let mint_asset_id = contract_id.asset_id(&Bits256::zeroed()); let addresses: [Address; 3] = wallets .iter() .map(|wallet| wallet.address().into()) diff --git a/packages/fuels/tests/contracts/asserts/Forc.toml b/packages/fuels/tests/contracts/asserts/Forc.toml index e6d8b1f23..9699ea950 100644 --- a/packages/fuels/tests/contracts/asserts/Forc.toml +++ b/packages/fuels/tests/contracts/asserts/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "asserts" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/auth_testing_abi/Forc.toml b/packages/fuels/tests/contracts/auth_testing_abi/Forc.toml index f306fecdf..46650f30a 100644 --- a/packages/fuels/tests/contracts/auth_testing_abi/Forc.toml +++ b/packages/fuels/tests/contracts/auth_testing_abi/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "auth_testing_abi" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/auth_testing_contract/Forc.toml b/packages/fuels/tests/contracts/auth_testing_contract/Forc.toml index 7ea22f673..d5d9fd2b3 100644 --- a/packages/fuels/tests/contracts/auth_testing_contract/Forc.toml +++ b/packages/fuels/tests/contracts/auth_testing_contract/Forc.toml @@ -5,5 +5,5 @@ license = "Apache-2.0" name = "auth_testing_contract" [dependencies] - auth_testing_abi = { path = "../auth_testing_abi" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/block_timestamp/Forc.toml b/packages/fuels/tests/contracts/block_timestamp/Forc.toml index e12e1261c..3ab556c8a 100644 --- a/packages/fuels/tests/contracts/block_timestamp/Forc.toml +++ b/packages/fuels/tests/contracts/block_timestamp/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "block_timestamp" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/configurables/Forc.toml b/packages/fuels/tests/contracts/configurables/Forc.toml index a1eda3c88..92f33c128 100644 --- a/packages/fuels/tests/contracts/configurables/Forc.toml +++ b/packages/fuels/tests/contracts/configurables/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "configurables" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/contract_test/Forc.toml b/packages/fuels/tests/contracts/contract_test/Forc.toml index 20e6c1ce4..7f175e460 100644 --- a/packages/fuels/tests/contracts/contract_test/Forc.toml +++ b/packages/fuels/tests/contracts/contract_test/Forc.toml @@ -6,3 +6,4 @@ name = "contract_test" [dependencies] increment_abi = { path = "../library_test", package = "library_test" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/large_return_data/Forc.toml b/packages/fuels/tests/contracts/large_return_data/Forc.toml index 13e2a57c8..e9084460f 100644 --- a/packages/fuels/tests/contracts/large_return_data/Forc.toml +++ b/packages/fuels/tests/contracts/large_return_data/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "large_return_data" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/lib_contract/Forc.toml b/packages/fuels/tests/contracts/lib_contract/Forc.toml index 85ac32051..8d19a713e 100644 --- a/packages/fuels/tests/contracts/lib_contract/Forc.toml +++ b/packages/fuels/tests/contracts/lib_contract/Forc.toml @@ -6,3 +6,4 @@ name = "lib_contract" [dependencies] lib_contract = { path = "../lib_contract_abi/", package = "lib_contract_abi" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/lib_contract_abi/Forc.toml b/packages/fuels/tests/contracts/lib_contract_abi/Forc.toml index 6b0c31acf..b75245dd1 100644 --- a/packages/fuels/tests/contracts/lib_contract_abi/Forc.toml +++ b/packages/fuels/tests/contracts/lib_contract_abi/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "lib_contract_abi" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/lib_contract_caller/Forc.toml b/packages/fuels/tests/contracts/lib_contract_caller/Forc.toml index 09b791984..31a86fcbd 100644 --- a/packages/fuels/tests/contracts/lib_contract_caller/Forc.toml +++ b/packages/fuels/tests/contracts/lib_contract_caller/Forc.toml @@ -6,3 +6,4 @@ name = "lib_contract_caller" [dependencies] lib_contract = { path = "../lib_contract_abi/", package = "lib_contract_abi" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/lib_contract_caller/src/main.sw b/packages/fuels/tests/contracts/lib_contract_caller/src/main.sw index b1fe50eac..97dc615bd 100644 --- a/packages/fuels/tests/contracts/lib_contract_caller/src/main.sw +++ b/packages/fuels/tests/contracts/lib_contract_caller/src/main.sw @@ -2,6 +2,7 @@ contract; use lib_contract::LibContract; use std::token::mint_to_address; +use std::constants::ZERO_B256; abi ContractCaller { fn increment_from_contract(contract_id: ContractId, value: u64) -> u64; @@ -32,7 +33,7 @@ impl ContractCaller for Contract { let contract_instance = abi(LibContract, contract_id.into()); let _ = contract_instance.increment(42); - mint_to_address(amount, address); + mint_to_address(address, ZERO_B256, amount); } fn require_from_contract(contract_id: ContractId) { diff --git a/packages/fuels/tests/contracts/library_test/Forc.toml b/packages/fuels/tests/contracts/library_test/Forc.toml index 65ff26b0d..82d9c2ace 100644 --- a/packages/fuels/tests/contracts/library_test/Forc.toml +++ b/packages/fuels/tests/contracts/library_test/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "library_test" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/liquidity_pool/Forc.toml b/packages/fuels/tests/contracts/liquidity_pool/Forc.toml index fcab2733d..069600dbb 100644 --- a/packages/fuels/tests/contracts/liquidity_pool/Forc.toml +++ b/packages/fuels/tests/contracts/liquidity_pool/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "liquidity_pool" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/liquidity_pool/src/main.sw b/packages/fuels/tests/contracts/liquidity_pool/src/main.sw index 667ccd6c0..e9a1e2b4a 100644 --- a/packages/fuels/tests/contracts/liquidity_pool/src/main.sw +++ b/packages/fuels/tests/contracts/liquidity_pool/src/main.sw @@ -11,6 +11,7 @@ use std::{ transfer_to_address, }, }; +use std::constants::ZERO_B256; abi LiquidityPool { #[payable] @@ -24,25 +25,24 @@ const BASE_TOKEN: b256 = 0x9ae5b658754e096e4d681c548daf46354495a437cc61492599e33 impl LiquidityPool for Contract { #[payable] fn deposit(recipient: Address) { - assert(ContractId::from(BASE_TOKEN) == msg_asset_id()); + assert(BASE_TOKEN == msg_asset_id()); assert(0 < msg_amount()); // Mint two times the amount. let amount_to_mint = msg_amount() * 2; // Mint some LP token based upon the amount of the base token. - mint_to_address(amount_to_mint, recipient); + mint_to_address(recipient, ZERO_B256, amount_to_mint); } #[payable] fn withdraw(recipient: Address) { - assert(contract_id() == msg_asset_id()); assert(0 < msg_amount()); // Amount to withdraw. let amount_to_transfer = msg_amount() / 2; // Transfer base token to recipient. - transfer_to_address(amount_to_transfer, ContractId::from(BASE_TOKEN), recipient); + transfer_to_address(recipient, BASE_TOKEN, amount_to_transfer); } } diff --git a/packages/fuels/tests/contracts/low_level_caller/Forc.toml b/packages/fuels/tests/contracts/low_level_caller/Forc.toml index 72ce3f9bf..711f63503 100644 --- a/packages/fuels/tests/contracts/low_level_caller/Forc.toml +++ b/packages/fuels/tests/contracts/low_level_caller/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "low_level_caller" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/msg_amount/Forc.toml b/packages/fuels/tests/contracts/msg_amount/Forc.toml index 170eb174f..11e47a02f 100644 --- a/packages/fuels/tests/contracts/msg_amount/Forc.toml +++ b/packages/fuels/tests/contracts/msg_amount/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "msg_amount" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/multiple_read_calls/Forc.toml b/packages/fuels/tests/contracts/multiple_read_calls/Forc.toml index c0293c3bf..40aae52b9 100644 --- a/packages/fuels/tests/contracts/multiple_read_calls/Forc.toml +++ b/packages/fuels/tests/contracts/multiple_read_calls/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "multiple_read_calls" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/payable_annotation/Forc.toml b/packages/fuels/tests/contracts/payable_annotation/Forc.toml index 66183feeb..c0e871fe7 100644 --- a/packages/fuels/tests/contracts/payable_annotation/Forc.toml +++ b/packages/fuels/tests/contracts/payable_annotation/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "payable_annotation" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/require/Forc.toml b/packages/fuels/tests/contracts/require/Forc.toml index cc27a685e..9f5f13899 100644 --- a/packages/fuels/tests/contracts/require/Forc.toml +++ b/packages/fuels/tests/contracts/require/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "require" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/revert_transaction_error/Forc.toml b/packages/fuels/tests/contracts/revert_transaction_error/Forc.toml index 9b2ef69e6..75071654b 100644 --- a/packages/fuels/tests/contracts/revert_transaction_error/Forc.toml +++ b/packages/fuels/tests/contracts/revert_transaction_error/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "revert_transaction_error" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/storage/Forc.toml b/packages/fuels/tests/contracts/storage/Forc.toml index e302196a2..d3adc9cd0 100644 --- a/packages/fuels/tests/contracts/storage/Forc.toml +++ b/packages/fuels/tests/contracts/storage/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "storage" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/token_ops/Forc.toml b/packages/fuels/tests/contracts/token_ops/Forc.toml index 5c8f0db95..ddc85d2af 100644 --- a/packages/fuels/tests/contracts/token_ops/Forc.toml +++ b/packages/fuels/tests/contracts/token_ops/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "token_ops" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/token_ops/src/main.sw b/packages/fuels/tests/contracts/token_ops/src/main.sw index a8aa018a0..542c666fe 100644 --- a/packages/fuels/tests/contracts/token_ops/src/main.sw +++ b/packages/fuels/tests/contracts/token_ops/src/main.sw @@ -1,14 +1,15 @@ contract; use std::{bytes::Bytes, context::balance_of, context::msg_amount, message::send_message, token::*}; +use std::constants::ZERO_B256; abi TestFuelCoin { fn mint_coins(mint_amount: u64); fn mint_to_addresses(mint_amount: u64, addresses: [Address; 3]); fn burn_coins(burn_amount: u64); - fn force_transfer_coins(coins: u64, asset_id: ContractId, target: ContractId); - fn transfer_coins_to_output(coins: u64, asset_id: ContractId, recipient: Address); - fn get_balance(target: ContractId, asset_id: ContractId) -> u64; + fn force_transfer_coins(coins: u64, asset_id: AssetId, target: ContractId); + fn transfer_coins_to_output(coins: u64, asset_id: AssetId, recipient: Address); + fn get_balance(target: ContractId, asset_id: AssetId) -> u64; #[payable] fn get_msg_amount() -> u64; fn send_message(recipient: b256, coins: u64); @@ -16,30 +17,30 @@ abi TestFuelCoin { impl TestFuelCoin for Contract { fn mint_coins(mint_amount: u64) { - mint(mint_amount); + mint(ZERO_B256, mint_amount); } fn mint_to_addresses(mint_amount: u64, addresses: [Address; 3]) { let mut counter = 0; while counter < 3 { - mint_to_address(mint_amount, addresses[counter]); + mint_to_address(addresses[counter], ZERO_B256, mint_amount); counter = counter + 1; } } fn burn_coins(burn_amount: u64) { - burn(burn_amount); + burn(ZERO_B256, burn_amount); } - fn force_transfer_coins(coins: u64, asset_id: ContractId, target: ContractId) { - force_transfer_to_contract(coins, asset_id, target); + fn force_transfer_coins(coins: u64, asset_id: AssetId, target: ContractId) { + force_transfer_to_contract(target, asset_id, coins); } // ANCHOR: variable_outputs - fn transfer_coins_to_output(coins: u64, asset_id: ContractId, recipient: Address) { - transfer_to_address(coins, asset_id, recipient); + fn transfer_coins_to_output(coins: u64, asset_id: AssetId, recipient: Address) { + transfer_to_address(recipient, asset_id, coins); } // ANCHOR_END: variable_outputs - fn get_balance(target: ContractId, asset_id: ContractId) -> u64 { + fn get_balance(target: ContractId, asset_id: AssetId) -> u64 { balance_of(target, asset_id) } diff --git a/packages/fuels/tests/contracts/transaction_block_height/Forc.toml b/packages/fuels/tests/contracts/transaction_block_height/Forc.toml index 2f744a0f3..88f4d951a 100644 --- a/packages/fuels/tests/contracts/transaction_block_height/Forc.toml +++ b/packages/fuels/tests/contracts/transaction_block_height/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "transaction_block_height" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/contracts/transaction_block_height/src/main.sw b/packages/fuels/tests/contracts/transaction_block_height/src/main.sw index 352b83b94..eff42e87e 100644 --- a/packages/fuels/tests/contracts/transaction_block_height/src/main.sw +++ b/packages/fuels/tests/contracts/transaction_block_height/src/main.sw @@ -1,12 +1,12 @@ contract; abi MyContract { - fn get_current_height() -> u64; + fn get_current_height() -> u32; fn calling_this_will_produce_a_block(); } impl MyContract for Contract { - fn get_current_height() -> u64 { + fn get_current_height() -> u32 { std::block::height() } diff --git a/packages/fuels/tests/logs.rs b/packages/fuels/tests/logs.rs index 1bdd9ce5e..c203c481d 100644 --- a/packages/fuels/tests/logs.rs +++ b/packages/fuels/tests/logs.rs @@ -1244,10 +1244,11 @@ async fn contract_token_ops_error_messages() -> Result<()> { { let contract_id = contract_instance.contract_id(); + let asset_id = contract_id.asset_id(&Bits256::zeroed()).into(); let address = wallet.address(); let error = contract_methods - .transfer_coins_to_output(1_000_000, contract_id, address) + .transfer_coins_to_output(1_000_000, asset_id, address) .call() .await .expect_err("should return a revert error"); diff --git a/packages/fuels/tests/logs/contract_logs/Forc.toml b/packages/fuels/tests/logs/contract_logs/Forc.toml index 0fce1449d..76efbd74a 100644 --- a/packages/fuels/tests/logs/contract_logs/Forc.toml +++ b/packages/fuels/tests/logs/contract_logs/Forc.toml @@ -6,3 +6,4 @@ name = "contract_logs" [dependencies] contract_logs = { path = "../contract_logs_abi/", package = "contract_logs_abi" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/logs/contract_logs_abi/Forc.toml b/packages/fuels/tests/logs/contract_logs_abi/Forc.toml index 17abdcce8..53dac61af 100644 --- a/packages/fuels/tests/logs/contract_logs_abi/Forc.toml +++ b/packages/fuels/tests/logs/contract_logs_abi/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "contract_logs_abi" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/logs/contract_with_contract_logs/Forc.toml b/packages/fuels/tests/logs/contract_with_contract_logs/Forc.toml index 8b0798fac..6ec4d54f5 100644 --- a/packages/fuels/tests/logs/contract_with_contract_logs/Forc.toml +++ b/packages/fuels/tests/logs/contract_with_contract_logs/Forc.toml @@ -6,3 +6,4 @@ name = "contract_with_contract_logs" [dependencies] library = { path = "../contract_logs_abi/", package = "contract_logs_abi" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/logs/script_logs/Forc.toml b/packages/fuels/tests/logs/script_logs/Forc.toml index cacd8d3dd..4d0b025b4 100644 --- a/packages/fuels/tests/logs/script_logs/Forc.toml +++ b/packages/fuels/tests/logs/script_logs/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_logs" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/logs/script_with_contract_logs/Forc.toml b/packages/fuels/tests/logs/script_with_contract_logs/Forc.toml index 56b09e02f..cf828dadd 100644 --- a/packages/fuels/tests/logs/script_with_contract_logs/Forc.toml +++ b/packages/fuels/tests/logs/script_with_contract_logs/Forc.toml @@ -6,3 +6,4 @@ name = "script_with_contract_logs" [dependencies] library = { path = "../contract_logs_abi/", package = "contract_logs_abi" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/predicates.rs b/packages/fuels/tests/predicates.rs index c5bd35e77..97c3912fa 100644 --- a/packages/fuels/tests/predicates.rs +++ b/packages/fuels/tests/predicates.rs @@ -221,7 +221,7 @@ async fn pay_with_predicate() -> Result<()> { .await?; let contract_methods = MyContract::new(contract_id.clone(), predicate.clone()).methods(); - let tx_params = TxParameters::new(1000000, 10000, 0); + let tx_params = TxParameters::new(1, 1000000, 0); assert_eq!(predicate.get_asset_balance(&BASE_ASSET_ID).await?, 192); @@ -232,7 +232,7 @@ async fn pay_with_predicate() -> Result<()> { .await?; assert_eq!(42, response.value); - assert_eq!(predicate.get_asset_balance(&BASE_ASSET_ID).await?, 187); + assert_eq!(predicate.get_asset_balance(&BASE_ASSET_ID).await?, 191); Ok(()) } @@ -275,8 +275,8 @@ async fn pay_with_predicate_vector_data() -> Result<()> { let contract_methods = MyContract::new(contract_id.clone(), predicate.clone()).methods(); let tx_params = TxParameters::default() - .set_gas_price(100000) - .set_gas_limit(10000); + .set_gas_price(1) + .set_gas_limit(1000000); assert_eq!(predicate.get_asset_balance(&BASE_ASSET_ID).await?, 192); @@ -287,7 +287,7 @@ async fn pay_with_predicate_vector_data() -> Result<()> { .await?; assert_eq!(42, response.value); - assert_eq!(predicate.get_asset_balance(&BASE_ASSET_ID).await?, 190); + assert_eq!(predicate.get_asset_balance(&BASE_ASSET_ID).await?, 191); Ok(()) } @@ -521,7 +521,7 @@ async fn contract_tx_and_call_params_with_predicate() -> Result<()> { println!("Contract deployed @ {contract_id}"); let contract_methods = MyContract::new(contract_id.clone(), predicate.clone()).methods(); - let my_tx_params = TxParameters::default().set_gas_price(100); + let my_tx_params = TxParameters::default().set_gas_price(1); let call_params_amount = 100; let call_params = CallParameters::default() diff --git a/packages/fuels/tests/predicates/basic_predicate/Forc.toml b/packages/fuels/tests/predicates/basic_predicate/Forc.toml index 06d368ee4..c6fbebefa 100644 --- a/packages/fuels/tests/predicates/basic_predicate/Forc.toml +++ b/packages/fuels/tests/predicates/basic_predicate/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "basic_predicate" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/predicates/basic_predicate/src/main.sw b/packages/fuels/tests/predicates/basic_predicate/src/main.sw index a9ff6dd6d..ba1cc464c 100644 --- a/packages/fuels/tests/predicates/basic_predicate/src/main.sw +++ b/packages/fuels/tests/predicates/basic_predicate/src/main.sw @@ -1,5 +1,5 @@ predicate; fn main(a: u32, b: u64) -> bool { - b == a + b == a.as_u64() } diff --git a/packages/fuels/tests/predicates/predicate_configurables/Forc.toml b/packages/fuels/tests/predicates/predicate_configurables/Forc.toml index 853bfd837..f03b71d32 100644 --- a/packages/fuels/tests/predicates/predicate_configurables/Forc.toml +++ b/packages/fuels/tests/predicates/predicate_configurables/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_configurables" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/predicates/signatures/Forc.toml b/packages/fuels/tests/predicates/signatures/Forc.toml index 51883a82a..7ae718555 100644 --- a/packages/fuels/tests/predicates/signatures/Forc.toml +++ b/packages/fuels/tests/predicates/signatures/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "signatures" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/providers.rs b/packages/fuels/tests/providers.rs index d235d78df..8f85a80f0 100644 --- a/packages/fuels/tests/providers.rs +++ b/packages/fuels/tests/providers.rs @@ -11,6 +11,7 @@ use fuels::{ tx::Receipt, types::{block::Block, coin_type::CoinType, errors::error, message::Message}, }; +use fuels_core::types::Bits256; #[tokio::test] async fn test_provider_launch_and_connect() -> Result<()> { @@ -337,6 +338,8 @@ 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 = 161; let gas_limit = 225_883; let response = contract_instance .methods() @@ -353,7 +356,7 @@ async fn test_gas_forwarded_defaults_to_tx_limit() -> Result<()> { .gas() .unwrap(); - assert_eq!(gas_limit, gas_forwarded); + assert_eq!(gas_limit, gas_forwarded + gas_used_by_script); Ok(()) } @@ -374,9 +377,10 @@ async fn test_amount_and_asset_forwarding() -> Result<()> { ); let contract_id = contract_instance.contract_id(); let contract_methods = contract_instance.methods(); + let asset_id = contract_id.asset_id(&Bits256::zeroed()).into(); let mut balance_response = contract_methods - .get_balance(contract_id, contract_id) + .get_balance(contract_id, asset_id) .call() .await?; assert_eq!(balance_response.value, 0); @@ -384,7 +388,7 @@ async fn test_amount_and_asset_forwarding() -> Result<()> { contract_methods.mint_coins(5_000_000).call().await?; balance_response = contract_methods - .get_balance(contract_id, contract_id) + .get_balance(contract_id, asset_id) .call() .await?; assert_eq!(balance_response.value, 5_000_000); @@ -417,7 +421,7 @@ async fn test_amount_and_asset_forwarding() -> Result<()> { // withdraw some tokens to wallet contract_methods - .transfer_coins_to_output(1_000_000, contract_id, address) + .transfer_coins_to_output(1_000_000, asset_id, address) .append_variable_outputs(1) .call() .await?; @@ -534,7 +538,7 @@ async fn test_call_param_gas_errors() -> Result<()> { let contract_methods = contract_instance.methods(); let response = contract_methods .initialize_counter(42) - .tx_params(TxParameters::default().set_gas_limit(3000)) + .tx_params(TxParameters::default().set_gas_limit(446000)) .call_params(CallParameters::default().set_gas_forwarded(1))? .call() .await diff --git a/packages/fuels/tests/scripts.rs b/packages/fuels/tests/scripts.rs index 3bb7cb6c3..884dd768b 100644 --- a/packages/fuels/tests/scripts.rs +++ b/packages/fuels/tests/scripts.rs @@ -135,7 +135,7 @@ async fn test_basic_script_with_tx_parameters() -> Result<()> { // ANCHOR: script_with_tx_params let parameters = TxParameters::default() .set_gas_price(1) - .set_gas_limit(10_000); + .set_gas_limit(1_000_000); let result = script_instance .main(a, b) .tx_params(parameters) @@ -247,8 +247,8 @@ async fn test_output_variable_estimation() -> Result<()> { receiver.set_provider(provider); let amount = 1000; - let asset_id = ContractId::from(*BASE_ASSET_ID); - let script_call = script_instance.main(amount, asset_id, receiver.address()); + let asset_id = BASE_ASSET_ID; + let script_call = script_instance.main(amount, asset_id.into(), receiver.address()); let inputs = wallet .get_asset_inputs_for_amount(BASE_ASSET_ID, amount, None) .await?; diff --git a/packages/fuels/tests/scripts/arguments/Forc.toml b/packages/fuels/tests/scripts/arguments/Forc.toml index f15bbe45f..e688700f9 100644 --- a/packages/fuels/tests/scripts/arguments/Forc.toml +++ b/packages/fuels/tests/scripts/arguments/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "arguments" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/basic_script/Forc.toml b/packages/fuels/tests/scripts/basic_script/Forc.toml index 32c24fc81..5d1375951 100644 --- a/packages/fuels/tests/scripts/basic_script/Forc.toml +++ b/packages/fuels/tests/scripts/basic_script/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "basic_script" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/basic_script/src/main.sw b/packages/fuels/tests/scripts/basic_script/src/main.sw index 6302d4a8e..b4da60172 100644 --- a/packages/fuels/tests/scripts/basic_script/src/main.sw +++ b/packages/fuels/tests/scripts/basic_script/src/main.sw @@ -1,7 +1,7 @@ script; fn main(a: u64, b: u32) -> str[5] { - if a < b { + if a < b.as_u64() { let my_string: str[5] = "hello"; my_string } else { diff --git a/packages/fuels/tests/scripts/require_from_contract/Forc.toml b/packages/fuels/tests/scripts/require_from_contract/Forc.toml index 8bb8ee1a8..f3556040b 100644 --- a/packages/fuels/tests/scripts/require_from_contract/Forc.toml +++ b/packages/fuels/tests/scripts/require_from_contract/Forc.toml @@ -6,3 +6,4 @@ name = "require_from_contract" [dependencies] library = { path = "../../contracts/lib_contract_abi", package = "lib_contract_abi" } +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/script_array/Forc.toml b/packages/fuels/tests/scripts/script_array/Forc.toml index 03c93b8f5..bad5d9c72 100644 --- a/packages/fuels/tests/scripts/script_array/Forc.toml +++ b/packages/fuels/tests/scripts/script_array/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_array" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/script_asserts/Forc.toml b/packages/fuels/tests/scripts/script_asserts/Forc.toml index 3a5691596..e0f1080e2 100644 --- a/packages/fuels/tests/scripts/script_asserts/Forc.toml +++ b/packages/fuels/tests/scripts/script_asserts/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_asserts" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/script_b256/Forc.toml b/packages/fuels/tests/scripts/script_b256/Forc.toml index 7f1f12e40..1f5db8d5d 100644 --- a/packages/fuels/tests/scripts/script_b256/Forc.toml +++ b/packages/fuels/tests/scripts/script_b256/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_b256" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/script_configurables/Forc.toml b/packages/fuels/tests/scripts/script_configurables/Forc.toml index acf0005e9..c5edc0e28 100644 --- a/packages/fuels/tests/scripts/script_configurables/Forc.toml +++ b/packages/fuels/tests/scripts/script_configurables/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_configurables" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/script_enum/Forc.toml b/packages/fuels/tests/scripts/script_enum/Forc.toml index f4941d428..2172ab275 100644 --- a/packages/fuels/tests/scripts/script_enum/Forc.toml +++ b/packages/fuels/tests/scripts/script_enum/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_enum" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/script_require/Forc.toml b/packages/fuels/tests/scripts/script_require/Forc.toml index ae05b728f..4b4a88921 100644 --- a/packages/fuels/tests/scripts/script_require/Forc.toml +++ b/packages/fuels/tests/scripts/script_require/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_require" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/script_struct/Forc.toml b/packages/fuels/tests/scripts/script_struct/Forc.toml index 165e1c61a..2be65dc43 100644 --- a/packages/fuels/tests/scripts/script_struct/Forc.toml +++ b/packages/fuels/tests/scripts/script_struct/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_struct" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/transfer_script/Forc.toml b/packages/fuels/tests/scripts/transfer_script/Forc.toml index 68199fabf..336d7c399 100644 --- a/packages/fuels/tests/scripts/transfer_script/Forc.toml +++ b/packages/fuels/tests/scripts/transfer_script/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "transfer_script" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/scripts/transfer_script/src/main.sw b/packages/fuels/tests/scripts/transfer_script/src/main.sw index 337e30813..2366121d2 100644 --- a/packages/fuels/tests/scripts/transfer_script/src/main.sw +++ b/packages/fuels/tests/scripts/transfer_script/src/main.sw @@ -2,6 +2,6 @@ script; use std::token::transfer_to_address; -fn main(amount: u64, asset: ContractId, receiver: Address) -> () { - transfer_to_address(amount, asset, receiver); +fn main(amount: u64, asset: AssetId, receiver: Address) -> () { + transfer_to_address(receiver, asset, amount); } diff --git a/packages/fuels/tests/types/contracts/b512/Forc.toml b/packages/fuels/tests/types/contracts/b512/Forc.toml index acb7c4b21..7ef51cc9c 100644 --- a/packages/fuels/tests/types/contracts/b512/Forc.toml +++ b/packages/fuels/tests/types/contracts/b512/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "b512" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/bytes/Forc.toml b/packages/fuels/tests/types/contracts/bytes/Forc.toml index 57958b02d..d6111f8f6 100644 --- a/packages/fuels/tests/types/contracts/bytes/Forc.toml +++ b/packages/fuels/tests/types/contracts/bytes/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "bytes" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/call_empty_return/Forc.toml b/packages/fuels/tests/types/contracts/call_empty_return/Forc.toml index 9782a12f9..9fd6b5d88 100644 --- a/packages/fuels/tests/types/contracts/call_empty_return/Forc.toml +++ b/packages/fuels/tests/types/contracts/call_empty_return/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "call_empty_return" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/complex_types_contract/Forc.toml b/packages/fuels/tests/types/contracts/complex_types_contract/Forc.toml index 1528f7adb..6ba4973cc 100644 --- a/packages/fuels/tests/types/contracts/complex_types_contract/Forc.toml +++ b/packages/fuels/tests/types/contracts/complex_types_contract/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "complex_types_contract" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/contract_output_test/Forc.toml b/packages/fuels/tests/types/contracts/contract_output_test/Forc.toml index fc60a1b05..356b036ac 100644 --- a/packages/fuels/tests/types/contracts/contract_output_test/Forc.toml +++ b/packages/fuels/tests/types/contracts/contract_output_test/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "contract_output_test" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/empty_arguments/Forc.toml b/packages/fuels/tests/types/contracts/empty_arguments/Forc.toml index cc1182616..64059cc3a 100644 --- a/packages/fuels/tests/types/contracts/empty_arguments/Forc.toml +++ b/packages/fuels/tests/types/contracts/empty_arguments/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "empty_arguments" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/enum_as_input/Forc.toml b/packages/fuels/tests/types/contracts/enum_as_input/Forc.toml index dffb513cc..47311ae22 100644 --- a/packages/fuels/tests/types/contracts/enum_as_input/Forc.toml +++ b/packages/fuels/tests/types/contracts/enum_as_input/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "enum_as_input" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/enum_encoding/Forc.toml b/packages/fuels/tests/types/contracts/enum_encoding/Forc.toml index 688f05519..71b1ab0a4 100644 --- a/packages/fuels/tests/types/contracts/enum_encoding/Forc.toml +++ b/packages/fuels/tests/types/contracts/enum_encoding/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "enum_encoding" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/enum_inside_struct/Forc.toml b/packages/fuels/tests/types/contracts/enum_inside_struct/Forc.toml index f09effbc0..2b1c7a139 100644 --- a/packages/fuels/tests/types/contracts/enum_inside_struct/Forc.toml +++ b/packages/fuels/tests/types/contracts/enum_inside_struct/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "enum_inside_struct" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/evm_address/Forc.toml b/packages/fuels/tests/types/contracts/evm_address/Forc.toml index af826f8d9..42b762a01 100644 --- a/packages/fuels/tests/types/contracts/evm_address/Forc.toml +++ b/packages/fuels/tests/types/contracts/evm_address/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "evm_address" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/generics/Forc.toml b/packages/fuels/tests/types/contracts/generics/Forc.toml index 258e92faf..f1ddcc371 100644 --- a/packages/fuels/tests/types/contracts/generics/Forc.toml +++ b/packages/fuels/tests/types/contracts/generics/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "generics" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/identity/Forc.toml b/packages/fuels/tests/types/contracts/identity/Forc.toml index ad18bc27f..5c67218c6 100644 --- a/packages/fuels/tests/types/contracts/identity/Forc.toml +++ b/packages/fuels/tests/types/contracts/identity/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "identity" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/native_types/Forc.toml b/packages/fuels/tests/types/contracts/native_types/Forc.toml index 0be1771e5..9e5db4fd5 100644 --- a/packages/fuels/tests/types/contracts/native_types/Forc.toml +++ b/packages/fuels/tests/types/contracts/native_types/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "native_types" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/nested_structs/Forc.toml b/packages/fuels/tests/types/contracts/nested_structs/Forc.toml index cc6fa4e8e..f64e32903 100644 --- a/packages/fuels/tests/types/contracts/nested_structs/Forc.toml +++ b/packages/fuels/tests/types/contracts/nested_structs/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "nested_structs" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/options/Forc.toml b/packages/fuels/tests/types/contracts/options/Forc.toml index 4b0808785..06d370ce4 100644 --- a/packages/fuels/tests/types/contracts/options/Forc.toml +++ b/packages/fuels/tests/types/contracts/options/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "options" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/raw_slice/Forc.toml b/packages/fuels/tests/types/contracts/raw_slice/Forc.toml index 4d0cc8264..143b0d72e 100644 --- a/packages/fuels/tests/types/contracts/raw_slice/Forc.toml +++ b/packages/fuels/tests/types/contracts/raw_slice/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "raw_slice" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/results/Forc.toml b/packages/fuels/tests/types/contracts/results/Forc.toml index 7f469f5d7..26bc53b9f 100644 --- a/packages/fuels/tests/types/contracts/results/Forc.toml +++ b/packages/fuels/tests/types/contracts/results/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "results" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/std_lib_string/Forc.toml b/packages/fuels/tests/types/contracts/std_lib_string/Forc.toml index db2113c44..f92da038f 100644 --- a/packages/fuels/tests/types/contracts/std_lib_string/Forc.toml +++ b/packages/fuels/tests/types/contracts/std_lib_string/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "std_lib_string" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/str_in_array/Forc.toml b/packages/fuels/tests/types/contracts/str_in_array/Forc.toml index 45cf1941b..bc4cd810c 100644 --- a/packages/fuels/tests/types/contracts/str_in_array/Forc.toml +++ b/packages/fuels/tests/types/contracts/str_in_array/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "str_in_array" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/tuples/Forc.toml b/packages/fuels/tests/types/contracts/tuples/Forc.toml index 14e440aec..3d77759cd 100644 --- a/packages/fuels/tests/types/contracts/tuples/Forc.toml +++ b/packages/fuels/tests/types/contracts/tuples/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "tuples" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/two_structs/Forc.toml b/packages/fuels/tests/types/contracts/two_structs/Forc.toml index 07ff3ac96..90ed5bf30 100644 --- a/packages/fuels/tests/types/contracts/two_structs/Forc.toml +++ b/packages/fuels/tests/types/contracts/two_structs/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "two_structs" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/type_inside_enum/Forc.toml b/packages/fuels/tests/types/contracts/type_inside_enum/Forc.toml index d467f8ebc..ba0ab4b9d 100644 --- a/packages/fuels/tests/types/contracts/type_inside_enum/Forc.toml +++ b/packages/fuels/tests/types/contracts/type_inside_enum/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "type_inside_enum" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/u128/Forc.toml b/packages/fuels/tests/types/contracts/u128/Forc.toml index 7c088696a..ec950b090 100644 --- a/packages/fuels/tests/types/contracts/u128/Forc.toml +++ b/packages/fuels/tests/types/contracts/u128/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "u128" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/u256/Forc.toml b/packages/fuels/tests/types/contracts/u256/Forc.toml index 31818ffda..95351c0cb 100644 --- a/packages/fuels/tests/types/contracts/u256/Forc.toml +++ b/packages/fuels/tests/types/contracts/u256/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "u256" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/vector_output/Forc.toml b/packages/fuels/tests/types/contracts/vector_output/Forc.toml index 0d7f08dad..ec901a9e9 100644 --- a/packages/fuels/tests/types/contracts/vector_output/Forc.toml +++ b/packages/fuels/tests/types/contracts/vector_output/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "vector_output" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/vectors/Forc.toml b/packages/fuels/tests/types/contracts/vectors/Forc.toml index 39c4ced3d..c71c44c25 100644 --- a/packages/fuels/tests/types/contracts/vectors/Forc.toml +++ b/packages/fuels/tests/types/contracts/vectors/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "vectors" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/contracts/vectors/src/main.sw b/packages/fuels/tests/types/contracts/vectors/src/main.sw index 7cb28649d..a42ed5c7a 100644 --- a/packages/fuels/tests/types/contracts/vectors/src/main.sw +++ b/packages/fuels/tests/types/contracts/vectors/src/main.sw @@ -26,15 +26,15 @@ abi MyContract { impl MyContract for Contract { fn u32_vec(arg: Vec) { - let expected = vec_from([0u8, 1u8, 2u8]); + let expected = vec_from([0, 1, 2]); assert(arg == expected); } fn vec_in_vec(arg: Vec>) { let mut expected = Vec::new(); - expected.push(vec_from([0u8, 1u8, 2u8])); - expected.push(vec_from([0u8, 1u8, 2u8])); + expected.push(vec_from([0, 1, 2])); + expected.push(vec_from([0, 1, 2])); assert(expected == arg); } @@ -48,7 +48,7 @@ impl MyContract for Contract { } fn vec_in_struct(arg: SomeStruct>) { let expected = SomeStruct { - a: vec_from([0u8, 1u8, 2u8]), + a: vec_from([0, 1, 2]), }; assert(arg.a == expected.a); @@ -62,13 +62,13 @@ impl MyContract for Contract { } fn vec_in_array(arg: [Vec; 2]) { - let expected = [vec_from([0u8, 1u8, 2u8]), vec_from([0u8, 1u8, 2u8])]; + let expected = [vec_from([0, 1, 2]), vec_from([0, 1, 2])]; assert(expected == arg); } fn vec_in_enum(arg: SomeEnum>) { - let vec = vec_from([0u8, 1u8, 2u8]); + let vec = vec_from([0, 1, 2]); let expected = SomeEnum::a(vec); assert(expected == arg); @@ -90,7 +90,7 @@ impl MyContract for Contract { } fn vec_in_tuple(arg: (Vec, Vec)) { - let expected = (vec_from([0u8, 1u8, 2u8]), vec_from([0u8, 1u8, 2u8])); + let expected = (vec_from([0, 1, 2]), vec_from([0, 1, 2])); assert(arg == expected); } @@ -99,20 +99,20 @@ impl MyContract for Contract { let mut inner_vec_1 = Vec::new(); - let inner_inner_vec_1 = vec_from([0u8, 1u8, 2u8]); + let inner_inner_vec_1 = vec_from([0, 1, 2]); inner_vec_1.push(inner_inner_vec_1); - let inner_inner_vec_2 = vec_from([3u8, 4u8, 5u8]); + let inner_inner_vec_2 = vec_from([3, 4, 5]); inner_vec_1.push(inner_inner_vec_2); expected.push(SomeStruct { a: inner_vec_1 }); let mut inner_vec_2 = Vec::new(); - let inner_inner_vec_3 = vec_from([6u8, 7u8, 8u8]); + let inner_inner_vec_3 = vec_from([6, 7, 8]); inner_vec_2.push(inner_inner_vec_3); - let inner_inner_vec_4 = vec_from([9u8, 10u8, 11u8]); + let inner_inner_vec_4 = vec_from([9, 10, 11]); inner_vec_2.push(inner_inner_vec_4); expected.push(SomeStruct { a: inner_vec_2 }); diff --git a/packages/fuels/tests/types/predicates/address/Forc.toml b/packages/fuels/tests/types/predicates/address/Forc.toml index 66b3b6cf0..6e9ccd1c6 100644 --- a/packages/fuels/tests/types/predicates/address/Forc.toml +++ b/packages/fuels/tests/types/predicates/address/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "address" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/enums/Forc.toml b/packages/fuels/tests/types/predicates/enums/Forc.toml index d056e3a33..60af6a008 100644 --- a/packages/fuels/tests/types/predicates/enums/Forc.toml +++ b/packages/fuels/tests/types/predicates/enums/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "enums" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/predicate_bytes/Forc.toml b/packages/fuels/tests/types/predicates/predicate_bytes/Forc.toml index 04b33b007..a75a8ea5e 100644 --- a/packages/fuels/tests/types/predicates/predicate_bytes/Forc.toml +++ b/packages/fuels/tests/types/predicates/predicate_bytes/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_bytes" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/predicate_generics/Forc.toml b/packages/fuels/tests/types/predicates/predicate_generics/Forc.toml index 3f72203ca..9cccb98b4 100644 --- a/packages/fuels/tests/types/predicates/predicate_generics/Forc.toml +++ b/packages/fuels/tests/types/predicates/predicate_generics/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_generics" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/predicate_generics/src/main.sw b/packages/fuels/tests/types/predicates/predicate_generics/src/main.sw index 9f298fd7c..6e5a93734 100644 --- a/packages/fuels/tests/types/predicates/predicate_generics/src/main.sw +++ b/packages/fuels/tests/types/predicates/predicate_generics/src/main.sw @@ -15,7 +15,7 @@ fn main( generic_enum: GenericEnum, ) -> bool { if let GenericEnum::Generic(other_struct) = generic_enum { - return other_struct.value == generic_struct.value; + return other_struct.value == generic_struct.value.as_u16(); } false diff --git a/packages/fuels/tests/types/predicates/predicate_raw_slice/Forc.toml b/packages/fuels/tests/types/predicates/predicate_raw_slice/Forc.toml index cc6891685..bbc4bece1 100644 --- a/packages/fuels/tests/types/predicates/predicate_raw_slice/Forc.toml +++ b/packages/fuels/tests/types/predicates/predicate_raw_slice/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_raw_slice" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/predicate_raw_slice/src/main.sw b/packages/fuels/tests/types/predicates/predicate_raw_slice/src/main.sw index 3c35e0448..19ba59de2 100644 --- a/packages/fuels/tests/types/predicates/predicate_raw_slice/src/main.sw +++ b/packages/fuels/tests/types/predicates/predicate_raw_slice/src/main.sw @@ -13,7 +13,7 @@ struct Wrapper { fn valid_raw_slice(slice: raw_slice) -> bool { let vec: Vec = Vec::from(slice); - vec.len() == 3 && vec.get(0).unwrap() == 40u8 && vec.get(1).unwrap() == 41u8 && vec.get(2).unwrap() == 42u8 + vec.len() == 3 && vec.get(0).unwrap() == 40 && vec.get(1).unwrap() == 41 && vec.get(2).unwrap() == 42 } fn valid_vec(vec: Vec) -> bool { diff --git a/packages/fuels/tests/types/predicates/predicate_std_lib_string/Forc.toml b/packages/fuels/tests/types/predicates/predicate_std_lib_string/Forc.toml index 3572429ca..a0adb8428 100644 --- a/packages/fuels/tests/types/predicates/predicate_std_lib_string/Forc.toml +++ b/packages/fuels/tests/types/predicates/predicate_std_lib_string/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_std_lib_string" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/predicate_tuples/Forc.toml b/packages/fuels/tests/types/predicates/predicate_tuples/Forc.toml index 9ae81c1ae..cb27d8cdb 100644 --- a/packages/fuels/tests/types/predicates/predicate_tuples/Forc.toml +++ b/packages/fuels/tests/types/predicates/predicate_tuples/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_tuples" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/predicate_u128/Forc.toml b/packages/fuels/tests/types/predicates/predicate_u128/Forc.toml index 42300980e..c49f6811f 100644 --- a/packages/fuels/tests/types/predicates/predicate_u128/Forc.toml +++ b/packages/fuels/tests/types/predicates/predicate_u128/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_u128" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/predicate_u256/Forc.toml b/packages/fuels/tests/types/predicates/predicate_u256/Forc.toml index 92e420a9d..83e962967 100644 --- a/packages/fuels/tests/types/predicates/predicate_u256/Forc.toml +++ b/packages/fuels/tests/types/predicates/predicate_u256/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_u256" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/predicate_vector/Forc.toml b/packages/fuels/tests/types/predicates/predicate_vector/Forc.toml index 6972a31e7..b35d18c2b 100644 --- a/packages/fuels/tests/types/predicates/predicate_vector/Forc.toml +++ b/packages/fuels/tests/types/predicates/predicate_vector/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_vector" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/predicate_vector/src/main.sw b/packages/fuels/tests/types/predicates/predicate_vector/src/main.sw index da769b493..d23cd2200 100644 --- a/packages/fuels/tests/types/predicates/predicate_vector/src/main.sw +++ b/packages/fuels/tests/types/predicates/predicate_vector/src/main.sw @@ -2,5 +2,5 @@ predicate; fn main(a: u32, b: u64, c: Vec) -> bool { let number: u64 = c.get(2).unwrap(); - number == (b + a) + number == (b + a.as_u64()) } diff --git a/packages/fuels/tests/types/predicates/predicate_vectors/Forc.toml b/packages/fuels/tests/types/predicates/predicate_vectors/Forc.toml index e540774b1..314bd7747 100644 --- a/packages/fuels/tests/types/predicates/predicate_vectors/Forc.toml +++ b/packages/fuels/tests/types/predicates/predicate_vectors/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "predicate_vectors" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/structs/Forc.toml b/packages/fuels/tests/types/predicates/structs/Forc.toml index 39840c670..021641985 100644 --- a/packages/fuels/tests/types/predicates/structs/Forc.toml +++ b/packages/fuels/tests/types/predicates/structs/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "structs" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/predicates/u64/Forc.toml b/packages/fuels/tests/types/predicates/u64/Forc.toml index 00b64eac3..fcaed98a3 100644 --- a/packages/fuels/tests/types/predicates/u64/Forc.toml +++ b/packages/fuels/tests/types/predicates/u64/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "u64" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/scripts/options_results/Forc.toml b/packages/fuels/tests/types/scripts/options_results/Forc.toml index 1364267d7..bb887bee4 100644 --- a/packages/fuels/tests/types/scripts/options_results/Forc.toml +++ b/packages/fuels/tests/types/scripts/options_results/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "options_results" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/scripts/script_bytes/Forc.toml b/packages/fuels/tests/types/scripts/script_bytes/Forc.toml index c76090898..4f170b8bc 100644 --- a/packages/fuels/tests/types/scripts/script_bytes/Forc.toml +++ b/packages/fuels/tests/types/scripts/script_bytes/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_bytes" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/scripts/script_generics/Forc.toml b/packages/fuels/tests/types/scripts/script_generics/Forc.toml index 9a0a76425..18eb86f42 100644 --- a/packages/fuels/tests/types/scripts/script_generics/Forc.toml +++ b/packages/fuels/tests/types/scripts/script_generics/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_generics" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/scripts/script_generics/src/main.sw b/packages/fuels/tests/types/scripts/script_generics/src/main.sw index e7a0e0c57..621ed1f41 100644 --- a/packages/fuels/tests/types/scripts/script_generics/src/main.sw +++ b/packages/fuels/tests/types/scripts/script_generics/src/main.sw @@ -14,11 +14,12 @@ fn main( bim: GenericBimbam, bam: GenericSnack, ) -> (GenericSnack, GenericBimbam) { - let bot = GenericBimbam { val: bam.mars }; ( GenericSnack { - twix: bot, - mars: 2u32 * bim.val, + twix: GenericBimbam { + val: bam.mars.as_u64(), + }, + mars: 2u32 * bim.val.as_u32(), }, GenericBimbam { val: 255u8 }, ) diff --git a/packages/fuels/tests/types/scripts/script_raw_slice/Forc.toml b/packages/fuels/tests/types/scripts/script_raw_slice/Forc.toml index 5de7d6466..981c5d8fd 100644 --- a/packages/fuels/tests/types/scripts/script_raw_slice/Forc.toml +++ b/packages/fuels/tests/types/scripts/script_raw_slice/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_raw_slice" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/scripts/script_std_lib_string/Forc.toml b/packages/fuels/tests/types/scripts/script_std_lib_string/Forc.toml index 02cf5a266..b5e72eb3e 100644 --- a/packages/fuels/tests/types/scripts/script_std_lib_string/Forc.toml +++ b/packages/fuels/tests/types/scripts/script_std_lib_string/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_std_lib_string" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/scripts/script_tuples/Forc.toml b/packages/fuels/tests/types/scripts/script_tuples/Forc.toml index f10bf2f1b..f1424f806 100644 --- a/packages/fuels/tests/types/scripts/script_tuples/Forc.toml +++ b/packages/fuels/tests/types/scripts/script_tuples/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_tuples" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/scripts/script_u128/Forc.toml b/packages/fuels/tests/types/scripts/script_u128/Forc.toml index 4c1c1b3ac..4a8ef1cc5 100644 --- a/packages/fuels/tests/types/scripts/script_u128/Forc.toml +++ b/packages/fuels/tests/types/scripts/script_u128/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_u128" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/scripts/script_u256/Forc.toml b/packages/fuels/tests/types/scripts/script_u256/Forc.toml index 0fe896592..78ceb9b7d 100644 --- a/packages/fuels/tests/types/scripts/script_u256/Forc.toml +++ b/packages/fuels/tests/types/scripts/script_u256/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_u256" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" } diff --git a/packages/fuels/tests/types/scripts/script_vectors/Forc.toml b/packages/fuels/tests/types/scripts/script_vectors/Forc.toml index 83b90e60d..af00d0095 100644 --- a/packages/fuels/tests/types/scripts/script_vectors/Forc.toml +++ b/packages/fuels/tests/types/scripts/script_vectors/Forc.toml @@ -5,3 +5,4 @@ license = "Apache-2.0" name = "script_vectors" [dependencies] +std = { git = "https://github.com/FuelLabs/sway", branch = "upgrade/fuel-core-v0.20.1" }