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!: upgrading forc to 0.52.1 #2017

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5ad7472
Upgrading `forc` to `0.51.1`
arboleya Mar 28, 2024
c7a87ef
Merge branch 'master' into aa/chore/upgrading-forc-0.51.1
arboleya Mar 28, 2024
8c84082
Merge branch 'master' into aa/chore/upgrading-forc-0.51.1
petertonysmith94 Mar 29, 2024
08241a9
Merge branch 'master' into aa/chore/upgrading-forc-0.51.1
arboleya Apr 4, 2024
d622856
Upgrading `forc` to `0.52.1`
arboleya Apr 5, 2024
cca95fe
Updating `prt()` accessor for `Vec`s
arboleya Apr 5, 2024
93e2d91
Applying new format for `AssetId`
arboleya Apr 5, 2024
ac1684f
Removing obsolete `forc` exceptions
arboleya Apr 5, 2024
eeffb2e
Adding [empty] changeset
arboleya Apr 5, 2024
2e60a57
Removing obsolete CI steps
arboleya Apr 5, 2024
42713ef
Temporarily disabling workflow step
arboleya Apr 5, 2024
de5abaf
Deleting obsolete changeset
arboleya Apr 5, 2024
abf4cd4
Adjusting changeset
arboleya Apr 5, 2024
e0bd6a6
Marking PR as a breaking change
arboleya Apr 5, 2024
65d7fff
Lintfix
arboleya Apr 7, 2024
8c3d18b
Re-enabling workflow step
arboleya Apr 7, 2024
cb78ab3
Increasing verbosity for debugging purposes
arboleya Apr 7, 2024
856b2f5
Merge branch 'master' into aa/chore/upgrading-forc-0.52.1
arboleya Apr 7, 2024
56215b3
Debugging forc build
arboleya Apr 7, 2024
3c3dd80
More debugging
arboleya Apr 7, 2024
40826df
Fixing directory path
arboleya Apr 7, 2024
9ba6300
More paths adjustments
arboleya Apr 7, 2024
5be60b4
Polishing test assertions
arboleya Apr 8, 2024
1b97fc9
Merge branch 'master' into aa/chore/upgrading-forc-0.52.1
arboleya Apr 10, 2024
5097ac7
Enabling PR auto-release
arboleya Apr 10, 2024
5b768e9
Merge branch 'master' into aa/chore/upgrading-forc-0.52.1
arboleya Apr 11, 2024
47c511e
Temporarily commenting failing tests
arboleya Apr 11, 2024
1fa4e24
Merge branch 'master' into aa/chore/upgrading-forc-0.52.1
arboleya Apr 11, 2024
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
9 changes: 9 additions & 0 deletions .changeset/five-cats-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@fuel-ts/abi-typegen": patch
"@fuel-ts/interfaces": patch
"@fuel-ts/versions": patch
"@fuel-ts/address": patch
"@fuel-ts/forc": patch
---

chore!: upgrading `forc` to `0.52.1`
18 changes: 0 additions & 18 deletions .github/actions/test-setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,3 @@ runs:
- name: Build
run: pnpm build
shell: bash

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
# selecting a toolchain either by action or manual `rustup` calls should happen
# before the cache plugin, as it uses the current rustc version as its cache key
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"

- name: Install forc for experimental builds
shell: bash
run: |
curl https://install.fuel.network > install-fuelup.sh
chmod +x install-fuelup.sh
./install-fuelup.sh --no-modify-path --skip-toolchain-installation
export PATH="${HOME}/.fuelup/bin:${PATH}"
fuelup toolchain new forc-experimental
fuelup component add forc@$(cat ./packages/forc/VERSION_EXPERIMENTAL)
2 changes: 1 addition & 1 deletion .github/workflows/pr-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: "Release PR to npm"
runs-on: ubuntu-latest
# comment out if:false to enable release PR to npm
if: false
# if: false
permissions: write-all
steps:
- name: Checkout
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ jobs:
- name: Forc Format Check
run: pnpm forc:check

- name: Debugging `forc build` @ docs-snippets
run: cd apps/docs-snippets && pnpm pretest

- name: Debugging `forc build` @ demo-typegen
run: cd apps/demo-typegen && pnpm pretest

- name: Debugging `forc build` @ abi-coder
run: cd packages/abi-coder && pnpm pretest

- name: Debugging `forc build` @ fuel-gauge
run: cd packages/fuel-gauge && pnpm pretest

- name: Debugging `forc build` @ script
run: cd packages/script && pnpm pretest

- name: Debugging `forc build` @ abi-typegen
run: cd packages/abi-typegen && pnpm pretest

- name: Debugging `forc build` @ utils
run: cd packages/utils && pnpm pretest

# linting of some tests depends on pretest being run so that it generates the necessary files
- name: Pretest
run: pnpm pretest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe(__filename, () => {
});

const asset: AssetId = {
value: BaseAssetId,
bits: BaseAssetId,
};

await contract.functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ describe(__filename, () => {

await contract.functions.mint_coins(subId, 100).call();

const address = { value: Wallet.generate().address.toB256() };
const assetId = { value: getMintedAssetId(contract.id.toB256(), subId) };
const address = { bits: Wallet.generate().address.toB256() };
const assetId = { bits: getMintedAssetId(contract.id.toB256(), subId) };

// #region variable-outputs-2
const { transactionResult } = await contract.functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe(__filename, () => {
const assetId = getMintedAssetId(contractId, subId);

await liquidityPoolContract.functions
.deposit({ value: liquidityOwner.address.toB256() })
.deposit({ bits: liquidityOwner.address.toB256() })
.callParams({ forward: [depositAmount, BaseAssetId] })
.txParams({ variableOutputs: 1 })
.call();
Expand All @@ -51,7 +51,7 @@ describe(__filename, () => {

// #region deposit-and-withdraw-cookbook-3
await liquidityPoolContract.functions
.withdraw({ value: liquidityOwner.address.toB256() })
.withdraw({ bits: liquidityOwner.address.toB256() })
.callParams({ forward: [depositAmount, BaseAssetId] })
.txParams({ variableOutputs: 1 })
.call();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ describe(__filename, () => {
// 2. Instantiate the script main arguments
const scriptArguments = [
contract.id.toB256(),
{ value: ASSET_A },
{ bits: ASSET_A },
new BN(1000),
{ value: ASSET_B },
{ bits: ASSET_B },
new BN(500),
];

Expand Down
10 changes: 5 additions & 5 deletions apps/docs-snippets/src/guide/types/asset-id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ describe('AssetId', () => {
// #import { AssetId };

const assetId: AssetId = {
value: Bits256,
bits: Bits256,
};
// #endregion asset-id-1

expect(assetId.value).toBe(Bits256);
expect(assetId.bits).toBe(Bits256);
});

it('should create an AssetId from a B256Address', async () => {
Expand All @@ -48,7 +48,7 @@ describe('AssetId', () => {
// #import { AssetId };

const assetId: AssetId = {
value: Bits256,
bits: Bits256,
};

const { value } = await contract.functions.echo_asset_id_comparison(assetId).simulate();
Expand All @@ -62,14 +62,14 @@ describe('AssetId', () => {
// #import { AssetId };

const assetId: AssetId = {
value: Bits256,
bits: Bits256,
};

const { value } = await contract.functions.echo_asset_id().simulate();

expect(value).toEqual(assetId);
// #endregion asset-id-4

expect(value.value).toEqual(Bits256);
expect(value.bits).toEqual(Bits256);
});
});
20 changes: 10 additions & 10 deletions apps/docs-snippets/src/guide/types/contract-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ describe(__filename, () => {
// #region address-input
// #import { Address };
const address = Address.fromRandom();
const addressInput = { value: address.toB256() };
const addressInput = { bits: address.toB256() };
// #endregion address-input
const callResponse = await contract.functions.address(addressInput).simulate();

// #region address-output
// #import { Address };
const addressOutput = callResponse.value;
const addressFromOutput: Address = Address.fromB256(addressOutput.value);
const addressFromOutput: Address = Address.fromB256(addressOutput.bits);
// #endregion address-output
expect(addressFromOutput).toEqual(address);
});

it('should successfully call a function with a ContractId type input and output parameters', async () => {
// #region contract-id-input
const contractId = '0x7296ff960b5eb86b5f79aa587d7ebe1bae147c7cac046a16d062fbd7f3a753ec';
const contractIdInput = { value: contractId.toString() };
const contractIdInput = { bits: contractId.toString() };
// #endregion contract-id-input
const callResponse = await contract.functions.contract_id(contractIdInput).simulate();

// #region contract-id-output
const contractIdOutput = callResponse.value;
const contractIdFromOutput: string = contractIdOutput.value;
const contractIdFromOutput: string = contractIdOutput.bits;
// #endregion contract-id-output

expect(contractIdFromOutput).toEqual(contractId);
Expand All @@ -49,28 +49,28 @@ describe(__filename, () => {
// #region identity-address-input
// #import { Address };
const address = Address.fromRandom();
const addressInput = { value: address.toB256() };
const addressInput = { bits: address.toB256() };
const addressIdentityInput = { Address: addressInput };
// #endregion identity-address-input
const callResponse1 = await contract.functions.identity(addressIdentityInput).simulate();

// #region identity-address-output
// #import { Address };
const identityFromOutput1 = callResponse1.value;
const addressStringFromOutput = identityFromOutput1.Address.value;
const addressStringFromOutput = identityFromOutput1.Address.bits;
const addressFromOutput: Address = Address.fromB256(addressStringFromOutput);
// #endregion identity-address-output

// #region identity-contract-input
const contractId = '0x7296ff960b5eb86b5f79aa587d7ebe1bae147c7cac046a16d062fbd7f3a753ec';
const contractIdInput = { value: contractId.toString() };
const contractIdInput = { bits: contractId.toString() };
const contractIdentityInput = { ContractId: contractIdInput };
// #endregion identity-contract-input
const callResponse2 = await contract.functions.identity(contractIdentityInput).simulate();

// #region identity-contract-output
const identityFromOutput2 = callResponse2.value;
const contractIdFromOutput: string = identityFromOutput2.ContractId.value;
const contractIdFromOutput: string = identityFromOutput2.ContractId.bits;
// #endregion identity-contract-output

expect(addressFromOutput).toEqual(address);
Expand All @@ -80,13 +80,13 @@ describe(__filename, () => {
it('should successfully call a function with an AssetId type input and output parameters', async () => {
// #region asset-id-input
const assetId = '0x0cfabde7bbe58d253cf3103d8f55d26987b3dc4691205b9299ac6826c613a2e2';
const assetIdInput = { value: assetId };
const assetIdInput = { bits: assetId };
// #endregion asset-id-input
const callResponse = await contract.functions.asset_id(assetIdInput).simulate();

// #region asset-id-output
const assetIdOutput = callResponse.value;
const assetIdFromOutput: string = assetIdOutput.value;
const assetIdFromOutput: string = assetIdOutput.bits;
// #endregion asset-id-output

expect(assetIdFromOutput).toEqual(assetId);
Expand Down
16 changes: 7 additions & 9 deletions apps/docs-snippets/src/guide/types/evm-address.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,20 @@ describe('EvMAddress', () => {
// #import { EvmAddress };

const evmAddress: EvmAddress = {
value: Bits256,
bits: Bits256,
};
// #endregion evm-address-1

// #region addresses-3
// #import { EvmAddress };

const address: EvmAddress = {
value: '0x000000000000000000000000210cf886ce41952316441ae4cac35f00f0e882a6',
bits: '0x000000000000000000000000210cf886ce41952316441ae4cac35f00f0e882a6',
};
// #endregion addresses-3

expect(evmAddress.value).toBe(Bits256);
expect(address.value).toBe(
'0x000000000000000000000000210cf886ce41952316441ae4cac35f00f0e882a6'
);
expect(evmAddress.bits).toBe(Bits256);
expect(address.bits).toBe('0x000000000000000000000000210cf886ce41952316441ae4cac35f00f0e882a6');
});

it('should create an Evm Address from a B256Address', async () => {
Expand All @@ -60,7 +58,7 @@ describe('EvMAddress', () => {
// #import { EvmAddress };

const evmAddress: EvmAddress = {
value: Bits256,
bits: Bits256,
};

const { value } = await contract.functions.echo_address_comparison(evmAddress).simulate();
Expand All @@ -74,14 +72,14 @@ describe('EvMAddress', () => {
// #import { EvmAddress };

const evmAddress: EvmAddress = {
value: Bits256,
bits: Bits256,
};

const { value } = await contract.functions.echo_address().simulate();

expect(value).toEqual(evmAddress);
// #endregion evm-address-4

expect(value.value).toEqual(Bits256);
expect(value.bits).toEqual(Bits256);
});
});
3 changes: 2 additions & 1 deletion apps/docs-snippets/src/guide/types/vector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ describe(__filename, () => {
expect(value.isActive).toEqual(employees[1].isActive);
});

it('should successfully execute a contract call with a bytecode input', async () => {
// TODO: Unskip test after sway-libs become compatible with latest forc (0.52+)
it.skip('should successfully execute a contract call with a bytecode input', async () => {
const bytecodeContract = await createAndDeployContractFromProject(
DocSnippetProjectsEnum.BYTECODE_INPUT
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ authors = ["Fuel Labs <contact@fuel.sh>"]
license = "Apache-2.0"
name = "bytecode-input"

[dependencies]
bytecode = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.19.0" }
# TODO: Uncomment bytecode-related stuff
# This requires sway-libs to be compatible with latest forc (0.52+)

# [dependencies]
# bytecode = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.19.0" }
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
contract;

use bytecode::*;
// TODO: Uncomment bytecode-related stuff
// This requires sway-libs to be compatible with latest forc (0.52+)
// use bytecode::*;


abi MyContract {
fn compute_bytecode_root(bytecode_input: Vec<u8>) -> b256;
// fn compute_bytecode_root(bytecode_input: Vec<u8>) -> b256;
fn compute_bytecode_root(bytecode_input: Vec<u8>) -> bool;
}

impl MyContract for Contract {
// #region vector-bytecode-input-sway
fn compute_bytecode_root(bytecode_input: Vec<u8>) -> b256 {
let root = compute_bytecode_root(bytecode_input);
return root;
fn compute_bytecode_root(bytecode_input: Vec<u8>) -> bool {
// let root = compute_bytecode_root(bytecode_input);
// return root;
return true;
}
// #endregion vector-bytecode-input-sway
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ abi EvmTest {
fn echo_asset_id_comparison(asset_id: AssetId) -> bool;
}

const ASSET_ID: AssetId = AssetId {
value: 0x9ae5b658754e096e4d681c548daf46354495a437cc61492599e33fc64dcdc30c,
};
const ASSET_ID: AssetId = AssetId::from(0x9ae5b658754e096e4d681c548daf46354495a437cc61492599e33fc64dcdc30c);

impl EvmTest for Contract {
fn echo_asset_id() -> AssetId {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{b512::B512, ecr::ec_recover_address, tx::{tx_id, tx_witness_data}};

fn main(signer: b256) -> bool {
let witness_data: B512 = tx_witness_data(1);
let address: b256 = ec_recover_address(witness_data, tx_id()).unwrap().value;
let address: b256 = ec_recover_address(witness_data, tx_id()).unwrap().bits();
return address == signer;
}
// #endregion multiple-signers-3
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{b512::B512, ecr::ec_recover_address, tx::{tx_id, tx_witness_data}};

fn main(signer: b256) -> bool {
let witness_data: B512 = tx_witness_data(1);
let address: b256 = ec_recover_address(witness_data, tx_id()).unwrap().value;
let address: b256 = ec_recover_address(witness_data, tx_id()).unwrap().bits();
return address == signer;
}
// #endregion multiple-signers-1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl TokenDepositor for Contract {
let sender = msg_sender().unwrap();

let address: b256 = match sender {
Identity::Address(sender_param) => sender_param.value,
Identity::Address(sender_param) => sender_param.bits(),
_ => revert(0),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ describe('templates/contract/bytecode', () => {
// validating
restore();

expect(rendered.trim()).toEqual(bytecodeTemplate);
expect(rendered.trim()).toEqual(bytecodeTemplate.trim());
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
Fuel-Core version: 33.33.33
*/

export default '0x740000034700000000000000000000445dfcc00110fff3005d4060495d47f001134904407648000272f0007b36f000001aec5000910000005c43f000244000004700000001000000000000000000000055b7ae10'
export default '0x1af030007400000200000000000000445dffc00110ffff005d4060495d47f001134904407648000272f0007b36f000001aec50005c43f00024400000470000000000000001000000000000000000000055b7ae10'
Loading
Loading