I am building a short but quite logic intense Starknet contract allowing abstract interactions between calls. Instead of just being able to chain calls like in a normal multicall, you can take the output a previous call and use it as the output of a future call. I added some conditional executions feature (like skipping a call given the result of a previous call) and I am now trying to add a kind of "trycatch" feature (if call A fails, perform B, otherwise perform C, then perform D).
Hello,
Summary:
I found a cairo code which appears to be valid but causes a compiler crash.
Env:
Context:
I am building a short but quite logic intense Starknet contract allowing abstract interactions between calls. Instead of just being able to chain calls like in a normal multicall, you can take the output a previous call and use it as the output of a future call. I added some conditional executions feature (like skipping a call given the result of a previous call) and I am now trying to add a kind of "trycatch" feature (if call A fails, perform B, otherwise perform C, then perform D).
My code looks like this: Check whole code here: https://github.com/starknet-id/composable_multicall/blob/62bf15f3bf48a7cc8e7d82309362628baa181e9b/src/contract.cairo#L141-L150
For a reason I don't understand, the specific lines:
And:
Cause this error when compiling with scarb:
To reproduce:
Clone https://github.com/starknet-id/composable_multicall/ Checkout commit
62bf15f3bf48a7cc8e7d82309362628baa181e9b
(it'sfeat: add catch & then feature
on branchfeat/try_catch
)