Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Box ops implementation from go-algorand box ops behavior change #488

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyteal/ast/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def __teal__(self, options: "CompileOptions"):
msg=f"{Op.box_create} unavailable",
)
return TealBlock.FromOp(
options, TealOp(self, Op.box_create), self.size, self.name
options, TealOp(self, Op.box_create), self.name, self.size
)

def __str__(self):
return f"(box_create {self.name} {self.size})"

def type_of(self):
return TealType.none
return TealType.uint64

def has_return(self):
return False
Expand Down Expand Up @@ -73,7 +73,7 @@ def __str__(self):
return f"(box_del {self.name})"

def type_of(self):
return TealType.none
return TealType.uint64

def has_return(self):
return False
Expand Down
6 changes: 3 additions & 3 deletions pyteal/ast/box_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
avm8Options = pt.CompileOptions(version=8)

POSITIVE_TEST_CASES: list[Tuple[pt.Expr, pt.TealType]] = [
(pt.BoxCreate(pt.Bytes("box"), pt.Int(10)), pt.TealType.none),
(pt.BoxDelete(pt.Bytes("box")), pt.TealType.none),
(pt.BoxCreate(pt.Bytes("box"), pt.Int(10)), pt.TealType.uint64),
(pt.BoxDelete(pt.Bytes("box")), pt.TealType.uint64),
(pt.BoxExtract(pt.Bytes("box"), pt.Int(2), pt.Int(4)), pt.TealType.bytes),
(
pt.BoxReplace(pt.Bytes("box"), pt.Int(3), pt.Bytes("replace")),
Expand Down Expand Up @@ -57,8 +57,8 @@ def test_box_create_compile():

expected = pt.TealSimpleBlock(
[
pt.TealOp(size_arg, pt.Op.int, 10),
pt.TealOp(name_arg, pt.Op.byte, '"eineName"'),
pt.TealOp(size_arg, pt.Op.int, 10),
pt.TealOp(expr, pt.Op.box_create),
]
)
Expand Down