Skip to content

Commit

Permalink
update state_db usage in CREATE2 based on ethereum#276
Browse files Browse the repository at this point in the history
  • Loading branch information
NIC619 authored and hwwhww committed Feb 2, 2018
1 parent 916f191 commit 141ee85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion evm/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def get_gas_remaining(self):

@contextmanager
def state_db(self, read_only=False):
with self.vm.state_db(read_only, self.msg.access_list) as state_db:
with self.vm_state.state_db(read_only, self.msg.access_list) as state_db:
yield state_db

#
Expand Down
13 changes: 3 additions & 10 deletions evm/logic/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,7 @@ def __call__(self, computation):

computation.extend_memory(start_position, size)

_state_db = computation.vm_state.state_db(
read_only=True,
access_list=computation.msg.access_list,
)
with _state_db as state_db:
with computation.state_db(read_only=True) as state_db:
insufficient_funds = state_db.get_balance(computation.msg.storage_address) < value
stack_too_deep = computation.msg.depth + 1 > constants.STACK_DEPTH_LIMIT

Expand All @@ -232,11 +228,8 @@ def __call__(self, computation):
salt,
call_data,
)
_state_db = computation.vm_state.state_db(
read_only=True,
access_list=computation.msg.access_list,
)
with _state_db as state_db:

with computation.state_db(read_only=True) as state_db:
is_collision = state_db.account_has_code_or_nonce(contract_address)

if is_collision:
Expand Down

0 comments on commit 141ee85

Please sign in to comment.