FuelLabs / sway

🌴 Empowering everyone to build reliable and efficient smart contracts.
https://docs.fuel.network/docs/sway/
Apache License 2.0
62.8k stars 5.35k forks source link

Simple unit test is failing to execute `csiz` #6347

Open kayagokalp opened 1 month ago

kayagokalp commented 1 month ago

Following test is failing on line 3, where the asm block is executed.

#[test]
fn do_test() {
    let child_contract = simple_contract::CONTRACT_ID;
    let registry = registry_contract::CONTRACT_ID;
    let mut length = asm(
        load_target: child_contract,  
        length,

    ) {
        csiz length load_target;
        length
    };
    // length of the fake child contract
    log(length);
}

Following simple contract is added as a contract dependency to the first project.

contract;

configurable {
    VALUE: u64 = 1,
}

abi MyContract {
    fn test_function() -> u64;
}

impl MyContract for Contract {
    // All this contract does is return the stored configurable value
    fn test_function() -> u64 {
        VALUE
    }
}
kayagokalp commented 1 month ago

This needs some investigation on our end, as it might not be the case that the reason for failure is due to the csiz