cairo: bug: "Internal error, cycle detected" with recursive struct in 2.3.0 but not in 2.3.0-rc0
Bug Report
Cairo version: 2.3.0
Current behavior:
We need to be able to handle recursive structures in Kakarot for the RLP decoding. The tests were running correctly in version 2.3.0-rc0 but are failing in 2.3.0 with this error :
thread 'main' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/salsa-0.16.1/src/lib.rs:490:48:
Internal error, cycle detected:
DatabaseKeyIndex { group_index: 2, query_index: 29, key_index: 759 }
DatabaseKeyIndex { group_index: 2, query_index: 29, key_index: 760 }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: 'scarb metadata' exited with error
If I modify the struct and the tests so that they don’t use struct recursion, the tests will run.
Expected behavior:
To be able to use struct recursion in 2.3.0 as well.
Steps to reproduce:
Ironically, I couldn’t reproduce the bug in a MRE so I might only be able to link you the related PR : https://github.com/kkrt-labs/kakarot-ssj/pull/457#issuecomment-1780949444
Once pulled, you should be able to run scarb test -f test_rlp.
Once using cairo 2.3.0-rc0 and assert that the tests run.
And once using cairo 2.3.0 and assert that the tests panic with the error mentionned above.
(Do not forget to modify the Scarb.toml as well)
Here is the related struct found in rlp.cairo:
#[derive(Drop, Copy, PartialEq)]
enum RLPItem {
String: Span<u8>,
List: Span<RLPItem>
}
Any tests calling the decode() function will trigger the error.
Other information:
I tried to reproduce the bug in a brand new scarb project but it is running smoothly. I will keep updated if I manage to reproduce the bug in a smaller setup. This is confusing.
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Fixed scc panic checks to be constitently post panics. Fixes #4314. — committed to starkware-libs/cairo by orizi 8 months ago
- Fixed scc panic checks to be constitently post panics. Fixes #4314. — committed to starkware-libs/cairo by orizi 8 months ago
- Fixed scc panic checks to be constitently post panics. Fixes #4314. — committed to starkware-libs/cairo by orizi 8 months ago
- Fixed scc panic checks to be constitently post panic stage. Fixes #4314. — committed to starkware-libs/cairo by orizi 8 months ago
- Fixed scc panic checks to be constitently post panic stage. Fixes #4314. — committed to starkware-libs/cairo by orizi 8 months ago
in any case, we are doing a 2.3.1 for some small fixes - this one is included - so this will be available hopefully later today.
Found and fixed. How badly does this block you? If we release 2.4.0-rc0 rather soon, will t be ok? or a 2.3.1 release is a must? Thanks!
Oh - it fails now - checking it out. thanks!
We have some algorithm for finding SCCs for adding
withdraw_gasstatements, and it fails for some reason - debugging 😃