FuelLabs / sway

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

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

Open kayagokalp opened 3 months ago

kayagokalp commented 3 months 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 3 months 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

sdankel commented 2 months ago

I'm not able to repro this. I think I followed your steps correctly, but the test is passing. Could you check if this still repros on master? If so, a gist or a branch with the projects would be helpful.