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.55.0 #2045

Merged
merged 87 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 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
001229d
Upgrading `forc` to `0.53.0`
arboleya Apr 11, 2024
574e682
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 11, 2024
e26dc07
Adjusting changeset
arboleya Apr 11, 2024
c0d13cd
Rolling back debugging workflow steps
arboleya Apr 11, 2024
73d6a2a
Fixing broken tests (applying breaking changes)
arboleya Apr 11, 2024
7080ea5
Adjusting changeset
arboleya Apr 11, 2024
ac13cef
Grouping all skipped tests into a single `describe` block
arboleya Apr 11, 2024
d53c837
Fixing test; updating vector pointer assertion
arboleya Apr 11, 2024
82a656c
Skipping grouped tests
arboleya Apr 11, 2024
2d66ae6
Disabling PR auto-release
arboleya Apr 11, 2024
b180bde
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
petertonysmith94 Apr 15, 2024
3a97943
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 16, 2024
9eadc6a
Re-generating changeset
arboleya Apr 16, 2024
9af7ade
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
petertonysmith94 Apr 17, 2024
faf02f5
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into aa…
danielbate Apr 18, 2024
bb691e3
docs: pinned version of fuels for `beta-5` docs
petertonysmith94 Apr 18, 2024
d19a3de
chore: added changeset
petertonysmith94 Apr 18, 2024
0ff8743
chore: added fuelsVersion to create-fuels
petertonysmith94 Apr 18, 2024
7b58acc
chore: pinned back the create-fuels version to 0.81.0
petertonysmith94 Apr 18, 2024
4a4f3e6
fix spelling
petertonysmith94 Apr 18, 2024
35f52c8
chore: lint
petertonysmith94 Apr 18, 2024
99b93b1
chore: lint :'(
petertonysmith94 Apr 18, 2024
4de6c39
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
danielbate Apr 19, 2024
7508d6d
Fix spelling
petertonysmith94 Apr 19, 2024
b8d0722
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into aa…
danielbate Apr 19, 2024
3c3e47a
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
petertonysmith94 Apr 19, 2024
31f710e
chore: upgrade reentrant test to `[email protected]` (#2121)
danielbate Apr 19, 2024
e507916
Upgrading `forc` to `0.55.0`
arboleya Apr 22, 2024
b457a67
Fixing broken tests
arboleya Apr 22, 2024
4cef4d7
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Apr 22, 2024
6438abb
Adjusting changeset
arboleya Apr 22, 2024
5186989
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 22, 2024
9e14db5
Lintfix
arboleya Apr 22, 2024
aefd045
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 23, 2024
91b8bb8
Removing useless changeset
arboleya Apr 23, 2024
3dbabdf
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Apr 23, 2024
b6cc48b
Added fuelsInstallVersion
petertonysmith94 Apr 23, 2024
9810efa
Finalised fuels install version
petertonysmith94 Apr 23, 2024
80eeb74
Reverted changes to fuels template version
petertonysmith94 Apr 23, 2024
ba55261
Removed @ prefix from note about version
petertonysmith94 Apr 23, 2024
f091610
Added verbose note
petertonysmith94 Apr 23, 2024
3c6286e
Altered version to accept patches
petertonysmith94 Apr 23, 2024
a2152e4
Updated install version 0.82.0
petertonysmith94 Apr 23, 2024
a6c1510
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
petertonysmith94 Apr 23, 2024
d337203
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
Dhaiwat10 Apr 24, 2024
34b4f48
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
danielbate Apr 24, 2024
64b5133
Merge branch 'ps/docs/patch-beta-5-fuels-version' into aa/chore/upgra…
Torres-ssf Apr 24, 2024
d529874
Rolling back verbosity increase
arboleya Apr 24, 2024
c13e148
Tyop
arboleya Apr 24, 2024
f627c3a
Merge branch 'master' into ps/docs/patch-beta-5-fuels-version
danielbate Apr 24, 2024
a9bc90b
Merge branch 'ps/docs/patch-beta-5-fuels-version' into aa/chore/upgra…
danielbate Apr 24, 2024
a5b1407
Removed `fuelsInstallVersion`
petertonysmith94 Apr 25, 2024
6896e59
Update apps/docs/src/guide/fuels-cli/commands.md
petertonysmith94 Apr 25, 2024
c57b6c9
Update apps/docs/src/guide/fuels-cli/commands.md
petertonysmith94 Apr 25, 2024
bad37a1
Merge branch 'ps/docs/patch-beta-5-fuels-version' into aa/chore/upgra…
arboleya Apr 25, 2024
be3accd
Using hardcoded snippet temporarily
arboleya Apr 25, 2024
b6b0a87
Removing region notations from hardcoded snippet
arboleya Apr 25, 2024
d00b56d
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 25, 2024
5004bfd
Merge branch 'master' into aa/chore/upgrading-forc-0.53.0
arboleya Apr 25, 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/ninety-hotels-impress.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.55.0`
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)
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
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,23 @@ describe('Transaction Request', () => {
expect(transactionRequest.witnesses.length).toEqual(2);
});

it('gets the transaction ID', async () => {
it('gets the transaction ID', () => {
// #region transaction-request-7
// #import { ScriptTransactionRequest };

// Instantiate the transaction request
const transactionRequest = new ScriptTransactionRequest({ script: scriptBytecode });

// Get the chain ID
const chainId = await provider.getChainId();
const chainId = provider.getChainId();

// Get the transaction ID using the Chain ID
const transactionId = transactionRequest.getTransactionId(chainId);
// TX ID: 0x55667d...
// #endregion transaction-request-7

expect(transactionId).toBe(
'0x35cd6a10e917d5d0223413c1fb9863d27da40e5d602a7f37cfbcefb570172f6c'
'0x8a1a2bb529db20cdd8f35a8b6e00b0440629712fa891fa29232a396982be3d15'
arboleya marked this conversation as resolved.
Show resolved Hide resolved
);
});
});
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 <[email protected]>"]
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
arboleya marked this conversation as resolved.
Show resolved Hide resolved
# 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
21 changes: 20 additions & 1 deletion apps/docs/src/guide/types/vectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,26 @@ Some Sway functions require you to pass in bytecode to the function. The type of

Take the `compute_bytecode_root` function from the [`bytecode` Sway library](https://github.com/FuelLabs/sway-libs/tree/master/libs/src/bytecode.sw), for example.

<<< @/../../docs-snippets/test/fixtures/forc-projects/bytecode-input/src/main.sw#vector-bytecode-input-sway{ts:line-numbers}
<!-- <<< @/../../docs-snippets/test/fixtures/forc-projects/bytecode-input/src/main.sw#vector-bytecode-input-sway{ts:line-numbers} -->

<!-- TODO: Uncomment swap hardcoded snippet -->

```rust
contract;

use bytecode::*;

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

impl MyContract for Contract {
fn compute_bytecode_root(bytecode_input: Vec<u8>) -> bool {
let root = compute_bytecode_root(bytecode_input);
return root;
}
}
```

To pass bytecode to this function, you can make use of the `arrayify` function to convert the bytecode file contents into a `UInt8Array`, the TS compatible type for Sway's `Vec<u8>` type and pass it the function like so:

Expand Down
Loading
Loading