-
Notifications
You must be signed in to change notification settings - Fork 310
New opcodes #410
base: master
Are you sure you want to change the base?
New opcodes #410
Conversation
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.
Just small bit and this is ready for merging :)
@@ -1301,6 +1301,42 @@ def sym_exec_ins(params, block, instr, func_call, current_func_name): | |||
stack.insert(0, computed) | |||
else: | |||
raise ValueError('STACK underflow') | |||
elif opcode == "SHL": | |||
if len(stack) > 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.
if len(stack) > 1: | |
if len(stack) >= 2: |
For readability
else: | ||
raise ValueError('STACK underflow') | ||
elif opcode == "SHR": | ||
if len(stack) > 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.
if len(stack) > 1: | |
if len(stack) >= 2: |
@@ -1549,6 +1585,19 @@ def sym_exec_ins(params, block, instr, func_call, current_func_name): | |||
global_state["miu_i"] = current_miu_i | |||
else: | |||
raise ValueError('STACK underflow') | |||
elif opcode == "EXTCODEHASH": | |||
if len(stack) > 0: |
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.
if len(stack) > 0: | |
if len(stack) >= 1: |
if len(stack) > 0: | ||
global_state["pc"] = global_state["pc"] + 1 | ||
stack.pop(0) | ||
new_var_name = "IH_codehash" |
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.
For better modelling, can you create a variable for each requested address?
@@ -1992,6 +2041,18 @@ def sym_exec_ins(params, block, instr, func_call, current_func_name): | |||
analysis["time_dependency_bug"][last_idx] = global_state["pc"] - 1 | |||
else: | |||
raise ValueError('STACK underflow') | |||
elif opcode == "CREATE2": | |||
if len(stack) > 3: |
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.
if len(stack) > 3: | |
if len(stack) >= 4: |
@@ -1301,6 +1301,42 @@ def sym_exec_ins(params, block, instr, func_call, current_func_name): | |||
stack.insert(0, computed) | |||
else: | |||
raise ValueError('STACK underflow') | |||
elif opcode == "SHL": | |||
if len(stack) > 1: | |||
global_state["pc"] = global_state["pc"] + 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.
Use += 1 for all such occurrences
This pr introduces support for new opcodes :