You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an issue with struct serialization when running a Cairo1 program with cairo1-run. When a struct is returned from the program, the serialized return does not match the expected output. Here's the Cairo program I'm testing:
After running cargo run ../cairo_programs/cairo-1-programs/tensor.cairo --layout all_cairo --args '[2 2] [1 2 3 4]' it returns:
Return values : [5:0, 5:2, 6:0, 6:4]
However, I expected it to return:
Return values :
[
2, // Total number of elements in 'shape'
2, // First element of 'shape'
2, // Second element of 'shape'
4, // Total number of elements in 'data'
1, // First element of 'data'
2, // Second element of 'data'
3, // Third element of 'data'
4 // Fourth element of 'data'
]
The discrepancy suggests an issue with how the struct is being serialized upon return.
What version/commit are you on?
Current Version/Commit: Branch cairo-1-input-args
From this PR: #1551
The text was updated successfully, but these errors were encountered:
Hello, we can definitely fetch the arrays from memory when fetching the return values to show the full arrays instead of their start and end addresses, but I find the expected format a bit confusing. I would suggest serializing it as [2 2] [1 2 3 4] instead to match the convention used for input args and we don't mix up the amount of elements on the array with the actual array elements
Hello, we can definitely fetch the arrays from memory when fetching the return values to show the full arrays instead of their start and end addresses, but I find the expected format a bit confusing. I would suggest serializing it as [2 2] [1 2 3 4] instead to match the convention used for input args and we don't mix up the amount of elements on the array with the actual array elements
I was following the same serialization than Cairo (if I'm not mistaken). But your suggestion sounds good as well.
Describe the bug
I'm encountering an issue with struct serialization when running a Cairo1 program with
cairo1-run
. When a struct is returned from the program, the serialized return does not match the expected output. Here's the Cairo program I'm testing:Here is the cairo program I'm testing:
After running
cargo run ../cairo_programs/cairo-1-programs/tensor.cairo --layout all_cairo --args '[2 2] [1 2 3 4]'
it returns:However, I expected it to return:
The discrepancy suggests an issue with how the struct is being serialized upon return.
What version/commit are you on?
Current Version/Commit: Branch
cairo-1-input-args
From this PR: #1551
The text was updated successfully, but these errors were encountered: