You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is only a writeup, on how other VMs handle fetching values from globals() in the Cairo0 hints.
In the Python VM, the initialize_vm method in cairo_runner provides a possibility to pass an optional argument, called static_locals. It is described as: static_locals - dictionary holding static values for execution. They are available in all scopes., meaning that when the value is passed inside of that object, they will be present in each hint execution scope and used. static_values are always updated in the constructor of the VirtualMachine, by these values and the ones provided in the constructor. static_locals are then always included in each step during, in the hint execution as globals.
My concern with this solution, is that there is no flag/possibility to pass the static_locals dynamically. They are loaded programatically for example here, which is in the entirely different package, called business logic on a wrapper class which extends from the basic CairoRunner.
What is also concerning, is that is can't find a place, where those static values are loaded into the scopes of rust and even go VMs. During hint execution, lambda VMs fetch constants like __usort_max_size from the current scope, but I don't see any entrypoint where those values are loaded, so that will always result in an error - ValueNotInScope.
After checking both solutions, there are a couple ways of handling this. We could either skip it entirely, since in other implementations there is no way of passing those values dynamically. We could load them from JSON and store them in some separate struct, maybe a field in hintrunner. We could also hardcode the values from the business logic package, but I'm not confident about that solution, since those values are passed externally and clearly are picked for some specific usecase.
The text was updated successfully, but these errors were encountered:
This issue is only a writeup, on how other VMs handle fetching values from globals() in the Cairo0 hints.
In the Python VM, the initialize_vm method in cairo_runner provides a possibility to pass an optional argument, called
static_locals
. It is described as:static_locals - dictionary holding static values for execution. They are available in all scopes.
, meaning that when the value is passed inside of that object, they will be present in each hint execution scope and used.static_values
are always updated in the constructor of the VirtualMachine, by these values and the ones provided in the constructor.static_locals
are then always included in each step during, in the hint execution asglobals
.My concern with this solution, is that there is no flag/possibility to pass the static_locals dynamically. They are loaded programatically for example here, which is in the entirely different package, called business logic on a wrapper class which extends from the basic CairoRunner.
What is also concerning, is that is can't find a place, where those static values are loaded into the scopes of rust and even go VMs. During hint execution, lambda VMs fetch constants like
__usort_max_size
from the current scope, but I don't see any entrypoint where those values are loaded, so that will always result in an error -ValueNotInScope
.After checking both solutions, there are a couple ways of handling this. We could either skip it entirely, since in other implementations there is no way of passing those values dynamically. We could load them from JSON and store them in some separate struct, maybe a field in hintrunner. We could also hardcode the values from the business logic package, but I'm not confident about that solution, since those values are passed externally and clearly are picked for some specific usecase.
The text was updated successfully, but these errors were encountered: