What version of fuels-ts are you using?
Latest
Steps to Reproduce
The script
script;
struct SomeStruct {
some_number: u64,
some_vec: Vec<u64>
}
fn main(
some_contract: ContractId,
some_struct: SomeStruct,
) {
log(some_struct.some_number);
log(some_struct.some_vec.get(0).unwrap());
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>(
scriptBin,
simpleScriptAbi,
wallet
);
const someStruct = {
some_number: 1,
some_vec: [1],
};
const request = await scriptInstance.functions
.main({ value: someContract.id.toHexString() }, someStruct)
.addContracts([someContract])
.txParams({ gasPrice: 1 })
.call();
}
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