Skip to content

Commit

Permalink
Drop Chain.apply_transaction()
Browse files Browse the repository at this point in the history
It was no longer used anywhere and it doesn't work because our VM is no
longer stateless
  • Loading branch information
gsalgado committed Apr 18, 2018
1 parent cbe36eb commit 283c768
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
19 changes: 0 additions & 19 deletions evm/chains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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()
Expand Down
11 changes: 0 additions & 11 deletions tests/core/chain-object/test_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 283c768

Please sign in to comment.