-
Notifications
You must be signed in to change notification settings - Fork 49
[Sierra-Emu] implement some todos from const and cast libfuncs
#1191
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
Merged
Merged
Changes from 82 commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
65ab4fa
Add sierra-emu as a debug utility
gabrielbosio baf9b00
Change working dir in sierra-emu job
gabrielbosio 11696b3
Merge branch 'main' into add_debug_utils
gabrielbosio 8caf292
Remove repeated lines in sierra-emu gitignore
gabrielbosio 758c981
Exclude debug_utils from coverage job
gabrielbosio 53343db
remove some todos from value and implement Coupon libfunc
FrancoGiachetta 37494f2
start adding corelib test
FrancoGiachetta c7f6e0c
run tests from corelib
FrancoGiachetta de3a0bf
merge main
FrancoGiachetta a664894
remove unwanted file
FrancoGiachetta 0464dfc
remove not related things
FrancoGiachetta 30c6191
get return_value from trace
FrancoGiachetta 40f0ed9
replace ids for debug info
FrancoGiachetta 144a7ac
add common folder for integration tests
FrancoGiachetta 60ac288
fix tests
FrancoGiachetta e18a55d
remove todo
FrancoGiachetta 21b75aa
ignore test for now
FrancoGiachetta be29058
add enum in const::inner
FrancoGiachetta c5e5355
remove todos and fix some failures
FrancoGiachetta 612b471
filter ignored tests
FrancoGiachetta 3b34455
Update debug_utils/sierra-emu/tests/common/mod.rs
FrancoGiachetta d7642af
Merge branch 'test-corelib' of github.com:lambdaclass/cairo_native in…
FrancoGiachetta 973a7db
run ignored test from the ci
FrancoGiachetta 035ff56
better ignoring
FrancoGiachetta 5fd9009
Merge branch 'test-corelib' into sierra-emu-add-some-libfs
FrancoGiachetta 6acc0c2
ignore test
FrancoGiachetta 1ab6479
fmt
FrancoGiachetta b325655
remove debug_name in enums
FrancoGiachetta fa74ff1
refactor
FrancoGiachetta 8e8c03f
remove unused dependency
FrancoGiachetta 5198de6
Merge branch 'test-corelib' into sierra-emu-add-some-libfs
FrancoGiachetta 0b5f319
More expressive naming for the workflow
FrancoGiachetta 6164b39
reviews
FrancoGiachetta ca359b2
Merge branch 'test-corelib' of github.com:lambdaclass/cairo_native in…
FrancoGiachetta 1cd02e9
reviews
FrancoGiachetta f1b40d0
fmt
FrancoGiachetta 48fb545
fmt ci
FrancoGiachetta 7b9c99c
revert last commit
FrancoGiachetta 986dafa
fmt
FrancoGiachetta f0e90c7
accidentally removed rayon usage
FrancoGiachetta 51ff8ea
avoid map's short-circuiting
FrancoGiachetta 6083538
catch panics the avoid loosing the test name
FrancoGiachetta 47a346a
Merge branch 'main' into test-corelib
FrancoGiachetta 4912309
log ignored tests
FrancoGiachetta eb3749b
clippy
FrancoGiachetta 50a4dde
Add "(WIP)" to corelib's test job
FrancoGiachetta ef4fda9
Merge branch 'main' into sierra-emu-add-some-libfs
FrancoGiachetta ee6b5f7
print progress as the test runs
FrancoGiachetta 3802add
print results as tests run
FrancoGiachetta 1f3bf94
fmt
FrancoGiachetta d1ec743
format makefile
FrancoGiachetta 3a626ce
Merge branch 'main' into test-corelib
FrancoGiachetta d38d14d
fix name test in ci
FrancoGiachetta 48fd257
Merge branch 'test-corelib' of github.com:lambdaclass/cairo_native in…
FrancoGiachetta 7a1fdfc
add dependencies removed in merge
FrancoGiachetta f89b02f
dependencies
FrancoGiachetta f278fcc
clippy
FrancoGiachetta d248128
remove unused import
FrancoGiachetta 72761ce
better indent in makefile
FrancoGiachetta 1e43ad3
uppercase tests summary comment for better sight
FrancoGiachetta d2c217b
Merge branch 'main' into test-corelib
FrancoGiachetta 511ebc1
Merge branch 'test-corelib' into sierra-emu-add-some-libfs
FrancoGiachetta 5040091
Merge branch 'sierra-emu-add-some-libfs' of github.com:lambdaclass/ca…
FrancoGiachetta 83416f1
fix clippy
FrancoGiachetta 6e02e1b
clippy
FrancoGiachetta fb4cea3
merge main
FrancoGiachetta 0d2a760
remove unnecesary pubs
FrancoGiachetta a9c1b9e
Merge branch 'main' into sierra-emu-add-some-libfs
FrancoGiachetta d9d3828
better docs
FrancoGiachetta 5879b7f
Merge branch 'sierra-emu-add-some-libfs' of github.com:lambdaclass/ca…
FrancoGiachetta b8de7be
better panic message in get_numberic_args_as_bigints()
FrancoGiachetta af371a8
Merge branch 'main' into sierra-emu-add-some-libfs
FrancoGiachetta 38a25b8
reviews
FrancoGiachetta 33e9fd4
Merge branch 'sierra-emu-add-some-libfs' of github.com:lambdaclass/ca…
FrancoGiachetta d797fed
Merge branch 'main' into sierra-emu-add-some-libfs
JulianGCalderon c148d29
remove unnecessary comment
FrancoGiachetta fc4e881
use slices in get_numeric_args_as_bigints
FrancoGiachetta fc2f8ac
Merge branch 'sierra-emu-add-some-libfs' of github.com:lambdaclass/ca…
FrancoGiachetta 5c25448
fmt
FrancoGiachetta 7f0393d
remove unnecesary to_vec
FrancoGiachetta 82b8da3
fmt
FrancoGiachetta ea6a75b
use iter instead of into_iter
FrancoGiachetta d3c5b0a
reviews changes
FrancoGiachetta 05c92eb
better error message
FrancoGiachetta 033930c
Merge branch 'main' into sierra-emu-add-some-libfs
FrancoGiachetta 9fac977
Merge branch 'main' into sierra-emu-add-some-libfs
FrancoGiachetta 545bbe5
fix typo
FrancoGiachetta 9bf4c2f
Merge branch 'sierra-emu-add-some-libfs' of github.com:lambdaclass/ca…
FrancoGiachetta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ mod dump; | |
| mod gas; | ||
| pub mod starknet; | ||
| mod test_utils; | ||
| mod utils; | ||
| mod value; | ||
| mod vm; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| use cairo_lang_sierra::{ | ||
| extensions::core::{CoreLibfunc, CoreType, CoreTypeConcrete}, | ||
| program_registry::ProgramRegistry, | ||
| }; | ||
| use num_bigint::BigInt; | ||
| use num_traits::ToPrimitive; | ||
|
|
||
| use crate::Value; | ||
|
|
||
| /// Receives a vector of values, filters any which is non numeric and returns a `Vec<BigInt>` | ||
| /// Useful when a binary operation takes generic values (like with bounded ints). | ||
| pub fn get_numberic_args_as_bigints(args: &[Value]) -> Vec<BigInt> { | ||
| args.iter() | ||
| .map(|v| match v { | ||
| Value::BoundedInt { value, .. } => value.to_owned(), | ||
| Value::I8(value) => BigInt::from(*value), | ||
| Value::I16(value) => BigInt::from(*value), | ||
| Value::I32(value) => BigInt::from(*value), | ||
| Value::I64(value) => BigInt::from(*value), | ||
| Value::I128(value) => BigInt::from(*value), | ||
| Value::U8(value) => BigInt::from(*value), | ||
| Value::U16(value) => BigInt::from(*value), | ||
| Value::U32(value) => BigInt::from(*value), | ||
| Value::U64(value) => BigInt::from(*value), | ||
| Value::U128(value) => BigInt::from(*value), | ||
| Value::Felt(value) => value.to_bigint(), | ||
| Value::Bytes31(value) => value.to_bigint(), | ||
| value => panic!("expected numeric value: {:?}", value), | ||
FrancoGiachetta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }) | ||
| .collect() | ||
| } | ||
|
|
||
| pub fn get_value_from_integer( | ||
| registry: &ProgramRegistry<CoreType, CoreLibfunc>, | ||
| ty: &CoreTypeConcrete, | ||
| value: BigInt, | ||
| ) -> Value { | ||
| match ty { | ||
| CoreTypeConcrete::NonZero(info) => { | ||
| let ty = registry.get_type(&info.ty).unwrap(); | ||
| get_value_from_integer(registry, ty, value) | ||
| } | ||
| CoreTypeConcrete::Sint8(_) => Value::I8(value.to_i8().unwrap()), | ||
| CoreTypeConcrete::Sint16(_) => Value::I16(value.to_i16().unwrap()), | ||
| CoreTypeConcrete::Sint32(_) => Value::I32(value.to_i32().unwrap()), | ||
| CoreTypeConcrete::Sint64(_) => Value::I64(value.to_i64().unwrap()), | ||
| CoreTypeConcrete::Sint128(_) => Value::I128(value.to_i128().unwrap()), | ||
| CoreTypeConcrete::Uint8(_) => Value::U8(value.to_u8().unwrap()), | ||
| CoreTypeConcrete::Uint16(_) => Value::U16(value.to_u16().unwrap()), | ||
| CoreTypeConcrete::Uint32(_) => Value::U32(value.to_u32().unwrap()), | ||
| CoreTypeConcrete::Uint64(_) => Value::U64(value.to_u64().unwrap()), | ||
| CoreTypeConcrete::Uint128(_) => Value::U128(value.to_u128().unwrap()), | ||
| _ => panic!("Found a non-numeric type"), | ||
FrancoGiachetta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.