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

Commit 52ba6d7

Browse files
committed
Jit VM: preliminary support for LOG
1 parent cae4aa8 commit 52ba6d7

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

ethereum/jitvm.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ def update(self, key, arg1, arg2):
7575
self.ext.set_balance(addr, self.ext.get_balance(addr) + xfer)
7676
self.ext.set_balance(self.msg.to, 0)
7777
self.ext.add_suicide(self.msg.to)
78+
elif key == EVMJIT.LOG:
79+
print("LOG {}".format(map(hexlify, arg2)))
80+
self.ext.log(self.msg.to, arg2, arg1)
7881
else:
79-
assert False, "Implement ME!"
82+
assert False, "Unknown EVM-C update key"
8083

8184
def call(self, kind, gas, address, value, input):
8285
if self.msg.depth >= 1024:
@@ -130,11 +133,12 @@ def call(self, kind, gas, address, value, input):
130133

131134

132135
def vm_execute(ext, msg, code):
136+
# FIXME: This pprint is needed for ext.get_code() to work. WTF??????????
137+
pprint(ext.__dict__)
138+
# pprint(msg.__dict__)
133139
# EVMJIT requires secure hash of the code to be used as the code
134140
# identifier.
135141
# TODO: Can we avoid recalculating it?
136-
pprint(ext.__dict__)
137-
pprint(msg.__dict__)
138142
code_hash = sha3_256(code)
139143
mode = (EVMJIT.HOMESTEAD if ext.post_homestead_hardfork()
140144
else EVMJIT.FRONTIER)

ethereum/processblock.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
from ethereum.utils import safe_ord, normalize_address, mk_contract_address, \
1313
mk_metropolis_contract_address, big_endian_to_int
1414
from ethereum import transactions
15+
from ethereum import jitvm
1516
import ethereum.config as config
1617

1718
sys.setrecursionlimit(100000)
1819

20+
vm_execute = jitvm.vm_execute
21+
1922
from ethereum.slogging import get_logger
2023
log_tx = get_logger('eth.pb.tx')
2124
log_msg = get_logger('eth.pb.msg')
@@ -280,7 +283,7 @@ def _apply_msg(ext, msg, code):
280283
if msg.code_address in specials.specials:
281284
res, gas, dat = specials.specials[msg.code_address](ext, msg)
282285
else:
283-
res, gas, dat = vm.vm_execute(ext, msg, code)
286+
res, gas, dat = vm_execute(ext, msg, code)
284287
# gas = int(gas)
285288
# assert utils.is_numeric(gas)
286289
if trace_msg:

0 commit comments

Comments
 (0)