lambdaclass / cairo_native

A compiler to convert Cairo's intermediate representation "Sierra" code to MLIR.
https://lambdaclass.github.io/cairo_native/cairo_native
Apache License 2.0
115 stars 42 forks source link

bug: stack overflow on AotExecutor creation #826

Closed enitrat closed 1 week ago

enitrat commented 1 week ago

repro:

clone https://github.com/kkrt-labs/ef-tests checkout cairo-native branch git checkout feat/cairo-native make make setup-kakarot run any test, like: cargo test baseFeeDiffPlaces_d34g0v0_Cancun --features v1,native -- --nocapture

this should fail with a stack overflow.

enitrat commented 1 week ago

snip of the backtrace obtained with lldb

* thread #4, name = 'stPreCompiledContracts2::test_CALLBlake2f_d0g2v0_Cancun', stop reason = EXC_BAD_ACCESS (code=2, address=0x17021bfc8)
  * frame #0: 0x000000010a0b25b4 stPreCompiledContracts2-1b585838309dcc76`core::ub_checks::is_nonoverlapping::runtime::h4582f2c3c0e7ed02(src=<unavailable>, dst=0x0000000000000000, size=0, count=0) at ub_checks.rs:141
    frame #1: 0x000000010a0ba0b0 stPreCompiledContracts2-1b585838309dcc76`core::intrinsics::copy_nonoverlapping::precondition_check::he684f1ab114af820 [inlined] core::ub_checks::is_nonoverlapping::h4fa8e2959770e63a at ub_checks.rs:161:5
    frame #2: 0x000000010a0ba0ac stPreCompiledContracts2-1b585838309dcc76`core::intrinsics::copy_nonoverlapping::precondition_check::he684f1ab114af820(src=0x00000001202e80d7, dst=0x000000017021c180, size=1, align=1, count=8) at intrinsics.rs:3056:16
    frame #3: 0x000000010a0adba0 stPreCompiledContracts2-1b585838309dcc76`core::ptr::read_unaligned::h5c5d7271ddbc127e [inlined] core::intrinsics::copy_nonoverlapping::h883dc08759392a3c at ub_checks.rs:75:17
    frame #4: 0x000000010a0adb7c stPreCompiledContracts2-1b585838309dcc76`core::ptr::read_unaligned::h5c5d7271ddbc127e(src=0x00000001202e80d7) at mod.rs:1423:9
    frame #5: 0x0000000109ef9988 stPreCompiledContracts2-1b585838309dcc76`core::core_arch::aarch64::neon::vld1_u8::hb79d0781c6b39f18(ptr="\U00000010\U00000019W\xffc\U00000006\xff*t~\xff\xff\xff_\xff\xff\xff\U00000016 (\xff\xff\xff\xff\xff7\xffts\v\bE5*\xff\xff\xff@A\xff\xff\xff\xff\xff\xfft\U00000013\xff\xff\xff\xff\xffM5^8gd\xff\xff#OdLE\xff\xffQ\xff\xff") at mod.rs:566:5
    frame #6: 0x0000000109ed5d48 stPreCompiledContracts2-1b585838309dcc76`hashbrown::raw::RawTable$LT$T$C$A$GT$::find::hf6cd088c34a49ced [inlined] hashbrown::raw::neon::Group::load::hac92dfe82656ef44 at neon.rs:47:15
    frame #7: 0x0000000109ed5d40 stPreCompiledContracts2-1b585838309dcc76`hashbrown::raw::RawTable$LT$T$C$A$GT$::find::hf6cd088c34a49ced [inlined] hashbrown::raw::RawTableInner::find_inner::h28da3972debbfa58(self=0x0000000170416b78, hash=2392032648173715671, eq=&mut dyn core::ops::function::FnMut<(usize), Output=bool> @ 0x000000017021c380) at mod.rs:2185:34
    frame #8: 0x0000000109ed5ccc stPreCompiledContracts2-1b585838309dcc76`hashbrown::raw::RawTable$LT$T$C$A$GT$::find::hf6cd088c34a49ced(self=0x0000000170416b78, hash=2392032648173715671, eq={closure_env#0}<cairo_lang_sierra::ids::ConcreteTypeId, cairo_lang_sierra::ids::ConcreteTypeId, cairo_lang_sierra::extensions::core::CoreTypeConcrete> @ 0x000000017021c288) at mod.rs:1462:26
    frame #9: 0x0000000109f12d0c stPreCompiledContracts2-1b585838309dcc76`hashbrown::map::HashMap$LT$K$C$V$C$S$C$A$GT$::get_inner::h0494b0c4733591ca [inlined] hashbrown::raw::RawTable$LT$T$C$A$GT$::get::hb8739e821ff08e9b at mod.rs:1479:15
    frame #10: 0x0000000109f12d08 stPreCompiledContracts2-1b585838309dcc76`hashbrown::map::HashMap$LT$K$C$V$C$S$C$A$GT$::get_inner::h0494b0c4733591ca(self=0x0000000170416b78, k=0x00000001202b8660) at map.rs:1359:24
    frame #11: 0x0000000109ee86ac stPreCompiledContracts2-1b585838309dcc76`std::collections::hash::map::HashMap$LT$K$C$V$C$S$GT$::get::h7fed2b5557558c10 [inlined] hashbrown::map::HashMap$LT$K$C$V$C$S$C$A$GT$::get::hd19ee49bb621a90b at map.rs:1313:15
    frame #12: 0x0000000109ee86a8 stPreCompiledContracts2-1b585838309dcc76`std::collections::hash::map::HashMap$LT$K$C$V$C$S$GT$::get::h7fed2b5557558c10(self=0x0000000170416b78, k=0x00000001202b8660) at map.rs:882:19
    frame #13: 0x0000000109f5f5f8 stPreCompiledContracts2-1b585838309dcc76`cairo_lang_sierra::program_registry::ProgramRegistry$LT$TType$C$TLibfunc$GT$::get_type::h1c92685b1858304f(self=0x0000000170416b48, id=0x00000001202b8660) at program_registry.rs:127:9
    frame #14: 0x00000001007a28b0 stPreCompiledContracts2-1b585838309dcc76`_$LT$cairo_lang_sierra..extensions..core..CoreTypeConcrete$u20$as$u20$cairo_native..types..TypeBuilder$GT$::layout::h7d37c3d815448cb4(self=0x00000001202b8620, registry=0x0000000170416b48) at types.rs:716:49
    frame #15: 0x00000001007a3478 stPreCompiledContracts2-1b585838309dcc76`_$LT$cairo_lang_sierra..extensions..core..CoreTypeConcrete$u20$as$u20$cairo_native..types..TypeBuilder$GT$::layout::_$u7b$$u7b$closure$u7d$$u7d$::h7f2a471d56b69940(acc=Option<core::alloc::layout::Layout> @ 0x000000017021d070, id=0x0000600002d87280) at types.rs:688:33
    frame #16: 0x0000000100693fc4 stPreCompiledContracts2-1b585838309dcc76`core::iter::traits::iterator::Iterator::try_fold::hc73475a72ed576b2(self=0x000000017021d9f0, init=Option<core::alloc::layout::Layout> @ 0x000000017021d3b8, f={closure_env#1} @ 0x000000017021d2e0) at iterator.rs:2410:21
    frame #17: 0x00000001007a2714 stPreCompiledContracts2-1b585838309dcc76`_$LT$cairo_lang_sierra..extensions..core..CoreTypeConcrete$u20$as$u20$cairo_native..types..TypeBuilder$GT$::layout::h7d37c3d815448cb4(self=0x00000001202bf5e0, registry=0x0000000170416b48) at types.rs:682:47
    frame #18: 0x00000001007a31b8 stPreCompiledContracts2-1b585838309dcc76`_$LT$cairo_lang_sierra..extensions..core..CoreTypeConcrete$u20$as$u20$cairo_native..types..TypeBuilder$GT$::layout::_$u7b$$u7b$closure$u7d$$u7d$::hd71e97f890dc5d4e(acc=Layout @ 0x000000017021df00, id=0x0000600002d87300) at types.rs:673:33
    frame #19: 0x0000000100693a88 stPreCompiledContracts2-1b585838309dcc76`core::iter::traits::iterator::Iterator::try_fold::h8965b7bc29af4895(self=0x000000017021e730, init=Layout @ 0x000000017021e198, f={closure_env#0} @ 0x000000017021e0b8) at iterator.rs:2410:21
    frame #20: 0x00000001007a26a0 stPreCompiledContracts2-1b585838309dcc76`_$LT$cairo_lang_sierra..extensions..core..CoreTypeConcrete$u20$as$u20$cairo_native..types..TypeBuilder$GT$::layout::h7d37c3d815448cb4(self=0x00000001202d3da0, registry=0x0000000170416b48) at types.rs:671:17
    frame #21: 0x0000000100799240 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca920, location=Location @ 0x000000017021f0d0, helper=0x0000000170223eb0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x000000017021f0e0, src_value=Value @ 0x000000017021f0f0) at array.rs:103:23
    frame #22: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca920, location=Location @ 0x0000000170221080, helper=0x0000000170223eb0, metadata=0x0000000170416440, value=Value @ 0x0000000170221090) at snapshot_clones.rs:52:21
    frame #23: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca920, location=Location @ 0x00000001702211e0, helper=0x0000000170223eb0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x00000001702211f0, src_value=Value @ 0x0000000170221200) at struct.rs:117:31
    frame #24: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca920, location=Location @ 0x0000000170221810, helper=0x0000000170223eb0, metadata=0x0000000170416440, value=Value @ 0x0000000170221820) at snapshot_clones.rs:52:21
    frame #25: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170223d20, location=Location @ 0x0000000170221b10, helper=0x0000000170223eb0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x0000000170221b20, src_value=Value @ 0x0000000170221b30) at enum.rs:580:44
    frame #26: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170223d20, location=Location @ 0x0000000170222ac0, helper=0x0000000170223eb0, metadata=0x0000000170416440, value=Value @ 0x0000000170222ad0) at snapshot_clones.rs:52:21
    frame #27: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca958, location=Location @ 0x0000000170222fa0, helper=0x0000000170227d80, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x0000000170222fb0, src_value=Value @ 0x0000000170222fc0) at array.rs:253:54
    frame #28: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca958, location=Location @ 0x0000000170224f50, helper=0x0000000170227d80, metadata=0x0000000170416440, value=Value @ 0x0000000170224f60) at snapshot_clones.rs:52:21
    frame #29: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca958, location=Location @ 0x00000001702250b0, helper=0x0000000170227d80, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x00000001702250c0, src_value=Value @ 0x00000001702250d0) at struct.rs:117:31
    frame #30: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca958, location=Location @ 0x00000001702256e0, helper=0x0000000170227d80, metadata=0x0000000170416440, value=Value @ 0x00000001702256f0) at snapshot_clones.rs:52:21
    frame #31: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170227bf0, location=Location @ 0x00000001702259e0, helper=0x0000000170227d80, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x00000001702259f0, src_value=Value @ 0x0000000170225a00) at enum.rs:580:44
    frame #32: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170227bf0, location=Location @ 0x0000000170226990, helper=0x0000000170227d80, metadata=0x0000000170416440, value=Value @ 0x00000001702269a0) at snapshot_clones.rs:52:21
    frame #33: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca990, location=Location @ 0x0000000170226e70, helper=0x000000017022bc50, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x0000000170226e80, src_value=Value @ 0x0000000170226e90) at array.rs:253:54
    frame #34: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca990, location=Location @ 0x0000000170228e20, helper=0x000000017022bc50, metadata=0x0000000170416440, value=Value @ 0x0000000170228e30) at snapshot_clones.rs:52:21
    frame #35: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca990, location=Location @ 0x0000000170228f80, helper=0x000000017022bc50, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x0000000170228f90, src_value=Value @ 0x0000000170228fa0) at struct.rs:117:31
    frame #36: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca990, location=Location @ 0x00000001702295b0, helper=0x000000017022bc50, metadata=0x0000000170416440, value=Value @ 0x00000001702295c0) at snapshot_clones.rs:52:21
    frame #37: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017022bac0, location=Location @ 0x00000001702298b0, helper=0x000000017022bc50, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x00000001702298c0, src_value=Value @ 0x00000001702298d0) at enum.rs:580:44
    frame #38: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017022bac0, location=Location @ 0x000000017022a860, helper=0x000000017022bc50, metadata=0x0000000170416440, value=Value @ 0x000000017022a870) at snapshot_clones.rs:52:21
    frame #39: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca9c8, location=Location @ 0x000000017022ad40, helper=0x000000017022fb20, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x000000017022ad50, src_value=Value @ 0x000000017022ad60) at array.rs:253:54
    frame #40: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca9c8, location=Location @ 0x000000017022ccf0, helper=0x000000017022fb20, metadata=0x0000000170416440, value=Value @ 0x000000017022cd00) at snapshot_clones.rs:52:21
    frame #41: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca9c8, location=Location @ 0x000000017022ce50, helper=0x000000017022fb20, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x000000017022ce60, src_value=Value @ 0x000000017022ce70) at struct.rs:117:31
    frame #42: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160ca9c8, location=Location @ 0x000000017022d480, helper=0x000000017022fb20, metadata=0x0000000170416440, value=Value @ 0x000000017022d490) at snapshot_clones.rs:52:21
    frame #43: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017022f990, location=Location @ 0x000000017022d780, helper=0x000000017022fb20, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x000000017022d790, src_value=Value @ 0x000000017022d7a0) at enum.rs:580:44
    frame #44: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017022f990, location=Location @ 0x000000017022e730, helper=0x000000017022fb20, metadata=0x0000000170416440, value=Value @ 0x000000017022e740) at snapshot_clones.rs:52:21
    frame #45: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa00, location=Location @ 0x000000017022ec10, helper=0x00000001702339f0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x000000017022ec20, src_value=Value @ 0x000000017022ec30) at array.rs:253:54
    frame #46: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa00, location=Location @ 0x0000000170230bc0, helper=0x00000001702339f0, metadata=0x0000000170416440, value=Value @ 0x0000000170230bd0) at snapshot_clones.rs:52:21
    frame #47: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa00, location=Location @ 0x0000000170230d20, helper=0x00000001702339f0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x0000000170230d30, src_value=Value @ 0x0000000170230d40) at struct.rs:117:31
    frame #48: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa00, location=Location @ 0x0000000170231350, helper=0x00000001702339f0, metadata=0x0000000170416440, value=Value @ 0x0000000170231360) at snapshot_clones.rs:52:21
    frame #49: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170233860, location=Location @ 0x0000000170231650, helper=0x00000001702339f0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x0000000170231660, src_value=Value @ 0x0000000170231670) at enum.rs:580:44
    frame #50: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170233860, location=Location @ 0x0000000170232600, helper=0x00000001702339f0, metadata=0x0000000170416440, value=Value @ 0x0000000170232610) at snapshot_clones.rs:52:21
    frame #51: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa38, location=Location @ 0x0000000170232ae0, helper=0x00000001702378c0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x0000000170232af0, src_value=Value @ 0x0000000170232b00) at array.rs:253:54
    frame #52: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa38, location=Location @ 0x0000000170234a90, helper=0x00000001702378c0, metadata=0x0000000170416440, value=Value @ 0x0000000170234aa0) at snapshot_clones.rs:52:21
    frame #53: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa38, location=Location @ 0x0000000170234bf0, helper=0x00000001702378c0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x0000000170234c00, src_value=Value @ 0x0000000170234c10) at struct.rs:117:31
    frame #54: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa38, location=Location @ 0x0000000170235220, helper=0x00000001702378c0, metadata=0x0000000170416440, value=Value @ 0x0000000170235230) at snapshot_clones.rs:52:21
    frame #55: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170237730, location=Location @ 0x0000000170235520, helper=0x00000001702378c0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x0000000170235530, src_value=Value @ 0x0000000170235540) at enum.rs:580:44
    frame #56: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170237730, location=Location @ 0x00000001702364d0, helper=0x00000001702378c0, metadata=0x0000000170416440, value=Value @ 0x00000001702364e0) at snapshot_clones.rs:52:21
    frame #57: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa70, location=Location @ 0x00000001702369b0, helper=0x000000017023b790, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x00000001702369c0, src_value=Value @ 0x00000001702369d0) at array.rs:253:54
    frame #58: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa70, location=Location @ 0x0000000170238960, helper=0x000000017023b790, metadata=0x0000000170416440, value=Value @ 0x0000000170238970) at snapshot_clones.rs:52:21
    frame #59: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa70, location=Location @ 0x0000000170238ac0, helper=0x000000017023b790, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x0000000170238ad0, src_value=Value @ 0x0000000170238ae0) at struct.rs:117:31
    frame #60: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caa70, location=Location @ 0x00000001702390f0, helper=0x000000017023b790, metadata=0x0000000170416440, value=Value @ 0x0000000170239100) at snapshot_clones.rs:52:21
    frame #61: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017023b600, location=Location @ 0x00000001702393f0, helper=0x000000017023b790, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x0000000170239400, src_value=Value @ 0x0000000170239410) at enum.rs:580:44
    frame #62: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017023b600, location=Location @ 0x000000017023a3a0, helper=0x000000017023b790, metadata=0x0000000170416440, value=Value @ 0x000000017023a3b0) at snapshot_clones.rs:52:21
    frame #63: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caaa8, location=Location @ 0x000000017023a880, helper=0x000000017023f660, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x000000017023a890, src_value=Value @ 0x000000017023a8a0) at array.rs:253:54
    frame #64: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caaa8, location=Location @ 0x000000017023c830, helper=0x000000017023f660, metadata=0x0000000170416440, value=Value @ 0x000000017023c840) at snapshot_clones.rs:52:21
    frame #65: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caaa8, location=Location @ 0x000000017023c990, helper=0x000000017023f660, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x000000017023c9a0, src_value=Value @ 0x000000017023c9b0) at struct.rs:117:31
    frame #66: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caaa8, location=Location @ 0x000000017023cfc0, helper=0x000000017023f660, metadata=0x0000000170416440, value=Value @ 0x000000017023cfd0) at snapshot_clones.rs:52:21
    frame #67: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017023f4d0, location=Location @ 0x000000017023d2c0, helper=0x000000017023f660, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x000000017023d2d0, src_value=Value @ 0x000000017023d2e0) at enum.rs:580:44
    frame #68: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017023f4d0, location=Location @ 0x000000017023e270, helper=0x000000017023f660, metadata=0x0000000170416440, value=Value @ 0x000000017023e280) at snapshot_clones.rs:52:21
    frame #69: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caae0, location=Location @ 0x000000017023e750, helper=0x0000000170243530, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x000000017023e760, src_value=Value @ 0x000000017023e770) at array.rs:253:54
    frame #70: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caae0, location=Location @ 0x0000000170240700, helper=0x0000000170243530, metadata=0x0000000170416440, value=Value @ 0x0000000170240710) at snapshot_clones.rs:52:21
    frame #71: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caae0, location=Location @ 0x0000000170240860, helper=0x0000000170243530, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x0000000170240870, src_value=Value @ 0x0000000170240880) at struct.rs:117:31
    frame #72: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160caae0, location=Location @ 0x0000000170240e90, helper=0x0000000170243530, metadata=0x0000000170416440, value=Value @ 0x0000000170240ea0) at snapshot_clones.rs:52:21
    frame #73: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001702433a0, location=Location @ 0x0000000170241190, helper=0x0000000170243530, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x00000001702411a0, src_value=Value @ 0x00000001702411b0) at enum.rs:580:44
    frame #74: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001702433a0, location=Location @ 0x0000000170242140, helper=0x0000000170243530, metadata=0x0000000170416440, value=Value @ 0x0000000170242150) at snapshot_clones.rs:52:21
    frame #75: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab18, location=Location @ 0x0000000170242620, helper=0x0000000170247400, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x0000000170242630, src_value=Value @ 0x0000000170242640) at array.rs:253:54
    frame #76: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab18, location=Location @ 0x00000001702445d0, helper=0x0000000170247400, metadata=0x0000000170416440, value=Value @ 0x00000001702445e0) at snapshot_clones.rs:52:21
    frame #77: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab18, location=Location @ 0x0000000170244730, helper=0x0000000170247400, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x0000000170244740, src_value=Value @ 0x0000000170244750) at struct.rs:117:31
    frame #78: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab18, location=Location @ 0x0000000170244d60, helper=0x0000000170247400, metadata=0x0000000170416440, value=Value @ 0x0000000170244d70) at snapshot_clones.rs:52:21
    frame #79: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170247270, location=Location @ 0x0000000170245060, helper=0x0000000170247400, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x0000000170245070, src_value=Value @ 0x0000000170245080) at enum.rs:580:44
    frame #80: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170247270, location=Location @ 0x0000000170246010, helper=0x0000000170247400, metadata=0x0000000170416440, value=Value @ 0x0000000170246020) at snapshot_clones.rs:52:21
    frame #81: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab50, location=Location @ 0x00000001702464f0, helper=0x000000017024b2d0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x0000000170246500, src_value=Value @ 0x0000000170246510) at array.rs:253:54
    frame #82: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab50, location=Location @ 0x00000001702484a0, helper=0x000000017024b2d0, metadata=0x0000000170416440, value=Value @ 0x00000001702484b0) at snapshot_clones.rs:52:21
    frame #83: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab50, location=Location @ 0x0000000170248600, helper=0x000000017024b2d0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x0000000170248610, src_value=Value @ 0x0000000170248620) at struct.rs:117:31
    frame #84: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab50, location=Location @ 0x0000000170248c30, helper=0x000000017024b2d0, metadata=0x0000000170416440, value=Value @ 0x0000000170248c40) at snapshot_clones.rs:52:21
    frame #85: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017024b140, location=Location @ 0x0000000170248f30, helper=0x000000017024b2d0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x0000000170248f40, src_value=Value @ 0x0000000170248f50) at enum.rs:580:44
    frame #86: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017024b140, location=Location @ 0x0000000170249ee0, helper=0x000000017024b2d0, metadata=0x0000000170416440, value=Value @ 0x0000000170249ef0) at snapshot_clones.rs:52:21
    frame #87: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab88, location=Location @ 0x000000017024a3c0, helper=0x000000017024f1a0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x000000017024a3d0, src_value=Value @ 0x000000017024a3e0) at array.rs:253:54
    frame #88: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab88, location=Location @ 0x000000017024c370, helper=0x000000017024f1a0, metadata=0x0000000170416440, value=Value @ 0x000000017024c380) at snapshot_clones.rs:52:21
    frame #89: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab88, location=Location @ 0x000000017024c4d0, helper=0x000000017024f1a0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x000000017024c4e0, src_value=Value @ 0x000000017024c4f0) at struct.rs:117:31
    frame #90: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cab88, location=Location @ 0x000000017024cb00, helper=0x000000017024f1a0, metadata=0x0000000170416440, value=Value @ 0x000000017024cb10) at snapshot_clones.rs:52:21
    frame #91: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017024f010, location=Location @ 0x000000017024ce00, helper=0x000000017024f1a0, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x000000017024ce10, src_value=Value @ 0x000000017024ce20) at enum.rs:580:44
    frame #92: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x000000017024f010, location=Location @ 0x000000017024ddb0, helper=0x000000017024f1a0, metadata=0x0000000170416440, value=Value @ 0x000000017024ddc0) at snapshot_clones.rs:52:21
    frame #93: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cabc0, location=Location @ 0x000000017024e290, helper=0x0000000170253070, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x000000017024e2a0, src_value=Value @ 0x000000017024e2b0) at array.rs:253:54
    frame #94: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cabc0, location=Location @ 0x0000000170250240, helper=0x0000000170253070, metadata=0x0000000170416440, value=Value @ 0x0000000170250250) at snapshot_clones.rs:52:21
    frame #95: 0x00000001007a0ca4 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::struct::snapshot_take::h8f7dfb51ae117e3c(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cabc0, location=Location @ 0x00000001702503a0, helper=0x0000000170253070, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::structure::StructConcreteType> @ 0x00000001702503b0, src_value=Value @ 0x00000001702503c0) at struct.rs:117:31
    frame #96: 0x000000010065e3e0 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h7200d91852efa506(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cabc0, location=Location @ 0x00000001702509d0, helper=0x0000000170253070, metadata=0x0000000170416440, value=Value @ 0x00000001702509e0) at snapshot_clones.rs:52:21
    frame #97: 0x000000010079e4cc stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::enum::snapshot_take::h3418519f693fbb47(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170252ee0, location=Location @ 0x0000000170250cd0, helper=0x0000000170253070, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::modules::enm::EnumConcreteType> @ 0x0000000170250ce0, src_value=Value @ 0x0000000170250cf0) at enum.rs:580:44
    frame #98: 0x000000010065e230 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h1455272272cb3966(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x0000000170252ee0, location=Location @ 0x0000000170251c80, helper=0x0000000170253070, metadata=0x0000000170416440, value=Value @ 0x0000000170251c90) at snapshot_clones.rs:52:21
    frame #99: 0x000000010079b0c8 stPreCompiledContracts2-1b585838309dcc76`cairo_native::types::array::snapshot_take::h916cef4c3e34a190(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cabf8, location=Location @ 0x0000000170252160, helper=0x0000000170256f40, metadata=0x0000000170416440, info=WithSelf<cairo_lang_sierra::extensions::types::InfoAndTypeConcreteType> @ 0x0000000170252170, src_value=Value @ 0x0000000170252180) at array.rs:253:54
    frame #100: 0x000000010065e308 stPreCompiledContracts2-1b585838309dcc76`cairo_native::metadata::snapshot_clones::SnapshotClonesMeta::register::_$u7b$$u7b$closure$u7d$$u7d$::h6c60699dfe5f0bad(context=0x00000001704178c0, registry=0x0000000170416b48, entry=0x00000001160cabf8, location=Location @ 0x0000000170254110, helper=0x0000000170256f40, metadata=0x0000000170416440, value=Value @ 0x0000000170254120) at snapshot_clones.rs:52:21
azteca1998 commented 1 week ago

Thank you for the backtrace, I was having problems running it with the debugger (getting no such file or directory).

Could to expand the backtrace a bit? What I'm looking for is a repeating pattern. As in a -> b -> c -> a -> b -> c, but not necessarily only 3 frames long.

enitrat commented 1 week ago

@azteca1998 so actually the debugger is launched from the root of the repo but the files are being read relative to crates/ef-testing so you can just run, in lldb:

platform settings -w path/to/ef-tests/crates/ef-testing

and then, lldb run

edit: expanded the trace to frame #100

azteca1998 commented 1 week ago

Thank you, it worked.

I see the loop clearly now, and I think I know why that happened. Let me check if I'm right.

azteca1998 commented 1 week ago

I confirm it was what I suspected. Now it should crash with an assert instead of a stack overflow. I'm working on a real fix.

azteca1998 commented 1 week ago

Okay I've fixed that stack overflow issue, but now there's another issue which also causes stack overflow.

The clone impl registration stack overflow is fixed, but it seems your test has a self-referencing enum. The program enters infinite recursion when it tries to generate infinite MLIR code because of this structure.

This is what I mentioned earlier in Telegram about self-referencing types, which I still haven't been able to fix.

enitrat commented 1 week ago

Ah indeed 🤦I forgot about this specific one. Sorry.

azteca1998 commented 1 week ago

No problem, it was easy to find once the stack trace changed. If everything goes correctly I should have that stack overflow fixed today, but that's a big if.

azteca1998 commented 1 week ago

The stack overflow should now be fixed (along with most memory leaks) in my PR.

enitrat commented 1 week ago

Great! Thank you!

enitrat commented 1 week ago

On this topic of memory leaks, is it possible that there would be one at runtime? I observed that our CI runner crashed on this last branch, with the same stack size as on main (where it passes) cf: https://github.com/kkrt-labs/kakarot-ssj/actions/runs/11149866714/job/30989765129?pr=1011

When running locally on my 64GB M2 mac, at some point my memory usage grows very big, but it succeeds.

image
enitrat commented 1 week ago

I ran an analysis of the memory usage on a local run of our test suite.

The memory usage was estimated with:

use std::ptr;
use std::mem;

#[link(name = "c")]
extern "C" {
    fn mach_task_self() -> libc::c_uint;
    fn task_info(
        task: libc::c_uint,
        flavor: libc::c_uint,
        task_info: *mut libc::c_void,
        inout_count: *mut libc::c_uint,
    ) -> libc::c_int;
}

const MACH_TASK_BASIC_INFO: libc::c_uint = 20;

#[repr(C)]
struct MachTaskBasicInfo {
    virtual_size: u64,
    resident_size: u64,
    resident_size_max: u64,
    user_time: u64,
    system_time: u64,
    policy: i32,
    suspend_count: i32,
}

fn get_current_memory_usage() -> Result<usize, String> {
    unsafe {
        let mut info = MachTaskBasicInfo {
            virtual_size: 0,
            resident_size: 0,
            resident_size_max: 0,
            user_time: 0,
            system_time: 0,
            policy: 0,
            suspend_count: 0,
        };
        let mut count = mem::size_of::<MachTaskBasicInfo>() as libc::c_uint / mem::size_of::<libc::integer_t>() as libc::c_uint;
        let kr = task_info(
            mach_task_self(),
            MACH_TASK_BASIC_INFO,
            &mut info as *mut _ as *mut libc::c_void,
            &mut count,
        );
        if kr == 0 {
            Ok(info.resident_size as usize)
        } else {
            Err(format!("Failed to get task info. Error code: {}", kr))
        }
    }
}

Result:

image

The steep curve around index 10k corresponds to stStackTests::stackOverflow tests. In these tests, we push up to 1024 items on the "Stack", which is using a Felt252Dict. Because the memory usage doesn't go down after these tests, I infer that there could be something leaking memory in them?

Could this be related to https://github.com/lambdaclass/cairo_native/issues/825 ? cc @edg-l

azteca1998 commented 1 week ago

Is this using my PR or the main branch?

enitrat commented 1 week ago

using your PR. I will also do a run from main brunch and compare the results - but from main branch, our CI still passes (it doesn't contain the bug fixed in your branch which is only included in an PR we have not merged yet)

azteca1998 commented 1 week ago

Do you happen to use a lot of arrays in those tests? I've realized I forgot something related to arrays in that PR.

enitrat commented 1 week ago

we use a lot of arrays generally, yes

enitrat commented 1 week ago

Here is the equivalent memory usage on main:

image
azteca1998 commented 1 week ago

Interesting. My PR seems to have a much stable memory usage, but also much higher.

I've fixed the issue with the arrays. Could you try again with the latest commit?

enitrat commented 1 week ago

I am seeing something weird:

thread 'stStackTests::stStackTests::test_shallowStack_d6g0v0_Cancun' panicked at /Users/msaug/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.5/src/raw/mod.rs:177:9:
Went past end of probe sequence
tests-ea898dc99e20dbff(43033,0x16f243000) malloc: Incorrect checksum for freed object 0x122a71328: probably modified after being freed.
Corrupt value: 0x7fffffffffff9b0
tests-ea898dc99e20dbff(43033,0x16f243000) malloc: *** set a breakpoint in malloc_error_break to debug

not sure whether i messed something with my local setup or not 🤔. Starting a CI run to see if it also happens there

azteca1998 commented 1 week ago

I don't think it's your environment. I think we're using a pointer after freeing it. The assert that crashed the program is probably only available in debug mode so it may or may not crash in release mode, but there's something definitely wrong.

azteca1998 commented 1 week ago

I have an idea on how to (attempt to) debug this, but I'd need the command that generates that specific error. I assume it's a test; if so, could I have the instructions to run only that specific test? If it happens in multiple tests, the smaller the test the better.

enitrat commented 1 week ago

There is actually another side effect. Now all of our tests revert with an error

 WARN ef_testing::models::result: stStackTests::stackOverflowDUP_d13g0v0_Cancun reverted:
Transaction execution has failed:
0: Error in the called contract (contract address: 0x0000000000000000000000000000000000000000000000000000000000000003, class hash: 0x06153ccf69fd20f832c794df36e19135f0070d0576144f0b47f75a226e4be530, selector: 0x015d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad):
Error at pc=0:25:
Cairo traceback (most recent call last):
Unknown location (pc=0:731)
Unknown location (pc=0:677)
Unknown location (pc=0:291)
Unknown location (pc=0:314)

1: Error in the called contract (contract address: 0x04c15a3ff2822ca5b75a67a2ff0226b8b18a94c1c7d396b0073269c5b074d14f, class hash: 0x05b953b2f2ed1e6a4943dc934cc8a5fb12de801745a40857f4459bb375c0f04c, selector: 0x007ec457cd7ed1630225a8328f826a29a327b19486f6b2882b4176545ebdbe3d):
Native execution error: Native execution error: Invalid chain id

Something has changed in the process of how we retrieve chain id.

Let me write another issue