From b09bcd095db74eda23f3aa2627cea1b71acd2317 Mon Sep 17 00:00:00 2001 From: Anderson Arboleya Date: Fri, 2 Feb 2024 19:34:52 -0300 Subject: [PATCH] chore: upgrading `forc` to `0.49.2` (#1707) --- .changeset/witty-hounds-work.md | 11 +++++ .github/actions/ci-setup/action.yaml | 2 + .../forc-projects/liquidity-pool/src/main.sw | 12 ++--- .../script-transfer-to-contract/src/main.sw | 2 +- .../transfer-to-address/src/main.sw | 2 +- .../fixtures/forc-projects/full/src/main.sw | 4 +- packages/forc/VERSION | 2 +- packages/forc/lib/install.js | 32 +++++++++---- packages/forc/lib/shared.js | 44 ++++++++++------- packages/fuel-core/lib/install.js | 35 +++++++------- packages/fuel-core/lib/shared.js | 31 ++++++++---- .../advanced-logging/src/main.sw | 8 +--- .../call-test-contract/src/main.sw | 2 +- .../configurable-contract/src/main.sw | 6 +-- .../forc-projects/liquidity-pool/src/main.sw | 2 +- .../multi-token-contract/src/main.sw | 2 +- .../predicate-vector-types/src/main.sw | 23 ++++----- .../forc-projects/revert-error/src/main.sw | 6 +-- .../forc-projects/token_abi/src/main.sw | 2 +- .../forc-projects/token_contract/src/main.sw | 2 +- .../vector-types-contract/src/main.sw | 39 +++++---------- .../vector-types-script/src/main.sw | 48 +++++++------------ packages/fuels/test/features/build.test.ts | 2 +- packages/fuels/test/features/deploy.test.ts | 2 +- .../call-test-script/src/main.sw | 2 +- packages/transactions/src/configs.ts | 2 +- .../versions/src/lib/getBuiltinVersions.ts | 2 +- 27 files changed, 167 insertions(+), 160 deletions(-) create mode 100644 .changeset/witty-hounds-work.md diff --git a/.changeset/witty-hounds-work.md b/.changeset/witty-hounds-work.md new file mode 100644 index 00000000000..b8b20e137d2 --- /dev/null +++ b/.changeset/witty-hounds-work.md @@ -0,0 +1,11 @@ +--- +"@fuel-ts/abi-typegen": patch +"@fuel-ts/forc": patch +"@fuel-ts/fuel-core": patch +"fuels": patch +"@fuel-ts/script": patch +"@fuel-ts/transactions": patch +"@fuel-ts/versions": patch +--- + +Upgrading `forc` to `0.49.2` diff --git a/.github/actions/ci-setup/action.yaml b/.github/actions/ci-setup/action.yaml index d1e6a3b8cae..376f20c2016 100644 --- a/.github/actions/ci-setup/action.yaml +++ b/.github/actions/ci-setup/action.yaml @@ -22,6 +22,7 @@ runs: apps/docs/.typedoc apps/docs/src/api packages/providers/src/__generated__ + templates/src/sway-api key: ${{ runner.os }}-generated-${{ github.sha }} - name: Cache Build @@ -37,6 +38,7 @@ runs: apps/docs/.typedoc apps/docs/src/api packages/providers/src/__generated__ + templates/src/sway-api key: ${{ runner.os }}-generated-${{ github.sha }} - name: Setup Node.js diff --git a/apps/docs-snippets/test/fixtures/forc-projects/liquidity-pool/src/main.sw b/apps/docs-snippets/test/fixtures/forc-projects/liquidity-pool/src/main.sw index 3f4a16b7614..db56c7f5311 100644 --- a/apps/docs-snippets/test/fixtures/forc-projects/liquidity-pool/src/main.sw +++ b/apps/docs-snippets/test/fixtures/forc-projects/liquidity-pool/src/main.sw @@ -2,14 +2,14 @@ contract; use std::{ + asset::{ + mint_to_address, + transfer_to_address, + }, call_frames::{ msg_asset_id, }, context::msg_amount, - token::{ - mint_to_address, - transfer_to_address, - }, }; use std::constants::ZERO_B256; @@ -20,9 +20,7 @@ abi LiquidityPool { fn withdraw(recipient: Address); } -const BASE_TOKEN: AssetId = AssetId::from( - 0x0000000000000000000000000000000000000000000000000000000000000000, -); +const BASE_TOKEN: AssetId = AssetId::from(0x0000000000000000000000000000000000000000000000000000000000000000); impl LiquidityPool for Contract { #[payable] diff --git a/apps/docs-snippets/test/fixtures/forc-projects/script-transfer-to-contract/src/main.sw b/apps/docs-snippets/test/fixtures/forc-projects/script-transfer-to-contract/src/main.sw index 64896ef70f9..8e7ca6bfd9b 100644 --- a/apps/docs-snippets/test/fixtures/forc-projects/script-transfer-to-contract/src/main.sw +++ b/apps/docs-snippets/test/fixtures/forc-projects/script-transfer-to-contract/src/main.sw @@ -1,7 +1,7 @@ // #region custom-transactions-1 script; -use std::token::force_transfer_to_contract; +use std::asset::force_transfer_to_contract; fn main( contract_address: b256, diff --git a/apps/docs-snippets/test/fixtures/forc-projects/transfer-to-address/src/main.sw b/apps/docs-snippets/test/fixtures/forc-projects/transfer-to-address/src/main.sw index 0e2c22d764a..126b69cf201 100644 --- a/apps/docs-snippets/test/fixtures/forc-projects/transfer-to-address/src/main.sw +++ b/apps/docs-snippets/test/fixtures/forc-projects/transfer-to-address/src/main.sw @@ -1,7 +1,7 @@ // #region contract-balance-2 contract; -use std::token::transfer_to_address; +use std::asset::transfer_to_address; abi TransferToAddress { #[payable] diff --git a/packages/abi-typegen/test/fixtures/forc-projects/full/src/main.sw b/packages/abi-typegen/test/fixtures/forc-projects/full/src/main.sw index 1cb3dbffd10..3499e5d942a 100644 --- a/packages/abi-typegen/test/fixtures/forc-projects/full/src/main.sw +++ b/packages/abi-typegen/test/fixtures/forc-projects/full/src/main.sw @@ -105,9 +105,7 @@ impl MyContract for Contract { x } fn types_evm_address(x: EvmAddress) -> EvmAddress { - EvmAddress::from( - 0x0606060606060606060606060606060606060606060606060606060606060606, - ) + EvmAddress::from(0x0606060606060606060606060606060606060606060606060606060606060606) } fn types_bytes(x: Bytes) -> Bytes { x diff --git a/packages/forc/VERSION b/packages/forc/VERSION index cffa44cf335..20f65730fee 100644 --- a/packages/forc/VERSION +++ b/packages/forc/VERSION @@ -1 +1 @@ -0.48.1 +0.49.2 diff --git a/packages/forc/lib/install.js b/packages/forc/lib/install.js index 5d2f031ffab..84e36fc32c4 100755 --- a/packages/forc/lib/install.js +++ b/packages/forc/lib/install.js @@ -21,13 +21,6 @@ import { const pkgPlatform = getPkgPlatform(); const forcVersion = await getCurrentVersion(); - // If a git branch is specified in the VERSION file, build from that branch - if (isGitBranch(forcVersion)) { - const branchName = forcVersion.split(':')[1]; - buildFromGitBranch(branchName); - return; - } - const pkgName = `forc-binaries-${pkgPlatform}.tar.gz`; const pkgUrl = `https://github.com/FuelLabs/sway/releases/download/v${forcVersion}/${pkgName}`; @@ -35,6 +28,7 @@ import { const binDir = join(__dirname, '../'); const binPath = join(binDir, 'forc-binaries', 'forc'); + let versionMatches = false; if (existsSync(binPath)) { @@ -42,18 +36,36 @@ import { const binVersion = binRawVersion.match(/([.0-9]+)/)?.[0]; versionMatches = binVersion === forcVersion; - info({ expected: forcVersion, received: binVersion }); + info({ + expected: forcVersion, + received: binVersion, + isGitBranch: isGitBranch(forcVersion), + }); } if (versionMatches) { info(`Forc binary already installed, skipping.`); } else { - // Download + // If a git branch is specified in the VERSION file, build from that branch + if (isGitBranch(forcVersion)) { + const branchName = forcVersion.split(':')[1]; + buildFromGitBranch(branchName); + return; + } + + const stdioOpts = { stdio: 'inherit' }; + + // Otherwise, download const buf = await fetch(pkgUrl).then((r) => r.buffer()); + + if (/not found/i.test(buf.toString())) { + throw new Error(`Version '${forcVersion}' not found\n at ${pkgUrl}`); + } + writeFileSync(pkgPath, buf); // Extract - execSync(`tar xzf "${pkgPath}" -C "${binDir}"`); + execSync(`tar xzf "${pkgPath}" -C "${binDir}"`, stdioOpts); // Cleanup rmSync(pkgPath); diff --git a/packages/forc/lib/shared.js b/packages/forc/lib/shared.js index 23280bb14ed..3ce890181e6 100644 --- a/packages/forc/lib/shared.js +++ b/packages/forc/lib/shared.js @@ -1,12 +1,13 @@ import { execSync } from 'child_process'; -import { cpSync, mkdirSync, rmSync, readFileSync, writeFileSync } from 'fs'; +import { cpSync, mkdirSync, rmSync, readFileSync, writeFileSync, existsSync } from 'fs'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; // eslint-disable-next-line @typescript-eslint/naming-convention export const __dirname = dirname(fileURLToPath(import.meta.url)); -export const binPath = join(__dirname, '../forc-binaries/forc'); +export const forcBinDirPath = join(__dirname, '..', 'forc-binaries'); +export const binPath = join(forcBinDirPath, 'forc'); const platforms = { darwin: { @@ -50,18 +51,29 @@ export const isGitBranch = (versionFileContents) => versionFileContents.indexOf( const swayRepoUrl = 'https://github.com/fuellabs/sway.git'; export const buildFromGitBranch = (branchName) => { - rmSync('sway-repo', { recursive: true, force: true }); - rmSync('forc-binaries', { recursive: true, force: true }); - execSync(`git clone --branch ${branchName} ${swayRepoUrl} sway-repo`); - execSync(`cd sway-repo && cargo build`); - mkdirSync('forc-binaries'); - cpSync('sway-repo/target/debug/forc', 'forc-binaries'); - cpSync('sway-repo/target/debug/forc-deploy', 'forc-binaries'); - cpSync('sway-repo/target/debug/forc-doc', 'forc-binaries'); - cpSync('sway-repo/target/debug/forc-fmt', 'forc-binaries'); - cpSync('sway-repo/target/debug/forc-lsp', 'forc-binaries'); - cpSync('sway-repo/target/debug/forc-run', 'forc-binaries'); - cpSync('sway-repo/target/debug/forc-submit', 'forc-binaries'); - cpSync('sway-repo/target/debug/forc-tx', 'forc-binaries'); - rmSync('sway-repo', { recursive: true, force: true }); + const swayRepoDir = join(__dirname, '..', 'sway-repo'); + const swayRepoDebugDir = join(swayRepoDir, 'target', 'debug'); + const stdioOpts = { stdio: 'inherit' }; + + if (existsSync(swayRepoDir)) { + execSync(`cd ${swayRepoDir} && git fetch origin && git checkout ${branchName}`, stdioOpts); + execSync(`cd ${swayRepoDir} && cargo build`, stdioOpts); + } else { + execSync(`git clone --branch ${branchName} ${swayRepoUrl} ${swayRepoDir}`, stdioOpts); + execSync(`cd ${swayRepoDir} && cargo build`, stdioOpts); + } + + const [from, to] = [swayRepoDebugDir, forcBinDirPath]; + + rmSync(to, { recursive: true, force: true }); + mkdirSync(to, { recursive: true }); + + cpSync(join(from, 'forc'), join(to, 'forc')); + cpSync(join(from, 'forc-deploy'), join(to, 'forc-deploy')); + cpSync(join(from, 'forc-doc'), join(to, 'forc-doc')); + cpSync(join(from, 'forc-fmt'), join(to, 'forc-fmt')); + cpSync(join(from, 'forc-lsp'), join(to, 'forc-lsp')); + cpSync(join(from, 'forc-run'), join(to, 'forc-run')); + cpSync(join(from, 'forc-submit'), join(to, 'forc-submit')); + cpSync(join(from, 'forc-tx'), join(to, 'forc-tx')); }; diff --git a/packages/fuel-core/lib/install.js b/packages/fuel-core/lib/install.js index 40ae451a84d..8fca329d3b5 100755 --- a/packages/fuel-core/lib/install.js +++ b/packages/fuel-core/lib/install.js @@ -21,13 +21,6 @@ import { const pkgPlatform = getPkgPlatform(); const fuelCoreVersion = await getCurrentVersion(); - // If a git branch is specified in the VERSION file, build from that branch - if (isGitBranch(fuelCoreVersion)) { - const branchName = fuelCoreVersion.split(':')[1]; - buildFromGitBranch(branchName); - return; - } - const fileName = `fuel-core-${fuelCoreVersion}-${pkgPlatform}`; const pkgName = `${fileName}.tar.gz`; const pkgUrl = `https://github.com/FuelLabs/fuel-core/releases/download/v${fuelCoreVersion}/${pkgName}`; @@ -44,25 +37,33 @@ import { const binVersion = binRawVersion.match(/([.0-9]+)/)?.[0]; versionMatches = binVersion === fuelCoreVersion; - info({ expected: fuelCoreVersion, received: binVersion }); + info({ + expected: fuelCoreVersion, + received: binVersion, + isGitBranch: isGitBranch(fuelCoreVersion), + }); } if (versionMatches) { info(`fuel-core binary already installed, skipping.`); } else { - // Empty the `fuel-core-binaries` directory if it exists - if (existsSync(binDir)) { - rmSync(`${binDir}/*`, { - recursive: true, - force: true, - }); - } else { - // Create the `fuel-core-binaries` directory if it doesn't exist - mkdirSync(binDir); + // If a git branch is specified in the VERSION file, build from that branch + if (isGitBranch(fuelCoreVersion)) { + const branchName = fuelCoreVersion.split(':')[1]; + buildFromGitBranch(branchName); + return; } + // Empty the `fuel-core-binaries` directory if it exists + rmSync(binDir, { recursive: true, force: true }); + // Download const buf = await fetch(pkgUrl).then((r) => r.buffer()); + + if (/not found/i.test(buf.toString())) { + throw new Error(`Version '${fuelCoreVersion}' not found\n at ${pkgUrl}`); + } + writeFileSync(pkgPath, buf); // Extract diff --git a/packages/fuel-core/lib/shared.js b/packages/fuel-core/lib/shared.js index d4d184f8783..5e11c83708e 100644 --- a/packages/fuel-core/lib/shared.js +++ b/packages/fuel-core/lib/shared.js @@ -1,12 +1,13 @@ import { execSync } from 'child_process'; -import { cpSync, mkdirSync, rmSync, readFileSync, writeFileSync } from 'fs'; +import { cpSync, mkdirSync, rmSync, readFileSync, writeFileSync, existsSync } from 'fs'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; // eslint-disable-next-line @typescript-eslint/naming-convention export const __dirname = dirname(fileURLToPath(import.meta.url)); -export const binPath = join(__dirname, '../fuel-core-binaries/fuel-core'); +export const fuelCoreBinDirPath = join(__dirname, '..', 'fuel-core-binaries'); +export const binPath = join(fuelCoreBinDirPath, 'fuel-core'); const platforms = { darwin: { @@ -49,11 +50,23 @@ export const isGitBranch = (versionFileContents) => versionFileContents.indexOf( const fuelCoreRepoUrl = 'https://github.com/fuellabs/fuel-core.git'; export const buildFromGitBranch = (branchName) => { - rmSync('fuel-core-repo', { recursive: true, force: true }); - rmSync('fuel-core-binaries', { recursive: true, force: true }); - execSync(`git clone --branch ${branchName} ${fuelCoreRepoUrl} fuel-core-repo`, { silent: true }); - execSync(`cd fuel-core-repo && cargo build`, { silent: true }); - mkdirSync('fuel-core-binaries'); - cpSync('fuel-core-repo/target/debug/fuel-core', 'fuel-core-binaries/fuel-core'); - rmSync('fuel-core-repo', { recursive: true, force: true }); + const fuelCoreRepoDir = join(__dirname, '..', 'fuel-core-repo'); + const fuelCoreRepoDebugDir = join(fuelCoreRepoDir, 'target', 'debug'); + const stdioOpts = { stdio: 'inherit' }; + + if (existsSync(fuelCoreRepoDir)) { + execSync(`cd ${fuelCoreRepoDir} && git pull && git checkout ${branchName}`, stdioOpts); + execSync(`cd ${fuelCoreRepoDir} && cargo build`, stdioOpts); + } else { + execSync(`git clone --branch ${branchName} ${fuelCoreRepoUrl} ${fuelCoreRepoDir}`, stdioOpts); + execSync(`cd ${fuelCoreRepoDir} && cargo build`, stdioOpts); + } + + const [from, to] = [fuelCoreRepoDebugDir, fuelCoreBinDirPath]; + + rmSync(to, { recursive: true, force: true }); + mkdirSync(to, { recursive: true }); + + mkdirSync(join(from, 'fuel-core'), join(to, 'fuel-core')); + cpSync(join(from, 'fuel-core'), join(to, 'fuel-core')); }; diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/advanced-logging/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/advanced-logging/src/main.sw index 9210634b59c..cbba7e2a8f2 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/advanced-logging/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/advanced-logging/src/main.sw @@ -45,9 +45,7 @@ impl AdvancedLogging for Contract { ammo: 10, game_id: 10_11_12u64, state: GameState::Playing(1), - contract_Id: ContractId::from( - 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF, - ), + contract_Id: ContractId::from(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF), difficulty: Difficulty::Medium(true), }; @@ -95,9 +93,7 @@ impl AdvancedLogging for Contract { ammo: 10, game_id: 10_11_12u64, state: GameState::Playing(1), - contract_Id: ContractId::from( - 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF, - ), + contract_Id: ContractId::from(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF), difficulty: Difficulty::Medium(true), }; require(a == b, game_ref); diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/call-test-contract/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/call-test-contract/src/main.sw index b3878aa19bf..bf13595f5cb 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/call-test-contract/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/call-test-contract/src/main.sw @@ -78,7 +78,7 @@ impl TestContract for Contract { value + 1 } fn call_external_foo(param: u64, contract_id: b256) -> u64 { - let external_contract = abi(TestContract, contract_id().into()); + let external_contract = abi(TestContract, contract_id); let response = external_contract.foo(param); response + 1 } diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/configurable-contract/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/configurable-contract/src/main.sw index 6bee36141d6..e34d64c453a 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/configurable-contract/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/configurable-contract/src/main.sw @@ -90,10 +90,6 @@ impl ConfigurableContract for Contract { } fn echo_configurables() -> (u8, u16, u32, u64, bool, b256, Colors, [[u32; 2]; 2], str[4], (u8, bool, str[2]), Struct1) { - ( - U8, - U16, U32, U64, BOOL, B256, ENUM, ARRAY, STR_4, TUPLE, - STRUCT_1, - ) + (U8, U16, U32, U64, BOOL, B256, ENUM, ARRAY, STR_4, TUPLE, STRUCT_1) } } diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/liquidity-pool/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/liquidity-pool/src/main.sw index 87094659732..9c8f8ad6ea2 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/liquidity-pool/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/liquidity-pool/src/main.sw @@ -9,7 +9,7 @@ use std::{ msg_asset_id, }, context::msg_amount, - token::{ + asset::{ mint_to_address, transfer_to_address, }, diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/multi-token-contract/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/multi-token-contract/src/main.sw index b4874384a89..f5761113960 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/multi-token-contract/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/multi-token-contract/src/main.sw @@ -2,10 +2,10 @@ contract; use std::{ address::Address, + asset::*, context::balance_of, context::msg_amount, contract_id::ContractId, - token::*, }; use std::constants::ZERO_B256; diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/predicate-vector-types/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/predicate-vector-types/src/main.sw index 00185c0e659..792ad41c1ea 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/predicate-vector-types/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/predicate-vector-types/src/main.sw @@ -25,11 +25,7 @@ fn main( result = result && (u32_vec.get(1).unwrap() == 1u32); - result = result && (vec_in_vec - .get(0) - .unwrap() - .get(1) - .unwrap() == 1u32); + result = result && (vec_in_vec.get(0).unwrap().get(1).unwrap() == 1u32); result = result && (struct_in_vec.get(0).unwrap().a == 0u32); @@ -58,14 +54,15 @@ fn main( let (tuple_a, tuple_b) = vec_in_tuple; result = result && (tuple_a.get(1).unwrap() == 1u32); - result = result && (vec_in_a_vec_in_a_struct_in_a_vec - .get(1) - .unwrap() - .a - .get(1) - .unwrap() - .get(1) - .unwrap() == 10u32); + result = result + && (vec_in_a_vec_in_a_struct_in_a_vec + .get(1) + .unwrap() + .a + .get(1) + .unwrap() + .get(1) + .unwrap() == 10u32); result } diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/revert-error/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/revert-error/src/main.sw index 2aa919fe2b5..f41a64f8d76 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/revert-error/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/revert-error/src/main.sw @@ -1,15 +1,15 @@ contract; use std::{ + asset::{ + transfer_to_address, + }, bytes::Bytes, constants::BASE_ASSET_ID, logging::log, message::{ send_message, }, - token::{ - transfer_to_address, - }, }; use custom_errors::{AccessError, InputError}; diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/token_abi/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/token_abi/src/main.sw index a0eec4d0aff..4fab0a48e2c 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/token_abi/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/token_abi/src/main.sw @@ -1,6 +1,6 @@ library; -use std::{address::Address, contract_id::ContractId, token::*}; +use std::{address::Address, asset::*, contract_id::ContractId}; abi Token { fn mint_coins(mint_amount: u64); diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/token_contract/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/token_contract/src/main.sw index dc02e6e71ca..11751fc7204 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/token_contract/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/token_contract/src/main.sw @@ -1,7 +1,7 @@ // #region token-contract contract; -use std::{context::balance_of, context::msg_amount, token::*}; +use std::{asset::*, context::balance_of, context::msg_amount}; use token_abi::Token; use std::constants::ZERO_B256; diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/vector-types-contract/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/vector-types-contract/src/main.sw index 4b7bd580697..27018143ea5 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/vector-types-contract/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/vector-types-contract/src/main.sw @@ -248,19 +248,15 @@ impl MyContract for Contract { } { let mut exp_vec_in_vec = Vec::new(); - exp_vec_in_vec - .push(vec_from([0, 1, 2])); - exp_vec_in_vec - .push(vec_from([0, 1, 2])); + exp_vec_in_vec.push(vec_from([0, 1, 2])); + exp_vec_in_vec.push(vec_from([0, 1, 2])); require(vec_in_vec == exp_vec_in_vec, "vec_in_vec err"); } { let mut exp_struct_in_vec = Vec::new(); - exp_struct_in_vec - .push(SomeStruct { a: 0u32 }); - exp_struct_in_vec - .push(SomeStruct { a: 1u32 }); + exp_struct_in_vec.push(SomeStruct { a: 0u32 }); + exp_struct_in_vec.push(SomeStruct { a: 1u32 }); require(struct_in_vec == exp_struct_in_vec, "struct_in_vec err"); } @@ -273,10 +269,8 @@ impl MyContract for Contract { } { let mut exp_array_in_vec = Vec::new(); - exp_array_in_vec - .push([0, 1]); - exp_array_in_vec - .push([0, 1]); + exp_array_in_vec.push([0, 1]); + exp_array_in_vec.push([0, 1]); require(array_in_vec == exp_array_in_vec, "array_in_vec err"); } @@ -293,19 +287,15 @@ impl MyContract for Contract { } { let mut exp_enum_in_vec = Vec::new(); - exp_enum_in_vec - .push(SomeEnum::a(0)); - exp_enum_in_vec - .push(SomeEnum::a(1)); + exp_enum_in_vec.push(SomeEnum::a(0)); + exp_enum_in_vec.push(SomeEnum::a(1)); require(enum_in_vec == exp_enum_in_vec, "enum_in_vec err"); } { let mut exp_tuple_in_vec = Vec::new(); - exp_tuple_in_vec - .push((0, 0)); - exp_tuple_in_vec - .push((1, 1)); + exp_tuple_in_vec.push((0, 0)); + exp_tuple_in_vec.push((1, 1)); require(tuple_in_vec == exp_tuple_in_vec, "tuple_in_vec err"); } @@ -320,15 +310,12 @@ impl MyContract for Contract { let mut inner_vec_1 = Vec::new(); let inner_inner_vec_1 = vec_from([0, 1, 2]); - inner_vec_1 - .push(inner_inner_vec_1); + inner_vec_1.push(inner_inner_vec_1); let inner_inner_vec_2 = vec_from([3, 4, 5]); - inner_vec_1 - .push(inner_inner_vec_2); + inner_vec_1.push(inner_inner_vec_2); - exp_vec_in_a_vec_in_a_struct_in_a_vec - .push(SomeStruct { a: inner_vec_1 }); + exp_vec_in_a_vec_in_a_struct_in_a_vec.push(SomeStruct { a: inner_vec_1 }); let mut inner_vec_2 = Vec::new(); diff --git a/packages/fuel-gauge/test/fixtures/forc-projects/vector-types-script/src/main.sw b/packages/fuel-gauge/test/fixtures/forc-projects/vector-types-script/src/main.sw index b6a8d740bfd..1db2f241a64 100644 --- a/packages/fuel-gauge/test/fixtures/forc-projects/vector-types-script/src/main.sw +++ b/packages/fuel-gauge/test/fixtures/forc-projects/vector-types-script/src/main.sw @@ -231,19 +231,15 @@ fn main( } { let mut exp_vec_in_vec = Vec::new(); - exp_vec_in_vec - .push(vec_from([0, 1, 2])); - exp_vec_in_vec - .push(vec_from([0, 1, 2])); + exp_vec_in_vec.push(vec_from([0, 1, 2])); + exp_vec_in_vec.push(vec_from([0, 1, 2])); require(vec_in_vec == exp_vec_in_vec, "vec_in_vec err"); } { let mut exp_struct_in_vec = Vec::new(); - exp_struct_in_vec - .push(SomeStruct { a: 0u32 }); - exp_struct_in_vec - .push(SomeStruct { a: 1u32 }); + exp_struct_in_vec.push(SomeStruct { a: 0u32 }); + exp_struct_in_vec.push(SomeStruct { a: 1u32 }); require(struct_in_vec == exp_struct_in_vec, "struct_in_vec err"); } @@ -256,10 +252,8 @@ fn main( } { let mut exp_array_in_vec = Vec::new(); - exp_array_in_vec - .push([0, 1]); - exp_array_in_vec - .push([0, 1]); + exp_array_in_vec.push([0, 1]); + exp_array_in_vec.push([0, 1]); require(array_in_vec == exp_array_in_vec, "array_in_vec err"); } @@ -276,19 +270,15 @@ fn main( } { let mut exp_enum_in_vec = Vec::new(); - exp_enum_in_vec - .push(SomeEnum::a(0)); - exp_enum_in_vec - .push(SomeEnum::a(1)); + exp_enum_in_vec.push(SomeEnum::a(0)); + exp_enum_in_vec.push(SomeEnum::a(1)); require(enum_in_vec == exp_enum_in_vec, "enum_in_vec err"); } { let mut exp_tuple_in_vec = Vec::new(); - exp_tuple_in_vec - .push((0, 0)); - exp_tuple_in_vec - .push((1, 1)); + exp_tuple_in_vec.push((0, 0)); + exp_tuple_in_vec.push((1, 1)); require(tuple_in_vec == exp_tuple_in_vec, "tuple_in_vec err"); } @@ -303,28 +293,22 @@ fn main( let mut inner_vec_1 = Vec::new(); let inner_inner_vec_1 = vec_from([0, 1, 2]); - inner_vec_1 - .push(inner_inner_vec_1); + inner_vec_1.push(inner_inner_vec_1); let inner_inner_vec_2 = vec_from([3, 4, 5]); - inner_vec_1 - .push(inner_inner_vec_2); + inner_vec_1.push(inner_inner_vec_2); - exp_vec_in_a_vec_in_a_struct_in_a_vec - .push(SomeStruct { a: inner_vec_1 }); + exp_vec_in_a_vec_in_a_struct_in_a_vec.push(SomeStruct { a: inner_vec_1 }); let mut inner_vec_2 = Vec::new(); let inner_inner_vec_3 = vec_from([6, 7, 8]); - inner_vec_2 - .push(inner_inner_vec_3); + inner_vec_2.push(inner_inner_vec_3); let inner_inner_vec_4 = vec_from([9, 10, 11]); - inner_vec_2 - .push(inner_inner_vec_4); + inner_vec_2.push(inner_inner_vec_4); - exp_vec_in_a_vec_in_a_struct_in_a_vec - .push(SomeStruct { a: inner_vec_2 }); + exp_vec_in_a_vec_in_a_struct_in_a_vec.push(SomeStruct { a: inner_vec_2 }); require( vec_in_a_vec_in_a_struct_in_a_vec == exp_vec_in_a_vec_in_a_struct_in_a_vec, diff --git a/packages/fuels/test/features/build.test.ts b/packages/fuels/test/features/build.test.ts index 1d45516959d..01ec4e186cc 100644 --- a/packages/fuels/test/features/build.test.ts +++ b/packages/fuels/test/features/build.test.ts @@ -111,5 +111,5 @@ describe( expect(killChildProcess).toHaveBeenCalledTimes(1); }); }, - { timeout: 10000 } + { timeout: 180000 } ); diff --git a/packages/fuels/test/features/deploy.test.ts b/packages/fuels/test/features/deploy.test.ts index 4d4bc74af8d..444c46b0214 100644 --- a/packages/fuels/test/features/deploy.test.ts +++ b/packages/fuels/test/features/deploy.test.ts @@ -42,5 +42,5 @@ describe( expect(fuelsContents.fooBar).toMatch(/0x/); }); }, - { timeout: 15000 } + { timeout: 180000 } ); diff --git a/packages/script/test/fixtures/forc-projects/call-test-script/src/main.sw b/packages/script/test/fixtures/forc-projects/call-test-script/src/main.sw index e7131afba44..421880956b4 100644 --- a/packages/script/test/fixtures/forc-projects/call-test-script/src/main.sw +++ b/packages/script/test/fixtures/forc-projects/call-test-script/src/main.sw @@ -2,7 +2,7 @@ script; fn log(v: T) { asm(r1: v) { - log r1 zero zero zero; + log r1 zero zero zero; } } diff --git a/packages/transactions/src/configs.ts b/packages/transactions/src/configs.ts index da06bb6adef..90b960eedaf 100644 --- a/packages/transactions/src/configs.ts +++ b/packages/transactions/src/configs.ts @@ -32,7 +32,7 @@ export const MAX_PREDICATE_DATA_LENGTH = 1024 * 1024; // Revert with this value for a failing call to `std::revert::require`. export const FAILED_REQUIRE_SIGNAL = '0xffffffffffff0000'; -// Revert with this value for a failing call to `std::token::transfer_to_address`. +// Revert with this value for a failing call to `std::asset::transfer_to_address`. export const FAILED_TRANSFER_TO_ADDRESS_SIGNAL = '0xffffffffffff0001'; // Revert with this value for a failing call to `std::message::send_message`. diff --git a/packages/versions/src/lib/getBuiltinVersions.ts b/packages/versions/src/lib/getBuiltinVersions.ts index fd81156542d..56de22d7f3e 100644 --- a/packages/versions/src/lib/getBuiltinVersions.ts +++ b/packages/versions/src/lib/getBuiltinVersions.ts @@ -1,6 +1,6 @@ export function getBuiltinVersions() { return { - FORC: '0.48.1', + FORC: '0.49.2', FUEL_CORE: '0.22.0', FUELS: '0.72.0', };