cairo_native icon indicating copy to clipboard operation
cairo_native copied to clipboard

Inter-contract recursion depth check

Open igaray opened this issue 2 years ago • 1 comments

When a cairo program calls the library_call or call_contract syscalls to invoke another contract, that other contract code runs in a new execution environment, but the recursion depth should be limited and the syscall return an error when it is exceeded. The current limit on starknet is 50, but this should be verified and also configurable.

c.f #261

igaray avatar Aug 04 '23 19:08 igaray

I think Inter-contract recursion depth should ideally be checked externally since we're returning control to the user (via the trait) and it's the user's responsibility to make the actual. Any necessary information to implement this should be provided by the user via the trait implementation, so we shouldn't need to do anything in this project.

azteca1998 avatar Aug 21 '23 12:08 azteca1998

I agree with what @azteca1998 The power to call another contract via library_call or call_contract lies in the end user, and it's their responsability whether to call another contract or not, they can easily keep a recursion counter in the syscall handler.

edg-l avatar Sep 13 '24 10:09 edg-l