Skip to content

Add ewasm support #923

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ monkeytype.sqlite3

# pyenv
.python-version
.idea
32 changes: 19 additions & 13 deletions evm/vm/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
abstractmethod
)
import itertools
from juno import juno_execute
import logging
from typing import ( # noqa: F401
Any,
Expand Down Expand Up @@ -537,20 +538,25 @@ def apply_computation(cls,
computation.precompiles[message.code_address](computation)
return computation

for opcode in computation.code:
opcode_fn = computation.get_opcode_fn(opcode)
# Hand off execution of WASM code
if computation.code[0:8] == b'\x00asm\x01\x00\x00\x00':
juno_execute(state, message, transaction_context, computation)

computation.logger.trace(
"OPCODE: 0x%x (%s) | pc: %s",
opcode,
opcode_fn.mnemonic,
max(0, computation.code.pc - 1),
)

try:
opcode_fn(computation=computation)
except Halt:
break
else:
for opcode in computation.code:
opcode_fn = computation.get_opcode_fn(opcode)

computation.logger.trace(
"OPCODE: 0x%x (%s) | pc: %s",
opcode,
opcode_fn.mnemonic,
max(0, computation.code.pc - 1),
)

try:
opcode_fn(computation=computation)
except Halt:
break
return computation

#
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"eth-bloom>=1.0.0,<2.0.0",
"eth-utils>=1.0.1,<2.0.0",
"eth-typing>=1.0.0,<2.0.0",
"juno>=0.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused, https://pypi.org/project/juno/ seems to be something different, no? Where is that dependency coming from?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok I see it is here: https://github.com/lrettig/juno But then, how does that fit in with that juno package on pypi that seems to be occupied by something else, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't. Two different things, no connection. The name can be changed :) I'm just running this locally, no pypi.

"pyethash>=0.1.27,<1.0.0",
"py-ecc>=1.4.2,<2.0.0",
"rlp>=1.0.1,<2.0.0",
Expand Down