We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#[contract] mod HelloStarknet { use array::ArrayTrait; #[external] fn test() { let mut arr = ArrayTrait::new(); arr.append(233); arr.append(124); rec(arr, 0_usize); } fn rec(arr: Array<felt252>, index: usize) { if (index == arr.len()) { return (); } rec(arr, index + 1_usize); } }
causes
Error: StarkException: (500, {'code': <StarknetErrorCode.COMPILATION_FAILED: 2>, 'message': 'Compilation failed. Error: Compilation failed.\n\nCaused by:\n failed solving the symbol tables\n'})
for starknet declare.
starknet declare
Checked starknet versions: 0.11.0.1 as well as 0.11.0.2. Cairo versions: main:9c3cb963 and also 1.0.0-alpha-6:439da05a
starknet
0.11.0.1
0.11.0.2
9c3cb963
439da05a
The text was updated successfully, but these errors were encountered:
It needs to have:
match gas::withdraw_gas_all(get_builtin_costs()) { Option::Some(_) => {}, Option::None(_) => panic(...), };
at the top of the recursive function
so
fn rec(arr: Array<felt252>, index: usize) { match gas::withdraw_gas_all(get_builtin_costs()) { Option::Some(_) => {}, Option::None(_) => panic(out_of_gas_array()), }; if (index == arr.len()) { return (); } rec(arr, index + 1_usize); } fn out_of_gas_array() -> Array<felt252> { let mut arr = ArrayTrait::new(); arr.append('Out of gas'); arr }
declares properly, but it's generally unclear, what the compiler says and why.
Sorry, something went wrong.
No branches or pull requests
causes
for
starknet declare
.Checked
starknet
versions:0.11.0.1
as well as0.11.0.2
.Cairo versions: main:
9c3cb963
and also 1.0.0-alpha-6:439da05a
The text was updated successfully, but these errors were encountered: