Simulator crashing because of VM
timbeiko opened this issue · 4 comments
When running simulator.py
, the following error happens:
Traceback (most recent call last):
File "simulator.py", line 50, in <module>
new_message = validators[next_proposer].make_new_consensus_message(rand_ID, data)
File "/Users/timbeiko/Code/ethshardingpoc/validator.py", line 149, in make_new_consensus_message
new_block = self.make_block(shard_ID, data, TTL)
File "/Users/timbeiko/Code/ethshardingpoc/validator.py", line 129, in make_block
new_vm_state, new_outgoing_payloads = apply_to_state(prevblock.vm_state, data, newly_received_payloads)
File "/Users/timbeiko/Code/ethshardingpoc/run.py", line 101, in apply_to_state
vladvm = subprocess.Popen([vladvm_path, 'apply', '/dev/stdin'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: './vladvm-ubuntu'
This was a fairly hacky thing we did to get the vm binaries working on both my ubuntu, and Steve's os x machine.
https://github.com/smarx/ethshardingpoc/blob/master/run.py#L18-L20
Does it work if you comment out the first two lines, so that it's just vladvm_path = './vladvm-macos'
?
It might be better to put that into the config file.
@maurelian that fixed it, the file runs on my machine now. Do you want me to try and fix those two lines to get the path to be set to './vladvm-macos'
if you're on mac?
FWIW if I pull @vladzamfir's latest commit (c59a342) , things break and I get the following error:
Traceback (most recent call last):
File "simulator.py", line 50, in <module>
new_message = validators[next_proposer].make_new_consensus_message(rand_ID, data)
File "/Users/timbeiko/Code/ethshardingpoc/validator.py", line 149, in make_new_consensus_message
new_block = self.make_block(shard_ID, data, TTL)
File "/Users/timbeiko/Code/ethshardingpoc/validator.py", line 129, in make_block
new_vm_state, new_outgoing_payloads = apply_to_state(prevblock.vm_state, data, newly_received_payloads)
File "/Users/timbeiko/Code/ethshardingpoc/run.py", line 107, in apply_to_state
result = json.loads(out)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
MacBook-Pro-3:ethshardingpoc timbeiko$
Update: after pulling 6f64ce5 everything works fine if I comment the lines mentioned by @maurelian above. So I think a fix to better check for MacOS vs. Ubuntu would probably help. simulator.py
runs fine now.