-
Notifications
You must be signed in to change notification settings - Fork 490
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: Found an unexpected cycle during cost computation. #4032
Comments
This requires cost tokens to be pre-charged, as the destruct in this case is recursive. |
Unfortunately not, it's impossible to avoid having the Dict inside this struct. Kakarot's EVM relies on dicts for the implementation of the Memory, the Stack, and a few other elements. All of them are grouped relative to their ExecutionContext. This is a big blocker for us as we're not able to spawn subcontexts (we can't implement the behavior of a call to other contracts) |
i don't really like my solution, but i believe it would work: |
What do you mean by id? |
struct Context { memory_dict: Felt252Dict, used by Hash(id, mem_addr) as key. |
If we don't have the choice then we will proceed this way but it involves refactoring the entire architecture, which we would like to avoid. |
I don't see any other choice for the time being unfortunately. Do note that a wrapper object holding both the dictionary and the current context is possible for abstracting most of this away. |
Bug Report
Cairo version:
2.2.0
Current behavior:
After implementing self-referring structs using a Nullable in Kakarot, we encounter the following error message. Note that since our main struct contains dicts, we need to derive
Destruct
to allow it to go out of scope.The
Destruct
impl is:I guess the problem comes from there?
Here's the error message. It only appears when running tests, not when compiling the crate.
The bug manifests when running scarb test in this branch: https://github.com/kkrt-labs/kakarot-ssj/tree/feat/nested-contexts
Expected behavior:
Steps to reproduce:
Related code:
Reproducible examples:
Other information:
The text was updated successfully, but these errors were encountered: