NethermindEth / cairo-vm-go

A virtual machine for Cairo written in Go
MIT License
79 stars 49 forks source link

Felt values in hints representing array length #383

Closed cicr99 closed 1 month ago

cicr99 commented 3 months ago

There are cases such as this hint:

%{
        n -= 1
        ids.continue_copying = 1 if n > 0 else 0
%}

where the value of n is supposed to be a felt, as you can see in its definition here:

%{ vm_enter_scope({'n': ids.len}) %}

where len is of type felt.

However, in practice, the actual value of n cannot be a value of 252 bits since that wouldn't be feasible to compute, as this is representing the length of an array. n should fit in int64. If we do the conversion from the moment we define the variable then all operations regarding n would be a lot easier and more efficient, as the way we can handle felts is using Element from this library.

Task: Look for all the places in the code of hints where this can be optimized and do so. Notice you'll also need to modify all the code related to operations with these variables

fishonamos commented 3 months ago

I will love to work on this @cicr99

Osatuyi commented 3 months ago

Hi @cicr99 . Can I be asssigned this please

cicr99 commented 3 months ago

Hi @Osatuyi, thanks for your interest in contributing. I'm not sure if @fishonamos is currently working on this or is still interested in working on it. Let him answer first and then we can assign someone to the issue. Sorry for the inconvenience

Osatuyi commented 3 months ago

allright. No problem.

fishonamos commented 3 months ago

Hi @cicr99 . Should I raise a PR for this?

cicr99 commented 2 months ago

Hi @fishonamos yes! When you have it done pls raise a PR. Any updates?

fishonamos commented 2 months ago

@cicr99. How can i reach out to you?

TAdev0 commented 2 months ago

@fishonamos any updates? do you need any help? dont hesitate to push a draft PR

TAdev0 commented 2 months ago

@fishonamos you asked to work on it almost 2 months ago, will assign you i'm working on it right now