pyteal icon indicating copy to clipboard operation
pyteal copied to clipboard

Box Storage Support

Open algoanne opened this issue 3 years ago • 4 comments

(WIP)

Problem

Developers need to be able to use the new box storage from pyteal. We want to support:

  • These opcodes:
    • [x] box_create
    • [x] box_extract
    • [x] box_replace
    • [x] box_del
    • [x] box_len
    • [x] box_get
    • [x] box_put

Solution

Possible syntax and questions to consider:

App.boxAlloc(Bytes("box name"), Int())

  • where the second argument is the size of box, in # of bytes (has limitations, should we check these at the pyteal layer?).
  • Implicitly is passed the app ID as well, which is needed to reference the box.

App.boxPut(reference-to-location, value being put) App.boxGet(reference-to-location) App.boxDel(Bytes("box name"))

Application calls need to be able to specify boxes (i.e. I think TxnObject needs a "boxes" property Txn.boxes)

algoanne avatar Apr 26 '22 20:04 algoanne

Cf. #353

tzaffi avatar May 25 '22 18:05 tzaffi

Just one question to confirm:

Referencing which boxes will be used in an app call (analogous to foreign arrays)

I suppose this is not quite applicable in current design (as of 2022/08/10), where boxes are not directly viewable like foreign array. It is done by app-args to manipulate boxes. Then I wonder if my assumption is wrong, or this line needs to be changed?

ahangsu avatar Aug 10 '22 14:08 ahangsu

@ahangsu I think the ticket had a stale description based. Like you're suggesting, there's no exposed go-algorand functionality to extend in pyteal. So, I updated to remove the line item.

michaeldiamant avatar Aug 11 '22 14:08 michaeldiamant

@michaeldiamant Thanks for the description update!

ahangsu avatar Aug 11 '22 14:08 ahangsu