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

bug: Got 'Unknown ap change' error while moving [4] #4036

Closed
wraitii opened this issue Sep 8, 2023 · 0 comments · Fixed by #4058
Closed

bug: Got 'Unknown ap change' error while moving [4] #4036

wraitii opened this issue Sep 8, 2023 · 0 comments · Fixed by #4058
Assignees
Labels
bug Something isn't working

Comments

@wraitii
Copy link
Contributor

wraitii commented Sep 8, 2023

Bug Report

Cairo version:

Happens on 2.2.0

Current behavior:

Compiling the following to CASM fails with the error:

Error: Compilation failed.

Caused by:
    #114->#115: Got 'Unknown ap change' error while moving [4].

Minimal repro:

use starknet::ContractAddress;

#[starknet::interface]
trait FirstInterface<T> {
    fn toto(self: @T, t: Array<ContractAddress>);
    fn balance_of(self: @T);
}


#[starknet::contract]
mod toto {
    #[storage]
    struct Storage {}
    
    use super:: {
        FirstInterfaceDispatcher, FirstInterfaceDispatcherTrait,
    };
    
    #[external(v0)]
    fn test_mint_and_unbox(self: @ContractState) {
        let contract = FirstInterfaceDispatcher { contract_address: starknet::contract_address_const::<5>() };
        
        contract.balance_of();
        contract.toto(array![contract.contract_address]);
        contract.balance_of();
    }
}

I believe every line here is necessary to make it fail, but I'm not sure why. The array! call could probably be reduced a bit but I didn't try.

Expected behavior:

This should compile.

Steps to reproduce:

starknet-compile the above, then starknet-sierra-compile it.

Interestingly, changing to

let t = array![contract.contract_address];
contract.toto(t);

Fixes it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants