From b279b9f9ee57178b0df985cfd79b16ce48399d58 Mon Sep 17 00:00:00 2001 From: NIC619 Date: Wed, 17 Jan 2018 17:33:55 +0800 Subject: [PATCH] update state_db usage in CREATE2 based on #276 --- evm/computation.py | 2 +- evm/logic/system.py | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/evm/computation.py b/evm/computation.py index cecbb7386d..0522622186 100644 --- a/evm/computation.py +++ b/evm/computation.py @@ -322,7 +322,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 # diff --git a/evm/logic/system.py b/evm/logic/system.py index 53ec1fd0f4..64e7f93a3b 100644 --- a/evm/logic/system.py +++ b/evm/logic/system.py @@ -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 @@ -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: