def __init__(self): if not is_pyethereum21_available(): version = get_pyethereum_version() if version is None: raise pkg_resources.DistributionNotFound( "The `ethereum` package is not available. The " "`PyEthereum21Backend` requires a 2.0.0+ version of the " "ethereum package to be installed.") elif version not in Spec('>=2.0.0,<2.2.0'): raise pkg_resources.DistributionNotFound( "The `PyEthereum21Backend` requires a 2.0.0+ version of the " "`ethereum` package. Found {0}".format(version)) self.fork_blocks = {} self.reset_to_genesis()
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_pyethereum21_available(): from ethereum.tools.tester import ( TransactionFailed as Pyeth21TransactionFailed, ) else: Pyeth21TransactionFailed = None SUPPORTED_FORKS = { FORK_HOMESTEAD, FORK_DAO, FORK_SPURIOUS_DRAGON, FORK_TANGERINE_WHISTLE, FORK_BYZANTIUM, } def _get_block_by_number(evm, block_number):
def eth_tester(): if not is_pyethereum21_available(): pytest.skip("PyEthereum >=2.0.0,<2.2.0 not available") backend = PyEthereum21Backend() return EthereumTester(backend=backend)