Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.

New opcodes - #410

Open
Mayur1496 wants to merge 8 commits into
enzymefinance:masterfrom
Mayur1496:new-opcodes
Open

New opcodes#410
Mayur1496 wants to merge 8 commits into
enzymefinance:masterfrom
Mayur1496:new-opcodes

Conversation

@Mayur1496

Copy link
Copy Markdown

This pr introduces support for new opcodes :

  • SHR
  • SHL
  • SAR
  • EXTCODEHASH
  • CREATE2

@Mayur1496 Mayur1496 changed the title {WIP] New opcodes [WIP] New opcodes Sep 19, 2020
@Mayur1496 Mayur1496 changed the title [WIP] New opcodes New opcodes Sep 24, 2020
@Mayur1496
Mayur1496 marked this pull request as ready for review September 24, 2020 11:50

@yxliang01 yxliang01 left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread oyente/symExec.py
else:
raise ValueError('STACK underflow')
elif opcode == "SHL":
if len(stack) > 1:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(stack) > 1:
if len(stack) >= 2:

For readability

Comment thread oyente/symExec.py
else:
raise ValueError('STACK underflow')
elif opcode == "SHR":
if len(stack) > 1:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(stack) > 1:
if len(stack) >= 2:

Comment thread oyente/symExec.py
else:
raise ValueError('STACK underflow')
elif opcode == "EXTCODEHASH":
if len(stack) > 0:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(stack) > 0:
if len(stack) >= 1:

Comment thread oyente/symExec.py
if len(stack) > 0:
global_state["pc"] = global_state["pc"] + 1
stack.pop(0)
new_var_name = "IH_codehash"

Copy link
Copy Markdown
Contributor

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?

Comment thread oyente/symExec.py
else:
raise ValueError('STACK underflow')
elif opcode == "CREATE2":
if len(stack) > 3:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(stack) > 3:
if len(stack) >= 4:

Comment thread oyente/symExec.py
raise ValueError('STACK underflow')
elif opcode == "SHL":
if len(stack) > 1:
global_state["pc"] = global_state["pc"] + 1

Copy link
Copy Markdown
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

3 participants