Assert valid operand length (#558)

* Assert valid bytecode and operand length

EVM bytecode comes in 32-byte chunks, and contracts require at least one
segment to be created. An example, originally written by @ggrieco-tob in issue #546, is included.
Unsure what expected behavior should be, but initial state has a problem when a contract is
created with a single byte.

Also added some exception handling in `parse_operand()` to catch invalid
instructions, e.g. a PUSH1 instruction followed by no bytes.

Signed-off-by: Cole Lightfighter <cole@onicsla.bz>

* Fix SLOAD invalid memory access

Simple check to ensure address storage is in global_storage before
attempting to load data.

* Remove invalid assertions
This commit is contained in:
cole-lightfighter 2017-11-21 11:56:00 -07:00 committed by feliam
parent fbe70f1bc5
commit fccf451406

View File

@ -0,0 +1,21 @@
from seth import *
seth = ManticoreEVM()
seth.verbosity(3)
user_account = seth.create_account(balance=1000)
bytecode = '`'
#Initialize contract
contract_account = seth.create_contract(owner=user_account,
balance=0,
init=bytecode)
def explore(state):
pass
seth.add_hook(None, explore)
seth.transaction( caller=user_account,
address=contract_account,
value=None,
data='',
)