-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Labels
Description
Problem
When a user creates a DynamicScratchVar, the compiler -by design- does not block-off slot space for this variable. Typically, the compiler allocates scratch slots at runtime with slot numbers which are as small as possible. However, without knowing at compile time what slots the compiler will create, there is always the possibility that the compiler will step on a user's dynamic slots. In the worst case, this could lead to unpredictable run-time behavior.
Solution
We should allow users to allocate a range of dynamic scratch var's at compile time. For example, the following API might work:
def approval_program():
DynamicScratchVar.allocate(range(128, 256)) # allocates slot id's [128, 255] for use only by DynamicScratchVar's
return Seq( ... the actual pyteal ... )Dependencies
Urgency
Medium