From 283c7689b9007c3e04e9c2bf4c54ce3461c6b297 Mon Sep 17 00:00:00 2001 From: Guilherme Salgado Date: Wed, 18 Apr 2018 10:57:02 +0100 Subject: [PATCH] Drop Chain.apply_transaction() It was no longer used anywhere and it doesn't work because our VM is no longer stateless --- evm/chains/base.py | 19 ------------------- tests/core/chain-object/test_chain.py | 11 ----------- 2 files changed, 30 deletions(-) diff --git a/evm/chains/base.py b/evm/chains/base.py index c77e7f53ac..aeaecb19ee 100644 --- a/evm/chains/base.py +++ b/evm/chains/base.py @@ -209,13 +209,6 @@ def get_vm(self, header=None): # # Execution API # - @abstractmethod - def apply_transaction(self, transaction): - """ - Applies the transaction to the current head block of the Chain. - """ - raise NotImplementedError("Chain classes must implement this method") - @abstractmethod def estimate_gas(self, transaction, at_header=None): """ @@ -487,18 +480,6 @@ def from_genesis_header(cls, chaindb, genesis_header): # # Mining and Execution API # - def apply_transaction(self, transaction): - """ - Applies the transaction to the current head block of the Chain. - """ - vm = self.get_vm() - computation, block = vm.apply_transaction(transaction) - - # Update header - self.header = block.header - - return computation - def estimate_gas(self, transaction, at_header=None): if at_header is None: at_header = self.get_canonical_head() diff --git a/tests/core/chain-object/test_chain.py b/tests/core/chain-object/test_chain.py index 06557a31d6..0537b9c6ca 100644 --- a/tests/core/chain-object/test_chain.py +++ b/tests/core/chain-object/test_chain.py @@ -34,17 +34,6 @@ def tx(chain, funded_address, funded_address_private_key): return new_transaction(vm, from_, recipient, amount, funded_address_private_key) -def test_apply_transaction(chain, tx): - vm = chain.get_vm() - - computation = chain.apply_transaction(tx) - - # Check if the state is updated. - vm = chain.get_vm() - assert vm.state.state_root == computation.state.state_root - assert vm.state.read_only_state_db.get_balance(tx.to) == tx.value - - def test_import_block_validation(valid_chain, funded_address, funded_address_initial_balance): block = rlp.decode(valid_block_rlp, sedes=FrontierBlock) imported_block = valid_chain.import_block(block)