Older non-integration related bugs

Issue PRs Description
Fix jump and felt_is_zero #15
Dataflow handling When there are 2 paths, and the point where they join uses a variable computed within those paths, it currently errors because it doesn't dominate it's use. To fix this we need to pass the variables through the block arguments.
bug: possible infinite loop when resizing a dict
libfunc: array_snapshot_pop_front
Fix dictionary gas counting
Failing test: felt252_to_bool_bug
This bug is caused by a bug in LLVM, already reported and fixed in the upcoming LLVM 18 release.
Failing test: _tests_cases_array_slice_cairo_expects_inconclusiveempty
Fix array slice bug
Failing test: _tests_cases_uint_safe_divmod_cairo_expects_inconclusiveempty
Update test/cases/uint/safe_divmod.cairo file Updates the test file and unlocks the corresponding test case
Failing test: ec_point_from_x_big
Fix bug in ec_point_from_x Libfunc ec_point_from_x_nz now uses -y instead of y when y > PRIME / 2
Add comparison between native and vm values for NonZero types
Failing test: ec_point_from_x_proptest
Fix bug in ec_point_from_x Libfunc ec_point_from_x_nz now uses -y instead of y when y > PRIME / 2
Add comparison between native and vm values for NonZero types
Make gas be a u128 instead of a u64
Make gas type be u128
Bug when with Err variant on results from a Starknet syscall
Fix llvm.getelementptr offset bug.
We were computing a byte offset on a pointer taking into account the actual type, causing the offset to be off by a factor of the actual type's length.

In other words, we were calculating the offset as if it were a C pointer, whereas we needed a byte offset. | | ‣ snapshot_take should handle non trivialy copyable types, (types with ptrs like arrays) | ‣ Fix snapshot_take for non-trivially-copyable types (ex. Array<T>) | This is most possibly related to the bug in keccak, which is caused by the clone on the array, which calls snapshot_take and array_snapshot_pop_front

-Add a new metadata for overriding snapshot_take's default behavior.

We cannot provide a default (zero) implementation for every possible sierra type. This PR implements a default for unsigned integer, boolean and nullable types which are known to be valid for dicts. | | ‣ Fix snapshot_take behavior for Nullable<T> types. | ‣ Fix nullable snapshots and a memory leak. | Add custom clone mechanism for Nullable<T> snapshots. Free the allocated memory when unboxing. |

Bugs found by integrating other projects and/or tests

Reporter Issue PRs Description
Dom (Nethermind)
Enum consistency
Fix single-variant enum bug. Single-variant enums generate a struct with an i0 tag, which is apparently not valid in LLVM (but LLVM didn't throw an error when used through at least invoke_packed).
Dom (Nethermind)
Further enum init testing. More tests
Dom (Nethermind)
Zero-width enums
Fix empty enum types. As can be seen in the enum_init_empty test introduced in #445, enums which are modeled by the zero length array representation cannot be initialised due to mismatching types in the generated mlir
Dom (Nethermind)
Incorrect payloads in complex enums
Fix enum payload bug.
As can be seen in the enum_init_nested_* tests in #445, enums are being returned with incorrect payloads, though whether this is because they are stored incorrectly or loaded/returned incorrectly I cannot say.

The comparison test framework had a bug where it failed to compare the VM vs native results in some cases. This PR rewrites that part making it both easier to read and understand, and fixing the bug in the process. | | cairo-native-test | ‣ Panic: cast from u8 to bytes31 not working | ‣ Fix casting libfuncs. | Casting now works with bytes31 too. | | Greg (Kakarot) | ‣ Kakarot tests | ‣ Fix box and unbox with enums. | The box and unbox libfuncs weren't working properly with stack-allocated enums (those with more than a single variant that are not C-style enums). | | Greg (Kakarot) | ‣ bug: Difference in function Id | ‣ Fix gas bug | There was assert because i copied the cairo code for gas that used 2 methods to calculate the gas at the same time and checked their results matched, the old method didnt match because we dont pass the function costs to it, but the new method acquires these function costs with another method, so we dont have to care (would need a pointless change in the api) and its easier. | | Greg (Kakarot) | ‣ bug: immarg operand has non-immediate parameter | ‣ Fix memcpy with dynamic length | There is an inline memcpy with a dynamic length, which is invalid. | | Greg (Kakarot) | ‣ bug: span issue | ‣ | | | cairo-native-test | ‣ Support all casts | Closed | | | cairo-native-test | ‣ Bug: Segfault in panics_test.cairo | ‣ | | | cairo-native-test | ‣ Bug: cairo test test_ecdsa_recover_public_key fails | ‣ | | | cairo-native-test | ‣ Bug: cairo test test_span fails with segfault | Closed by rewrite of the array module | | | cairo-native-test | ‣ Bug: cairo tests fmt_test fails | ‣ | | | cairo-native-test | ‣ Bug: cairo-test byte_array_test.cairo tests fail | ‣ | | | cairo-native-test | ‣ Bug: cairo-test test_u256_div_mod_n fails | Fixed | | | cairo-native-test | ‣ Bug: cairo-test integer_tests fail (mostly signed ints) | ‣ | | | kariy (Cartridge) | ‣ panicked on index out of bounds | Closed | | | Bohdan (Nethermind) | ‣ Unexpected behaviour of event emitting (2.6.3) | Closed | | | Bohdan (Nethermind) | ‣ Problems with passing arrays (2.6.3) | Closed | | | Greg (Kakarot) | ‣ bug: issue in self referencing struct | Closed | | | Bohdan (Nethermind) | ‣ | | | | Bohdan (Nethermind) | ‣ | ‣ | | | | ‣ | ‣ | |