Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: upgrade forc to 0.56.0 #2180

Merged
merged 19 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/chatty-teachers-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@fuel-ts/abi-typegen": minor
"@fuel-ts/abi-coder": minor
"@fuel-ts/versions": minor
"@fuel-ts/script": minor
"@fuel-ts/utils": minor
"@fuel-ts/forc": minor
---

chore!: upgrade `forc` to `0.56.0`
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The [documentation](https://docs.fuel.network/docs/fuels-ts/) site is your main
- [Contracts](https://docs.fuel.network/docs/fuels-ts/contracts/)
- [Scripts](https://docs.fuel.network/docs/fuels-ts/scripts/)
- [Predicates](https://docs.fuel.network/docs/fuels-ts/predicates/)
- [ABI Typegen](https://docs.fuel.network/docs/fuels-ts/typegen/)
- [ABI Typegen](https://docs.fuel.network/docs/fuels-ts/fuels-cli/abi-typegen/)
- [Contributing](https://github.com/FuelLabs/fuels-ts/blob/master/CONTRIBUTING.md)
- [The Fuel Forum](https://forum.fuel.network/)
- [The Fuel Ecosystem](#the-fuel-ecosystem)
Expand Down
6 changes: 3 additions & 3 deletions apps/demo-typegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"scripts": {
"pretest": "run-s build:forc build:types",
"build:forc": "run-p forc:*",
"forc:contract": "pnpm fuels-forc build -p contract --release --experimental-new-encoding",
"forc:script": "pnpm fuels-forc build -p script --release --experimental-new-encoding",
"forc:predicate": "pnpm fuels-forc build -p predicate --release --experimental-new-encoding",
"forc:contract": "pnpm fuels-forc build -p contract --release",
"forc:script": "pnpm fuels-forc build -p script --release",
"forc:predicate": "pnpm fuels-forc build -p predicate --release",
"build:types": "run-p types:*",
"types:contract": "pnpm fuels typegen -i contract/out/release/demo-contract-abi.json -o src/contract-types",
"types:script": "pnpm fuels typegen -i script/out/release/script-abi.json -o src/script-types --script",
Expand Down
2 changes: 1 addition & 1 deletion apps/docs-snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"scripts": {
"pretest": "pnpm build:forc",
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release --experimental-new-encoding"
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release"
},
"devDependencies": {
"@fuel-ts/account": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('Transaction Request', () => {
// #endregion transaction-request-7

expect(transactionId).toBe(
'0x6a9901970ce4d7a43f10f4a95b8e1ecf07be35993dc6e41547d000ee74465a0a'
'0x09274de739e2a53a815799b4c7fa93359eaf4befee0b26be04a7a6283bbeb127'
);
});
});
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
// #region deposit-and-withdraw-cookbook-1
contract;

use std::{
asset::{
mint_to_address,
transfer_to_address,
},
call_frames::{
msg_asset_id,
},
context::msg_amount,
};
use std::{asset::{mint_to, transfer,}, call_frames::{msg_asset_id,}, context::msg_amount,};
use std::constants::ZERO_B256;

abi LiquidityPool {
Expand All @@ -32,7 +23,7 @@ impl LiquidityPool for Contract {
let amount_to_mint = msg_amount() * 2;

// Mint some LP token based upon the amount of the base token.
mint_to_address(recipient, ZERO_B256, amount_to_mint);
mint_to(Identity::Address(recipient), ZERO_B256, amount_to_mint);
}

#[payable]
Expand All @@ -43,7 +34,7 @@ impl LiquidityPool for Contract {
let amount_to_transfer = msg_amount() / 2;

// Transfer base token to recipient.
transfer_to_address(recipient, BASE_TOKEN, amount_to_transfer);
transfer(Identity::Address(recipient), BASE_TOKEN, amount_to_transfer);
}
}
// #endregion deposit-and-withdraw-cookbook-1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// #region custom-transactions-1
script;

use std::asset::force_transfer_to_contract;
use std::asset::transfer;

fn main(
contract_address: b256,
Expand All @@ -11,9 +11,9 @@ fn main(
amount_asset_b: u64,
) -> bool {
let wrapped_contract = ContractId::from(contract_address);

force_transfer_to_contract(wrapped_contract, asset_a, amount_asset_a);
force_transfer_to_contract(wrapped_contract, asset_b, amount_asset_b);
let contract_id = Identity::ContractId(wrapped_contract);
transfer(contract_id, asset_a, amount_asset_a);
transfer(contract_id, asset_b, amount_asset_b);
true
}
// #endregion custom-transactions-1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
contract;

use std::asset::{burn, force_transfer_to_contract, mint, transfer_to_address,};
use std::asset::{burn, mint, transfer};

abi Token {
fn transfer_to_address(target: Address, asset_id: AssetId, coins: u64);
Expand All @@ -12,11 +12,11 @@ abi Token {
impl Token for Contract {
// #region variable-outputs-1
fn transfer_to_address(recipient: Address, asset_id: AssetId, amount: u64) {
transfer_to_address(recipient, asset_id, amount);
transfer(Identity::Address(recipient), asset_id, amount);
}

fn transfer_to_contract(target: ContractId, asset_id: AssetId, amount: u64) {
force_transfer_to_contract(target, asset_id, amount);
transfer(Identity::ContractId(target), asset_id, amount);
}
// #endregion variable-outputs-1
fn mint_coins(sub_id: b256, mint_amount: u64) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// #region contract-balance-2
contract;

use std::asset::transfer_to_address;
use std::asset::transfer;

abi TransferToAddress {
#[payable]
Expand All @@ -13,7 +13,11 @@ impl TransferToAddress for Contract {
fn transfer(amount_to_transfer: u64, asset_id: AssetId, recipient: b256) {
let recipient_address = Address::from(recipient);

transfer_to_address(recipient_address, asset_id, amount_to_transfer);
transfer(
Identity::Address(recipient_address),
asset_id,
amount_to_transfer,
);
}
}
// #endregion contract-balance-2
2 changes: 1 addition & 1 deletion packages/abi-coder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
"scripts": {
"pretest": "pnpm build:forc",
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release --experimental-new-encoding",
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release",
"build": "tsup",
"postbuild": "tsx ../../scripts/postbuild.ts"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-typegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ See the full ABI-spec [here](https://github.com/FuelLabs/fuel-specs/blob/master/

## Documentation

See [Fuels-ts Documentation](https://docs.fuel.network/docs/fuels-ts/typegen/)
See [Fuels-ts Documentation](https://docs.fuel.network/docs/fuels-ts/fuels-cli/abi-typegen/)

## Installation

Expand Down
2 changes: 1 addition & 1 deletion packages/abi-typegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"scripts": {
"pretest": "pnpm build:forc",
"build": "tsup",
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release --experimental-new-encoding",
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release",
"postbuild": "tsx ../../scripts/postbuild.ts"
},
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
Fuel-Core version: 33.33.33
*/

export default '0x1af030007400000200000000000003a85dffc00110ffff00740000001aec5000910001485d43f009104103001a4460005d4d10491b441000104934405d47f002104404405d4920001b44144010453440504fb0205fed10045fed20055047b13872500010284535005047b138504fb05072500010284d15005d453000504fb0105fed10025fed20035047b11872480010284534805047b1185fed00005d43f0035fed00015043b040724800102843b480504bb0a0724c0010284914c01ae9200020f8330058fbe00250fbe004740000721a4bd000504fb0b072500010284d05001ae9300020f8330058fbe00250fbe004740000691a4fd000134924c0134920001a4c00007648001c504bb0d0724c0010284914c01ae9200020f8330058fbe00250fbe0047400006c1a4bd000504fb0e072500010284d05001ae9300020f8330058fbe00250fbe004740000631a43d000504fb0c072500010284d15001ae9300020f8330058fbe00250fbe0047400004a1a47d000294d2411764c0001740000441a4060005d41004a5fed001e5fec001f5043b0f05047b0801ae900001ae5100020f8330058fbe00250fbe0047400005a5047b0901ae900001ae5100020f8330058fbe00250fbe004740000535d43f005264000001a4070005fed00205d43f0055fed00215fec00225047b1005d43b0215d4bb02210492040154d0480764c0001134d0480764c00025d43f006364000005d4110005d4910021b481480104104801a4810005e4120005d411002104100405f4500025043b10050450010504bb030724c0008284904c050412008724c0008284114c05043b12872440010284124405043b1285047b06072480010284504805d4110005047b128504bb070724c0010284914c05d45200112451040254110005d43f0073640000095000007960800001aec5000910000101a43a0001a47e0007248001028ed04801a43b0005d4100011af50000920000101af9100098080000970000074af8000095000007960800001aec5000910000101a43a0001a47e0007248001028ed04801a43b0005d4100001af50000920000101af9100098080000970000074af800009500007f960800001aec5000910000301a43a0001a4790001a4be0005d4d00015d53f008104d35005d5100005d5500011b541540105145405fed40005d53f0085fed40011a53b0005057b02072580010285545805f4130015043b020504fb01072500010284d05005d413000724c0010284504c01af51000920000301af92000980800009700007f4af80000470000006d61696e000000000000000000000248000000000000000800000000000000040000000000000250000000000000040000000000075bcd15000000000000007b000000000000000a00000000000003a8'
export default '0x1af030007400000200000000000004405dffc00110ffff00740000001aec5000910001a85d43f009104103001a4460005d4d10491b441000104934405d47f002104404405d4920001b44144010453440504fb0205fed10045fed20055047b19872500010284535005047b198504fb08072500010284d15005d453000504fb0105fed10025fed20035047b17872480010284534805047b1785fed00005d43f0035fed00015043b058724800102843b480504bb0e8724c0010284914c01ae9200020f8330058fbe00250fbe004740000991a4bd000504fb0f872500010284d05001ae9300020f8330058fbe00250fbe004740000901a4fd000134924c0134920001a4c00007648001c504bb118724c0010284914c01ae9200020f8330058fbe00250fbe004740000931a4bd000504fb12872500010284d05001ae9300020f8330058fbe00250fbe0047400008a1a43d000504fb10872500010284d15001ae9300020f8330058fbe00250fbe004740000711a47d000294d2411764c00017400006b1a4060005d41004a5fed002a5fec002b5043b1505047b0c81ae900001ae5100020f8330058fbe00250fbe004740000815047b0d81ae900001ae5100020f8330058fbe00250fbe0047400007a5d43f005264000001a4070005fed002c5d43f0055fed002d5fec002e504fb1605d43b02c5d47b02d5d4bb02e10492040165114807650000113511480765000065043b0685fec000d5047b13872480018284504807400000d12492440104920401b49148026480000281d04401a4470005043b0305fec10065fed10075fed20085047b13872480018284504805043b0b072480018284114805d43b027134100007640000f5d43b01613410040764000025d43f006364000005043b0b0504100085047b0b0504510085045100872480008284d04805041300872480008284114805d4130005d4530021b441440104104401a4410005e4110005d413002104100405f4d00025043b16050450010504bb048724c0008284904c050412008724c0008284114c05043b18872440010284124405043b1885047b09072480010284504805d4110005047b188504bb0a0724c0010284914c05d45200112451040254110005d43f0073640000095000007960800001aec5000910000101a43a0001a47e0007248001028ed04801a43b0005d4100011af50000920000101af9100098080000970000074af8000095000007960800001aec5000910000101a43a0001a47e0007248001028ed04801a43b0005d4100001af50000920000101af9100098080000970000074af800009500007f960800001aec5000910000301a43a0001a4790001a4be0005d4d00015d53f008104d35005d5100005d5500011b541540105145405fed40005d53f0085fed40011a53b0005057b02072580010285545805f4130015043b020504fb01072500010284d05005d413000724c0010284504c01af51000920000301af92000980800009700007f4af800006d61696e0000000000000000000002480000000000000008000000000000000400000000000002500000000000000400cccccccccccc0002000000000000007b000000000000000a0000000000000440'
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const _abi = {
"type": 0,
"typeArguments": null
},
"offset": 348
"offset": 500
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/account/src/providers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This module contains common Provider classes and utility functions for connectin

## Documentation

See [Fuels-ts Documentation](https://docs.fuel.network/docs/fuels-ts/providers/)
See [Fuels-ts Documentation](https://docs.fuel.network/docs/fuels-ts/provider/)

## Usage

Expand Down
2 changes: 1 addition & 1 deletion packages/forc/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.55.0
0.56.0
4 changes: 2 additions & 2 deletions packages/fuel-gauge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"author": "Fuel Labs <contact@fuel.sh> (https://fuel.network/)",
"scripts": {
"pretest": "run-s build:forc build:forc-experimental build:process-predicates",
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release --experimental-new-encoding",
"build:forc-experimental": "pnpm fuels-forc build -p test/fixtures/forc-projects-experimental --release --experimental-new-encoding",
"build:forc": "pnpm fuels-forc build -p test/fixtures/forc-projects --release",
"build:forc-experimental": "pnpm fuels-forc build -p test/fixtures/forc-projects-experimental --release",
"build:process-predicates": "tsx ./scripts/process-predicates.ts"
},
"license": "Apache-2.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/fuel-gauge/scripts/process-predicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import { join } from 'path';

const projectsDir = join(__dirname, '../test/fixtures/forc-projects');

const files = readdirSync(projectsDir).filter((file) => file.includes('predicate-'));
const files = readdirSync(projectsDir).filter(
(file) =>
file.includes('predicate-') &&
// TODO @arboleya remove filter
!/input-data/.test(file)
);

const { log } = console;

Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-gauge/src/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ describe('Contract', () => {
FuelGaugeProjectsEnum.STORAGE_TEST_CONTRACT
);

const wallet = await generateTestWallet(provider, [[10_000, baseAssetId]]);
const wallet = await generateTestWallet(provider, [[50_000, baseAssetId]]);

const factory = new ContractFactory(binHexlified, abiContents, wallet);

Expand Down
12 changes: 6 additions & 6 deletions packages/fuel-gauge/src/dry-run-multiple-txs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,24 @@ describe('dry-run-multiple-txs', () => {
const revertFactory = new ContractFactory(binRevert, abiRevert, wallet);

const revertContract = await revertFactory.deployContract({
maxFee: 9000,
maxFee: 15000,
});

const multiTokenFactory = new ContractFactory(binMultiToken, abiMultiToken, wallet);

const multiTokenContract = await multiTokenFactory.deployContract({
maxFee: 9000,
maxFee: 15000,
});

const logFactory = new ContractFactory(binLog, abiLog, wallet);

const logContract = await logFactory.deployContract({
maxFee: 9000,
maxFee: 15000,
});
const logOtherFactory = new ContractFactory(binLogOther, abiLogOther, wallet);

const logOtherContract = await logOtherFactory.deployContract({
maxFee: 9000,
maxFee: 15000,
});

return { revertContract, multiTokenContract, logContract, logOtherContract };
Expand All @@ -75,7 +75,7 @@ describe('dry-run-multiple-txs', () => {
const revertFactory = new ContractFactory(binRevert, abiRevert, wallet);

const revertContract = await revertFactory.deployContract({
maxFee: 9000,
maxFee: 15000,
});

const resources = await wallet.getResourcesToSpend([[500_000, baseAssetId]]);
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('dry-run-multiple-txs', () => {
// request 1
const factory = new ContractFactory(binHexlified, abiContents, wallet);
const { transactionRequest: request1 } = factory.createTransactionRequest({
maxFee: 9000,
maxFee: 15000,
});

// request 2
Expand Down
8 changes: 4 additions & 4 deletions packages/fuel-gauge/src/policies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ describe('Policies', () => {

const txParams: CustomTxParams = {
tip: 11,
witnessLimit: randomNumber(800, 900),
maturity: randomNumber(1, 2),
maxFee: 1500,
witnessLimit: 2000,
maturity: 1,
maxFee: 5000,
};

const { transactionRequest: txRequest } = factory.createTransactionRequest(txParams);
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('Policies', () => {
tip: 2,
maturity: randomNumber(1, 2),
witnessLimit: randomNumber(800, 900),
maxFee: 2000,
maxFee: 2500,
});

const txRequest = await callScope.getTransactionRequest();
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-gauge/src/reentrant-contract-calls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Reentrant Contract Calls', () => {
beforeAll(async () => {
const provider = await Provider.create(FUEL_NETWORK_URL);
baseAssetId = provider.getBaseAssetId();
wallet = await generateTestWallet(provider, [[20_000, baseAssetId]]);
wallet = await generateTestWallet(provider, [[50_000, baseAssetId]]);

const factoryBar = new ContractFactory(bar.binHexlified, bar.abiContents, wallet);
barContract = await factoryBar.deployContract({ baseAssetId });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use std::{
},
context::msg_amount,
asset::{
mint_to_address,
transfer_to_address,
mint_to,
transfer_to,
},
};

Expand Down Expand Up @@ -54,7 +54,7 @@ impl LiquidityPool for Contract {
let amount_to_mint = msg_amount() * 2;

// Mint some LP token based upon the amount of the base token.
mint_to_address(recipient, ZERO_B256, amount_to_mint);
mint_to(recipient, ZERO_B256, amount_to_mint);
}

#[storage(read), payable]
Expand All @@ -65,7 +65,7 @@ impl LiquidityPool for Contract {
let amount_to_transfer = msg_amount() / 2;

// Transfer base token to recipient.
transfer_to_address(recipient, storage.base_token.read(), amount_to_transfer);
transfer_to(recipient, storage.base_token.read(), amount_to_transfer);
}
}
// #endregion liquidity-pool-contract
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl MultiToken for Contract {
let mut counter = 0;

while counter < 3 {
mint_to_address(addresses[counter], sub_id, mint_amount);
mint_to(Identity::Address(addresses[counter]), sub_id, mint_amount);
counter = counter + 1;
}
}
Expand All @@ -48,11 +48,11 @@ impl MultiToken for Contract {
}

fn transfer_to_contract(target: ContractId, asset_id: AssetId, amount: u64) {
force_transfer_to_contract(target, asset_id, amount);
transfer(Identity::ContractId(target), asset_id, amount);
}

fn transfer_to_address(recipient: Address, asset_id: AssetId, amount: u64) {
transfer_to_address(recipient, asset_id, amount);
transfer(Identity::Address(recipient), asset_id, amount);
}

fn get_balance(target: ContractId, asset_id: AssetId) -> u64 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ predicate;
use std::inputs::input_predicate_data;

fn main() -> bool {
let input: bool = input_predicate_data(0);
let input: bool = input_predicate_data::<bool>(0);
input == true
}
Loading
Loading