-
Notifications
You must be signed in to change notification settings - Fork 14
Add pop/push size per instruction #116
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
Conversation
TODO: improve testing coverage so that we cover the new code |
@property | ||
def stack_push_size(self) -> int: | ||
return 1 | ||
|
||
|
||
class Txn(Instruction): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add stack_push_size = 1
for Txn instruction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great catch
@property | ||
def stack_push_size(self) -> int: | ||
return 2 | ||
|
||
|
||
class Global(Instruction): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add stack_push_size = 1
for Global Instruction
@property | ||
def stack_push_size(self) -> int: | ||
return 1 | ||
|
||
|
||
class Cover(Instruction): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add stack_pop_size = 1 + self._idx
and stack_push_size = 1 + self._idx
to cover instruction (?)
@@ -1444,6 +1736,10 @@ def __init__(self) -> None: | |||
def __str__(self) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add stack_push_size = 1
for AppGlobalGet (app_global_get) instruction.
@property | ||
def stack_push_size(self) -> int: | ||
return 1 | ||
|
||
|
||
class Addr(Instruction): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add stack_push_size = 1
for Addr instruction.
@@ -2678,6 +3346,14 @@ def cost(self) -> int: | |||
return 4 | |||
return 0 | |||
|
|||
@property | |||
def stack_pop_size(self) -> int: | |||
return 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to stack_pop_size = 1
for BBitwiseInvert (b~) instruction
@property | ||
def stack_push_size(self) -> int: | ||
return 1 | ||
|
||
|
||
class Intc3(Instruction): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add stack_push_size = 1
for Intc3
@property | ||
def stack_push_size(self) -> int: | ||
return 1 | ||
|
||
|
||
class Substring3(Instruction): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add stack_push_size = 1
and stack_pop_size = 3
to Substring3 Instruction
@@ -3760,6 +4676,10 @@ def field(self) -> TransactionField: | |||
"""Array transaction field being accessed.""" | |||
return self._field | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add stack_pop_size = 1
to Itxnas instruction
@@ -3903,6 +4847,14 @@ def start_position(self) -> int: | |||
raise TealerException("replace instruction does not have any immediates") | |||
return self._idx | |||
|
|||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Number of values popped depends on the immediate argument s
. If there's no immediate argument then, replace
is replace3
and stack_pop_size = 3
. If there is a immediate argument then replace s
is equivalent to replace2 s
and stack_pop_size = 2
.
@@ -4142,6 +5142,14 @@ def __init__(self, index: int): | |||
self._index: int = index | |||
self._version: int = 8 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bury n
: should we set the pop size to n + 1
and push size to n
? I don't know if the stack depth n
includes A
value or not.
@@ -4164,6 +5172,10 @@ def __init__(self, n: int): | |||
self._nelements: int = n | |||
self._version: int = 8 | |||
|
|||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add stack_pop_size = n
and update stack_push_size
to 0
for Popn instruction
@@ -4183,6 +5195,10 @@ def __init__(self, count: int): | |||
self._count: int = count | |||
self._version: int = 8 | |||
|
|||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update stack_push_size = n + 1
and stack_pop_size = 1
for Dupn instruction
@@ -4204,6 +5220,10 @@ def __init__(self, bytes_list: List[str]): | |||
self._bytes_list = bytes_list | |||
self._version: int = 8 | |||
|
|||
@property | |||
def stack_push_size(self) -> int: | |||
return 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update stack_push_size = len(self._bytes_list)
for PushBytess instruction.
@@ -4225,6 +5245,10 @@ def __init__(self, int_list: List[int]): | |||
self._int_list = int_list | |||
self._version: int = 8 | |||
|
|||
@property | |||
def stack_push_size(self) -> int: | |||
return 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update stack_push_size = len(self._int_list)
for PushInts instruction.
No description provided.