algorand / algorand/pyteal

Allow Users to Allocate Space for DynamicScratchVar's

Aperta
#200 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
new-feature-request Team Scytale
Lingua principale
Python
Stelle
288
Fork
138
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## 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:

```python
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

#195

## Urgency

Medium

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.