cairo-vm icon indicating copy to clipboard operation
cairo-vm copied to clipboard

[REFACTOR] Abstract the representation of field elements. Phase 2

Open pefontana opened this issue 3 years ago • 1 comments

[REFACTOR] Abstract the representation of field elements. Phase 2

Issue: #268 Waiting for PR #427

Description

  • Add multiple FieldElement methods
  • Refactor Memory.get_integer to return a FieldElement. Because of this change every time a hint function gets a variable value from memory (get_integer_from_var_name) it now gets a FieldElement. So this refactor includes adaptations in all the hints implementation, so as to work with FielElements.

One thing to take into account. Scope variables still use BigInts, because they can operate with negative numbers instead of FieldElements.

Checklist

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

pefontana avatar Sep 22 '22 21:09 pefontana

Codecov Report

Merging #441 (8959e33) into add-field-element (68571de) will decrease coverage by 0.08%. The diff coverage is 91.17%.

@@                  Coverage Diff                  @@
##           add-field-element     #441      +/-   ##
=====================================================
- Coverage              96.59%   96.50%   -0.09%     
=====================================================
  Files                     54       54              
  Lines                   9154     9241      +87     
=====================================================
+ Hits                    8842     8918      +76     
- Misses                   312      323      +11     
Impacted Files Coverage Δ
...int_processor/builtin_hint_processor/hint_utils.rs 90.90% <0.00%> (ø)
...t_processor/builtin_hint_processor/memset_utils.rs 100.00% <ø> (ø)
src/hint_processor/builtin_hint_processor/set.rs 100.00% <ø> (ø)
src/hint_processor/hint_processor_definition.rs 100.00% <ø> (ø)
src/hint_processor/proxies/exec_scopes_proxy.rs 70.33% <ø> (ø)
src/utils.rs 99.51% <ø> (ø)
src/vm/vm_memory/memory_segments.rs 97.74% <76.92%> (-1.06%) :arrow_down:
src/hint_processor/builtin_hint_processor/usort.rs 93.50% <80.00%> (-1.17%) :arrow_down:
src/types/relocatable.rs 90.69% <81.53%> (-0.56%) :arrow_down:
...cessor/builtin_hint_processor/find_element_hint.rs 97.96% <84.61%> (ø)
... and 20 more

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

codecov-commenter avatar Sep 22 '22 21:09 codecov-commenter