lambdaclass / cairo-vm_in_go

cairo-vm_in_go is a Go implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
Apache License 2.0
57 stars 13 forks source link

fix: Extract aliased constants from identifiers #278

Closed fmoletta closed 1 year ago

fmoletta commented 1 year ago

When constants are imported from other modules, they appear as an alias in the compiled json. As we didn't take them into account when creating the constants map, hints that imported aliased constants would fail. For example:

"starkware.cairo.common.cairo_keccak.keccak.BLOCK_SIZE": {
            "destination": "starkware.cairo.common.cairo_keccak.packed_keccak.BLOCK_SIZE",
            "type": "alias"
        },
        "starkware.cairo.common.cairo_keccak.packed_keccak.BLOCK_SIZE": {
            "type": "const",
            "value": 3
        },

Here the hint executed with access to scope starkware.cairo.common.cairo_keccak.keccak needs the alias in order to access the BLOCK_SIZE constant imported from starkware.cairo.common.cairo_keccak.packed_keccak

codecov-commenter commented 1 year ago

Codecov Report

Merging #278 (ef175d1) into main (edaabf3) will increase coverage by 0.06%. The diff coverage is 82.35%.

@@            Coverage Diff             @@
##             main     #278      +/-   ##
==========================================
+ Coverage   58.67%   58.73%   +0.06%     
==========================================
  Files          41       41              
  Lines        5249     5264      +15     
==========================================
+ Hits         3080     3092      +12     
- Misses       1911     1914       +3     
  Partials      258      258              
Files Changed Coverage Δ
pkg/parser/parser.go 57.89% <ø> (ø)
pkg/vm/program.go 35.18% <82.35%> (+17.23%) :arrow_up:

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