File size: 175,606 Bytes
5980447
1
2
{"repo": "omgnetwork/plasma-contracts", "pull_number": 231, "instance_id": "omgnetwork__plasma-contracts-231", "issue_numbers": "", "base_commit": "ef0112fef4843218cca5fe84dd2fce45f0a841b5", "patch": "diff --git a/plasma_core/block.py b/plasma_core/block.py\n--- a/plasma_core/block.py\n+++ b/plasma_core/block.py\n@@ -1,7 +1,6 @@\n import rlp\n from rlp.sedes import CountableList, big_endian_int\n from eth_utils import keccak\n-from plasma_core.utils.signatures import sign, get_signer\n from plasma_core.utils.merkle.fixed_merkle import FixedMerkle\n from plasma_core.transaction import Transaction\n from plasma_core.constants import NULL_SIGNATURE\n@@ -41,15 +40,19 @@ def is_deposit_block(self):\n         return len(self.transactions) == 1 and self.transactions[0].is_deposit\n \n     def sign(self, key):\n-        return SignedBlock(self, sign(self.hash, key))\n+        return SignedBlock(self, key.sign_msg_hash(self.hash))\n \n \n class SignedBlock(Block):\n \n     def __init__(self, block, signature=NULL_SIGNATURE):\n         super().__init__(block.transactions, block.number)\n-        self.signature = signature\n+        self._signature = signature\n+\n+    @property\n+    def signature(self):\n+        return self._signature.to_bytes()\n \n     @property\n     def signer(self):\n-        return get_signer(self.hash, self.signature)\n+        return self._signature.recover_public_key_from_msg_hash(self.hash).to_checksum_address()\ndiff --git a/plasma_core/child_chain.py b/plasma_core/child_chain.py\n--- a/plasma_core/child_chain.py\n+++ b/plasma_core/child_chain.py\n@@ -1,5 +1,4 @@\n from plasma_core.utils.transactions import decode_utxo_id\n-from plasma_core.utils.address import address_to_hex\n from plasma_core.constants import NULL_SIGNATURE\n from plasma_core.exceptions import (InvalidBlockSignatureException,\n                                     InvalidTxSignatureException,\n@@ -98,7 +97,7 @@ def __apply_transaction(self, tx):\n \n     def _validate_block(self, block):\n         # Check for a valid signature.\n-        if not block.is_deposit_block and (block.signature == NULL_SIGNATURE or address_to_hex(block.signer) != self.operator):\n+        if not block.is_deposit_block and (block.signature == NULL_SIGNATURE or block.signer != self.operator.address):\n             raise InvalidBlockSignatureException('failed to validate block')\n \n         # Validate each transaction in the block.\ndiff --git a/plasma_core/constants.py b/plasma_core/constants.py\n--- a/plasma_core/constants.py\n+++ b/plasma_core/constants.py\n@@ -1,4 +1,4 @@\n-from ethereum import utils as u\n+import plasma_core.utils.utils as u\n \n AUTHORITY = {\n     'address': '0xfd02EcEE62797e75D86BCff1642EB0844afB28c7',\ndiff --git a/plasma_core/transaction.py b/plasma_core/transaction.py\n--- a/plasma_core/transaction.py\n+++ b/plasma_core/transaction.py\n@@ -3,7 +3,6 @@\n from eth_utils import address, keccak\n from plasma_core.constants import NULL_SIGNATURE, NULL_ADDRESS, EMPTY_METADATA\n from plasma_core.utils.eip712_struct_hash import hash_struct\n-from plasma_core.utils.signatures import sign, get_signer\n from plasma_core.utils.transactions import encode_utxo_id\n from rlp.exceptions import DeserializationError\n \n@@ -13,7 +12,6 @@ def pad_list(to_pad, value, required_length):\n \n \n class TransactionInput(rlp.Serializable):\n-\n     fields = (\n         ('blknum', big_endian_int),\n         ('txindex', big_endian_int),\n@@ -29,7 +27,6 @@ def identifier(self):\n \n \n class TransactionOutput(rlp.Serializable):\n-\n     fields = (\n         ('owner', rlp.sedes.Binary.fixed_length(20)),\n         ('token', rlp.sedes.Binary.fixed_length(20)),\n@@ -44,7 +41,6 @@ def __init__(self, owner=NULL_ADDRESS, token=NULL_ADDRESS, amount=0):\n \n \n class Transaction(rlp.Serializable):\n-\n     NUM_TXOS = 4\n     DEFAULT_INPUT = (0, 0, 0)\n     DEFAULT_OUTPUT = (NULL_ADDRESS, NULL_ADDRESS, 0)\n@@ -103,11 +99,11 @@ def encoded(self):\n     def is_deposit(self):\n         return all([i.blknum == 0 for i in self.inputs])\n \n-    def sign(self, index, key, verifyingContract=None):\n-        hash = hash_struct(self, verifyingContract=verifyingContract)\n-        sig = sign(hash, key)\n-        self.signatures[index] = sig\n-        self._signers[index] = get_signer(hash, sig) if sig != NULL_SIGNATURE else NULL_ADDRESS\n+    def sign(self, index, account, verifyingContract=None):\n+        msg_hash = hash_struct(self, verifyingContract=verifyingContract)\n+        sig = account.key.sign_msg_hash(msg_hash)\n+        self.signatures[index] = sig.to_bytes()\n+        self._signers[index] = sig.recover_public_key_from_msg_hash(msg_hash).to_canonical_address() if sig != NULL_SIGNATURE else NULL_ADDRESS\n \n     @staticmethod\n     def deserialize(obj):\ndiff --git a/plasma_core/utils/address.py b/plasma_core/utils/address.py\ndeleted file mode 100644\n--- a/plasma_core/utils/address.py\n+++ /dev/null\n@@ -1,6 +0,0 @@\n-def address_to_hex(address):\n-    return '0x' + address.hex()\n-\n-\n-def address_to_bytes(address):\n-    return bytes.fromhex(address[2:])\ndiff --git a/plasma_core/utils/merkle/fixed_merkle.py b/plasma_core/utils/merkle/fixed_merkle.py\n--- a/plasma_core/utils/merkle/fixed_merkle.py\n+++ b/plasma_core/utils/merkle/fixed_merkle.py\n@@ -1,4 +1,4 @@\n-from ethereum.utils import sha3\n+from eth_utils import keccak as sha3\n from .exceptions import MemberNotExistException\n from plasma_core.constants import NULL_HASH\n \ndiff --git a/plasma_core/utils/signatures.py b/plasma_core/utils/signatures.py\ndeleted file mode 100644\n--- a/plasma_core/utils/signatures.py\n+++ /dev/null\n@@ -1,18 +0,0 @@\n-from ethereum import utils as u\n-\n-\n-def sign(hash, key):\n-    vrs = u.ecsign(hash, key)\n-    rsv = vrs[1:] + vrs[:1]\n-    vrs_bytes = [u.encode_int32(i) for i in rsv[:2]] + [u.int_to_bytes(rsv[2])]\n-    return b''.join(vrs_bytes)\n-\n-\n-def get_signer(hash, sig):\n-    v = sig[64]\n-    if v < 27:\n-        v += 27\n-    r = u.bytes_to_int(sig[:32])\n-    s = u.bytes_to_int(sig[32:64])\n-    pub = u.ecrecover_to_pub(hash, v, r, s)\n-    return u.sha3(pub)[-20:]\ndiff --git a/plasma_core/utils/transactions.py b/plasma_core/utils/transactions.py\n--- a/plasma_core/utils/transactions.py\n+++ b/plasma_core/utils/transactions.py\n@@ -6,7 +6,7 @@ def decode_utxo_id(utxo_id):\n     blknum = utxo_id // BLKNUM_OFFSET\n     txindex = (utxo_id % BLKNUM_OFFSET) // BLKNUM_OFFSET\n     oindex = utxo_id - blknum * BLKNUM_OFFSET - txindex * TXINDEX_OFFSET\n-    return (blknum, txindex, oindex)\n+    return blknum, txindex, oindex\n \n \n def encode_utxo_id(blknum, txindex, oindex):\ndiff --git a/plasma_core/utils/utils.py b/plasma_core/utils/utils.py\n--- a/plasma_core/utils/utils.py\n+++ b/plasma_core/utils/utils.py\n@@ -1,18 +1,23 @@\n-from ethereum import utils as u\n-from plasma_core.constants import NULL_HASH\n-from plasma_core.utils.merkle.fixed_merkle import FixedMerkle\n+from eth_utils import decode_hex\n \n \n-def get_empty_merkle_tree_hash(depth):\n-    zeroes_hash = NULL_HASH\n-    for _ in range(depth):\n-        zeroes_hash = u.sha3(zeroes_hash + zeroes_hash)\n-    return zeroes_hash\n+def normalize_key(key):\n+    if isinstance(key, bytes):\n+        key = key.decode(\"utf-8\")\n+    if isinstance(key, int):\n+        o = encode_int32(key)\n+    elif len(key) == 32:\n+        o = key\n+    elif len(key) == 64:\n+        o = decode_hex(key)\n+    elif len(key) == 66 and key[:2] == '0x':\n+        o = decode_hex(key[2:])\n+    else:\n+        raise Exception(\"Invalid key format: %r\" % key)\n+    if o == b'\\x00' * 32:\n+        raise Exception(\"Zero privkey invalid\")\n+    return o\n \n \n-def get_merkle_of_leaves(depth, leaves):\n-    return FixedMerkle(depth, leaves)\n-\n-\n-def bytes_fill_left(inp, length):\n-    return bytes(length - len(inp)) + inp\n+def encode_int32(v):\n+    return v.to_bytes(32, byteorder='big')\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -24,17 +24,19 @@\n     keywords='plasma contracts ethereum development solidity',\n     packages=find_packages(exclude=['contrib', 'docs', 'tests']),\n     install_requires=[\n-        'ethereum==2.3.2',\n-        'web3==4.8.2',\n         'rlp==1.1.0',\n         'py-solc-simple==0.0.14',\n-        'eip712-structs==1.1.0'\n+        'web3==5.0.0',\n+        'eip712-structs==1.1.0',\n+        'eth_tester==0.2.0b2'\n     ],\n     extras_require={\n         'dev': [\n             'pytest>=4.6.0',\n             'pylint>=2.3.0',\n-            'flake8>=3.7.0'\n+            'flake8>=3.7.0',\n+            'pytest-xprocess>=0.12.0',\n+            'pytest-xdist>=1.29.0'\n         ]\n     }\n )\ndiff --git a/testlang/testlang.py b/testlang/testlang.py\n--- a/testlang/testlang.py\n+++ b/testlang/testlang.py\n@@ -1,37 +1,17 @@\n import rlp\n+from web3.exceptions import MismatchedABI\n+\n from plasma_core.child_chain import ChildChain\n-from plasma_core.account import EthereumAccount\n from plasma_core.block import Block\n from plasma_core.transaction import Transaction, TransactionOutput\n from plasma_core.constants import MIN_EXIT_PERIOD, NULL_SIGNATURE, NULL_ADDRESS\n from plasma_core.utils.transactions import decode_utxo_id, encode_utxo_id\n-from plasma_core.utils.address import address_to_hex\n from plasma_core.utils.merkle.fixed_merkle import FixedMerkle\n-import conftest\n-\n \n IN_FLIGHT_PERIOD = MIN_EXIT_PERIOD // 2\n \n \n-def get_accounts(ethtester):\n-    \"\"\"Converts ethereum.tools.tester accounts into a list.\n-\n-    Args:\n-        ethtester (ethereum.tools.tester): Ethereum tester instance.\n-\n-    Returns:\n-        EthereumAccount[]: A list of EthereumAccounts.\n-    \"\"\"\n-\n-    accounts = []\n-    for i in range(10):\n-        address = getattr(ethtester, 'a{0}'.format(i))\n-        key = getattr(ethtester, 'k{0}'.format(i))\n-        accounts.append(EthereumAccount(address_to_hex(address), key))\n-    return accounts\n-\n-\n-class StandardExit(object):\n+class StandardExit:\n     \"\"\"Represents a Plasma exit.\n \n     Attributes:\n@@ -62,7 +42,7 @@ def __eq__(self, other):\n         return (self.to_list() == other) or (self.to_list()[:3] == other)\n \n \n-class PlasmaBlock(object):\n+class PlasmaBlock:\n     \"\"\"Represents a Plasma block.\n \n     Attributes:\n@@ -75,11 +55,10 @@ def __init__(self, root, timestamp):\n         self.timestamp = timestamp\n \n \n-class InFlightExit(object):\n+class InFlightExit:\n \n     def __init__(self, root_chain, in_flight_tx, exit_start_timestamp, exit_priority, exit_map, bond_owner,\n                  oldest_competitor):\n-\n         self.root_chain = root_chain\n         self.in_flight_tx = in_flight_tx\n         self.exit_start_timestamp = exit_start_timestamp\n@@ -120,33 +99,35 @@ def output_blocked(self, index):\n         return self.input_blocked(index + 4)\n \n \n-class TestingLanguage(object):\n+class TestingLanguage:\n     \"\"\"Represents the testing language.\n \n     Attributes:\n         root_chain (ABIContract): Root chain contract instance.\n-        eththester (tester): Ethereum tester instance.\n+        w3 (Web3): w3 instance.\n         accounts (EthereumAccount[]): List of available accounts.\n         operator (EthereumAccount): The operator's account.\n         child_chain (ChildChain): Child chain instance.\n     \"\"\"\n \n-    def __init__(self, root_chain, ethtester):\n+    def __init__(self, root_chain, w3, accounts):\n         self.root_chain = root_chain\n-        self.ethtester = ethtester\n-        self.accounts = get_accounts(ethtester)\n+        self.w3 = w3\n+        self.accounts = accounts\n         self.operator = self.accounts[0]\n-        self.child_chain = ChildChain(operator=self.operator.address)\n-        self.events = []\n-\n-        def gather_events(event):\n-            all_contract_topics = self.root_chain.translator.event_data.keys()\n-            if self.root_chain.address is event.address and event.topics[0] in all_contract_topics:\n-                self.events.append(self.root_chain.translator.decode_event(event.topics, event.data))\n-        self.ethtester.chain.head_state.log_listeners.append(gather_events)\n+        self.child_chain = ChildChain(operator=self.operator)\n+        self.events_filter = w3.eth.filter({'address': root_chain.address, 'fromBlock': 'latest'})\n \n     def flush_events(self):\n-        events, self.events = self.events, []\n+        logs = self.events_filter.get_new_entries()\n+        events = []\n+        contract_events = self.root_chain.get_contract_events()\n+        for contract_event in contract_events:\n+            for log in logs:\n+                try:\n+                    events.append(contract_event().processLog(log))\n+                except MismatchedABI:\n+                    pass\n         return events\n \n     def submit_block(self, transactions, signer=None, force_invalid=False):\n@@ -154,7 +135,7 @@ def submit_block(self, transactions, signer=None, force_invalid=False):\n         blknum = self.root_chain.nextChildBlock()\n         block = Block(transactions, number=blknum)\n         signed_block = block.sign(signer.key)\n-        self.root_chain.submitBlock(signed_block.root, sender=signer.key)\n+        self.root_chain.functions.submitBlock(signed_block.root).transact({'from': signer.address})\n         if force_invalid:\n             self.child_chain.blocks[self.child_chain.next_child_block] = signed_block\n             self.child_chain.next_deposit_block = self.child_chain.next_child_block + 1\n@@ -166,12 +147,12 @@ def submit_block(self, transactions, signer=None, force_invalid=False):\n     @property\n     def timestamp(self):\n         \"\"\"Current chain timestamp\"\"\"\n-        return self.ethtester.chain.head_state.timestamp\n+        return self.w3.eth.getBlock('latest').timestamp\n \n     def deposit(self, owner, amount):\n         deposit_tx = Transaction(outputs=[(owner.address, NULL_ADDRESS, amount)])\n         blknum = self.root_chain.getDepositBlockNumber()\n-        self.root_chain.deposit(deposit_tx.encoded, value=amount)\n+        self.root_chain.deposit(deposit_tx.encoded, **{'from': owner.address, 'value': amount})\n         deposit_id = encode_utxo_id(blknum, 0, 0)\n         block = Block([deposit_tx], number=blknum)\n         self.child_chain.add_block(block)\n@@ -191,38 +172,36 @@ def deposit_token(self, owner, token, amount):\n \n         deposit_tx = Transaction(outputs=[(owner.address, token.address, amount)])\n         token.mint(owner.address, amount)\n-        self.ethtester.chain.mine()\n-        token.approve(self.root_chain.address, amount, sender=owner.key)\n-        self.ethtester.chain.mine()\n+        token.approve(self.root_chain.address, amount, **{'from': owner.address})\n         blknum = self.root_chain.getDepositBlockNumber()\n         pre_balance = self.get_balance(self.root_chain, token)\n-        self.root_chain.depositFrom(deposit_tx.encoded, sender=owner.key)\n+        self.root_chain.depositFrom(deposit_tx.encoded, **{'from': owner.address})\n         balance = self.get_balance(self.root_chain, token)\n         assert balance == pre_balance + amount\n         block = Block(transactions=[deposit_tx], number=blknum)\n         self.child_chain.add_block(block)\n         return encode_utxo_id(blknum, 0, 0)\n \n-    def spend_utxo(self, input_ids, keys, outputs=None, metadata=None, force_invalid=False):\n+    def spend_utxo(self, input_ids, accounts, outputs=None, metadata=None, force_invalid=False):\n         if outputs is None:\n             outputs = []\n         inputs = [decode_utxo_id(input_id) for input_id in input_ids]\n         spend_tx = Transaction(inputs=inputs, outputs=outputs, metadata=metadata)\n         for i in range(0, len(inputs)):\n-            spend_tx.sign(i, keys[i], verifyingContract=self.root_chain)\n+            spend_tx.sign(i, accounts[i], verifyingContract=self.root_chain)\n         blknum = self.submit_block([spend_tx], force_invalid=force_invalid)\n         spend_id = encode_utxo_id(blknum, 0, 0)\n         return spend_id\n \n-    def start_standard_exit(self, output_id, key, bond=None):\n+    def start_standard_exit(self, output_id, account, bond=None):\n         output_tx = self.child_chain.get_transaction(output_id)\n-        self.start_standard_exit_with_tx_body(output_id, output_tx, key, bond)\n+        self.start_standard_exit_with_tx_body(output_id, output_tx, account, bond)\n \n-    def start_standard_exit_with_tx_body(self, output_id, output_tx, key, bond=None):\n+    def start_standard_exit_with_tx_body(self, output_id, output_tx, account, bond=None):\n         merkle = FixedMerkle(16, [output_tx.encoded])\n         proof = merkle.create_membership_proof(output_tx.encoded)\n         bond = bond if bond is not None else self.root_chain.standardExitBond()\n-        self.root_chain.startStandardExit(output_id, output_tx.encoded, proof, value=bond, sender=key)\n+        self.root_chain.startStandardExit(output_id, output_tx.encoded, proof, **{'value': bond, 'from': account.address})\n \n     def challenge_standard_exit(self, output_id, spend_id, input_index=None):\n         spend_tx = self.child_chain.get_transaction(spend_id)\n@@ -243,10 +222,11 @@ def start_in_flight_exit(self, tx_id, bond=None, sender=None):\n             sender = self.accounts[0]\n         (encoded_spend, encoded_inputs, proofs, signatures) = self.get_in_flight_exit_info(tx_id)\n         bond = bond if bond is not None else self.root_chain.inFlightExitBond()\n-        self.root_chain.startInFlightExit(encoded_spend, encoded_inputs, proofs, signatures, value=bond, sender=sender.key)\n+        self.root_chain.startInFlightExit(encoded_spend, encoded_inputs, proofs, signatures,\n+                                          **{'value': bond, 'from': sender.address})\n \n     def create_utxo(self, token=NULL_ADDRESS):\n-        class Utxo(object):\n+        class Utxo:\n             def __init__(self, deposit_id, owner, token, amount, spend, spend_id):\n                 self.deposit_id = deposit_id\n                 self.owner = owner\n@@ -262,7 +242,7 @@ def __init__(self, deposit_id, owner, token, amount, spend, spend_id):\n         else:\n             deposit_id = self.deposit_token(owner, token, amount)\n             token_address = token.address\n-        spend_id = self.spend_utxo([deposit_id], [owner.key], [(owner.address, token_address, 100)])\n+        spend_id = self.spend_utxo([deposit_id], [owner], [(owner.address, token_address, 100)])\n         spend = self.child_chain.get_transaction(spend_id)\n         return Utxo(deposit_id, owner, token_address, amount, spend, spend_id)\n \n@@ -279,8 +259,8 @@ def start_fee_exit(self, operator, amount, token=NULL_ADDRESS, bond=None):\n \n         fee_exit_id = self.root_chain.getFeeExitId(self.root_chain.nextFeeExit())\n         bond = bond if bond is not None else self.root_chain.standardExitBond()\n-        self.root_chain.startFeeExit(token, amount, value=bond, sender=operator.key)\n-        return fee_exit_id\n+        tx_hash = self.root_chain.startFeeExit(token, amount, **{'value': bond, 'from': operator.address, 'gas': 1_000_000})\n+        return fee_exit_id, tx_hash\n \n     def process_exits(self, token, exit_id, count, **kwargs):\n         \"\"\"Finalizes exits that have completed the exit period.\n@@ -291,7 +271,7 @@ def process_exits(self, token, exit_id, count, **kwargs):\n             count (int): Maximum number of exits to be processed.\n         \"\"\"\n \n-        self.root_chain.processExits(token, exit_id, count, **kwargs)\n+        return self.root_chain.processExits(token, exit_id, count, **kwargs)\n \n     def get_challenge_proof(self, utxo_id, spend_id):\n         \"\"\"Returns information required to submit a challenge.\n@@ -305,7 +285,8 @@ def get_challenge_proof(self, utxo_id, spend_id):\n         \"\"\"\n \n         spend_tx = self.child_chain.get_transaction(spend_id)\n-        inputs = [(spend_tx.blknum1, spend_tx.txindex1, spend_tx.oindex1), (spend_tx.blknum2, spend_tx.txindex2, spend_tx.oindex2)]\n+        inputs = [(spend_tx.blknum1, spend_tx.txindex1, spend_tx.oindex1),\n+                  (spend_tx.blknum2, spend_tx.txindex2, spend_tx.oindex2)]\n         try:\n             input_index = inputs.index(decode_utxo_id(utxo_id))\n         except ValueError:\n@@ -359,12 +340,9 @@ def get_balance(self, account, token=NULL_ADDRESS):\n             int: The account's balance.\n         \"\"\"\n         if token == NULL_ADDRESS:\n-            return self.ethtester.chain.head_state.get_balance(account.address)\n+            return self.w3.eth.getBalance(account.address)\n         if hasattr(token, \"balanceOf\"):\n             return token.balanceOf(account.address)\n-        else:\n-            token_contract = conftest.watch_contract(self.ethtester, 'MintableToken', token)\n-            return token_contract.balanceOf(account.address)\n \n     def forward_timestamp(self, amount):\n         \"\"\"Forwards the chain's timestamp.\n@@ -372,8 +350,8 @@ def forward_timestamp(self, amount):\n         Args:\n             amount (int): Number of seconds to move forward time.\n         \"\"\"\n-\n-        self.ethtester.chain.head_state.timestamp += amount\n+        eth_module = self.w3.eth\n+        eth_module.increase_time(amount)\n \n     def get_in_flight_exit_info(self, tx_id, spend_tx=None):\n         if spend_tx is None:\n@@ -404,14 +382,14 @@ def get_merkle_proof(self, tx_id):\n         merkle = block.merklized_transaction_set\n         return merkle.create_membership_proof(tx.encoded)\n \n-    def piggyback_in_flight_exit_input(self, tx_id, input_index, key, bond=None):\n+    def piggyback_in_flight_exit_input(self, tx_id, input_index, account, bond=None):\n         spend_tx = self.child_chain.get_transaction(tx_id)\n         bond = bond if bond is not None else self.root_chain.piggybackBond()\n-        self.root_chain.piggybackInFlightExit(spend_tx.encoded, input_index, sender=key, value=bond)\n+        self.root_chain.piggybackInFlightExit(spend_tx.encoded, input_index, **{'value': bond, 'from': account.address})\n \n-    def piggyback_in_flight_exit_output(self, tx_id, output_index, key, bond=None):\n+    def piggyback_in_flight_exit_output(self, tx_id, output_index, account, bond=None):\n         assert output_index in range(4)\n-        return self.piggyback_in_flight_exit_input(tx_id, output_index + 4, key, bond)\n+        return self.piggyback_in_flight_exit_input(tx_id, output_index + 4, account, bond)\n \n     @staticmethod\n     def find_shared_input(tx_a, tx_b):\n@@ -435,13 +413,15 @@ def find_input_index(output_id, tx_b):\n                 tx_b_input_index = i\n         return tx_b_input_index\n \n-    def challenge_in_flight_exit_not_canonical(self, in_flight_tx_id, competing_tx_id, key):\n+    def challenge_in_flight_exit_not_canonical(self, in_flight_tx_id, competing_tx_id, account):\n         in_flight_tx = self.child_chain.get_transaction(in_flight_tx_id)\n         competing_tx = self.child_chain.get_transaction(competing_tx_id)\n         (in_flight_tx_input_index, competing_tx_input_index) = self.find_shared_input(in_flight_tx, competing_tx)\n         proof = self.get_merkle_proof(competing_tx_id)\n         signature = competing_tx.signatures[competing_tx_input_index]\n-        self.root_chain.challengeInFlightExitNotCanonical(in_flight_tx.encoded, in_flight_tx_input_index, competing_tx.encoded, competing_tx_input_index, competing_tx_id, proof, signature, sender=key)\n+        self.root_chain.challengeInFlightExitNotCanonical(in_flight_tx.encoded, in_flight_tx_input_index,\n+                                                          competing_tx.encoded, competing_tx_input_index,\n+                                                          competing_tx_id, proof, signature, **{'from': account.address})\n \n     def respond_to_non_canonical_challenge(self, in_flight_tx_id, key):\n         in_flight_tx = self.child_chain.get_transaction(in_flight_tx_id)\n@@ -449,14 +429,18 @@ def respond_to_non_canonical_challenge(self, in_flight_tx_id, key):\n         self.root_chain.respondToNonCanonicalChallenge(in_flight_tx.encoded, in_flight_tx_id, proof)\n \n     def forward_to_period(self, period):\n-        self.forward_timestamp((period - 1) * IN_FLIGHT_PERIOD)\n+        forward_time = (period - 1) * IN_FLIGHT_PERIOD\n+        if forward_time:\n+            self.forward_timestamp(forward_time)\n \n     def challenge_in_flight_exit_input_spent(self, in_flight_tx_id, spend_tx_id, key):\n         in_flight_tx = self.child_chain.get_transaction(in_flight_tx_id)\n         spend_tx = self.child_chain.get_transaction(spend_tx_id)\n         (in_flight_tx_input_index, spend_tx_input_index) = self.find_shared_input(in_flight_tx, spend_tx)\n         signature = spend_tx.signatures[spend_tx_input_index]\n-        self.root_chain.challengeInFlightExitInputSpent(in_flight_tx.encoded, in_flight_tx_input_index, spend_tx.encoded, spend_tx_input_index, signature, sender=key)\n+        self.root_chain.challengeInFlightExitInputSpent(in_flight_tx.encoded, in_flight_tx_input_index,\n+                                                        spend_tx.encoded, spend_tx_input_index, signature,\n+                                                        **{'from': key.address})\n \n     def challenge_in_flight_exit_output_spent(self, in_flight_tx_id, spending_tx_id, output_index, key):\n         in_flight_tx = self.child_chain.get_transaction(in_flight_tx_id)\n@@ -465,7 +449,10 @@ def challenge_in_flight_exit_output_spent(self, in_flight_tx_id, spending_tx_id,\n         spending_tx_input_index = self.find_input_index(in_flight_tx_output_id, spending_tx)\n         in_flight_tx_inclusion_proof = self.get_merkle_proof(in_flight_tx_id)\n         spending_tx_sig = spending_tx.signatures[spending_tx_input_index]\n-        self.root_chain.challengeInFlightExitOutputSpent(in_flight_tx.encoded, in_flight_tx_output_id, in_flight_tx_inclusion_proof, spending_tx.encoded, spending_tx_input_index, spending_tx_sig, sender=key)\n+        self.root_chain.challengeInFlightExitOutputSpent(in_flight_tx.encoded, in_flight_tx_output_id,\n+                                                         in_flight_tx_inclusion_proof, spending_tx.encoded,\n+                                                         spending_tx_input_index, spending_tx_sig,\n+                                                         **{'from': key.address})\n \n     def get_in_flight_exit(self, in_flight_tx_id):\n         in_flight_tx = self.child_chain.get_transaction(in_flight_tx_id)\n", "test_patch": "diff --git a/tests/conftest.py b/tests/conftest.py\n--- a/tests/conftest.py\n+++ b/tests/conftest.py\n@@ -1,114 +1,171 @@\n+import itertools\n import os\n+\n import pytest\n-from ethereum import utils\n-from ethereum.tools import tester\n-from ethereum.abi import ContractTranslator\n-from ethereum.config import config_metropolis\n-from plasma_core.utils.address import address_to_hex\n-from plasma_core.utils.deployer import Deployer\n+from eth_keys.datatypes import PrivateKey\n from solc_simple import Builder\n-from testlang.testlang import TestingLanguage\n from solcx import link_code\n+from web3 import Web3, HTTPProvider\n+from web3.main import get_default_modules\n+from xprocess import ProcessStarter\n \n+from plasma_core.account import EthereumAccount\n+from plasma_core.utils.deployer import Deployer\n+from testlang.testlang import TestingLanguage\n+from tests.conveniece_wrappers import ConvenienceContractWrapper, AutominingEth\n \n EXIT_PERIOD = 4 * 60  # 4 minutes\n+\n GAS_LIMIT = 10000000\n START_GAS = GAS_LIMIT - 1000000\n-config_metropolis['BLOCK_GAS_LIMIT'] = GAS_LIMIT\n \n+HUNDRED_ETH = 100 * 10 ** 18\n \n-# Compile contracts before testing\n-OWN_DIR = os.path.dirname(os.path.realpath(__file__))\n-CONTRACTS_DIR = os.path.abspath(os.path.realpath(os.path.join(OWN_DIR, '../contracts')))\n-OUTPUT_DIR = os.path.abspath(os.path.realpath(os.path.join(OWN_DIR, '../build')))\n-builder = Builder(CONTRACTS_DIR, OUTPUT_DIR)\n-builder.compile_all()\n-deployer = Deployer(builder)\n \n+# IMPORTANT NOTICE\n+# Whenever we pass to or receive from web3 an address, we do it in checksum format.\n+# On the other hand, in plasma (transactions, blocks, etc.) we should pass addresses in binary form (canonical address).\n \n-def pytest_addoption(parser):\n-    parser.addoption(\"--runslow\", action=\"store_true\",\n-                     default=False, help=\"run slow tests\")\n \n+@pytest.fixture(scope=\"session\")\n+def deployer():\n+    own_dir = os.path.dirname(os.path.realpath(__file__))\n+    contracts_dir = os.path.abspath(os.path.realpath(os.path.join(own_dir, '../contracts')))\n+    output_dir = os.path.abspath(os.path.realpath(os.path.join(own_dir, '../build')))\n \n-def pytest_collection_modifyitems(config, items):\n-    if config.getoption(\"--runslow\"):\n-        # --runslow given in cli: do not skip slow tests\n-        return\n-    skip_slow = pytest.mark.skip(reason=\"need --runslow option to run\")\n-    for item in items:\n-        if \"slow\" in item.keywords:\n-            item.add_marker(skip_slow)\n+    builder = Builder(contracts_dir, output_dir)\n+    builder.compile_all()\n+    deployer = Deployer(builder)\n+    return deployer\n \n \n-@pytest.fixture\n-def ethtester():\n-    tester.chain = tester.Chain()\n-    return tester\n+@pytest.fixture(scope=\"session\")\n+def accounts():\n+    _accounts = []\n+    for i in range(1, 11):\n+        pk = PrivateKey(i.to_bytes(32, byteorder='big'))\n+        _accounts.append(EthereumAccount(pk.public_key.to_checksum_address(), pk))\n+    return _accounts\n+\n+\n+def ganache_initial_accounts_args(accounts):\n+    return [f\"--account=\\\"{acc.key.to_hex()},{HUNDRED_ETH}\\\"\" for acc in accounts]\n+\n+\n+def parse_worker_no(worker_id):\n+    worker_no = 0\n+    try:\n+        worker_no = int(worker_id[2:])\n+    except ValueError:\n+        pass\n+\n+    return worker_no\n+\n+\n+@pytest.fixture(scope=\"session\")\n+def ganache_port(worker_id):\n+    default_port = 8545\n+    worker_no = parse_worker_no(worker_id)\n+    print(f'{worker_id}, {worker_no}')\n+    return default_port + worker_no\n+\n+\n+def ganache_cli(accounts, port):\n+    accounts_args = ganache_initial_accounts_args(accounts)\n+\n+    class Starter(ProcessStarter):\n+        pattern = \"Listening on .*\"\n+        args = [\"ganache-cli\",\n+                f\"--port={port}\",\n+                f\"--gasLimit={GAS_LIMIT}\",\n+                f\"--time=0\",\n+                f\"--blockTime=0\",\n+                ] + accounts_args\n+\n+        def filter_lines(self, lines):\n+            return itertools.islice(lines, 100)\n+\n+    return Starter\n+\n+\n+@pytest.fixture(scope=\"session\")\n+def _w3_session(xprocess, accounts, ganache_port):\n+\n+    web3_modules = get_default_modules()\n+    web3_modules.update(eth=(AutominingEth,))\n+\n+    _w3 = Web3(HTTPProvider(endpoint_uri=f'http://localhost:{ganache_port}'), modules=web3_modules)\n+    if not _w3.isConnected():  # try to connect to an external ganache\n+        xprocess.ensure(f'GANACHE_{ganache_port}', ganache_cli(accounts, ganache_port))\n+        assert _w3.provider.make_request('miner_stop', [])['result']\n+\n+    _w3.eth.defaultAccount = _w3.eth.accounts[0]\n+\n+    yield _w3\n+\n+    xprocess.getinfo(f'GANACHE_{ganache_port}').terminate()\n \n \n @pytest.fixture\n-def ethutils():\n-    return utils\n+def w3(_w3_session):\n+    yield _w3_session\n+    _w3_session.eth.enable_auto_mine()\n \n \n @pytest.fixture\n-def get_contract(ethtester, ethutils):\n-    def create_contract(path, args=(), sender=ethtester.k0, libraries=None):\n+def get_contract(w3, deployer, accounts):\n+    def create_contract(path, args=(), sender=accounts[0], libraries=None):\n         if libraries is None:\n             libraries = dict()\n         abi, hexcode = deployer.builder.get_contract_data(path)\n-        encoded_args = (ContractTranslator(abi).encode_constructor_arguments(args) if args else b'')\n \n         libraries = _encode_libs(libraries)\n         linked_hexcode = link_code(hexcode, libraries)\n+        factory = w3.eth.contract(abi=abi, bytecode=linked_hexcode)\n+        tx_hash = factory.constructor(*args).transact({'gas': START_GAS, 'from': sender.address})\n+        tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash)\n+        contract = w3.eth.contract(abi=abi, address=tx_receipt.contractAddress)\n+        return ConvenienceContractWrapper(contract)\n \n-        code = ethutils.decode_hex(linked_hexcode) + encoded_args\n-        address = ethtester.chain.tx(sender=sender, to=b'', startgas=START_GAS, data=code)\n-        return ethtester.ABIContract(ethtester.chain, abi, address)\n     return create_contract\n \n \n @pytest.fixture\n-def root_chain(ethtester, get_contract):\n-    return initialized_contract(ethtester, get_contract, EXIT_PERIOD)\n+def root_chain(get_contract):\n+    return initialized_contract(get_contract, EXIT_PERIOD)\n \n \n-def initialized_contract(ethtester, get_contract, exit_period):\n+def initialized_contract(get_contract, exit_period):\n     pql = get_contract('PriorityQueueLib')\n     pqf = get_contract('PriorityQueueFactory', libraries={'PriorityQueueLib': pql.address})\n-    ethtester.chain.mine()\n     contract = get_contract('RootChain', libraries={'PriorityQueueFactory': pqf.address})\n-    ethtester.chain.mine()\n-    contract.init(exit_period, sender=ethtester.k0)\n-    ethtester.chain.mine()\n-    return contract\n-\n-\n-def deploy_token(ethtester, get_contract):\n-    contract = get_contract('MintableToken')\n-    ethtester.chain.mine()\n+    contract.init(exit_period)\n     return contract\n \n \n @pytest.fixture\n-def token(ethtester, get_contract):\n-    return deploy_token(ethtester, get_contract)\n+def token(get_contract):\n+    return get_contract('MintableToken')\n \n \n @pytest.fixture\n-def testlang(root_chain, ethtester):\n-    return TestingLanguage(root_chain, ethtester)\n+def testlang(root_chain, w3, accounts):\n+    return TestingLanguage(root_chain, w3, accounts)\n \n \n @pytest.fixture\n-def root_chain_short_exit_period(ethtester, get_contract):\n-    return initialized_contract(ethtester, get_contract, 0)\n+def root_chain_short_exit_period(get_contract):\n+    # Minimal valid exit period is 2, if we exit period to less than 2\n+    # we will be dividing by zero in function`RootChain::_firstPhaseNotOver`.\n+    # But, if we set exit period to 2, then we will automatically end up in the second phase as\n+    # blocks are mined with 1 second interval.\n+    exit_period = 4\n+    return initialized_contract(get_contract, exit_period)\n \n \n @pytest.fixture\n-def testlang_root_chain_short_exit_period(root_chain_short_exit_period, ethtester):\n-    return TestingLanguage(root_chain_short_exit_period, ethtester)\n+def testlang_root_chain_short_exit_period(root_chain_short_exit_period, w3, accounts):\n+    return TestingLanguage(root_chain_short_exit_period, w3, accounts)\n \n \n @pytest.fixture\n@@ -116,13 +173,16 @@ def utxo(testlang):\n     return testlang.create_utxo()\n \n \n-def watch_contract(ethtester, path, address):\n-    abi, _ = deployer.builder.get_contract_data(path)\n-    return ethtester.ABIContract(ethtester.chain, abi, address)\n-\n-\n def _encode_libs(libraries):\n     return {\n-        libname + '.sol' + ':' + libname: address_to_hex(libaddress)\n+        libname + '.sol' + ':' + libname: libaddress\n         for libname, libaddress in libraries.items()\n     }\n+\n+\n+def assert_event(event_obj, expected_event_name, expected_event_args=None):\n+    if expected_event_args is None:\n+        expected_event_args = {}\n+\n+    assert event_obj['event'] == expected_event_name\n+    assert expected_event_args.items() <= event_obj['args'].items()\ndiff --git a/tests/contracts/priority_queue/test_priority_queue.py b/tests/contracts/priority_queue/test_priority_queue.py\n--- a/tests/contracts/priority_queue/test_priority_queue.py\n+++ b/tests/contracts/priority_queue/test_priority_queue.py\n@@ -1,21 +1,30 @@\n-import pytest\n-from ethereum.tools.tester import TransactionFailed\n-from plasma_core.utils.address import address_to_hex\n import math\n \n+import pytest\n+from eth_tester.exceptions import TransactionFailed\n+\n \n @pytest.fixture\n-def priority_queue(get_contract, ethtester):\n+def priority_queue(get_contract, accounts):\n     pql = get_contract('PriorityQueueLib')\n     return get_contract(\n-        'PriorityQueue',\n-        args=[address_to_hex(ethtester.a0)], libraries={'PriorityQueueLib': pql.address}\n+        'PriorityQueueWrapper',\n+        args=[accounts[0].address], libraries={'PriorityQueueLib': pql.address}\n     )\n \n \n+def del_min(priority_queue) -> int:\n+    w3 = priority_queue.web3\n+    tx_hash = priority_queue.delMin()\n+    receipt = w3.eth.getTransactionReceipt(tx_hash)\n+    events = priority_queue.events.DelMin().processReceipt(receipt)\n+    assert len(events) == 1\n+    return events[0]['args']['val']\n+\n+\n def test_priority_queue_get_min_empty_should_fail(priority_queue):\n     with pytest.raises(TransactionFailed):\n-        priority_queue.getMin()\n+        del_min(priority_queue)\n \n \n def test_priority_queue_insert(priority_queue):\n@@ -39,15 +48,15 @@ def test_priority_queue_insert_out_of_order(priority_queue):\n \n def test_priority_queue_delete_min(priority_queue):\n     priority_queue.insert(2)\n-    assert priority_queue.delMin() == 2\n+    assert del_min(priority_queue) == 2\n     assert priority_queue.currentSize() == 0\n \n \n def test_priority_queue_delete_all(priority_queue):\n     priority_queue.insert(5)\n     priority_queue.insert(2)\n-    assert priority_queue.delMin() == 2\n-    assert priority_queue.delMin() == 5\n+    assert del_min(priority_queue) == 2\n+    assert del_min(priority_queue) == 5\n     assert priority_queue.currentSize() == 0\n     with pytest.raises(TransactionFailed):\n         priority_queue.getMin()\n@@ -56,14 +65,14 @@ def test_priority_queue_delete_all(priority_queue):\n def test_priority_insert_is_not_idempotent(priority_queue):\n     priority_queue.insert(2)\n     priority_queue.insert(2)\n-    assert priority_queue.delMin() == 2\n-    assert priority_queue.delMin() == 2\n+    assert del_min(priority_queue) == 2\n+    assert del_min(priority_queue) == 2\n     assert priority_queue.currentSize() == 0\n \n \n def test_priority_queue_delete_then_insert(priority_queue):\n     priority_queue.insert(2)\n-    assert priority_queue.delMin() == 2\n+    assert del_min(priority_queue) == 2\n     priority_queue.insert(5)\n     assert priority_queue.getMin() == 5\n \n@@ -78,18 +87,17 @@ def test_priority_queue_insert_spam_does_not_elevate_gas_cost_above_200k():\n     assert op_cost(size) < 200000\n \n \n-def run_test(ethtester, priority_queue, values):\n+def run_test(w3, priority_queue, values):\n     for i, value in enumerate(values):\n-        if i % 10 == 0:\n-            ethtester.chain.mine()\n         priority_queue.insert(value)\n-        gas = ethtester.chain.last_gas_used()\n-        assert gas <= op_cost(i + 1)\n+        gas = w3.eth.last_gas_used\n+        if i != 0:  # at first insert there is a small additional cost - we take care of only the asymptotic cost\n+            assert gas <= op_cost(i + 1)\n+\n     for i in range(1, len(values)):\n-        if i % 10 == 0:\n-            ethtester.chain.mine()\n-        assert i == priority_queue.delMin()\n-        gas = ethtester.chain.last_gas_used()\n+        assert i == priority_queue.functions.delMin().call()\n+        priority_queue.delMin()\n+        gas = w3.eth.last_gas_used\n         assert gas <= op_cost(len(values) - i)\n \n \n@@ -97,32 +105,42 @@ def op_cost(n):\n     tx_base_cost = 21000\n     # Numbers were discovered experimentally. They represent upper bound of\n     # gas cost of execution of delMin or insert operations.\n-    return tx_base_cost + 28677 + 6638 * math.floor(math.log(n, 2))\n+    return tx_base_cost + 39723 + 6582 * math.floor(math.log(n, 2))\n \n \n-def test_priority_queue_worst_case_gas_cost(ethtester, priority_queue):\n+def test_priority_queue_worst_case_gas_cost(w3, priority_queue):\n     values = list(range(1, 100))\n     values.reverse()\n-    run_test(ethtester, priority_queue, values)\n+    run_test(w3, priority_queue, values)\n \n \n-def test_priority_queue_average_case_gas_cost(ethtester, priority_queue):\n+def test_priority_queue_average_case_gas_cost(w3, priority_queue):\n     import random\n     random.seed(a=0)\n     values = list(range(1, 100))\n     random.shuffle(values)\n-    run_test(ethtester, priority_queue, values)\n+    run_test(w3, priority_queue, values)\n \n \n-def test_priority_queue_best_case_gas_cost(ethtester, priority_queue):\n+def test_priority_queue_best_case_gas_cost(w3, priority_queue):\n     values = list(range(1, 100))\n-    run_test(ethtester, priority_queue, values)\n+    run_test(w3, priority_queue, values)\n \n \n-def test_del_min_can_be_called_by_owner_only(ethtester, priority_queue):\n+def test_del_min_can_be_called_by_owner_only(w3, get_contract, accounts):\n+    pql = get_contract('PriorityQueueLib')\n+    priority_queue = get_contract(\"PriorityQueue\",\n+                                  args=[accounts[0].address],\n+                                  libraries={'PriorityQueueLib': pql.address}\n+                                  )  # without a proxy contract\n+\n     priority_queue.insert(7)\n \n     with pytest.raises(TransactionFailed):\n-        priority_queue.delMin(sender=ethtester.k1)\n+        priority_queue.delMin(**{'from': accounts[1].address})\n+\n+    assert priority_queue.functions.delMin().call() == 7\n+    tx_hash = priority_queue.delMin(**{'from': accounts[0].address})\n+    receipt = w3.eth.waitForTransactionReceipt(tx_hash)\n \n-    assert priority_queue.delMin(sender=ethtester.k0) == 7\n+    assert receipt['status'] == 1\ndiff --git a/tests/contracts/rlp/test_plasma_core.py b/tests/contracts/rlp/test_plasma_core.py\n--- a/tests/contracts/rlp/test_plasma_core.py\n+++ b/tests/contracts/rlp/test_plasma_core.py\n@@ -1,14 +1,15 @@\n import pytest\n+from eth_utils import to_checksum_address\n+\n from plasma_core.constants import NULL_ADDRESS\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n from plasma_core.transaction import Transaction\n from plasma_core.utils.transactions import decode_utxo_id\n \n \n @pytest.fixture\n-def plasma_core_test(ethtester, get_contract):\n+def plasma_core_test(get_contract):\n     contract = get_contract('PlasmaCoreTest')\n-    ethtester.chain.mine()\n     return contract\n \n \n@@ -29,7 +30,7 @@ def test_get_output(plasma_core_test):\n     owner = '0x82a978b3f5962a5b0957d9ee9eef472ee55b42f1'\n     amount = 100\n     tx = Transaction(outputs=[(owner, null, amount)])\n-    assert plasma_core_test.getOutput(tx.encoded, 0) == [owner, null, amount]\n+    assert plasma_core_test.getOutput(tx.encoded, 0) == [to_checksum_address(owner), null, amount]\n     assert plasma_core_test.getOutput(tx.encoded, 1) == [null, null, 0]\n \n \n@@ -49,14 +50,13 @@ def test_metadata_is_part_of_the_proof(testlang):\n     deposit_id = testlang.deposit(owner, amount)\n \n     input_ids = [deposit_id]\n-    keys = [owner.key]\n     outputs = [(owner.address, NULL_ADDRESS, amount)]\n-    spend_id = testlang.spend_utxo(input_ids, keys, outputs, b'metadata info')\n+    spend_id = testlang.spend_utxo(input_ids, [owner], outputs, b'metadata info')\n \n     inputs = [decode_utxo_id(input_id) for input_id in input_ids]\n     bad_spend_tx = Transaction(inputs=inputs, outputs=outputs, metadata=b'other information')\n     with pytest.raises(TransactionFailed):\n-        testlang.start_standard_exit_with_tx_body(spend_id, bad_spend_tx, owner.key)\n+        testlang.start_standard_exit_with_tx_body(spend_id, bad_spend_tx, owner)\n \n \n def test_get_input_id(plasma_core_test):\ndiff --git a/tests/contracts/rlp/test_rlp.py b/tests/contracts/rlp/test_rlp.py\n--- a/tests/contracts/rlp/test_rlp.py\n+++ b/tests/contracts/rlp/test_rlp.py\n@@ -5,7 +5,7 @@\n import pytest\n import rlp\n \n-from eth_utils import encode_hex, is_address, to_canonical_address\n+from eth_utils import is_address, to_canonical_address\n from rlp.sedes import big_endian_int, Binary\n \n \n@@ -56,19 +56,18 @@ def __init__(self, *args):\n \n \n @pytest.fixture\n-def rlp_test(ethtester, get_contract):\n+def rlp_test(get_contract):\n     contract = get_contract('RLPTest')\n-    ethtester.chain.mine()\n     return contract\n \n \n-def test_rlp_tx_eight(ethtester, rlp_test):\n-    tx = Eight(0, 1, 2, 3, 4, 5, ethtester.a0, ethtester.a1)\n+def test_rlp_tx_eight(accounts, rlp_test):\n+    tx = Eight(0, 1, 2, 3, 4, 5, accounts[0].address, accounts[1].address)\n     tx_bytes = rlp.encode(tx, Eight)\n-    assert [5, encode_hex(ethtester.a0), encode_hex(ethtester.a1)] == rlp_test.eight(tx_bytes)\n+    assert [5, accounts[0].address, accounts[1].address] == rlp_test.eight(tx_bytes)\n \n \n-def test_rlp_tx_eleven(ethtester, rlp_test):\n-    tx = Eleven(0, 1, 2, 3, 4, 5, 6, 7, ethtester.a0, ethtester.a1, ethtester.a2)\n+def test_rlp_tx_eleven(accounts, rlp_test):\n+    tx = Eleven(0, 1, 2, 3, 4, 5, 6, 7, accounts[0].address, accounts[1].address, accounts[2].address)\n     tx_bytes = rlp.encode(tx, Eleven)\n-    assert [7, encode_hex(ethtester.a0), encode_hex(ethtester.a1), encode_hex(ethtester.a2)] == rlp_test.eleven(tx_bytes)\n+    assert [7, accounts[0].address, accounts[1].address, accounts[2].address] == rlp_test.eleven(tx_bytes)\ndiff --git a/tests/contracts/root_chain/test_challenge_in_flight_exit_input_spent.py b/tests/contracts/root_chain/test_challenge_in_flight_exit_input_spent.py\n--- a/tests/contracts/root_chain/test_challenge_in_flight_exit_input_spent.py\n+++ b/tests/contracts/root_chain/test_challenge_in_flight_exit_input_spent.py\n@@ -1,5 +1,5 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n from plasma_core.constants import NULL_ADDRESS\n \n \n@@ -8,13 +8,13 @@\n def test_challenge_in_flight_exit_input_spent_should_succeed(testlang, period):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_1.key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_1)\n     testlang.forward_to_period(period)\n \n-    testlang.challenge_in_flight_exit_input_spent(spend_id, double_spend_id, owner_2.key)\n+    testlang.challenge_in_flight_exit_input_spent(spend_id, double_spend_id, owner_2)\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert not in_flight_exit.input_piggybacked(0)\n@@ -23,49 +23,49 @@ def test_challenge_in_flight_exit_input_spent_should_succeed(testlang, period):\n def test_challenge_in_flight_exit_input_spent_not_piggybacked_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n     testlang.start_in_flight_exit(spend_id)\n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_input_spent(spend_id, double_spend_id, owner_2.key)\n+        testlang.challenge_in_flight_exit_input_spent(spend_id, double_spend_id, owner_2)\n \n \n def test_challenge_in_flight_exit_input_spent_same_tx_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_1.key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_1)\n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_input_spent(spend_id, spend_id, owner_2.key)\n+        testlang.challenge_in_flight_exit_input_spent(spend_id, spend_id, owner_2)\n \n \n def test_challenge_in_flight_exit_input_spent_unrelated_tx_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id_1 = testlang.deposit(owner_1, amount)\n     deposit_id_2 = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id_1], [owner_1.key])\n-    unrelated_spend_id = testlang.spend_utxo([deposit_id_2], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)])\n+    spend_id = testlang.spend_utxo([deposit_id_1], [owner_1])\n+    unrelated_spend_id = testlang.spend_utxo([deposit_id_2], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)])\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_1.key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_1)\n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_input_spent(spend_id, unrelated_spend_id, owner_2.key)\n+        testlang.challenge_in_flight_exit_input_spent(spend_id, unrelated_spend_id, owner_2)\n \n \n def test_challenge_in_flight_exit_input_spent_invalid_signature_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_2.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_2], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_1.key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_1)\n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_input_spent(spend_id, double_spend_id, owner_2.key)\n+        testlang.challenge_in_flight_exit_input_spent(spend_id, double_spend_id, owner_2)\ndiff --git a/tests/contracts/root_chain/test_challenge_in_flight_exit_not_canonical.py b/tests/contracts/root_chain/test_challenge_in_flight_exit_not_canonical.py\n--- a/tests/contracts/root_chain/test_challenge_in_flight_exit_not_canonical.py\n+++ b/tests/contracts/root_chain/test_challenge_in_flight_exit_not_canonical.py\n@@ -1,17 +1,19 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n+\n from plasma_core.constants import NULL_ADDRESS, MIN_EXIT_PERIOD\n \n \n def test_challenge_in_flight_exit_not_canonical_should_succeed(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)],\n+                                          force_invalid=True)\n \n     testlang.start_in_flight_exit(spend_id)\n \n-    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert in_flight_exit.bond_owner == owner_2.address\n@@ -22,34 +24,35 @@ def test_challenge_in_flight_exit_not_canonical_should_succeed(testlang):\n def test_challenge_in_flight_exit_not_canonical_wrong_period_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)],\n+                                          force_invalid=True)\n \n     testlang.start_in_flight_exit(spend_id)\n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\n \n \n def test_challenge_in_flight_exit_not_canonical_same_tx_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], force_invalid=True)\n \n     testlang.start_in_flight_exit(spend_id)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\n \n \n def test_challenge_in_flight_exit_not_canonical_unrelated_tx_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id_1 = testlang.deposit(owner_1, amount)\n     deposit_id_2 = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id_1], [owner_1.key])\n-    unrelated_spend_id = testlang.spend_utxo([deposit_id_2], [owner_1.key])\n+    spend_id = testlang.spend_utxo([deposit_id_1], [owner_1])\n+    unrelated_spend_id = testlang.spend_utxo([deposit_id_2], [owner_1])\n     spend_tx = testlang.child_chain.get_transaction(spend_id)\n     unrelated_spend_tx = testlang.child_chain.get_transaction(unrelated_spend_id)\n \n@@ -59,14 +62,17 @@ def test_challenge_in_flight_exit_not_canonical_unrelated_tx_should_fail(testlan\n     signature = unrelated_spend_tx.signatures[0]\n \n     with pytest.raises(TransactionFailed):\n-        testlang.root_chain.challengeInFlightExitNotCanonical(spend_tx.encoded, 0, unrelated_spend_tx.encoded, 0, unrelated_spend_id, proof, signature, sender=owner_2.key)\n+        testlang.root_chain.challengeInFlightExitNotCanonical(spend_tx.encoded, 0, unrelated_spend_tx.encoded, 0,\n+                                                              unrelated_spend_id, proof, signature,\n+                                                              **{'from': owner_2.address})\n \n \n def test_challenge_in_flight_exit_not_canonical_wrong_index_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)],\n+                                          force_invalid=True)\n     spend_tx = testlang.child_chain.get_transaction(spend_id)\n     double_spend_tx = testlang.child_chain.get_transaction(double_spend_id)\n \n@@ -76,26 +82,30 @@ def test_challenge_in_flight_exit_not_canonical_wrong_index_should_fail(testlang\n     signature = double_spend_tx.signatures[0]\n \n     with pytest.raises(TransactionFailed):\n-        testlang.root_chain.challengeInFlightExitNotCanonical(spend_tx.encoded, 0, double_spend_tx.encoded, 1, double_spend_id, proof, signature, sender=owner_2.key)\n+        testlang.root_chain.challengeInFlightExitNotCanonical(spend_tx.encoded, 0, double_spend_tx.encoded, 1,\n+                                                              double_spend_id, proof, signature,\n+                                                              **{'from': owner_2.address})\n \n \n def test_challenge_in_flight_exit_not_canonical_invalid_signature_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_2.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_2], [(owner_1.address, NULL_ADDRESS, 100)],\n+                                          force_invalid=True)\n \n     testlang.start_in_flight_exit(spend_id)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\n \n \n def test_challenge_in_flight_exit_not_canonical_invalid_proof_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)],\n+                                          force_invalid=True)\n     spend_tx = testlang.child_chain.get_transaction(spend_id)\n     double_spend_tx = testlang.child_chain.get_transaction(double_spend_id)\n \n@@ -105,34 +115,39 @@ def test_challenge_in_flight_exit_not_canonical_invalid_proof_should_fail(testla\n     signature = double_spend_tx.signatures[0]\n \n     with pytest.raises(TransactionFailed):\n-        testlang.root_chain.challengeInFlightExitNotCanonical(spend_tx.encoded, 0, double_spend_tx.encoded, 0, double_spend_id, proof, signature, sender=owner_2.key)\n+        testlang.root_chain.challengeInFlightExitNotCanonical(spend_tx.encoded, 0, double_spend_tx.encoded, 0,\n+                                                              double_spend_id, proof, signature,\n+                                                              **{'from': owner_2.address})\n \n \n def test_challenge_in_flight_exit_not_canonical_same_tx_twice_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)],\n+                                          force_invalid=True)\n \n     testlang.start_in_flight_exit(spend_id)\n \n-    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\n \n \n def test_challenge_in_flight_exit_twice_older_position_should_succeed(testlang):\n     owner_1, owner_2, owner_3, amount = testlang.accounts[0], testlang.accounts[1], testlang.accounts[2], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id_1 = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n-    double_spend_id_2 = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 50)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id_1 = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)],\n+                                            force_invalid=True)\n+    double_spend_id_2 = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 50)],\n+                                            force_invalid=True)\n \n     testlang.start_in_flight_exit(spend_id)\n \n-    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id_2, key=owner_2.key)\n-    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id_1, key=owner_3.key)\n+    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id_2, account=owner_2)\n+    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id_1, account=owner_3)\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert in_flight_exit.bond_owner == owner_3.address\n@@ -143,24 +158,27 @@ def test_challenge_in_flight_exit_twice_older_position_should_succeed(testlang):\n def test_challenge_in_flight_exit_twice_younger_position_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id_1 = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n-    double_spend_id_2 = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 50)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id_1 = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)],\n+                                            force_invalid=True)\n+    double_spend_id_2 = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 50)],\n+                                            force_invalid=True)\n \n     testlang.start_in_flight_exit(spend_id)\n \n-    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id_1, key=owner_2.key)\n+    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id_1, account=owner_2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id_2, key=owner_2.key)\n+        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id_2, account=owner_2)\n \n \n def test_challenge_in_flight_exit_not_canonical_with_inputs_spent_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    testlang.start_standard_exit(deposit_id, owner_1.key)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    testlang.start_standard_exit(deposit_id, owner_1)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)],\n+                                          force_invalid=True)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, 0, 1)\n@@ -169,4 +187,4 @@ def test_challenge_in_flight_exit_not_canonical_with_inputs_spent_should_fail(te\n \n     # Since IFE can be exited only from inputs, no further canonicity game required\n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\ndiff --git a/tests/contracts/root_chain/test_challenge_in_flight_exit_output_spent.py b/tests/contracts/root_chain/test_challenge_in_flight_exit_output_spent.py\n--- a/tests/contracts/root_chain/test_challenge_in_flight_exit_output_spent.py\n+++ b/tests/contracts/root_chain/test_challenge_in_flight_exit_output_spent.py\n@@ -1,5 +1,5 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n from plasma_core.constants import NULL_ADDRESS\n \n \n@@ -8,13 +8,13 @@\n def test_challenge_in_flight_exit_output_spent_should_succeed(testlang, period):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)])\n-    double_spend_id = testlang.spend_utxo([spend_id], [owner_1.key], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)])\n+    double_spend_id = testlang.spend_utxo([spend_id], [owner_1], force_invalid=True)\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1)\n     testlang.forward_to_period(period)\n \n-    testlang.challenge_in_flight_exit_output_spent(spend_id, double_spend_id, 0, owner_2.key)\n+    testlang.challenge_in_flight_exit_output_spent(spend_id, double_spend_id, 0, owner_2)\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert not in_flight_exit.output_piggybacked(0)\n@@ -23,49 +23,49 @@ def test_challenge_in_flight_exit_output_spent_should_succeed(testlang, period):\n def test_challenge_in_flight_exit_output_spent_not_piggybacked_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)])\n-    double_spend_id = testlang.spend_utxo([spend_id], [owner_1.key], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)])\n+    double_spend_id = testlang.spend_utxo([spend_id], [owner_1], force_invalid=True)\n     testlang.start_in_flight_exit(spend_id)\n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_output_spent(spend_id, double_spend_id, 0, owner_2.key)\n+        testlang.challenge_in_flight_exit_output_spent(spend_id, double_spend_id, 0, owner_2)\n \n \n def test_challenge_in_flight_exit_output_spent_unrelated_tx_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id_1 = testlang.deposit(owner_1, amount)\n     deposit_id_2 = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id_1], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)])\n-    unrelated_spend_id = testlang.spend_utxo([deposit_id_2], [owner_1.key])\n+    spend_id = testlang.spend_utxo([deposit_id_1], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)])\n+    unrelated_spend_id = testlang.spend_utxo([deposit_id_2], [owner_1])\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1)\n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_output_spent(spend_id, unrelated_spend_id, 0, owner_2.key)\n+        testlang.challenge_in_flight_exit_output_spent(spend_id, unrelated_spend_id, 0, owner_2)\n \n \n def test_challenge_in_flight_exit_output_spent_invalid_signature_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)])\n-    double_spend_id = testlang.spend_utxo([spend_id], [owner_2.key], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)])\n+    double_spend_id = testlang.spend_utxo([spend_id], [owner_2], force_invalid=True)\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1)\n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_output_spent(spend_id, double_spend_id, 0, owner_2.key)\n+        testlang.challenge_in_flight_exit_output_spent(spend_id, double_spend_id, 0, owner_2)\n \n \n def test_challenge_in_flight_exit_output_spent_invalid_proof_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)])\n-    double_spend_id = testlang.spend_utxo([spend_id], [owner_1.key], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)])\n+    double_spend_id = testlang.spend_utxo([spend_id], [owner_1], force_invalid=True)\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1)\n     testlang.forward_to_period(2)\n \n     in_flight_tx = testlang.child_chain.get_transaction(spend_id)\n@@ -73,4 +73,6 @@ def test_challenge_in_flight_exit_output_spent_invalid_proof_should_fail(testlan\n     in_flight_tx_inclusion_proof = b''\n     spending_tx_sig = spending_tx.signatures[0]\n     with pytest.raises(TransactionFailed):\n-        testlang.root_chain.challengeInFlightExitOutputSpent(in_flight_tx.encoded, spend_id, in_flight_tx_inclusion_proof, spending_tx.encoded, 0, spending_tx_sig, sender=owner_2.key)\n+        testlang.root_chain.challengeInFlightExitOutputSpent(in_flight_tx.encoded, spend_id,\n+                                                             in_flight_tx_inclusion_proof, spending_tx.encoded, 0,\n+                                                             spending_tx_sig, **{'from': owner_2.address})\ndiff --git a/tests/contracts/root_chain/test_challenge_standard_exit.py b/tests/contracts/root_chain/test_challenge_standard_exit.py\n--- a/tests/contracts/root_chain/test_challenge_standard_exit.py\n+++ b/tests/contracts/root_chain/test_challenge_standard_exit.py\n@@ -1,5 +1,5 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n from plasma_core.constants import NULL_ADDRESS, NULL_ADDRESS_HEX, MIN_EXIT_PERIOD, NULL_SIGNATURE\n from plasma_core.transaction import Transaction\n from plasma_core.utils.transactions import decode_utxo_id\n@@ -8,10 +8,10 @@\n def test_challenge_standard_exit_valid_spend_should_succeed(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], outputs=[(owner.address, NULL_ADDRESS, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], outputs=[(owner.address, NULL_ADDRESS, amount)])\n \n-    testlang.start_standard_exit(spend_id, owner.key)\n-    doublespend_id = testlang.spend_utxo([spend_id], [owner.key], outputs=[(owner.address, NULL_ADDRESS, amount)])\n+    testlang.start_standard_exit(spend_id, owner)\n+    doublespend_id = testlang.spend_utxo([spend_id], [owner], outputs=[(owner.address, NULL_ADDRESS, amount)])\n     testlang.challenge_standard_exit(spend_id, doublespend_id)\n \n     assert testlang.get_standard_exit(spend_id) == [NULL_ADDRESS_HEX, NULL_ADDRESS_HEX, 0]\n@@ -20,10 +20,10 @@ def test_challenge_standard_exit_valid_spend_should_succeed(testlang):\n def test_challenge_standard_exit_if_successful_awards_the_bond(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], outputs=[(owner.address, NULL_ADDRESS, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], outputs=[(owner.address, NULL_ADDRESS, amount)])\n \n-    testlang.start_standard_exit(spend_id, owner.key)\n-    doublespend_id = testlang.spend_utxo([spend_id], [owner.key], outputs=[(owner.address, NULL_ADDRESS, amount)])\n+    testlang.start_standard_exit(spend_id, owner)\n+    doublespend_id = testlang.spend_utxo([spend_id], [owner], outputs=[(owner.address, NULL_ADDRESS, amount)])\n \n     pre_balance = testlang.get_balance(owner)\n     testlang.challenge_standard_exit(spend_id, doublespend_id)\n@@ -34,10 +34,10 @@ def test_challenge_standard_exit_if_successful_awards_the_bond(testlang):\n def test_challenge_standard_exit_mature_valid_spend_should_succeed(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], outputs=[(owner.address, NULL_ADDRESS, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], outputs=[(owner.address, NULL_ADDRESS, amount)])\n \n-    testlang.start_standard_exit(spend_id, owner.key)\n-    doublespend_id = testlang.spend_utxo([spend_id], [owner.key], outputs=[(owner.address, NULL_ADDRESS, amount)])\n+    testlang.start_standard_exit(spend_id, owner)\n+    doublespend_id = testlang.spend_utxo([spend_id], [owner], outputs=[(owner.address, NULL_ADDRESS, amount)])\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -48,8 +48,8 @@ def test_challenge_standard_exit_mature_valid_spend_should_succeed(testlang):\n def test_challenge_standard_exit_invalid_spend_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    testlang.start_standard_exit(deposit_id, owner_1.key)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_2.key], force_invalid=True)\n+    testlang.start_standard_exit(deposit_id, owner_1)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_2], force_invalid=True)\n \n     with pytest.raises(TransactionFailed):\n         testlang.challenge_standard_exit(deposit_id, spend_id)\n@@ -58,10 +58,10 @@ def test_challenge_standard_exit_invalid_spend_should_fail(testlang):\n def test_challenge_standard_exit_unrelated_spend_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id_1 = testlang.deposit(owner, amount)\n-    testlang.start_standard_exit(deposit_id_1, owner.key)\n+    testlang.start_standard_exit(deposit_id_1, owner)\n \n     deposit_id_2 = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id_2], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id_2], [owner])\n \n     with pytest.raises(TransactionFailed):\n         testlang.challenge_standard_exit(deposit_id_1, spend_id)\n@@ -71,7 +71,7 @@ def test_challenge_standard_exit_uninitialized_memory_and_zero_sig_should_fail(t\n     bond = testlang.root_chain.standardExitBond()\n     owner, amount = testlang.accounts[0], 100 * bond\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner])\n     tx = testlang.child_chain.get_transaction(spend_id)\n \n     with pytest.raises(TransactionFailed):\n@@ -81,7 +81,7 @@ def test_challenge_standard_exit_uninitialized_memory_and_zero_sig_should_fail(t\n def test_challenge_standard_exit_not_started_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner])\n \n     with pytest.raises(TransactionFailed):\n         testlang.challenge_standard_exit(deposit_id, spend_id)\n@@ -95,17 +95,18 @@ def test_challenge_standard_exit_wrong_oindex_should_fail(testlang):\n     deposit_id = testlang.deposit(alice, alice_money + bob_money)\n     deposit_blknum, _, _ = decode_utxo_id(deposit_id)\n \n-    spend_tx = Transaction(inputs=[decode_utxo_id(deposit_id)], outputs=[(alice.address, NULL_ADDRESS, alice_money), (bob.address, NULL_ADDRESS, bob_money)])\n-    spend_tx.sign(0, alice.key, verifyingContract=testlang.root_chain)\n+    spend_tx = Transaction(inputs=[decode_utxo_id(deposit_id)],\n+                           outputs=[(alice.address, NULL_ADDRESS, alice_money), (bob.address, NULL_ADDRESS, bob_money)])\n+    spend_tx.sign(0, alice, verifyingContract=testlang.root_chain)\n     blknum = testlang.submit_block([spend_tx])\n     alice_utxo = encode_utxo_id(blknum, 0, 0)\n     bob_utxo = encode_utxo_id(blknum, 0, 1)\n \n-    testlang.start_standard_exit(alice_utxo, alice.key)\n-    testlang.start_standard_exit(bob_utxo, bob.key)\n+    testlang.start_standard_exit(alice_utxo, alice)\n+    testlang.start_standard_exit(bob_utxo, bob)\n \n-    bob_spend_id = testlang.spend_utxo([bob_utxo], [bob.key], outputs=[(bob.address, NULL_ADDRESS, bob_money)])\n-    alice_spend_id = testlang.spend_utxo([alice_utxo], [alice.key], outputs=[(alice.address, NULL_ADDRESS, alice_money)])\n+    bob_spend_id = testlang.spend_utxo([bob_utxo], [bob], outputs=[(bob.address, NULL_ADDRESS, bob_money)])\n+    alice_spend_id = testlang.spend_utxo([alice_utxo], [alice], outputs=[(alice.address, NULL_ADDRESS, alice_money)])\n \n     with pytest.raises(TransactionFailed):\n         testlang.challenge_standard_exit(alice_utxo, bob_spend_id)\n@@ -116,20 +117,21 @@ def test_challenge_standard_exit_wrong_oindex_should_fail(testlang):\n     testlang.challenge_standard_exit(alice_utxo, alice_spend_id)\n \n \n-def test_challenge_standard_exit_with_in_flight_exit_tx_should_succeed(ethtester, testlang):\n+def test_challenge_standard_exit_with_in_flight_exit_tx_should_succeed(testlang):\n     # exit cross-spend test, cases 3 and 4\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], outputs=[(owner.address, NULL_ADDRESS, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], outputs=[(owner.address, NULL_ADDRESS, amount)])\n \n     ife_tx = Transaction(inputs=[decode_utxo_id(spend_id)], outputs=[(owner.address, NULL_ADDRESS, amount)])\n-    ife_tx.sign(0, owner.key, verifyingContract=testlang.root_chain)\n+    ife_tx.sign(0, owner, verifyingContract=testlang.root_chain)\n \n     (encoded_spend, encoded_inputs, proofs, signatures) = testlang.get_in_flight_exit_info(None, spend_tx=ife_tx)\n     bond = testlang.root_chain.inFlightExitBond()\n-    testlang.root_chain.startInFlightExit(encoded_spend, encoded_inputs, proofs, signatures, value=bond, sender=owner.key)\n+    testlang.root_chain.startInFlightExit(encoded_spend, encoded_inputs, proofs, signatures,\n+                                          **{'value': bond, 'from': owner.address})\n \n-    testlang.start_standard_exit(spend_id, owner.key)\n+    testlang.start_standard_exit(spend_id, owner)\n     assert testlang.get_standard_exit(spend_id).amount == 100\n \n     exit_id = testlang.get_standard_exit_id(spend_id)\ndiff --git a/tests/contracts/root_chain/test_deposit.py b/tests/contracts/root_chain/test_deposit.py\n--- a/tests/contracts/root_chain/test_deposit.py\n+++ b/tests/contracts/root_chain/test_deposit.py\n@@ -1,19 +1,21 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n+\n+from plasma_core.block import Block\n from plasma_core.constants import NULL_ADDRESS\n-from plasma_core.utils.transactions import decode_utxo_id\n+from plasma_core.utils.transactions import decode_utxo_id, encode_utxo_id\n from plasma_core.transaction import Transaction\n from plasma_core.utils.merkle.fixed_merkle import FixedMerkle\n \n \n-def test_deposit_valid_values_should_succeed(ethtester, testlang):\n+def test_deposit_valid_values_should_succeed(testlang, w3):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n     deposit_tx = testlang.child_chain.get_transaction(deposit_id)\n \n     merkle = FixedMerkle(16, [deposit_tx.encoded])\n \n-    assert testlang.root_chain.blocks(1) == [merkle.root, ethtester.chain.head_state.timestamp]\n+    assert testlang.root_chain.blocks(1) == [merkle.root, testlang.timestamp]\n     assert testlang.root_chain.nextDepositBlock() == 2\n \n \n@@ -53,18 +55,22 @@ def test_deposit_with_input_should_fail(testlang):\n         testlang.root_chain.deposit(deposit_tx.encoded, value=amount)\n \n \n-def test_at_most_999_deposits_per_child_block(testlang):\n+def test_at_most_999_deposits_per_child_block(testlang, w3):\n     owner = testlang.accounts[0]\n     child_block_interval = testlang.root_chain.CHILD_BLOCK_INTERVAL()\n+    w3.eth.disable_auto_mine()\n+    blknum = testlang.root_chain.getDepositBlockNumber()\n     for i in range(0, child_block_interval - 1):\n-        deposit_id = testlang.deposit(owner, 1)\n+        deposit_id = _deposit(testlang, owner, 1, blknum + i)\n         if i % 25 == 0:\n-            testlang.ethtester.chain.mine()\n+            w3.eth.mine()\n+    w3.eth.enable_auto_mine()\n+    w3.eth.mine()\n \n     with pytest.raises(TransactionFailed):\n         testlang.deposit(owner, 1)\n \n-    testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, NULL_ADDRESS, 1)])\n+    testlang.spend_utxo([deposit_id], [owner], [(owner.address, NULL_ADDRESS, 1)])\n     testlang.deposit(owner, 1)\n \n \n@@ -85,9 +91,9 @@ def test_token_deposit_non_existing_token_should_fail(testlang, token):\n     deposit_tx = Transaction(outputs=[(owner.address, NULL_ADDRESS, amount)])\n \n     token.mint(owner.address, amount)\n-    token.approve(testlang.root_chain.address, amount, sender=owner.key)\n+    token.approve(testlang.root_chain.address, amount, **{'from': owner.address})\n     with pytest.raises(TransactionFailed):\n-        testlang.root_chain.depositFrom(deposit_tx.encoded, sender=owner.key)\n+        testlang.root_chain.depositFrom(deposit_tx.encoded, **{'from': owner.address})\n \n \n def test_token_deposit_no_approve_should_fail(testlang, token):\n@@ -96,7 +102,7 @@ def test_token_deposit_no_approve_should_fail(testlang, token):\n \n     token.mint(owner.address, amount)\n     with pytest.raises(TransactionFailed):\n-        testlang.root_chain.depositFrom(deposit_tx.encoded, sender=owner.key)\n+        testlang.root_chain.depositFrom(deposit_tx.encoded, **{'from': owner.address})\n \n \n def test_token_deposit_insufficient_approve_should_fail(testlang, token):\n@@ -104,6 +110,15 @@ def test_token_deposit_insufficient_approve_should_fail(testlang, token):\n     deposit_tx = Transaction(outputs=[(owner.address, token.address, amount * 5)])\n \n     token.mint(owner.address, amount)\n-    token.approve(testlang.root_chain.address, amount, sender=owner.key)\n+    token.approve(testlang.root_chain.address, amount, **{'from': owner.address})\n     with pytest.raises(TransactionFailed):\n-        testlang.root_chain.depositFrom(deposit_tx.encoded, sender=owner.key)\n+        testlang.root_chain.depositFrom(deposit_tx.encoded, **{'from': owner.address})\n+\n+\n+def _deposit(testlang, owner, amount, blknum):\n+    deposit_tx = Transaction(outputs=[(owner.address, NULL_ADDRESS, amount)])\n+    testlang.root_chain.contract.functions.deposit(deposit_tx.encoded).transact({'from': owner.address, 'value': amount})\n+    deposit_id = encode_utxo_id(blknum, 0, 0)\n+    block = Block([deposit_tx], number=blknum)\n+    testlang.child_chain.add_block(block)\n+    return deposit_id\ndiff --git a/tests/contracts/root_chain/test_fee_exit.py b/tests/contracts/root_chain/test_fee_exit.py\n--- a/tests/contracts/root_chain/test_fee_exit.py\n+++ b/tests/contracts/root_chain/test_fee_exit.py\n@@ -1,16 +1,20 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n+\n from plasma_core.constants import NULL_ADDRESS, NULL_ADDRESS_HEX, MIN_EXIT_PERIOD\n+from tests.conftest import assert_event\n+\n \n # TODO: test if fee exit generates events\n \n \n-def test_start_fee_exit_should_succeed(testlang):\n-    operator, amount = testlang.accounts[0], 100\n-    exit_id = testlang.start_fee_exit(operator, amount)\n+def test_start_fee_exit_should_succeed(testlang, root_chain):\n+    operator, amount = testlang.operator, 100\n+    exit_id, tx_hash = testlang.start_fee_exit(operator, amount)\n+\n+    [exit_started] = testlang.flush_events()\n \n-    [exit] = testlang.flush_events()\n-    assert {\"owner\": operator.address, \"_event_type\": b'ExitStarted'}.items() <= exit.items()\n+    assert_event(exit_started, expected_event_name=\"ExitStarted\", expected_event_args={\"owner\": operator.address, \"exitId\": exit_id})\n     assert testlang.root_chain.exits(exit_id) == [operator.address, NULL_ADDRESS_HEX, amount, 1]\n \n \n@@ -27,8 +31,8 @@ def test_start_fee_exit_finalizes_after_two_MFPs(testlang):\n     testlang.flush_events()\n \n     testlang.start_fee_exit(operator, amount)\n-    [exit] = testlang.flush_events()\n-    assert {\"owner\": operator.address, \"_event_type\": b'ExitStarted'}.items() <= exit.items()\n+    [exit_event] = testlang.flush_events()\n+    assert_event(exit_event, expected_event_name=\"ExitStarted\", expected_event_args={\"owner\": operator.address})\n     balance = testlang.get_balance(testlang.root_chain)\n \n     testlang.forward_timestamp(MIN_EXIT_PERIOD + 1)\n@@ -40,5 +44,5 @@ def test_start_fee_exit_finalizes_after_two_MFPs(testlang):\n     testlang.process_exits(NULL_ADDRESS, 0, 1)\n \n     [exit_finalized] = testlang.flush_events()\n-    assert {\"exitId\": exit['exitId'], \"_event_type\": b'ExitFinalized'}.items() <= exit_finalized.items()\n+    assert_event(exit_finalized, expected_event_name='ExitFinalized', expected_event_args={'exitId': exit_event['args']['exitId']})\n     assert testlang.get_balance(testlang.root_chain) == 0\ndiff --git a/tests/contracts/root_chain/test_init.py b/tests/contracts/root_chain/test_init.py\n--- a/tests/contracts/root_chain/test_init.py\n+++ b/tests/contracts/root_chain/test_init.py\n@@ -1,5 +1,5 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n \n \n EXIT_PERIOD = 4 * 60\n@@ -10,19 +10,19 @@ def utxo(testlang_root_chain_short_exit_period):\n     return testlang_root_chain_short_exit_period.create_utxo()\n \n \n-def test_cant_ever_init_twice(ethtester, root_chain):\n-    ethtester.chain.mine()\n+def test_cant_ever_init_twice(root_chain, accounts):\n     with pytest.raises(TransactionFailed):\n-        root_chain.init(EXIT_PERIOD, sender=ethtester.k0)\n+        root_chain.init(EXIT_PERIOD, **{'from': accounts[0].address})\n \n \n-def test_exit_period_setting_has_effect(testlang_root_chain_short_exit_period):\n+def test_exit_period_setting_has_effect(testlang_root_chain_short_exit_period, w3):\n     owner = testlang_root_chain_short_exit_period.accounts[0]\n     deposit_id = testlang_root_chain_short_exit_period.deposit(owner, 100)\n \n-    spend_id = testlang_root_chain_short_exit_period.spend_utxo([deposit_id], [owner.key])\n-\n+    spend_id = testlang_root_chain_short_exit_period.spend_utxo([deposit_id], [owner])\n     testlang_root_chain_short_exit_period.start_in_flight_exit(spend_id)\n \n+    w3.eth.increase_time(2)  # explicitly forward time to the second period\n+\n     with pytest.raises(TransactionFailed):\n-        testlang_root_chain_short_exit_period.piggyback_in_flight_exit_input(spend_id, 0, owner.key)\n+        testlang_root_chain_short_exit_period.piggyback_in_flight_exit_input(spend_id, 0, owner)\ndiff --git a/tests/contracts/root_chain/test_long_run.py b/tests/contracts/root_chain/test_long_run.py\n--- a/tests/contracts/root_chain/test_long_run.py\n+++ b/tests/contracts/root_chain/test_long_run.py\n@@ -1,7 +1,9 @@\n+import datetime\n+import random\n+\n import pytest\n+\n from plasma_core.constants import NULL_ADDRESS, DAY\n-import random\n-import datetime\n \n \n def subtract(left, right):\n@@ -10,11 +12,11 @@ def subtract(left, right):\n \n def pick(left):\n     item = random.choice(left)\n-    return (subtract(left, [item]), item)\n+    return subtract(left, [item]), item\n \n \n @pytest.mark.slow()\n-def test_slow(testlang):\n+def test_slow(testlang, w3):\n     utxos = []\n     random.seed(a=0)\n     owner, amount = testlang.accounts[0], 100\n@@ -27,45 +29,42 @@ def test_slow(testlang):\n     # 4. attempt to finalize\n \n     for i in range(1000):\n-        print(\"[{}]: iteration {}\".format(datetime.datetime.now(), i))\n+        print(f'[{datetime.datetime.now()}]: iteration {i}')\n         # 1. deposit few\n         for _ in range(5):\n             deposit_id = testlang.deposit(owner, amount)\n-            max_gas = max(max_gas, testlang.ethtester.chain.last_gas_used())\n-            spend_id = testlang.spend_utxo(deposit_id, owner, amount, owner)\n-            max_gas = max(max_gas, testlang.ethtester.chain.last_gas_used())\n+            max_gas = max(max_gas, testlang.w3.eth.last_gas_used)\n+            spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, NULL_ADDRESS, amount)])\n+            max_gas = max(max_gas, testlang.w3.eth.last_gas_used)\n             utxos.append(spend_id)\n \n-        testlang.forward_timestamp(DAY * 2)\n+        w3.eth.increase_time(DAY * 2)\n \n-        testlang.ethtester.chain.mine()\n         # 2. spend\n         for _ in range(random.randint(2, 4)):\n             utxos, pos = pick(utxos)\n-            spend_id = testlang.spend_utxo(pos, owner, amount, owner)\n-            max_gas = max(max_gas, testlang.ethtester.chain.last_gas_used())\n+            spend_id = testlang.spend_utxo([pos], [owner], [(owner.address, NULL_ADDRESS, amount)])\n+            max_gas = max(max_gas, testlang.w3.eth.last_gas_used)\n             utxos.append(spend_id)\n \n         # 3. double-spend, exit and challenge\n         for _ in range(random.randint(2, 4)):\n             utxos, pos = pick(utxos)\n-            spend_id = testlang.spend_utxo(pos, owner, amount, owner)\n-            max_gas = max(max_gas, testlang.ethtester.chain.last_gas_used())\n+            spend_id = testlang.spend_utxo([pos], [owner], [(owner.address, NULL_ADDRESS, amount)])\n+            max_gas = max(max_gas, testlang.w3.eth.last_gas_used)\n             utxos.append(spend_id)\n-            testlang.start_standard_exit(owner, pos)\n+            testlang.start_standard_exit(pos, owner)\n             testlang.challenge_standard_exit(pos, spend_id)\n \n-        testlang.ethtester.chain.mine()\n         # 4. exit\n         for _ in range(random.randint(2, 4)):\n             utxos, pos = pick(utxos)\n-            testlang.start_standard_exit(owner, pos)\n-            max_gas = max(max_gas, testlang.ethtester.chain.last_gas_used())\n+            testlang.start_standard_exit(pos, owner)\n+            max_gas = max(max_gas, testlang.w3.eth.last_gas_used)\n \n-        testlang.ethtester.chain.mine()\n         # 4. attempt to finalize\n         testlang.process_exits(NULL_ADDRESS, 0, 3)\n-        max_gas = max(max_gas, testlang.ethtester.chain.last_gas_used())\n-        print(\"max_gas is {}\".format(max_gas))\n+        max_gas = max(max_gas, testlang.w3.eth.last_gas_used)\n+        print(f'max_gas is {max_gas}')\n \n-    assert max_gas < 200000\n+    assert max_gas < 400000\ndiff --git a/tests/contracts/root_chain/test_piggyback_in_flight_exit.py b/tests/contracts/root_chain/test_piggyback_in_flight_exit.py\n--- a/tests/contracts/root_chain/test_piggyback_in_flight_exit.py\n+++ b/tests/contracts/root_chain/test_piggyback_in_flight_exit.py\n@@ -1,5 +1,5 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n from plasma_core.constants import MIN_EXIT_PERIOD, NULL_ADDRESS\n from plasma_core.utils.transactions import decode_utxo_id, encode_utxo_id\n \n@@ -13,13 +13,12 @@ def test_piggyback_in_flight_exit_valid_input_owner_should_succeed(testlang, num\n         owners.append(testlang.accounts[i])\n         deposit_ids.append(testlang.deposit(owners[i], amount))\n \n-    owner_keys = [owner.key for owner in owners]\n-    spend_id = testlang.spend_utxo(deposit_ids, owner_keys)\n+    spend_id = testlang.spend_utxo(deposit_ids, owners)\n \n     testlang.start_in_flight_exit(spend_id)\n \n     input_index = num_inputs - 1\n-    testlang.piggyback_in_flight_exit_input(spend_id, input_index, owners[input_index].key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, input_index, owners[input_index])\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert in_flight_exit.input_piggybacked(input_index)\n@@ -32,12 +31,12 @@ def test_piggyback_in_flight_exit_valid_output_owner_should_succeed(testlang, nu\n     outputs = []\n     for i in range(0, num_outputs):\n         outputs.append((testlang.accounts[i].address, NULL_ADDRESS, 1))\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], outputs)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1], outputs)\n \n     testlang.start_in_flight_exit(spend_id)\n \n     output_index = num_outputs - 1\n-    testlang.piggyback_in_flight_exit_output(spend_id, output_index, testlang.accounts[output_index].key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, output_index, testlang.accounts[output_index])\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert in_flight_exit.output_piggybacked(output_index)\n@@ -46,75 +45,75 @@ def test_piggyback_in_flight_exit_valid_output_owner_should_succeed(testlang, nu\n def test_piggyback_in_flight_exit_invalid_owner_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n \n     testlang.start_in_flight_exit(spend_id)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_2.key)\n+        testlang.piggyback_in_flight_exit_input(spend_id, 0, owner_2)\n \n \n def test_piggyback_in_flight_exit_non_existent_exit_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner])\n \n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_input(spend_id, 0, owner.key)\n+        testlang.piggyback_in_flight_exit_input(spend_id, 0, owner)\n \n \n def test_piggyback_unpiggybacked_output_of_finalized_in_flight_exit_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key],\n+    spend_id = testlang.spend_utxo([deposit_id], [owner],\n                                    [(owner.address, NULL_ADDRESS, 50), (owner.address, NULL_ADDRESS, 50)])\n \n     # First time should succeed\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner)\n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, 0, 100)\n \n     # Piggybacking already finalized IFE should fail\n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_output(spend_id, 1, owner.key)\n+        testlang.piggyback_in_flight_exit_output(spend_id, 1, owner)\n \n \n def test_piggyback_in_flight_exit_wrong_period_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner])\n \n     testlang.start_in_flight_exit(spend_id)\n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_input(spend_id, 0, owner.key)\n+        testlang.piggyback_in_flight_exit_input(spend_id, 0, owner)\n \n \n def test_piggyback_in_flight_exit_invalid_index_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner])\n \n     testlang.start_in_flight_exit(spend_id)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_input(spend_id, 8, owner.key)\n+        testlang.piggyback_in_flight_exit_input(spend_id, 8, owner)\n \n \n def test_piggyback_in_flight_exit_twice_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner])\n \n     testlang.start_in_flight_exit(spend_id)\n \n     input_index = 0\n-    testlang.piggyback_in_flight_exit_input(spend_id, input_index, owner.key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, input_index, owner)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_input(spend_id, input_index, owner.key)\n+        testlang.piggyback_in_flight_exit_input(spend_id, input_index, owner)\n \n \n @pytest.mark.parametrize(\"num_outputs\", [1, 2, 3, 4])\n@@ -125,11 +124,11 @@ def test_piggyback_in_flight_exit_output_with_preexisting_standard_exit_should_f\n     outputs = []\n     for i in range(0, num_outputs):\n         outputs.append((testlang.accounts[i].address, NULL_ADDRESS, 1))\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], outputs)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1], outputs)\n \n     blknum, txindex, _ = decode_utxo_id(spend_id)\n     exit_pos = encode_utxo_id(blknum, txindex, num_outputs - 1)\n-    testlang.start_standard_exit(exit_pos, key=testlang.accounts[num_outputs - 1].key)\n+    testlang.start_standard_exit(exit_pos, account=testlang.accounts[num_outputs - 1])\n \n     testlang.start_in_flight_exit(spend_id)\n \n@@ -137,7 +136,7 @@ def test_piggyback_in_flight_exit_output_with_preexisting_standard_exit_should_f\n     bond = testlang.root_chain.piggybackBond()\n \n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_output(spend_id, num_outputs - 1, testlang.accounts[num_outputs - 1].key,\n+        testlang.piggyback_in_flight_exit_output(spend_id, num_outputs - 1, testlang.accounts[num_outputs - 1],\n                                                  bond)\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n@@ -152,11 +151,11 @@ def test_piggyback_in_flight_exit_output_with_preexisting_finalized_standard_exi\n     outputs = []\n     for i in range(num_outputs):\n         outputs.append((testlang.accounts[i].address, NULL_ADDRESS, 1))\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], outputs)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], outputs)\n \n     blknum, txindex, _ = decode_utxo_id(spend_id)\n     exit_pos = encode_utxo_id(blknum, txindex, num_outputs - 1)\n-    testlang.start_standard_exit(exit_pos, key=testlang.accounts[num_outputs - 1].key)\n+    testlang.start_standard_exit(exit_pos, account=testlang.accounts[num_outputs - 1])\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, 0, 1)\n@@ -167,7 +166,7 @@ def test_piggyback_in_flight_exit_output_with_preexisting_finalized_standard_exi\n     bond = testlang.root_chain.piggybackBond()\n \n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_output(spend_id, num_outputs - 1, testlang.accounts[num_outputs - 1].key,\n+        testlang.piggyback_in_flight_exit_output(spend_id, num_outputs - 1, testlang.accounts[num_outputs - 1],\n                                                  bond)\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n@@ -178,23 +177,23 @@ def test_piggyback_in_flight_exit_output_with_preexisting_finalized_standard_exi\n def test_piggybacking_an_output_of_unsupported_token_should_fail(testlang, token, output):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit_token(owner, token, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, token.address, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, token.address, amount)])\n     testlang.start_in_flight_exit(spend_id)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_input(spend_id, output, owner.key)\n+        testlang.piggyback_in_flight_exit_input(spend_id, output, owner)\n \n \n @pytest.mark.parametrize(\"output\", [0, 4])  # first input and first output\n def test_piggybacking_an_output_of_supported_token_should_succeed(testlang, token, output):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit_token(owner, token, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, token.address, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, token.address, amount)])\n     testlang.start_in_flight_exit(spend_id)\n \n     testlang.root_chain.addToken(token.address)\n \n-    testlang.piggyback_in_flight_exit_input(spend_id, output, owner.key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, output, owner)\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert in_flight_exit.input_piggybacked(output)\n@@ -207,13 +206,13 @@ def test_piggybacking_outputs_of_different_tokens_should_succeed(testlang, token\n     token_deposit_id = testlang.deposit_token(owner, token, amount)\n     eth_deposit_id = testlang.deposit(owner, amount)\n \n-    spend_id = testlang.spend_utxo([token_deposit_id, eth_deposit_id], [owner.key] * 2,\n+    spend_id = testlang.spend_utxo([token_deposit_id, eth_deposit_id], [owner] * 2,\n                                    [(owner.address, NULL_ADDRESS, amount), (owner.address, token.address, amount)])\n \n     testlang.start_in_flight_exit(spend_id)\n \n     for i in outputs:\n-        testlang.piggyback_in_flight_exit_input(spend_id, i, owner.key)\n+        testlang.piggyback_in_flight_exit_input(spend_id, i, owner)\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n \ndiff --git a/tests/contracts/root_chain/test_process_exits.py b/tests/contracts/root_chain/test_process_exits.py\n--- a/tests/contracts/root_chain/test_process_exits.py\n+++ b/tests/contracts/root_chain/test_process_exits.py\n@@ -1,20 +1,21 @@\n-from plasma_core.constants import NULL_ADDRESS, NULL_ADDRESS_HEX, MIN_EXIT_PERIOD\n-from eth_utils import encode_hex, to_canonical_address\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n+from eth_utils import to_canonical_address\n \n+from plasma_core.constants import NULL_ADDRESS, NULL_ADDRESS_HEX, MIN_EXIT_PERIOD\n from plasma_core.utils.transactions import decode_utxo_id, encode_utxo_id\n+from tests.conftest import assert_event\n \n \n @pytest.mark.parametrize(\"num_outputs\", [1, 2, 3, 4])\n def test_process_exits_standard_exit_should_succeed(testlang, num_outputs):\n     owners, amount, outputs = [], 100, []\n     for i in range(0, num_outputs):\n-        owners.append(testlang.accounts[i])\n+        owners.append(testlang.accounts[i + 1])\n         outputs.append((owners[i].address, NULL_ADDRESS, amount))\n \n     deposit_id = testlang.deposit(owners[0], num_outputs * amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owners[0].key], outputs)\n+    spend_id = testlang.spend_utxo([deposit_id], [owners[0]], outputs)\n \n     output_index = num_outputs - 1\n     utxo_pos = spend_id + output_index\n@@ -23,14 +24,14 @@ def test_process_exits_standard_exit_should_succeed(testlang, num_outputs):\n     pre_balance = testlang.get_balance(output_owner)\n     testlang.flush_events()\n \n-    testlang.start_standard_exit(utxo_pos, output_owner.key)\n+    testlang.start_standard_exit(utxo_pos, output_owner)\n     [exit_event] = testlang.flush_events()\n-    assert {\"owner\": output_owner.address, \"_event_type\": b'ExitStarted'}.items() <= exit_event.items()\n+    assert_event(exit_event, expected_event_name='ExitStarted', expected_event_args={\"owner\": output_owner.address})\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, 0, 100)\n     [exit_finalized] = testlang.flush_events()\n-    assert {\"exitId\": exit_event['exitId'], \"_event_type\": b'ExitFinalized'}.items() <= exit_finalized.items()\n+    assert_event(exit_finalized, expected_event_name='ExitFinalized', expected_event_args={\"exitId\": exit_event['args']['exitId']})\n \n     standard_exit = testlang.get_standard_exit(utxo_pos)\n     assert standard_exit.owner == NULL_ADDRESS_HEX\n@@ -42,9 +43,9 @@ def test_process_exits_standard_exit_should_succeed(testlang, num_outputs):\n def test_process_exits_in_flight_exit_should_succeed(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, NULL_ADDRESS, 100)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, NULL_ADDRESS, 100)])\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner)\n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n     pre_balance = testlang.get_balance(owner)\n@@ -73,13 +74,13 @@ def test_finalize_exits_for_erc20_should_succeed(testlang, root_chain, token):\n     root_chain.addToken(token.address)\n     assert root_chain.hasToken(token.address)\n     deposit_id = testlang.deposit_token(owner, token, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, token.address, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, token.address, amount)])\n \n-    testlang.start_standard_exit(spend_id, owner.key)\n+    testlang.start_standard_exit(spend_id, owner)\n \n     standard_exit = testlang.get_standard_exit(spend_id)\n     assert standard_exit.amount == amount\n-    assert standard_exit.token == encode_hex(token.address)\n+    assert standard_exit.token == token.address\n     assert standard_exit.owner == owner.address\n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -99,16 +100,18 @@ def test_finalize_exits_old_utxo_is_mature_after_single_mfp(testlang):\n     owner, amount = testlang.accounts[0], 100\n \n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, NULL_ADDRESS, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, NULL_ADDRESS, amount)])\n \n     testlang.forward_timestamp(required_exit_period)\n-    testlang.start_standard_exit(spend_id, owner.key)\n+    testlang.start_standard_exit(spend_id, owner)\n     testlang.forward_timestamp(minimal_finalization_period)\n \n     assert testlang.get_standard_exit(spend_id).owner == owner.address\n     testlang.process_exits(NULL_ADDRESS, 0, 100)\n+\n     testlang.forward_timestamp(1)\n     assert testlang.get_standard_exit(spend_id).owner == owner.address\n+\n     testlang.process_exits(NULL_ADDRESS, 0, 100)\n     assert testlang.get_standard_exit(spend_id).owner == NULL_ADDRESS_HEX\n \n@@ -119,9 +122,9 @@ def test_finalize_exits_new_utxo_is_mature_after_mfp_plus_rep(testlang):\n     owner, amount = testlang.accounts[0], 100\n \n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, NULL_ADDRESS, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, NULL_ADDRESS, amount)])\n \n-    testlang.start_standard_exit(spend_id, owner.key)\n+    testlang.start_standard_exit(spend_id, owner)\n \n     testlang.forward_timestamp(required_exit_period)\n     assert testlang.get_standard_exit(spend_id).owner == owner.address\n@@ -139,16 +142,16 @@ def test_finalize_exits_only_mature_exits_are_processed(testlang):\n     owner, amount = testlang.accounts[0], 100\n \n     deposit_id_1 = testlang.deposit(owner, amount)\n-    spend_id_1 = testlang.spend_utxo([deposit_id_1], [owner.key], [(owner.address, NULL_ADDRESS, amount)])\n+    spend_id_1 = testlang.spend_utxo([deposit_id_1], [owner], [(owner.address, NULL_ADDRESS, amount)])\n \n-    testlang.start_standard_exit(spend_id_1, owner.key)\n+    testlang.start_standard_exit(spend_id_1, owner)\n \n     testlang.forward_timestamp(required_exit_period + minimal_finalization_period + 1)\n \n     deposit_id_2 = testlang.deposit(owner, amount)\n-    spend_id_2 = testlang.spend_utxo([deposit_id_2], [owner.key], [(owner.address, NULL_ADDRESS, amount)])\n+    spend_id_2 = testlang.spend_utxo([deposit_id_2], [owner], [(owner.address, NULL_ADDRESS, amount)])\n \n-    testlang.start_standard_exit(spend_id_2, owner.key)\n+    testlang.start_standard_exit(spend_id_2, owner)\n \n     assert testlang.get_standard_exit(spend_id_1).owner == owner.address\n     assert testlang.get_standard_exit(spend_id_2).owner == owner.address\n@@ -167,12 +170,12 @@ def test_finalize_exits_partial_queue_processing(testlang):\n     owner, amount = testlang.accounts[0], 100\n \n     deposit_id_1 = testlang.deposit(owner, amount)\n-    spend_id_1 = testlang.spend_utxo([deposit_id_1], [owner.key], [(owner.address, NULL_ADDRESS, amount)])\n-    testlang.start_standard_exit(spend_id_1, owner.key)\n+    spend_id_1 = testlang.spend_utxo([deposit_id_1], [owner], [(owner.address, NULL_ADDRESS, amount)])\n+    testlang.start_standard_exit(spend_id_1, owner)\n \n     deposit_id_2 = testlang.deposit(owner, amount)\n-    spend_id_2 = testlang.spend_utxo([deposit_id_2], [owner.key], [(owner.address, NULL_ADDRESS, amount)])\n-    testlang.start_standard_exit(spend_id_2, owner.key)\n+    spend_id_2 = testlang.spend_utxo([deposit_id_2], [owner], [(owner.address, NULL_ADDRESS, amount)])\n+    testlang.start_standard_exit(spend_id_2, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, testlang.get_standard_exit_id(spend_id_1), 1)\n@@ -186,12 +189,12 @@ def test_processing_exits_with_specifying_top_exit_id_is_possible(testlang):\n     owner, amount = testlang.accounts[0], 100\n \n     deposit_id_1 = testlang.deposit(owner, amount)\n-    testlang.start_standard_exit(deposit_id_1, owner.key)\n+    testlang.start_standard_exit(deposit_id_1, owner)\n \n     deposit_id_2 = testlang.deposit(owner, amount)\n-    spend_id_2 = testlang.spend_utxo([deposit_id_2], [owner.key], [(owner.address, NULL_ADDRESS, amount)])\n+    spend_id_2 = testlang.spend_utxo([deposit_id_2], [owner], [(owner.address, NULL_ADDRESS, amount)])\n     testlang.start_in_flight_exit(spend_id_2)\n-    testlang.piggyback_in_flight_exit_output(spend_id_2, 0, owner.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id_2, 0, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -202,49 +205,59 @@ def test_processing_exits_with_specifying_top_exit_id_is_possible(testlang):\n     assert in_flight_exit.bond_owner == NULL_ADDRESS_HEX\n \n \n-def test_finalize_exits_tx_race_short_circuit(testlang):\n+def test_finalize_exits_tx_race_short_circuit(testlang, w3, root_chain):\n     utxo1 = testlang.create_utxo()\n     utxo2 = testlang.create_utxo()\n     utxo3 = testlang.create_utxo()\n     utxo4 = testlang.create_utxo()\n-    testlang.start_standard_exit(utxo1.spend_id, utxo1.owner.key)\n-    testlang.start_standard_exit(utxo2.spend_id, utxo2.owner.key)\n-    testlang.start_standard_exit(utxo3.spend_id, utxo3.owner.key)\n-    testlang.start_standard_exit(utxo4.spend_id, utxo4.owner.key)\n+    testlang.start_standard_exit(utxo1.spend_id, utxo1.owner)\n+    testlang.start_standard_exit(utxo2.spend_id, utxo2.owner)\n+    testlang.start_standard_exit(utxo3.spend_id, utxo3.owner)\n+    testlang.start_standard_exit(utxo4.spend_id, utxo4.owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, testlang.get_standard_exit_id(utxo1.spend_id), 1)\n-    with pytest.raises(TransactionFailed):\n-        testlang.process_exits(NULL_ADDRESS, testlang.get_standard_exit_id(utxo1.spend_id), 3)\n-    short_circuit_gas = testlang.ethtester.chain.last_gas_used()\n-    assert short_circuit_gas < 67291  # value from _tx_race_normal\n \n+    w3.eth.disable_auto_mine()\n+\n+    tx_hash = root_chain.functions\\\n+        .processExits(NULL_ADDRESS, testlang.get_standard_exit_id(utxo1.spend_id), 3)\\\n+        .transact({'gas': 100_000})  # reasonably high amount of gas (otherwise it fails on gas estimation)\n+\n+    w3.eth.mine(expect_error=True)\n \n-def test_finalize_exits_tx_race_normal(testlang):\n+    tx_receipt = w3.eth.getTransactionReceipt(tx_hash)\n+    short_circuit_gas = tx_receipt['gasUsed']\n+\n+    assert tx_receipt['status'] == 0  # assert the tx failed\n+    assert short_circuit_gas < 69408  # value from _tx_race_normal\n+\n+\n+def test_finalize_exits_tx_race_normal(testlang, w3):\n     utxo1 = testlang.create_utxo()\n     utxo2 = testlang.create_utxo()\n     utxo3 = testlang.create_utxo()\n     utxo4 = testlang.create_utxo()\n-    testlang.start_standard_exit(utxo1.spend_id, utxo1.owner.key)\n-    testlang.start_standard_exit(utxo2.spend_id, utxo2.owner.key)\n-    testlang.start_standard_exit(utxo3.spend_id, utxo3.owner.key)\n-    testlang.start_standard_exit(utxo4.spend_id, utxo4.owner.key)\n+    testlang.start_standard_exit(utxo1.spend_id, utxo1.owner)\n+    testlang.start_standard_exit(utxo2.spend_id, utxo2.owner)\n+    testlang.start_standard_exit(utxo3.spend_id, utxo3.owner)\n+    testlang.start_standard_exit(utxo4.spend_id, utxo4.owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, testlang.get_standard_exit_id(utxo1.spend_id), 1)\n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n     testlang.process_exits(NULL_ADDRESS, testlang.get_standard_exit_id(utxo2.spend_id), 3)\n-    three_exits_tx_gas = testlang.ethtester.chain.last_gas_used()\n-    assert three_exits_tx_gas > 3516  # value from _tx_race_short_circuit\n+    three_exits_tx_gas = w3.eth.last_gas_used\n+    assert three_exits_tx_gas > 26258  # value from _tx_race_short_circuit\n \n \n-def test_finalize_exits_empty_queue_should_crash(testlang, ethtester):\n+def test_finalize_exits_empty_queue_should_crash(testlang):\n     owner, amount = testlang.accounts[0], 100\n \n     deposit_id_1 = testlang.deposit(owner, amount)\n-    spend_id_1 = testlang.spend_utxo([deposit_id_1], [owner.key], [(owner.address, NULL_ADDRESS, 100)])\n-    testlang.start_standard_exit(spend_id_1, owner.key)\n+    spend_id_1 = testlang.spend_utxo([deposit_id_1], [owner], [(owner.address, NULL_ADDRESS, 100)])\n+    testlang.start_standard_exit(spend_id_1, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, testlang.get_standard_exit_id(spend_id_1), 1)\n@@ -259,8 +272,8 @@ def test_finalize_skipping_top_utxo_check_is_possible(testlang):\n     owner, amount = testlang.accounts[0], 100\n \n     deposit_id_1 = testlang.deposit(owner, amount)\n-    spend_id_1 = testlang.spend_utxo([deposit_id_1], [owner.key], [(owner.address, NULL_ADDRESS, 100)])\n-    testlang.start_standard_exit(spend_id_1, owner.key)\n+    spend_id_1 = testlang.spend_utxo([deposit_id_1], [owner], [(owner.address, NULL_ADDRESS, 100)])\n+    testlang.start_standard_exit(spend_id_1, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, 0, 1)\n@@ -272,10 +285,10 @@ def test_finalize_skipping_top_utxo_check_is_possible(testlang):\n def test_finalize_challenged_exit_will_not_send_funds(testlang):\n     owner, finalizer, amount = testlang.accounts[0], testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, NULL_ADDRESS, 100)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, NULL_ADDRESS, 100)])\n \n-    testlang.start_standard_exit(spend_id, owner.key)\n-    doublespend_id = testlang.spend_utxo([spend_id], [owner.key], [(owner.address, NULL_ADDRESS, 100)])\n+    testlang.start_standard_exit(spend_id, owner)\n+    doublespend_id = testlang.spend_utxo([spend_id], [owner], [(owner.address, NULL_ADDRESS, 100)])\n \n     testlang.challenge_standard_exit(spend_id, doublespend_id)\n     assert testlang.get_standard_exit(spend_id) == [NULL_ADDRESS_HEX, NULL_ADDRESS_HEX, 0]\n@@ -283,7 +296,7 @@ def test_finalize_challenged_exit_will_not_send_funds(testlang):\n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n     pre_balance = testlang.get_balance(testlang.root_chain)\n-    testlang.process_exits(NULL_ADDRESS, 0, 1, sender=finalizer.key)\n+    testlang.process_exits(NULL_ADDRESS, 0, 1, **{'from': finalizer.address})\n     post_balance = testlang.get_balance(testlang.root_chain)\n     assert post_balance == pre_balance\n \n@@ -291,32 +304,32 @@ def test_finalize_challenged_exit_will_not_send_funds(testlang):\n def test_finalize_challenged_exit_does_not_emit_events(testlang):\n     owner, finalizer, amount = testlang.accounts[0], testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, NULL_ADDRESS, 100)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, NULL_ADDRESS, 100)])\n \n-    testlang.start_standard_exit(spend_id, owner.key)\n-    doublespend_id = testlang.spend_utxo([spend_id], [owner.key], [(owner.address, NULL_ADDRESS, 100)])\n+    testlang.start_standard_exit(spend_id, owner)\n+    doublespend_id = testlang.spend_utxo([spend_id], [owner], [(owner.address, NULL_ADDRESS, 100)])\n \n     testlang.challenge_standard_exit(spend_id, doublespend_id)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n     testlang.flush_events()\n-    testlang.process_exits(NULL_ADDRESS, 0, 1, sender=finalizer.key)\n+    testlang.process_exits(NULL_ADDRESS, 0, 1, **{'from': finalizer.address})\n     assert [] == testlang.flush_events()\n \n \n def test_finalize_exit_challenge_of_finalized_will_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, NULL_ADDRESS, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, NULL_ADDRESS, amount)])\n \n-    testlang.start_standard_exit(spend_id, owner.key)\n+    testlang.start_standard_exit(spend_id, owner)\n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n     testlang.process_exits(NULL_ADDRESS, testlang.get_standard_exit_id(spend_id), 100)\n     standard_exit = testlang.get_standard_exit(spend_id)\n     assert standard_exit.owner == NULL_ADDRESS_HEX\n-    doublespend_id = testlang.spend_utxo([spend_id], [owner.key], [(owner.address, NULL_ADDRESS, 100)])\n+    doublespend_id = testlang.spend_utxo([spend_id], [owner], [(owner.address, NULL_ADDRESS, 100)])\n     with pytest.raises(TransactionFailed):\n         testlang.challenge_standard_exit(spend_id, doublespend_id)\n \n@@ -325,12 +338,12 @@ def test_finalize_exits_for_in_flight_exit_should_transfer_funds(testlang):\n     owner, amount = testlang.accounts[0], 100\n     first_utxo = 100 - 33\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key],\n+    spend_id = testlang.spend_utxo([deposit_id], [owner],\n                                    [(owner.address, NULL_ADDRESS, first_utxo), (owner.address, NULL_ADDRESS, 33)])\n \n     # start an in-flight exit and piggyback it\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -346,12 +359,12 @@ def test_finalize_in_flight_exit_finalizes_only_piggybacked_outputs(testlang):\n     owner, amount = testlang.accounts[0], 100\n     first_utxo = 100 - 33\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key],\n+    spend_id = testlang.spend_utxo([deposit_id], [owner],\n                                    [(owner.address, NULL_ADDRESS, first_utxo), (owner.address, NULL_ADDRESS, 33)])\n \n     # start an in-flight exit and piggyback it\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -373,19 +386,18 @@ def test_finalize_exits_priority_for_in_flight_exits_corresponds_to_the_age_of_y\n     deposit_0_id = testlang.deposit(owner, amount)\n     deposit_1_id = testlang.deposit(owner, amount)\n \n-    spend_00_id = testlang.spend_utxo([deposit_0_id], [owner.key],\n+    spend_00_id = testlang.spend_utxo([deposit_0_id], [owner],\n                                       [(owner.address, NULL_ADDRESS, 30), (owner.address, NULL_ADDRESS, 70)])\n     blknum, txindex, _ = decode_utxo_id(spend_00_id)\n     spend_01_id = encode_utxo_id(blknum, txindex, 1)\n-    spend_1_id = testlang.spend_utxo([spend_01_id], [owner.key], [(owner.address, NULL_ADDRESS, 70)])\n-    testlang.ethtester.chain.mine()\n-    spend_2_id = testlang.spend_utxo([deposit_1_id], [owner.key], [(owner.address, NULL_ADDRESS, 100)])\n+    spend_1_id = testlang.spend_utxo([spend_01_id], [owner], [(owner.address, NULL_ADDRESS, 70)])\n+    spend_2_id = testlang.spend_utxo([deposit_1_id], [owner], [(owner.address, NULL_ADDRESS, 100)])\n \n-    testlang.start_standard_exit(spend_00_id, owner.key)\n+    testlang.start_standard_exit(spend_00_id, owner)\n \n     testlang.start_in_flight_exit(spend_1_id)\n-    testlang.piggyback_in_flight_exit_output(spend_1_id, 0, owner.key)\n-    testlang.start_standard_exit(spend_2_id, owner.key)\n+    testlang.piggyback_in_flight_exit_output(spend_1_id, 0, owner)\n+    testlang.start_standard_exit(spend_2_id, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -408,12 +420,12 @@ def test_finalize_in_flight_exit_with_erc20_token_should_succeed(testlang, token\n     owner, amount = testlang.accounts[1], 100\n     testlang.root_chain.addToken(token.address)\n     deposit_id = testlang.deposit_token(owner, token, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, token.address, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, token.address, amount)])\n \n     testlang.start_in_flight_exit(spend_id)\n \n-    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner.key)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner.key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -443,19 +455,19 @@ def test_finalize_in_flight_exit_with_erc20_token_should_transfer_funds_and_bond\n     owner, amount = testlang.accounts[1], 100\n     testlang.root_chain.addToken(token.address)\n     deposit_id = testlang.deposit_token(owner, token, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, token.address, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, token.address, amount)])\n \n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n-    token_balance = testlang.get_balance(owner, token.address)\n+    token_balance = testlang.get_balance(owner, token)\n     eth_balance = testlang.get_balance(owner)\n \n-    testlang.process_exits(token.address, 0, 1)\n+    testlang.process_exits(token.address, 0, 1, gas=800_000)\n \n-    assert testlang.get_balance(owner, token.address) == token_balance + amount\n+    assert testlang.get_balance(owner, token) == token_balance + amount\n     assert testlang.get_balance(owner) == eth_balance + testlang.root_chain.piggybackBond()\n \n \n@@ -465,40 +477,40 @@ def test_finalize_in_flight_exit_with_eth_and_erc20_token(testlang, token):\n     token_deposit = testlang.deposit_token(owner_1, token, amount)\n     eth_deposit = testlang.deposit(owner_2, amount)\n \n-    spend_id = testlang.spend_utxo([token_deposit, eth_deposit], [owner_1.key, owner_2.key],\n+    spend_id = testlang.spend_utxo([token_deposit, eth_deposit], [owner_1, owner_2],\n                                    [(owner_1.address, NULL_ADDRESS, amount - 1),\n                                     (owner_2.address, token.address, amount - 2)])\n \n     testlang.start_in_flight_exit(spend_id)\n \n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1.key)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 1, owner_2.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 1, owner_2)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n     (owner_1_balances, owner_2_balances) = [\n-        (testlang.get_balance(owner), testlang.get_balance(owner, token.address)) for owner in [owner_1, owner_2]\n+        (testlang.get_balance(owner), testlang.get_balance(owner, token)) for owner in [owner_1, owner_2]\n     ]\n \n     # finalize only ERC20 token\n     testlang.process_exits(token.address, 0, 1)\n \n     assert testlang.get_balance(owner_1) == owner_1_balances[0]\n-    assert testlang.get_balance(owner_1, token.address) == owner_1_balances[1]\n+    assert testlang.get_balance(owner_1, token) == owner_1_balances[1]\n \n     # only owner 2 receives his founds\n     assert testlang.get_balance(owner_2) == owner_2_balances[0] + testlang.root_chain.piggybackBond()\n-    assert testlang.get_balance(owner_2, token.address) == owner_2_balances[1] + (amount - 2)\n+    assert testlang.get_balance(owner_2, token) == owner_2_balances[1] + (amount - 2)\n \n     # finalize Eth\n     testlang.process_exits(NULL_ADDRESS, 0, 1)\n \n     assert testlang.get_balance(owner_1) == owner_1_balances[0] + (amount - 1) + testlang.root_chain.piggybackBond()\n-    assert testlang.get_balance(owner_1, token.address) == owner_1_balances[1]\n+    assert testlang.get_balance(owner_1, token) == owner_1_balances[1]\n \n     # nothing changed\n     assert testlang.get_balance(owner_2) == owner_2_balances[0] + testlang.root_chain.piggybackBond()\n-    assert testlang.get_balance(owner_2, token.address) == owner_2_balances[1] + (amount - 2)\n+    assert testlang.get_balance(owner_2, token) == owner_2_balances[1] + (amount - 2)\n \n \n def test_does_not_finalize_outputs_of_other_tokens(testlang, token):\n@@ -507,7 +519,7 @@ def test_does_not_finalize_outputs_of_other_tokens(testlang, token):\n     token_deposit = testlang.deposit_token(owner_1, token, amount)\n     eth_deposit = testlang.deposit(owner_2, amount)\n \n-    spend_id = testlang.spend_utxo([token_deposit, eth_deposit], [owner_1.key, owner_2.key],\n+    spend_id = testlang.spend_utxo([token_deposit, eth_deposit], [owner_1, owner_2],\n                                    outputs=[(owner_1.address, NULL_ADDRESS, amount - 1),\n                                             (owner_2.address, token.address, amount - 22),\n                                             (owner_2.address, token.address, 20)\n@@ -515,8 +527,8 @@ def test_does_not_finalize_outputs_of_other_tokens(testlang, token):\n \n     testlang.start_in_flight_exit(spend_id)\n \n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1.key)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 1, owner_2.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 1, owner_2)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -540,14 +552,14 @@ def test_when_processing_ife_finalization_of_erc20_token_does_not_clean_up_eth_o\n     token_deposit = testlang.deposit_token(owner_1, token, amount)\n     eth_deposit = testlang.deposit(owner_2, amount)\n \n-    spend_id = testlang.spend_utxo([token_deposit, eth_deposit], [owner_1.key, owner_2.key],\n+    spend_id = testlang.spend_utxo([token_deposit, eth_deposit], [owner_1, owner_2],\n                                    [(owner_1.address, NULL_ADDRESS, amount),\n                                     (owner_2.address, token.address, amount)])\n \n     testlang.start_in_flight_exit(spend_id)\n \n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1.key)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 1, owner_2.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 1, owner_2)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -571,7 +583,7 @@ def test_ife_is_enqueued_once_per_token(testlang, token):\n     token_deposit_id = testlang.deposit_token(owner, token, amount)\n     testlang.root_chain.addToken(token.address)\n \n-    spend_id = testlang.spend_utxo([token_deposit_id, eth_deposit_id], [owner.key] * 2,\n+    spend_id = testlang.spend_utxo([token_deposit_id, eth_deposit_id], [owner] * 2,\n                                    [(owner.address, NULL_ADDRESS, amount // 2),\n                                     (owner.address, NULL_ADDRESS, amount // 2),\n                                     (owner.address, token.address, amount // 2),\n@@ -579,7 +591,7 @@ def test_ife_is_enqueued_once_per_token(testlang, token):\n \n     testlang.start_in_flight_exit(spend_id)\n     for i in range(4):\n-        testlang.piggyback_in_flight_exit_output(spend_id, i, owner.key)\n+        testlang.piggyback_in_flight_exit_output(spend_id, i, owner)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -602,14 +614,14 @@ def test_when_processing_an_ife_it_is_cleaned_up_when_all_piggybacked_outputs_fi\n     token_deposit = testlang.deposit_token(owner_1, token, amount)\n     eth_deposit = testlang.deposit(owner_2, amount)\n \n-    spend_id = testlang.spend_utxo([token_deposit, eth_deposit], [owner_1.key, owner_2.key],\n+    spend_id = testlang.spend_utxo([token_deposit, eth_deposit], [owner_1, owner_2],\n                                    [(owner_1.address, NULL_ADDRESS, amount),\n                                     (owner_2.address, token.address, amount)])\n \n     testlang.start_in_flight_exit(spend_id)\n \n-    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1.key)\n-    testlang.piggyback_in_flight_exit_output(spend_id, 1, owner_2.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 0, owner_1)\n+    testlang.piggyback_in_flight_exit_output(spend_id, 1, owner_2)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n \n@@ -639,9 +651,9 @@ def test_in_flight_exit_is_cleaned_up_even_though_none_of_outputs_exited(testlan\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n \n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, NULL_ADDRESS, amount)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, NULL_ADDRESS, amount)])\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner.key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner)\n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     pre_balance = testlang.get_balance(owner)\n \ndiff --git a/tests/contracts/root_chain/test_respond_to_non_canonical_challenge.py b/tests/contracts/root_chain/test_respond_to_non_canonical_challenge.py\n--- a/tests/contracts/root_chain/test_respond_to_non_canonical_challenge.py\n+++ b/tests/contracts/root_chain/test_respond_to_non_canonical_challenge.py\n@@ -1,5 +1,5 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n from plasma_core.constants import NULL_ADDRESS, MIN_EXIT_PERIOD\n \n \n@@ -8,14 +8,14 @@\n def test_respond_to_non_canonical_challenge_should_succeed(testlang, period):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\n \n     testlang.forward_to_period(period)\n \n-    testlang.respond_to_non_canonical_challenge(spend_id, owner_1.key)\n+    testlang.respond_to_non_canonical_challenge(spend_id, owner_1)\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert in_flight_exit.bond_owner == owner_1.address\n@@ -26,24 +26,24 @@ def test_respond_to_non_canonical_challenge_should_succeed(testlang, period):\n def test_respond_to_non_canonical_challenge_not_older_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\n \n     testlang.forward_to_period(2)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.respond_to_non_canonical_challenge(spend_id, owner_1.key)\n+        testlang.respond_to_non_canonical_challenge(spend_id, owner_1)\n \n \n def test_respond_to_non_canonical_challenge_invalid_proof_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+    testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\n \n     testlang.forward_to_period(2)\n \n@@ -56,9 +56,9 @@ def test_respond_to_non_canonical_challenge_invalid_proof_should_fail(testlang):\n def test_respond_to_not_canonical_challenge_with_inputs_spent_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    testlang.start_standard_exit(deposit_id, owner_1.key)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key])\n-    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n+    testlang.start_standard_exit(deposit_id, owner_1)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1])\n+    double_spend_id = testlang.spend_utxo([deposit_id], [owner_1], [(owner_1.address, NULL_ADDRESS, 100)], force_invalid=True)\n \n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, 0, 1)\n@@ -69,4 +69,4 @@ def test_respond_to_not_canonical_challenge_with_inputs_spent_should_fail(testla\n \n     # Since IFE can be exited only from inputs, no further canonicity game required\n     with pytest.raises(TransactionFailed):\n-        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, key=owner_2.key)\n+        testlang.challenge_in_flight_exit_not_canonical(spend_id, double_spend_id, account=owner_2)\ndiff --git a/tests/contracts/root_chain/test_start_in_flight_exit.py b/tests/contracts/root_chain/test_start_in_flight_exit.py\n--- a/tests/contracts/root_chain/test_start_in_flight_exit.py\n+++ b/tests/contracts/root_chain/test_start_in_flight_exit.py\n@@ -1,12 +1,11 @@\n import pytest\n from eth_utils import to_canonical_address\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n from plasma_core.constants import NULL_ADDRESS, NULL_ADDRESS_HEX, MIN_EXIT_PERIOD\n-from tests.conftest import deploy_token\n \n \n @pytest.mark.parametrize(\"num_inputs\", [1, 2, 3, 4])\n-def test_start_in_flight_exit_should_succeed(ethtester, testlang, num_inputs):\n+def test_start_in_flight_exit_should_succeed(testlang, num_inputs):\n     amount = 100\n     owners = []\n     deposit_ids = []\n@@ -14,14 +13,13 @@ def test_start_in_flight_exit_should_succeed(ethtester, testlang, num_inputs):\n         owners.append(testlang.accounts[i])\n         deposit_ids.append(testlang.deposit(owners[i], amount))\n \n-    owner_keys = [owner.key for owner in owners]\n-    spend_id = testlang.spend_utxo(deposit_ids, owner_keys)\n+    spend_id = testlang.spend_utxo(deposit_ids, owners)\n \n     testlang.start_in_flight_exit(spend_id)\n \n     # Exit was created\n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n-    assert in_flight_exit.exit_start_timestamp == ethtester.chain.head_state.timestamp\n+    assert in_flight_exit.exit_start_timestamp == testlang.timestamp\n     assert in_flight_exit.exit_map == 0\n     assert in_flight_exit.bond_owner == owners[0].address\n     assert in_flight_exit.oldest_competitor == 0\n@@ -41,7 +39,7 @@ def test_start_in_flight_exit_should_succeed(ethtester, testlang, num_inputs):\n \n \n @pytest.mark.parametrize(\"num_inputs\", [1, 2, 3, 4])\n-def test_start_in_flight_exit_with_erc20_tokens_should_succeed(ethtester, testlang, token, num_inputs):\n+def test_start_in_flight_exit_with_erc20_tokens_should_succeed(testlang, token, num_inputs):\n     amount = 100\n     owners = []\n     deposit_ids = []\n@@ -49,14 +47,13 @@ def test_start_in_flight_exit_with_erc20_tokens_should_succeed(ethtester, testla\n         owners.append(testlang.accounts[i])\n         deposit_ids.append(testlang.deposit_token(owners[i], token, amount))\n \n-    owner_keys = [owner.key for owner in owners]\n-    spend_id = testlang.spend_utxo(deposit_ids, owner_keys)\n+    spend_id = testlang.spend_utxo(deposit_ids, owners)\n \n     testlang.start_in_flight_exit(spend_id)\n \n     # Exit was created\n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n-    assert in_flight_exit.exit_start_timestamp == ethtester.chain.head_state.timestamp\n+    assert in_flight_exit.exit_start_timestamp == testlang.timestamp\n     assert in_flight_exit.exit_map == 0\n     assert in_flight_exit.bond_owner == owners[0].address\n     assert in_flight_exit.oldest_competitor == 0\n@@ -65,7 +62,7 @@ def test_start_in_flight_exit_with_erc20_tokens_should_succeed(ethtester, testla\n     for i in range(0, num_inputs):\n         input_info = in_flight_exit.get_input(i)\n         assert input_info.owner == to_canonical_address(owners[i].address)\n-        assert input_info.token == token.address\n+        assert input_info.token == to_canonical_address(token.address)\n         assert input_info.amount == amount\n \n     # Remaining inputs are still unset\n@@ -75,13 +72,13 @@ def test_start_in_flight_exit_with_erc20_tokens_should_succeed(ethtester, testla\n         assert input_info.amount == 0\n \n \n-def test_start_in_flight_exit_with_erc20_token_and_eth_should_succeed(ethtester, testlang, token):\n+def test_start_in_flight_exit_with_erc20_token_and_eth_should_succeed(testlang, token):\n     owner = testlang.accounts[0]\n     deposit_eth_id = testlang.deposit(owner, 100)\n     deposit_token_id = testlang.deposit_token(owner, token, 110)\n     spend_id = testlang.spend_utxo(\n         [deposit_eth_id, deposit_token_id],\n-        [owner.key, owner.key],\n+        [owner, owner],\n         [(owner.address, NULL_ADDRESS, 100), (owner.address, token.address, 110)]\n     )\n \n@@ -89,7 +86,7 @@ def test_start_in_flight_exit_with_erc20_token_and_eth_should_succeed(ethtester,\n \n     # Exit was created\n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n-    assert in_flight_exit.exit_start_timestamp == ethtester.chain.head_state.timestamp\n+    assert in_flight_exit.exit_start_timestamp == testlang.timestamp\n     assert in_flight_exit.exit_map == 0\n     assert in_flight_exit.bond_owner == owner.address\n     assert in_flight_exit.oldest_competitor == 0\n@@ -102,7 +99,7 @@ def test_start_in_flight_exit_with_erc20_token_and_eth_should_succeed(ethtester,\n \n     input_info = in_flight_exit.get_input(1)\n     assert input_info.owner == to_canonical_address(owner.address)\n-    assert input_info.token == token.address\n+    assert input_info.token == to_canonical_address(token.address)\n     assert input_info.amount == 110\n \n     # Remaining inputs are still unset\n@@ -115,7 +112,7 @@ def test_start_in_flight_exit_with_erc20_token_and_eth_should_succeed(ethtester,\n def test_start_in_flight_exit_with_an_output_with_a_token_not_from_inputs_should_fail(testlang, token):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], [(owner.address, token.address, 100)])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], [(owner.address, token.address, 100)])\n \n     with pytest.raises(TransactionFailed):\n         testlang.start_in_flight_exit(spend_id)\n@@ -130,7 +127,7 @@ def test_start_in_flight_exit_that_spends_more_than_value_of_inputs_should_fail(\n     owner, amount = testlang.accounts[0], 100\n     outputs = [(owner.address, token.address, value) for value in output_values]\n     deposits = [testlang.deposit_token(owner, token, amount) for _ in range(4)]\n-    spend_id = testlang.spend_utxo(deposits, [owner.key] * 4, outputs, force_invalid=True)\n+    spend_id = testlang.spend_utxo(deposits, [owner] * 4, outputs, force_invalid=True)\n \n     with pytest.raises(TransactionFailed):\n         testlang.start_in_flight_exit(spend_id)\n@@ -139,7 +136,7 @@ def test_start_in_flight_exit_that_spends_more_than_value_of_inputs_should_fail(\n def test_start_in_flight_exit_invalid_signature_should_fail(testlang, token):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit_token(owner_1, token, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_2.key], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_2], force_invalid=True)\n \n     with pytest.raises(TransactionFailed):\n         testlang.start_in_flight_exit(spend_id)\n@@ -148,7 +145,7 @@ def test_start_in_flight_exit_invalid_signature_should_fail(testlang, token):\n def test_start_in_flight_exit_invalid_bond_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner])\n \n     with pytest.raises(TransactionFailed):\n         testlang.start_in_flight_exit(spend_id, bond=0)\n@@ -157,7 +154,7 @@ def test_start_in_flight_exit_invalid_bond_should_fail(testlang):\n def test_start_in_flight_exit_invalid_spend_should_fail(testlang):\n     owner_1, owner_2, amount = testlang.accounts[0], testlang.accounts[1], 100\n     deposit_id = testlang.deposit(owner_1, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_2.key], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_2], force_invalid=True)\n \n     with pytest.raises(TransactionFailed):\n         testlang.start_in_flight_exit(spend_id)\n@@ -166,7 +163,7 @@ def test_start_in_flight_exit_invalid_spend_should_fail(testlang):\n def test_start_in_flight_exit_invalid_proof_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner])\n \n     proofs = b''\n     (encoded_spend, encoded_inputs, _, signatures) = testlang.get_in_flight_exit_info(spend_id)\n@@ -179,7 +176,7 @@ def test_start_in_flight_exit_invalid_proof_should_fail(testlang):\n def test_start_in_flight_exit_twice_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key])\n+    spend_id = testlang.spend_utxo([deposit_id], [owner])\n \n     # First time should succeed\n     testlang.start_in_flight_exit(spend_id)\n@@ -192,12 +189,12 @@ def test_start_in_flight_exit_twice_should_fail(testlang):\n def test_start_finalized_in_flight_exit_once_more_should_fail(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key],\n+    spend_id = testlang.spend_utxo([deposit_id], [owner],\n                                    [(owner.address, NULL_ADDRESS, 50), (owner.address, NULL_ADDRESS, 50)])\n \n     # First time should succeed\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner.key)\n+    testlang.piggyback_in_flight_exit_input(spend_id, 0, owner)\n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, 0, 10)\n \n@@ -213,7 +210,7 @@ def test_start_in_flight_exit_invalid_outputs_should_fail(testlang):\n     # Create a transaction with outputs greater than inputs\n     output = (owner_2.address, NULL_ADDRESS, amount * 2)\n \n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], [output], force_invalid=True)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1], [output], force_invalid=True)\n \n     with pytest.raises(TransactionFailed):\n         testlang.start_in_flight_exit(spend_id)\n@@ -230,11 +227,10 @@ def test_start_in_flight_exit_cancelling_standard_exits_from_inputs(testlang, nu\n         deposit_id = testlang.deposit(owners[i], amount)\n         deposit_ids.append(deposit_id)\n \n-    owner_keys = [owner.key for owner in owners]\n-    spend_id = testlang.spend_utxo(deposit_ids, owner_keys)\n+    spend_id = testlang.spend_utxo(deposit_ids, owners)\n \n     for i in range(0, num_inputs):\n-        testlang.start_standard_exit(deposit_ids[i], owners[i].key)\n+        testlang.start_standard_exit(deposit_ids[i], owners[i])\n \n     for i in range(0, num_inputs):\n         assert testlang.get_standard_exit(deposit_ids[i]) == [owners[i].address, NULL_ADDRESS_HEX, 100]\n@@ -262,11 +258,10 @@ def test_start_in_flight_exit_with_finalized_standard_exits_from_inputs_flags_ex\n         deposit_id = testlang.deposit(owners[i], amount)\n         deposit_ids.append(deposit_id)\n \n-    owner_keys = [owner.key for owner in owners]\n-    spend_id = testlang.spend_utxo(deposit_ids, owner_keys)\n+    spend_id = testlang.spend_utxo(deposit_ids, owners)\n \n     for i in range(0, num_inputs):\n-        testlang.start_standard_exit(deposit_ids[i], owners[i].key)\n+        testlang.start_standard_exit(deposit_ids[i], owners[i])\n \n     for i in range(0, num_inputs):\n         assert testlang.get_standard_exit(deposit_ids[i]) == [owners[i].address, NULL_ADDRESS_HEX, 100]\n@@ -288,7 +283,7 @@ def test_start_in_flight_exit_spending_the_same_input_twice_should_fail(testlang\n \n     deposit_id = testlang.deposit(owner, amount)\n     spend_id = testlang.spend_utxo([deposit_id] * 2,\n-                                   [owner.key] * 2,\n+                                   [owner] * 2,\n                                    [(owner.address, NULL_ADDRESS, amount)],\n                                    force_invalid=True)\n \n@@ -296,14 +291,14 @@ def test_start_in_flight_exit_spending_the_same_input_twice_should_fail(testlang\n         testlang.start_in_flight_exit(spend_id)\n \n \n-def test_start_in_flight_exit_with_four_different_tokens_should_succeed(testlang, ethtester, get_contract):\n+def test_start_in_flight_exit_with_four_different_tokens_should_succeed(testlang, get_contract):\n \n     owner, amount, tokens_no = testlang.accounts[0], 100, 4\n \n-    tokens = [deploy_token(ethtester, get_contract) for _ in range(tokens_no)]\n+    tokens = [get_contract('MintableToken') for _ in range(tokens_no)]\n     deposits = [testlang.deposit_token(owner, tokens[i], amount)for i in range(tokens_no)]\n     outputs = [(owner.address, tokens[i].address, amount) for i in range(4)]\n-    spend_id = testlang.spend_utxo(deposits, [owner.key] * tokens_no, outputs)\n+    spend_id = testlang.spend_utxo(deposits, [owner] * tokens_no, outputs)\n \n     testlang.start_in_flight_exit(spend_id, sender=owner)\n \ndiff --git a/tests/contracts/root_chain/test_start_standard_exit.py b/tests/contracts/root_chain/test_start_standard_exit.py\n--- a/tests/contracts/root_chain/test_start_standard_exit.py\n+++ b/tests/contracts/root_chain/test_start_standard_exit.py\n@@ -1,14 +1,13 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n from plasma_core.constants import NULL_ADDRESS, NULL_ADDRESS_HEX, MIN_EXIT_PERIOD\n from plasma_core.transaction import Transaction\n from plasma_core.utils.eip712_struct_hash import hash_struct\n-from plasma_core.utils.signatures import sign\n from plasma_core.utils.transactions import decode_utxo_id, encode_utxo_id\n \n \n def test_start_standard_exit_should_succeed(testlang, utxo):\n-    testlang.start_standard_exit(utxo.spend_id, utxo.owner.key)\n+    testlang.start_standard_exit(utxo.spend_id, utxo.owner)\n     assert testlang.get_standard_exit(utxo.spend_id) == [utxo.owner.address, NULL_ADDRESS_HEX, utxo.amount]\n \n \n@@ -19,18 +18,18 @@ def test_start_standard_exit_multiple_outputs_should_succeed(testlang, num_outpu\n         owners.append(testlang.accounts[i])\n         outputs.append((owners[i].address, NULL_ADDRESS, 1))\n     deposit_id = testlang.deposit(owners[0], amount)\n-    spend_id = testlang.spend_utxo([deposit_id], [owners[0].key], outputs)\n+    spend_id = testlang.spend_utxo([deposit_id], [owners[0]], outputs)\n \n     output_index = num_outputs - 1\n     output_id = spend_id + output_index\n-    testlang.start_standard_exit(output_id, owners[output_index].key)\n+    testlang.start_standard_exit(output_id, owners[output_index])\n     assert testlang.get_standard_exit(output_id) == [owners[output_index].address, NULL_ADDRESS_HEX, 1]\n \n \n def test_start_standard_exit_twice_should_fail(testlang, utxo):\n-    testlang.start_standard_exit(utxo.spend_id, utxo.owner.key)\n+    testlang.start_standard_exit(utxo.spend_id, utxo.owner)\n     with pytest.raises(TransactionFailed):\n-        testlang.start_standard_exit(utxo.spend_id, utxo.owner.key)\n+        testlang.start_standard_exit(utxo.spend_id, utxo.owner)\n \n \n def test_start_standard_exit_invalid_proof_should_fail(testlang):\n@@ -48,20 +47,20 @@ def test_start_standard_exit_invalid_bond_should_fail(testlang):\n     deposit_id = testlang.deposit(owner, amount)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.start_standard_exit(deposit_id, owner.key, bond=0)\n+        testlang.start_standard_exit(deposit_id, owner, bond=0)\n \n \n def test_start_standard_exit_by_non_owner_should_fail(testlang, utxo):\n     mallory = testlang.accounts[1]\n     with pytest.raises(TransactionFailed):\n-        testlang.start_standard_exit(utxo.spend_id, mallory.key)\n+        testlang.start_standard_exit(utxo.spend_id, mallory)\n \n \n def test_start_standard_exit_unknown_token_should_fail(testlang, token):\n     utxo = testlang.create_utxo(token)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.start_standard_exit(utxo.spend_id, utxo.owner.key)\n+        testlang.start_standard_exit(utxo.spend_id, utxo.owner)\n \n \n def test_start_standard_exit_old_utxo_has_required_exit_period_to_start_exit(testlang, utxo):\n@@ -71,27 +70,27 @@ def test_start_standard_exit_old_utxo_has_required_exit_period_to_start_exit(tes\n \n     testlang.forward_timestamp(required_exit_period + minimal_required_period)\n \n-    steal_id = testlang.spend_utxo([utxo.deposit_id], [mallory.key], [(mallory.address, NULL_ADDRESS, utxo.amount)],\n+    steal_id = testlang.spend_utxo([utxo.deposit_id], [mallory], [(mallory.address, NULL_ADDRESS, utxo.amount)],\n                                    force_invalid=True)\n-    testlang.start_standard_exit(steal_id, mallory.key)\n+    testlang.start_standard_exit(steal_id, mallory)\n \n     testlang.forward_timestamp(minimal_required_period - 1)\n-    testlang.start_standard_exit(utxo.spend_id, utxo.owner.key)\n+    testlang.start_standard_exit(utxo.spend_id, utxo.owner)\n \n-    [_, exitId, _] = testlang.root_chain.getNextExit(NULL_ADDRESS)\n-    [_, _, _, position] = testlang.root_chain.exits(exitId)\n+    [_, exit_id, _] = testlang.root_chain.getNextExit(NULL_ADDRESS)\n+    [_, _, _, position] = testlang.root_chain.exits(exit_id)\n     assert position == utxo.spend_id\n \n \n def test_start_standard_exit_on_finalized_exit_should_fail(testlang, utxo):\n     required_exit_period = MIN_EXIT_PERIOD  # see tesuji blockchain design\n     minimal_required_period = MIN_EXIT_PERIOD  # see tesuji blockchain design\n-    testlang.start_standard_exit(utxo.spend_id, utxo.owner.key)\n+    testlang.start_standard_exit(utxo.spend_id, utxo.owner)\n     testlang.forward_timestamp(required_exit_period + minimal_required_period)\n     testlang.process_exits(NULL_ADDRESS, 0, 100)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.start_standard_exit(utxo.spend_id, utxo.owner.key)\n+        testlang.start_standard_exit(utxo.spend_id, utxo.owner)\n \n \n def test_start_standard_exit_wrong_oindex_should_fail(testlang):\n@@ -102,26 +101,26 @@ def test_start_standard_exit_wrong_oindex_should_fail(testlang):\n \n     spend_tx = Transaction(inputs=[decode_utxo_id(deposit_id)],\n                            outputs=[(alice.address, NULL_ADDRESS, alice_money), (bob.address, NULL_ADDRESS, bob_money)])\n-    spend_tx.sign(0, alice.key, verifyingContract=testlang.root_chain)\n+    spend_tx.sign(0, alice, verifyingContract=testlang.root_chain)\n     blknum = testlang.submit_block([spend_tx])\n     alice_utxo = encode_utxo_id(blknum, 0, 0)\n     bob_utxo = encode_utxo_id(blknum, 0, 1)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.start_standard_exit(bob_utxo, alice.key)\n+        testlang.start_standard_exit(bob_utxo, alice)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.start_standard_exit(alice_utxo, bob.key)\n+        testlang.start_standard_exit(alice_utxo, bob)\n \n-    testlang.start_standard_exit(alice_utxo, alice.key)\n-    testlang.start_standard_exit(bob_utxo, bob.key)\n+    testlang.start_standard_exit(alice_utxo, alice)\n+    testlang.start_standard_exit(bob_utxo, bob)\n \n \n def test_start_standard_exit_from_deposit_must_be_exitable_in_minimal_finalization_period(testlang):\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n \n-    testlang.start_standard_exit(deposit_id, owner.key)\n+    testlang.start_standard_exit(deposit_id, owner)\n \n     required_exit_period = MIN_EXIT_PERIOD  # see tesuji blockchain design\n     testlang.forward_timestamp(required_exit_period + 1)\n@@ -138,12 +137,12 @@ def test_start_standard_exit_on_piggyback_in_flight_exit_valid_output_owner_shou\n     outputs = []\n     for i in range(0, num_outputs):\n         outputs.append((testlang.accounts[i].address, NULL_ADDRESS, 1))\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], outputs)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1], outputs)\n \n     testlang.start_in_flight_exit(spend_id)\n \n     output_index = num_outputs - 1\n-    testlang.piggyback_in_flight_exit_output(spend_id, output_index, testlang.accounts[output_index].key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, output_index, testlang.accounts[output_index])\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert in_flight_exit.output_piggybacked(output_index)\n@@ -152,7 +151,7 @@ def test_start_standard_exit_on_piggyback_in_flight_exit_valid_output_owner_shou\n     output_id = encode_utxo_id(blknum, txindex, output_index)\n \n     with pytest.raises(TransactionFailed):\n-        testlang.start_standard_exit(output_id, testlang.accounts[output_index].key)\n+        testlang.start_standard_exit(output_id, testlang.accounts[output_index])\n \n \n @pytest.mark.parametrize(\"num_outputs\", [1, 2, 3, 4])\n@@ -163,7 +162,7 @@ def test_start_standard_exit_on_in_flight_exit_output_should_block_future_piggyb\n     outputs = []\n     for i in range(0, num_outputs):\n         outputs.append((testlang.accounts[i].address, NULL_ADDRESS, 1))\n-    spend_id = testlang.spend_utxo([deposit_id], [owner_1.key], outputs)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner_1], outputs)\n \n     testlang.start_in_flight_exit(spend_id)\n \n@@ -171,10 +170,10 @@ def test_start_standard_exit_on_in_flight_exit_output_should_block_future_piggyb\n \n     blknum, txindex, _ = decode_utxo_id(spend_id)\n     output_id = encode_utxo_id(blknum, txindex, output_index)\n-    testlang.start_standard_exit(output_id, key=testlang.accounts[output_index].key)\n+    testlang.start_standard_exit(output_id, account=testlang.accounts[output_index])\n \n     with pytest.raises(TransactionFailed):\n-        testlang.piggyback_in_flight_exit_output(spend_id, output_index, testlang.accounts[output_index].key)\n+        testlang.piggyback_in_flight_exit_output(spend_id, output_index, testlang.accounts[output_index])\n \n     in_flight_exit = testlang.get_in_flight_exit(spend_id)\n     assert not in_flight_exit.output_piggybacked(output_index)\n@@ -186,12 +185,12 @@ def test_start_standard_exit_on_finalized_in_flight_exit_output_should_fail(test\n     owner, amount = testlang.accounts[0], 100\n     deposit_id = testlang.deposit(owner, amount)\n     outputs = [(owner.address, NULL_ADDRESS, 1)] * num_outputs\n-    spend_id = testlang.spend_utxo([deposit_id], [owner.key], outputs)\n+    spend_id = testlang.spend_utxo([deposit_id], [owner], outputs)\n     output_index = num_outputs - 1\n \n     # start IFE, piggyback one output and process the exit\n     testlang.start_in_flight_exit(spend_id)\n-    testlang.piggyback_in_flight_exit_output(spend_id, output_index, owner.key)\n+    testlang.piggyback_in_flight_exit_output(spend_id, output_index, owner)\n     testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1)\n     testlang.process_exits(NULL_ADDRESS, 0, 1)\n \n@@ -200,12 +199,12 @@ def test_start_standard_exit_on_finalized_in_flight_exit_output_should_fail(test\n     # all not finalized outputs can exit via SE\n     for i in range(output_index):\n         output_id = encode_utxo_id(blknum, txindex, i)\n-        testlang.start_standard_exit(output_id, key=owner.key)\n+        testlang.start_standard_exit(output_id, account=owner)\n \n     # an already finalized output __cannot__ exit via SE\n     with pytest.raises(TransactionFailed):\n         output_id = encode_utxo_id(blknum, txindex, output_index)\n-        testlang.start_standard_exit(output_id, key=owner.key)\n+        testlang.start_standard_exit(output_id, account=owner)\n \n \n def test_start_standard_exit_from_two_deposits_with_the_same_amount_and_owner_should_succeed(testlang):\n@@ -216,10 +215,10 @@ def test_start_standard_exit_from_two_deposits_with_the_same_amount_and_owner_sh\n     # SE ids should be different\n     assert testlang.get_standard_exit_id(first_deposit_id) != testlang.get_standard_exit_id(second_deposit_id)\n \n-    testlang.start_standard_exit(first_deposit_id, owner.key)\n+    testlang.start_standard_exit(first_deposit_id, owner)\n \n     # should start a SE of a similar deposit (same owner and amount)\n-    testlang.start_standard_exit(second_deposit_id, owner.key)\n+    testlang.start_standard_exit(second_deposit_id, owner)\n \n \n def test_old_signature_scheme_does_not_work_any_longer(testlang, utxo):\n@@ -227,40 +226,40 @@ def test_old_signature_scheme_does_not_work_any_longer(testlang, utxo):\n     # Then passing new signature to the same challenge data, challenge will succeed\n     alice = testlang.accounts[0]\n     outputs = [(alice.address, NULL_ADDRESS, 50)]\n-    spend_id = testlang.spend_utxo([utxo.spend_id], [alice.key], outputs)\n+    spend_id = testlang.spend_utxo([utxo.spend_id], [alice], outputs)\n \n-    testlang.start_standard_exit(spend_id, alice.key)\n+    testlang.start_standard_exit(spend_id, alice)\n     exit_id = testlang.get_standard_exit_id(spend_id)\n \n     # let's prepare old schema signature for a transaction with an input of exited utxo\n     spend_tx = Transaction(inputs=[decode_utxo_id(spend_id)], outputs=outputs)\n-    old_signature = sign(spend_tx.hash, alice.key)\n+    old_signature = alice.key.sign_msg_hash(spend_tx.hash).to_bytes()\n \n     # challenge will fail on signature verification\n     with pytest.raises(TransactionFailed):\n         testlang.root_chain.challengeStandardExit(exit_id, spend_tx.encoded, 0, old_signature)\n \n     # sanity check: let's provide new schema signature for a challenge\n-    new_signature = sign(hash_struct(spend_tx, verifyingContract=testlang.root_chain), alice.key)\n+    new_signature = alice.key.sign_msg_hash(hash_struct(spend_tx, verifyingContract=testlang.root_chain)).to_bytes()\n     testlang.root_chain.challengeStandardExit(exit_id, spend_tx.encoded, 0, new_signature)\n \n \n def test_signature_scheme_respects_verifying_contract(testlang, utxo):\n     alice = testlang.accounts[0]\n     outputs = [(alice.address, NULL_ADDRESS, 50)]\n-    spend_id = testlang.spend_utxo([utxo.spend_id], [alice.key], outputs)\n+    spend_id = testlang.spend_utxo([utxo.spend_id], [alice], outputs)\n \n-    testlang.start_standard_exit(spend_id, alice.key)\n+    testlang.start_standard_exit(spend_id, alice)\n     exit_id = testlang.get_standard_exit_id(spend_id)\n \n     spend_tx = Transaction(inputs=[decode_utxo_id(spend_id)], outputs=outputs)\n \n-    bad_contract_signature = sign(hash_struct(spend_tx, verifyingContract=None), alice.key)\n+    bad_contract_signature = alice.key.sign_msg_hash(hash_struct(spend_tx, verifyingContract=None)).to_bytes()\n \n     # challenge will fail on signature verification\n     with pytest.raises(TransactionFailed):\n         testlang.root_chain.challengeStandardExit(exit_id, spend_tx.encoded, 0, bad_contract_signature)\n \n     # sanity check\n-    proper_signature = sign(hash_struct(spend_tx, verifyingContract=testlang.root_chain), alice.key)\n+    proper_signature = alice.key.sign_msg_hash(hash_struct(spend_tx, verifyingContract=testlang.root_chain)).to_bytes()\n     testlang.root_chain.challengeStandardExit(exit_id, spend_tx.encoded, 0, proper_signature)\ndiff --git a/tests/contracts/root_chain/test_submit_block.py b/tests/contracts/root_chain/test_submit_block.py\n--- a/tests/contracts/root_chain/test_submit_block.py\n+++ b/tests/contracts/root_chain/test_submit_block.py\n@@ -1,15 +1,15 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n \n \n-def test_submit_block_valid_key_should_succeed(ethtester, testlang):\n+def test_submit_block_valid_key_should_succeed(testlang):\n     submitter = testlang.accounts[0]\n     assert testlang.root_chain.nextChildBlock() == 1000\n     blknum = testlang.submit_block([], submitter)\n \n     block_info = testlang.root_chain.blocks(1000)\n     assert block_info[0] == testlang.child_chain.get_block(blknum).root\n-    assert block_info[1] == ethtester.chain.head_state.timestamp\n+    assert block_info[1] == testlang.timestamp\n     assert testlang.root_chain.nextChildBlock() == 2000\n \n \ndiff --git a/tests/contracts/root_chain/test_tokens.py b/tests/contracts/root_chain/test_tokens.py\n--- a/tests/contracts/root_chain/test_tokens.py\n+++ b/tests/contracts/root_chain/test_tokens.py\n@@ -1,5 +1,5 @@\n import pytest\n-from ethereum.tools.tester import TransactionFailed\n+from eth_tester.exceptions import TransactionFailed\n from plasma_core.constants import NULL_ADDRESS\n \n \n@@ -11,14 +11,14 @@ def test_token_adding(token, root_chain):\n         root_chain.addToken(token.address)\n \n \n-def test_token_adding_gas_cost(ethtester, root_chain):\n+def test_token_adding_gas_cost(w3, root_chain):\n     ADDRESS_A = b'\\x00' * 19 + b'\\x01'\n     ADDRESS_B = b'\\x00' * 19 + b'\\x02'\n     root_chain.addToken(ADDRESS_A)\n-    gas = ethtester.chain.last_gas_used()\n+    gas = w3.eth.last_gas_used\n     print(\"PriorityQueue first deployment costs {} gas\".format(gas))\n     root_chain.addToken(ADDRESS_B)\n-    gas = ethtester.chain.last_gas_used()\n+    gas = w3.eth.last_gas_used\n     print(\"PriorityQueue second deployment costs {} gas\".format(gas))\n \n \ndiff --git a/tests/conveniece_wrappers.py b/tests/conveniece_wrappers.py\nnew file mode 100644\n--- /dev/null\n+++ b/tests/conveniece_wrappers.py\n@@ -0,0 +1,121 @@\n+from eth_tester.exceptions import TransactionFailed\n+from web3 import eth\n+from web3._utils.datatypes import PropertyCheckingFactory\n+from web3.contract import Contract\n+\n+\n+class AutominingEth(eth.Eth):\n+    \"\"\" A simple convenience wrapper that cooperates with ganache EVM,\n+        so that mining transactions is automatic yet deterministic.\n+\n+        Provides methods for control of mining and time forwarding.\n+    \"\"\"\n+\n+    def __init__(self, web3):\n+        super().__init__(web3)\n+        self._mine = True\n+        self._next_timestamp = None\n+        self._last_tx_hash = None\n+\n+    def disable_auto_mine(self):\n+        self._mine = False\n+\n+    def enable_auto_mine(self):\n+        self._mine = True\n+\n+    def mine(self, timestamp=None, expect_error=False):\n+        timestamp = timestamp or self._get_next_timestamp()\n+        try:\n+            result = self.web3.manager.request_blocking('evm_mine', [timestamp])\n+            if result != \"0x0\":\n+                raise TransactionFailed(\"Could not mine next block\")\n+        except ValueError as error:\n+            if expect_error:\n+                return\n+\n+            if error.args[0]['message'] == \"VM Exception while processing transaction: revert\":\n+                raise TransactionFailed\n+            raise error\n+\n+    def increase_time(self, seconds):\n+        self._next_timestamp = self.getBlock('latest')['timestamp'] + seconds\n+\n+    def sendTransaction(self, transaction):\n+        tx_hash = super().sendTransaction(transaction)\n+        if self._mine:\n+            self.mine()\n+\n+        self._last_tx_hash = tx_hash\n+        return tx_hash\n+\n+    @property\n+    def last_gas_used(self):\n+        receipt = self.waitForTransactionReceipt(self._last_tx_hash)\n+        return receipt['gasUsed']\n+\n+    def _get_next_timestamp(self):\n+        next_timestamp = self._next_timestamp or (self.getBlock('latest')['timestamp'] + 1)\n+        self._next_timestamp = None\n+        return next_timestamp\n+\n+\n+class ConvenienceContractWrapper:\n+    \"\"\" Wraps web3.Contract, so that the calling of functions is simpler.\n+\n+        Instead of calling:\n+            `contract.functions.<name_of_function>(args).transact()`\n+        we can simply call:\n+            `contract.<name_of_function>(args)`\n+    \"\"\"\n+\n+    # Gas must be preset, due to an error in ganache, which causes ganache-cli to panic\n+    # at gas estimation when the transaction being estimated fails.\n+    default_params = {'gasPrice': 0, 'gas': 4 * 10 ** 6}\n+\n+    def __init__(self, contract: Contract):\n+        self.contract = contract\n+\n+    def __getattr__(self, item):\n+        method = self._find_abi_method(item)\n+        if method:\n+            function = self.contract.functions.__getattribute__(item)\n+            return ConvenienceContractWrapper._call_or_transact(function, method)\n+\n+        return self.contract.__getattribute__(item)\n+\n+    def _find_abi_method(self, item):\n+        for i in self.contract.abi:\n+            if i['type'] == 'function' and i['name'] == item:\n+                return i\n+\n+    @staticmethod\n+    def _call_or_transact(function, method_abi):\n+        def _do_call(*args):\n+            try:\n+                result = function(*args).call()\n+            except ValueError:\n+                raise TransactionFailed\n+            return result\n+\n+        def _do_transact(*args, **kwargs):\n+            params = {**ConvenienceContractWrapper.default_params, **kwargs}\n+\n+            tx_hash = function(*args).transact(params)\n+            receipt = function.web3.eth.waitForTransactionReceipt(tx_hash)\n+            if receipt.status == 0:\n+                raise TransactionFailed\n+\n+            return tx_hash\n+\n+        if method_abi['constant']:\n+            return _do_call\n+        else:\n+            return _do_transact\n+\n+    def get_contract_events(self):\n+        contract_events = []\n+        for attr in dir(self.events):\n+            attr = getattr(self.events, attr)\n+            if isinstance(attr, PropertyCheckingFactory):\n+                contract_events.append(attr)\n+        return contract_events\ndiff --git a/tests/utils/test_fixed_merkle.py b/tests/utils/test_fixed_merkle.py\n--- a/tests/utils/test_fixed_merkle.py\n+++ b/tests/utils/test_fixed_merkle.py\n@@ -1,6 +1,7 @@\n import math\n import pytest\n-from ethereum.utils import sha3\n+from eth_utils import keccak as sha3\n+\n from plasma_core.utils.merkle.fixed_merkle import FixedMerkle\n from plasma_core.constants import NULL_HASH\n \ndiff --git a/tests/utils/test_ganache.py b/tests/utils/test_ganache.py\nnew file mode 100644\n--- /dev/null\n+++ b/tests/utils/test_ganache.py\n@@ -0,0 +1,29 @@\n+def test_explicitly_mine_consecutive_blocks(w3, accounts):\n+    w3.eth.disable_auto_mine()\n+\n+    latest_block = w3.eth.getBlock('latest')\n+    tx_hash = w3.eth.sendTransaction({'from': accounts[0].address, 'to': accounts[1].address, 'value': 100})\n+\n+    # new block has not been automatically mined\n+    assert w3.eth.getBlock('latest') == latest_block\n+\n+    # mine the pending tx\n+    w3.eth.mine()\n+\n+    new_block = w3.eth.getBlock('latest')\n+    assert new_block.number == latest_block.number + 1\n+    assert new_block.timestamp == latest_block.timestamp + 1\n+    assert tx_hash in new_block.transactions\n+\n+\n+def test_auto_mine_transactions(w3, accounts):\n+\n+    latest_block = w3.eth.getBlock('latest')\n+    tx_hash = w3.eth.sendTransaction({'from': accounts[0].address, 'to': accounts[1].address, 'value': 100})\n+\n+    # new block has been automatically mined\n+\n+    new_block = w3.eth.getBlock('latest')\n+    assert new_block.number == latest_block.number + 1\n+    assert new_block.timestamp == latest_block.timestamp + 1\n+    assert tx_hash in new_block.transactions\n", "problem_statement": "", "hints_text": "", "created_at": "2019-08-28T10:12:00Z"}