Passing Vec to script causes random values inside script

What version of fuels-ts are you using?


Steps to Reproduce

The script


struct SomeStruct {
    some_number: u64,
    some_vec: Vec<u64> 

fn main(
    some_contract: ContractId,
    some_struct: SomeStruct,
) {
    require(some_struct.some_vec.get(0).unwrap() == 1, "wtf is going on");

The script call

async function simpleScript(
    someContract: Contract,
    wallet: WalletUnlocked
) {
    const scriptBin = readFileSync(
        join(__dirname, "../../../scripts/simple-script/out/debug/simple-script.bin")

    const scriptInstance = new Script<[ContractIdInput, Number[]], any>(

   const someStruct = {
        some_number: 1,
        some_vec: [1],

    const request = await scriptInstance.functions
        .main({ value: }, someStruct)
        .txParams({ gasPrice: 1 })

Expected Behavior

Log should return 1 or BN: 0x1 for BOTH the some_number and some_vec.

Actual Behavior

Log returns 1 for some_number and different, random values for some_vec on each script call.

Would be great if somebody could reproduce and take a look. Passing Vec to script causes random values inside script · Issue #1015 · FuelLabs/fuels-ts · GitHub

Edit: This applies to Vecs in general, regardless of whether they are passed through struct or not. Reproducer inside the linked GH issue.

Thank you for opening an issue for this.

Let’s track this via Github and post the status here when it’s addressed.

1 Like