Skip to content
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 CairoPie serialization. #1444

Merged
merged 19 commits into from
Sep 18, 2023
Merged

Fix CairoPie serialization. #1444

merged 19 commits into from
Sep 18, 2023

Conversation

azteca1998
Copy link
Collaborator

@azteca1998 azteca1998 commented Sep 13, 2023

Fix CairoPie serialization

Description

See #1443 for details.

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.
    • CHANGELOG has been updated.

@github-actions
Copy link

github-actions bot commented Sep 13, 2023

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 4.945 ± 0.130 4.811 5.156 1.02 ± 0.03
head big_factorial 4.833 ± 0.015 4.815 4.864 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 4.054 ± 0.025 4.021 4.111 1.00 ± 0.01
head big_fibonacci 4.050 ± 0.041 4.019 4.163 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 11.500 ± 0.238 11.227 11.813 1.02 ± 0.02
head blake2s_integration_benchmark 11.288 ± 0.042 11.247 11.394 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 4.143 ± 0.071 4.067 4.278 1.01 ± 0.02
head compare_arrays_200000 4.096 ± 0.023 4.059 4.122 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 2.754 ± 0.008 2.744 2.767 1.01 ± 0.01
head dict_integration_benchmark 2.736 ± 0.022 2.722 2.793 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 2.116 ± 0.016 2.100 2.144 1.00 ± 0.01
head field_arithmetic_get_square_benchmark 2.114 ± 0.023 2.068 2.147 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 11.136 ± 0.092 11.061 11.315 1.00 ± 0.01
head integration_builtins 11.101 ± 0.079 11.036 11.258 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 11.494 ± 0.035 11.429 11.558 1.01 ± 0.01
head keccak_integration_benchmark 11.421 ± 0.073 11.380 11.618 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 4.121 ± 0.057 4.072 4.258 1.02 ± 0.02
head linear_search 4.049 ± 0.031 4.013 4.111 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 2.941 ± 0.008 2.932 2.960 1.00
head math_cmp_and_pow_integration_benchmark 2.949 ± 0.037 2.922 3.048 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 2.659 ± 0.011 2.644 2.675 1.00
head math_integration_benchmark 2.665 ± 0.027 2.642 2.737 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 2.360 ± 0.008 2.350 2.371 1.00
head memory_integration_benchmark 2.371 ± 0.016 2.349 2.408 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 2.641 ± 0.019 2.620 2.680 1.00
head operations_with_data_structures_benchmarks 2.644 ± 0.024 2.628 2.710 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 953.1 ± 1.6 950.3 955.4 1.00 ± 0.01
head pedersen 951.4 ± 9.7 945.7 978.4 1.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.770 ± 0.002 1.767 1.774 1.00
head poseidon_integration_benchmark 1.775 ± 0.005 1.771 1.788 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 3.404 ± 0.039 3.377 3.499 1.01 ± 0.01
head secp_integration_benchmark 3.376 ± 0.017 3.357 3.415 1.00
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.980 ± 0.006 1.974 1.992 1.00 ± 0.00
head set_integration_benchmark 1.974 ± 0.003 1.970 1.980 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 7.391 ± 0.034 7.351 7.460 1.00 ± 0.01
head uint256_integration_benchmark 7.380 ± 0.024 7.344 7.420 1.00

@codecov
Copy link

codecov bot commented Sep 14, 2023

Codecov Report

Merging #1444 (04ea28c) into main (bd496ea) will increase coverage by 0.00%.
The diff coverage is 99.32%.

@@           Coverage Diff            @@
##             main    #1444    +/-   ##
========================================
  Coverage   96.98%   96.99%            
========================================
  Files          93       93            
  Lines       38637    38782   +145     
========================================
+ Hits        37474    37618   +144     
- Misses       1163     1164     +1     
Files Changed Coverage Δ
vm/src/vm/runners/cairo_pie.rs 98.71% <99.31%> (+7.05%) ⬆️
vm/src/types/program.rs 99.42% <100.00%> (ø)
vm/src/vm/runners/cairo_runner.rs 98.04% <100.00%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more


for value in values {
match value {
MaybeRelocatable::RelocatableValue(_) => todo!(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Program data should never be other than Int anyway AFAIK. I'd like to convert it to Felt eventually rather than MaybeRelocatable.

Copy link
Member

@pefontana pefontana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice @azteca1998 !
I think that with some little changes we will be good to go

CHANGELOG.md Show resolved Hide resolved
vm/src/serde/deserialize_program.rs Outdated Show resolved Hide resolved
vm/src/tests/.gitignore Outdated Show resolved Hide resolved
vm/src/tests/cairo_pie_test.rs Outdated Show resolved Hide resolved
vm/src/tests/cairo_pie_test.rs Outdated Show resolved Hide resolved
pub memory: CairoPieMemory,
pub execution_resources: ExecutionResources,
pub additional_data: HashMap<String, BuiltinAdditionalData>,
pub version: CairoPieVersion,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it is possible, but can we use a String type for the version field.
Plus add a constant with the CairoPieVersion String, so it is easy to change

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it is possible, it'd need to be initialized every time the CairoPie object is created. Having it as it is now this cannot happen because the version field is zero-sized.

The constant is easy. Fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@pefontana pefontana added this pull request to the merge queue Sep 18, 2023
Merged via the queue into main with commit 8d711e1 Sep 18, 2023
39 checks passed
@pefontana pefontana deleted the fix-cairo-pie-serialization branch September 18, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants