Example #1
0
 def __init__(self):
     if not is_pyethereum16_available():
         version = get_pyethereum_version()
         if version is None:
             raise pkg_resources.DistributionNotFound(
                 "The `ethereum` package is not available.  The "
                 "`PyEthereum16Backend` requires a 1.6.x version of the "
                 "ethereum package to be installed.")
         elif version not in Spec('>=1.6.0,<1.7.0'):
             raise pkg_resources.DistributionNotFound(
                 "The `PyEthereum16Backend` requires a 1.6.x version of the "
                 "`ethereum` package.  Found {0}".format(version))
     self.reset_to_genesis()
Example #2
0
from eth_tester.utils.accounts import (
    private_key_to_address, )

from eth_tester.backends.pyethereum.serializers import (
    serialize_block,
    serialize_transaction,
    serialize_transaction_hash,
    serialize_transaction_receipt,
)
from eth_tester.backends.pyethereum.validation import (
    validate_transaction, )
from eth_tester.utils.formatting import (
    replace_exceptions, )

if is_pyethereum16_available():
    from ethereum.tester import (
        TransactionFailed as Pyeth16TransactionFailed, )
else:
    Pyeth16TransactionFailed = None


#
# Internal getters for EVM objects
#
def _get_transaction_by_hash(evm, transaction_hash, mined=True):
    # first check unmined transactions
    for index, candidate in enumerate(evm.block.get_transaction_hashes()):
        if candidate == transaction_hash:
            transaction = evm.block.transaction_list[index]
            return evm.block, transaction, index
def eth_tester():
    if not is_pyethereum16_available():
        pytest.skip("PyEthereum >=1.6.0,<1.7.0 not available")
    backend = PyEthereum16Backend()
    return EthereumTester(backend=backend)