Пример #1
0
    'bcForkStressTest.json:ForkStressTest',
    'bcWalletTest.json:walletReorganizeOwners',
}


def blockchain_fixture_mark_fn(fixture_name):
    if fixture_name in SLOW_FIXTURE_NAMES:
        return pytest.mark.blockchain_slow
    else:
        return None


FIXTURES = find_fixtures(
    BASE_FIXTURE_PATH,
    normalize_blockchain_fixtures,
    skip_fn=blockchain_fixture_skip_fn,
    ignore_fn=blockchain_fixture_skip_fn,  # TODO: remove
    mark_fn=blockchain_fixture_mark_fn,
)


@pytest.mark.parametrize(
    'fixture_name,fixture',
    FIXTURES,
)
def test_blockchain_fixtures(fixture_name, fixture):
    genesis_params = {
        'parent_hash': fixture['genesisBlockHeader']['parentHash'],
        'uncles_hash': fixture['genesisBlockHeader']['uncleHash'],
        'coinbase': fixture['genesisBlockHeader']['coinbase'],
        'state_root': fixture['genesisBlockHeader']['stateRoot'],
Пример #2
0
    'stSystemOperationsTest.json:CallRecursiveBomb3',
    'stSystemOperationsTest.json:CallRecursiveBombLog',
    'stSystemOperationsTest.json:CallRecursiveBombLog2',
}


def state_fixture_mark_fn(fixture_name):
    if fixture_name in SLOW_FIXTURE_NAMES:
        return pytest.mark.state_slow
    else:
        return None


FIXTURES = find_fixtures(
    BASE_FIXTURE_PATH,
    normalize_statetest_fixture,
    skip_fn=state_fixture_skip_fn,
    mark_fn=state_fixture_mark_fn,
)


def get_block_hash_for_testing(self, block_number):
    if block_number >= self.block.header.block_number:
        return b''
    elif block_number < 0:
        return b''
    elif block_number < self.block.header.block_number - 256:
        return b''
    else:
        return keccak("{0}".format(block_number))

Пример #3
0
from evm.utils.ecdsa import (
    BadSignature, )

from evm.utils.fixture_tests import (
    find_fixtures,
    normalize_transactiontest_fixture,
    normalize_signed_transaction,
)

ROOT_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))

BASE_FIXTURE_PATH = os.path.join(ROOT_PROJECT_DIR, 'fixtures',
                                 'TransactionTests')

FIXTURES = find_fixtures(
    BASE_FIXTURE_PATH,
    normalize_transactiontest_fixture,
)


def test_transaction_fixtures_smoke_test():
    assert FIXTURES


@pytest.mark.parametrize(
    'fixture_name,fixture',
    FIXTURES,
)
def test_transaction_fixtures(fixture_name, fixture):
    header = BlockHeader(1, fixture.get('blocknumber', 0), 100)
    chain = MainnetChain(get_db_backend(), header=header)
    vm = chain.get_vm()
Пример #4
0
def vm_fixture_skip_fn(fixture_path, fixture_name, fixture):
    return False


def vm_fixture_mark_fn(fixture_name):
    if 'Performance' in fixture_name:
        return pytest.mark.vm_performance
    elif 'vmInputLimits' in fixture_name:
        return pytest.mark.vm_limits
    else:
        return None


FIXTURES = find_fixtures(
    BASE_FIXTURE_PATH,
    normalize_vmtest_fixture,
    skip_fn=vm_fixture_skip_fn,
    mark_fn=vm_fixture_mark_fn,
)


#
# Testing Overrides
#
def apply_message_for_testing(self, message):
    """
    For VM tests, we don't actually apply messages.
    """
    computation = Computation(
        vm=self,
        message=message,
    )