Skip to content

Commit c26412c

Browse files
hakymullaJulianGCalderongabrielbosioFrancoGiachetta
committed
Review TODO comments (#1227)
* Review TODO comments * Minor improvements to Sierra Emu crate (#1202) * Move cairo-lang dependencies to workspace * Remove sierra-emu/.gitignore * Update lock * Add fibonacci.cairo example for sierra emulator * Simplify Makefile * Simplify README and improve documentation on how to use the binary * Add make check * Improve examples * Document make check * Remove unused script * Add fibonacci_contract.cairo * Fix typo in Makefile * Fix CI * Use cairo2/corelib instead of corelib for symlinking in sierra emu * Improve Sierra Emulator descritopn * Move more dependencies to workspace * Fix whitespace * Fix whitespace (again) --------- Co-authored-by: Gabriel Bosio <[email protected]> * Add Trace Dump feature (#1199) * Add trace dump support in compiler * Add sierra emu dependency with trace-dump feature * Add trace dump metadata * Register trace dump symbols on executors * Use trace dump feature in cairo-native-run * Remove unused feature * Rename trace_id symbol * Don't generate trace dump on return when no tail recursion target has been found * Update lock * Derive Eq,PartialEq on TraceDump * Substract initial required gas in sierra emu * Print error when trace dump is not found, but ignore * Add trace dump test * Fix clippy * Remove `get_layout` from trace dump * Rename variables * Minor improvements * Add documentation * Improve documentation * Improve documentation on trace dump runtime functions * Fix typo Co-authored-by: Gabriel Bosio <[email protected]> * Fix warning * Update usage docs * Document trace dump feature for programs * Add txt to blockquote to avoid executing in doc test --------- Co-authored-by: Gabriel Bosio <[email protected]> * [Sierra-Emu] Implement missing syscall and nullable libfuncs (#1205) * Add sierra-emu as a debug utility * Change working dir in sierra-emu job * Remove repeated lines in sierra-emu gitignore * Exclude debug_utils from coverage job * remove some todos from value and implement Coupon libfunc * start adding corelib test * run tests from corelib * remove unwanted file * remove not related things * get return_value from trace * replace ids for debug info * add common folder for integration tests * fix tests * remove todo * ignore test for now * filter ignored tests * Update debug_utils/sierra-emu/tests/common/mod.rs Co-authored-by: Julian Gonzalez Calderon <[email protected]> * run ignored test from the ci * better ignoring * remove debug_name in enums * refactor * remove unused dependency * More expressive naming for the workflow Co-authored-by: Gabriel Bosio <[email protected]> * reviews * reviews * fmt * fmt ci * revert last commit * fmt * accidentally removed rayon usage * avoid map's short-circuiting * catch panics the avoid loosing the test name * log ignored tests * clippy * Add "(WIP)" to corelib's test job Co-authored-by: Gabriel Bosio <[email protected]> * print progress as the test runs * fmt * format makefile Co-authored-by: Julian Gonzalez Calderon <[email protected]> * fix name test in ci * add dependencies removed in merge * dependencies * clippy * remove unused import * better indent in makefile * uppercase tests summary comment for better sight * add starknet missing libfuncs * cargo.lock * add null, nullable_from_box and match_nullable libfuncs * clippyt * add forward_snapshot libfunc + fix is() for nullable * refactor syscall handler * add some felt types to match * remove type_to_name() call in is() function --------- Co-authored-by: gabrielbosio <[email protected]> Co-authored-by: Julian Gonzalez Calderon <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> * [Sierra-Emu] implement some todos from `const` and `cast` libfuncs (#1191) * Add sierra-emu as a debug utility * Change working dir in sierra-emu job * Remove repeated lines in sierra-emu gitignore * Exclude debug_utils from coverage job * remove some todos from value and implement Coupon libfunc * start adding corelib test * run tests from corelib * remove unwanted file * remove not related things * get return_value from trace * replace ids for debug info * add common folder for integration tests * fix tests * remove todo * ignore test for now * add enum in const::inner * remove todos and fix some failures * filter ignored tests * Update debug_utils/sierra-emu/tests/common/mod.rs Co-authored-by: Julian Gonzalez Calderon <[email protected]> * run ignored test from the ci * better ignoring * ignore test * fmt * remove debug_name in enums * refactor * remove unused dependency * More expressive naming for the workflow Co-authored-by: Gabriel Bosio <[email protected]> * reviews * reviews * fmt * fmt ci * revert last commit * fmt * accidentally removed rayon usage * avoid map's short-circuiting * catch panics the avoid loosing the test name * log ignored tests * clippy * Add "(WIP)" to corelib's test job Co-authored-by: Gabriel Bosio <[email protected]> * print progress as the test runs * fmt * format makefile Co-authored-by: Julian Gonzalez Calderon <[email protected]> * fix name test in ci * add dependencies removed in merge * dependencies * clippy * remove unused import * better indent in makefile * uppercase tests summary comment for better sight * fix clippy * clippy * remove unnecesary pubs * better docs * better panic message in get_numberic_args_as_bigints() Co-authored-by: Julian Gonzalez Calderon <[email protected]> * reviews * remove unnecessary comment Co-authored-by: Julian Gonzalez Calderon <[email protected]> * use slices in get_numeric_args_as_bigints * fmt * remove unnecesary to_vec * fmt * use iter instead of into_iter * reviews changes * better error message * fix typo --------- Co-authored-by: gabrielbosio <[email protected]> Co-authored-by: Julian Gonzalez Calderon <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> * [Sierra-Emu] implement `get_available_gas` libfunc (#1210) * implement las gas libfunc * remove unnecesary pubs * Improve sierra2casm-dbg (#1206) * Add sierra2casm-dbg * Sync cairo version between sierra2casm-dbg and root * Bump Cairo VM version in sierra2casm-dbg * Fix compilation and linter errors * Bump Cairo in sierra2casm-dbg * Remove unused serde dep in sierra2casm-dbg * Remove Rust toolchain in sierra2casm-dbg * Add sierra2casm-dbg CI job (#1201) * Move cairo-lang dependencies to workspace * Remove sierra-emu/.gitignore * Update lock * Add fibonacci.cairo example for sierra emulator * Simplify Makefile * Simplify README and improve documentation on how to use the binary * Add make check * Improve examples * Document make check * Remove unused script * Add fibonacci_contract.cairo * Fix typo in Makefile * Fix CI * Use cairo2/corelib instead of corelib for symlinking in sierra emu * Improve Sierra Emulator descritopn * Move more dependencies to workspace * Rename to casm-data-flow * Add Makefile * Add basic run-contract example * Add fibonacci_starknet.cairo * Fix hint format * Add basic README.md * Update dependencies * Print gas usage * Finish README.md * Add .PHONY * Fix paragraph * Move deps to workspace * Fix whitespace * Fix whitespace * Fix README.md --------- Co-authored-by: gabrielbosio <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> * [Sierra-Emu] implement missing libfuncs from `int_range` and `array` (#1200) * Add sierra-emu as a debug utility * Change working dir in sierra-emu job * Remove repeated lines in sierra-emu gitignore * Exclude debug_utils from coverage job * remove some todos from value and implement Coupon libfunc * start adding corelib test * run tests from corelib * remove unwanted file * remove not related things * get return_value from trace * replace ids for debug info * add common folder for integration tests * fix tests * remove todo * ignore test for now * filter ignored tests * Update debug_utils/sierra-emu/tests/common/mod.rs Co-authored-by: Julian Gonzalez Calderon <[email protected]> * run ignored test from the ci * better ignoring * remove debug_name in enums * refactor * remove unused dependency * More expressive naming for the workflow Co-authored-by: Gabriel Bosio <[email protected]> * reviews * reviews * fmt * fmt ci * revert last commit * fmt * accidentally removed rayon usage * avoid map's short-circuiting * catch panics the avoid loosing the test name * log ignored tests * clippy * Add "(WIP)" to corelib's test job Co-authored-by: Gabriel Bosio <[email protected]> * print progress as the test runs * fmt * format makefile Co-authored-by: Julian Gonzalez Calderon <[email protected]> * fix name test in ci * add dependencies removed in merge * dependencies * clippy * remove unused import * better indent in makefile * uppercase tests summary comment for better sight * implement int_range libfuncs * implement missing array libfuncs * fmt * add is() for IntRange * remove unnecesary pubs * reviews * reviews * fix branching in int_range_try_new * clippy * reviews * fmt --------- Co-authored-by: gabrielbosio <[email protected]> Co-authored-by: Julian Gonzalez Calderon <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> * [Sierra-Emu] Implement missing libfuncs from int (#1192) * Add sierra-emu as a debug utility * Change working dir in sierra-emu job * Remove repeated lines in sierra-emu gitignore * Exclude debug_utils from coverage job * remove some todos from value and implement Coupon libfunc * start adding corelib test * run tests from corelib * remove unwanted file * remove not related things * get return_value from trace * replace ids for debug info * add common folder for integration tests * fix tests * remove todo * ignore test for now * filter ignored tests * Update debug_utils/sierra-emu/tests/common/mod.rs Co-authored-by: Julian Gonzalez Calderon <[email protected]> * run ignored test from the ci * better ignoring * remove debug_name in enums * refactor * remove unused dependency * implement missing libfuncs from int * fmt * More expressive naming for the workflow Co-authored-by: Gabriel Bosio <[email protected]> * reviews * reviews * fmt * fmt ci * revert last commit * fmt * accidentally removed rayon usage * avoid map's short-circuiting * catch panics the avoid loosing the test name * log ignored tests * clippy * Add "(WIP)" to corelib's test job Co-authored-by: Gabriel Bosio <[email protected]> * add general libfuncs: const, equal, to_felt, from_felt * add diff libfunc * print progress as the test runs * fmt * fix from_felt * remove unused files + fix issue with non-integer * format makefile Co-authored-by: Julian Gonzalez Calderon <[email protected]> * try fix from_felt * fix name test in ci * add dependencies removed in merge * dependencies * clippy * remove unused import * better indent in makefile * uppercase tests summary comment for better sight * simplify a little apply_wrapping_op * merge test-corelib * remove unnecesary pubs * also match builtins instead of filtering them * format * use slices in get_numeric_args_as_bigints * fmt * remove unnecesary to_vec * fmt * use iter instead of into_iter * clippy * reviews + remove uint128 file * rename uint252 file to uint256 * fix clippy --------- Co-authored-by: gabrielbosio <[email protected]> Co-authored-by: Julian Gonzalez Calderon <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> * Update arch.rs * Update main.rs * Update arch.rs * Update enum.rs * Update arch.rs * Update executor.rs * Update contract.rs * Update bytes31.rs * Update felt252.rs * Update starknet.rs * Update starknet.rs * implement circuit_single_limb_less_than_guarantee_verify (#1212) * implement circuit_single_limb_less_than_guarantee_verify * fmt * clippy * Fix comment Co-authored-by: Julian Gonzalez Calderon <[email protected]> --------- Co-authored-by: Julian Gonzalez Calderon <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> * [Sierra-Emu] Fix felt-dict's overflow, circuits libfuncs and implement missing EcPoint libfunc (#1208) * change initial gas due to overflows * fix some libfuncs in circuits * fix is() for circuits * remove Value::Unit from return values in get_output * match U96LimbsLessThanGuarantee correctly * some corrections to circuits * some corrections to circuits * fix failure_guarantee_verify to avoid panicking * fix circuits * more fixes to circuits + implement ec_zero libfunc * clippy * remove unnecesary tests * remove unnecesary file * fix branch index * add comment * fix eval_u96_limbs_less_than_guarantee_verify * remove circuit failure test * update trace dump with new Value::CircitOutputs * fmt * reviews + fix modulus in trace dump * remove unnecesary file * fix clippy * implement circuit_single_limb_less_than_guarantee_verify * fix trace dump for circuit outputs * fix felt_dict_get * fix felt_dict_get * implement U96LimbsLessThanGuarantee for trace dump * remove unnecessary code * fmt * fix felt_dict_entry_get * revert change in circuits.rs * remove unwanted file * revert unwanted change * revert unwanted change * make trace dump for circuit outputs cleaner * remove unwanted code * increase felt dict count always during get() * doc function + merge main * reviews * use elemts stride for offseting u384 structs * forgot to update one stride --------- Co-authored-by: Gabriel Bosio <[email protected]> * cherry: Use dynamic arrays instead of static arrays for circuit data (#1233) (#1237) * [Serra-Emu] Fix some libfuncs (#1223) * change initial gas due to overflows * fix some libfuncs in circuits * fix is() for circuits * remove Value::Unit from return values in get_output * match U96LimbsLessThanGuarantee correctly * some corrections to circuits * some corrections to circuits * fix failure_guarantee_verify to avoid panicking * fix circuits * more fixes to circuits + implement ec_zero libfunc * clippy * remove unnecesary tests * remove unnecesary file * fix branch index * add comment * fix eval_u96_limbs_less_than_guarantee_verify * remove circuit failure test * update trace dump with new Value::CircitOutputs * fmt * reviews + fix modulus in trace dump * remove unnecesary file * fix clippy * implement circuit_single_limb_less_than_guarantee_verify * fix trace dump for circuit outputs * fix felt_dict_get * fix felt_dict_get * implement U96LimbsLessThanGuarantee for trace dump * remove unnecessary code * fmt * fix felt_dict_entry_get * revert change in circuits.rs * remove unwanted file * revert unwanted change * revert unwanted change * fix cast and int range libfuncs * make trace dump for circuit outputs cleaner * remove unwanted code * increase felt dict count always during get() * doc function + merge main * fix some libfuncs * implement CouponCall not working * all tests passing * remove WIP for corelib tests in sierra-emu's ci * remove WIP for corelib tests in sierra-emu's ci * fmt! * pop unused argument in coupon_call * better error messages in utils * Fix format * Gather compilation statistics (#1236) * Add basic Statistics struct and its builder * Add Serialzie to Statistics * Generate basic sierra statistics * Add stats argument to compile * Save sierra to mlir and mlir passes time * Add stats argument to object_to_shared_lib * Save linking time * Add stats argument to module_to_object * Save llvm time * Save total compilation time * Save object size in statistics * Remove StatisticsBuilder * Add libfunc frequency * Remove work * Assert frequency map is not empty * Save mlir operation count * Save llvmir instructions and opcode frequency * Save llvmir virtual register count * Adapt trace_dump.rs * Don't rely on transmute * Move MLIR walking logic to walk_ir module * Move LLVMIR walking to walk_ir module * Improve comments * Pass statistics to compile stats * Save MLIR operations by libfunc * Add clone_option_mut macro * Validate statistics * Use clone_option_mut * Document statistics * Document walk_ir module * Add API to statistics * Add support for saving stats on `starknet-native-compile` * Add documentation * Fix clippy * Update starknet-blocks.yml ref * Rephrase docs Co-authored-by: Gabriel Bosio <[email protected]> * Update script for comparing state dumps --------- Co-authored-by: Gabriel Bosio <[email protected]> * Don't fail on empty programs (#1248) * Update version (#1249) --------- Co-authored-by: Julian Gonzalez Calderon <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> Co-authored-by: Franco Giachetta <[email protected]> Co-authored-by: gabrielbosio <[email protected]>
1 parent cdfdaed commit c26412c

File tree

9 files changed

+14
-13
lines changed

9 files changed

+14
-13
lines changed

src/arch.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl AbiArgument for ValueWithInfoWrapper<'_> {
114114
.to_bytes(buffer, find_dict_drop_override)?,
115115

116116
(Value::Array(_), CoreTypeConcrete::Array(_)) => {
117-
// TODO: Assert that `info.ty` matches all the values' types.
117+
// TODO: Assert that `info.ty` matches all the values' types. See: https://github.com/lambdaclass/cairo_native/issues/1216
118118

119119
let abi_ptr = self.value.to_ptr(
120120
self.arena,
@@ -130,6 +130,7 @@ impl AbiArgument for ValueWithInfoWrapper<'_> {
130130
abi.capacity.to_bytes(buffer, find_dict_drop_override)?;
131131
}
132132
(Value::BoundedInt { .. }, CoreTypeConcrete::BoundedInt(_)) => {
133+
// See: https://github.com/lambdaclass/cairo_native/issues/1217
133134
native_panic!("todo: implement AbiArgument for Value::BoundedInt case")
134135
}
135136
(Value::Bytes31(value), CoreTypeConcrete::Bytes31(_)) => {

src/bin/cairo-native-stress/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ fn main() {
103103
let before_round = Instant::now();
104104

105105
let program = modify_starknet_contract(program.clone(), UNIQUE_CONTRACT_VALUE, round);
106-
// TODO: use the program hash instead of round number.
107106
let hash = round;
108107

109108
debug!(hash, "obtained test program");

src/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ fn invoke_dynamic(
265265
_ if type_info.is_builtin() => {
266266
if !type_info.is_zst(registry)? {
267267
if let CoreTypeConcrete::BuiltinCosts(_) = type_info {
268-
// todo: should we use this value?
268+
// todo: should we use this value? See: https://github.com/lambdaclass/cairo_native/issues/1219
269269
let _value = match &mut return_ptr {
270270
Some(return_ptr) => unsafe { *read_value::<*mut u64>(return_ptr) },
271271
None => ret_registers[0] as *mut u64,

src/executor/contract.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ mod tests {
729729
use rayon::iter::ParallelBridge;
730730
use rstest::*;
731731

732-
// todo add recursive contract test
732+
// todo add recursive contract test See: https://github.com/lambdaclass/cairo_native/issues/1220
733733

734734
#[fixture]
735735
fn starknet_program() -> ContractClass {

src/libfuncs/bytes31.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ mod test {
170170
use starknet_types_core::felt::Felt;
171171

172172
lazy_static! {
173-
// TODO: Test `bytes31_const` once the compiler supports it.
173+
// TODO: Test `bytes31_const` once the compiler supports it. See: https://github.com/lambdaclass/cairo_native/issues/1224
174174
static ref BYTES31_ROUNDTRIP: (String, Program) = load_cairo! {
175175
use core::bytes_31::{bytes31_try_from_felt252, bytes31_to_felt252};
176176

src/libfuncs/felt252.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,10 @@ pub mod test {
364364
}
365365
};
366366

367-
// TODO: Add test program for `felt252_add_const`.
368-
// TODO: Add test program for `felt252_sub_const`.
369-
// TODO: Add test program for `felt252_mul_const`.
370-
// TODO: Add test program for `felt252_div_const`.
367+
// TODO: Add test program for `felt252_add_const`. See: https://github.com/lambdaclass/cairo_native/issues/1214
368+
// TODO: Add test program for `felt252_sub_const`. See: https://github.com/lambdaclass/cairo_native/issues/1214
369+
// TODO: Add test program for `felt252_mul_const`. See: https://github.com/lambdaclass/cairo_native/issues/1214
370+
// TODO: Add test program for `felt252_div_const`. See: https://github.com/lambdaclass/cairo_native/issues/1214
371371

372372
static ref FELT252_CONST: (String, Program) = load_cairo! {
373373
extern fn felt252_const<const value: felt252>() -> felt252 nopanic;

src/starknet.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl From<&Felt252Abi> for Felt {
5353
}
5454

5555
/// Binary representation of a `u256` (in MLIR).
56-
// TODO: This shouldn't need to be public.
56+
// TODO: This shouldn't need to be public. See: https://github.com/lambdaclass/cairo_native/issues/1221
5757
#[derive(
5858
Debug,
5959
Clone,
@@ -557,7 +557,7 @@ impl StarknetSyscallHandler for DummySyscallHandler {
557557
}
558558
}
559559

560-
// TODO: Move to the correct place or remove if unused.
560+
// TODO: Move to the correct place or remove if unused. See: https://github.com/lambdaclass/cairo_native/issues/1222
561561
pub(crate) mod handler {
562562
use super::*;
563563
use crate::utils::{libc_free, libc_malloc};

src/types/enum.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,8 @@ pub fn get_layout_for_variants(
761761
/// Extract the type and layout for the default enum representation, its discriminant and all its
762762
/// payloads.
763763
// TODO: Change this function to accept a slice of slices (for variants). Not all uses have a slice
764-
// with one `ConcreteTypeId` per variant (deploy_syscalls has two types for the Ok() variant).
764+
// with one `ConcreteTypeId` per variant (deploy_syscalls has two types for the Ok() variant).
765+
// See: https://github.com/lambdaclass/cairo_native/issues/1187/
765766
pub fn get_type_for_variants<'ctx>(
766767
context: &'ctx Context,
767768
module: &Module<'ctx>,

src/types/starknet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! ## Secp256Point
2020
//! TODO
2121
22-
// TODO: Maybe the types used here can be i251 instead of i252.
22+
// TODO: Maybe the types used here can be i251 instead of i252. See https://github.com/lambdaclass/cairo_native/issues/1226
2323

2424
use super::WithSelf;
2525
use crate::{

0 commit comments

Comments
 (0)