-
Notifications
You must be signed in to change notification settings - Fork 164
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
Fix output serialization for cairo 1 #1645
Conversation
This reverts commit 061ba87.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1645 +/- ##
==========================================
+ Coverage 97.64% 97.68% +0.03%
==========================================
Files 92 91 -1
Lines 37656 37654 -2
==========================================
+ Hits 36769 36782 +13
+ Misses 887 872 -15 ☔ View full report in Codecov by Sentry. |
Benchmark Results for unmodified programs 🚀
|
Thanks @juanbono and @fmoletta this PR as well as #1630 successfully fix the issue with Nullable Felt252Dict printing. However, a problem arises when Nullable Felt252Dict types are embeded within a struct. The printing does not behave as expected. Let's take the following example: struct NullableVec<T> {
items: Felt252Dict<Nullable<T>>,
len: usize,
}
fn main() -> NullableVec<u32> {
let mut d: Felt252Dict<Nullable<u32>> = Default::default();
// Populate the dictionary
d.insert(0, nullable_from_box(BoxTrait::new(10)));
d.insert(1, nullable_from_box(BoxTrait::new(20)));
d.insert(2, nullable_from_box(BoxTrait::new(30)));
// Return NullableVec
NullableVec {
items: d,
len: 3,
}
} When executing the code with |
Hello! Thanks for pointing this out! |
cairo1-run/src/main.rs
Outdated
// Serializes the return values in a user-friendly format | ||
// Displays Arrays using brackets ([]) and Dictionaries using ({}) | ||
// Recursively dereferences referenced values (such as Span & Box) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is intended to be the documentation, then it should be prefixed with the triple slash ///
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call!
This PR reverts #1630 and re-implements it
print_output
flag #1644