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

Resolve as BigInt3 structure

Open cicr99 opened this issue 10 months ago • 6 comments

Currently we use the following logic for resolving BigInt3 structures:

valMemoryValues, err := hinter.GetConsecutiveValues(vm, valAddr, int16(3))
if err != nil {
    return err
}

// [d0, d1, d2]
var valValues [3]*fp.Element

for i := 0; i < 3; i++ {
    valValue, err := valMemoryValues[i].FieldElement()
    if err != nil {
    	return err
    }
    valValues[i] = valValue
}

valValues is the argument that should be passed down to the pack functionality.

As this logic is repeated in the code several times, it would be beneficial to separate it in its own functionality, something like ResolveAsBigInt3 passing the starting address of the structure in memory

cicr99 avatar Apr 10 '24 14:04 cicr99