예제 #1
0
def fixture(fixture_data):
    fixture_path, fixture_key, fixture_fork, post_state_index = fixture_data
    fixture = load_fixture(
        fixture_path,
        fixture_key,
        normalize_statetest_fixture(fork=fixture_fork, post_state_index=post_state_index),
    )
    return fixture
예제 #2
0
#    os.path.join(BASE_FIXTURE_PATH, "stTransactionTest.json"),
#    os.path.join(BASE_FIXTURE_PATH, "stTransitionTest.json"),
#    os.path.join(BASE_FIXTURE_PATH, "stWalletTest.json"),
#)

RAW_FIXTURES = tuple(
    (
        os.path.relpath(fixture_path, BASE_FIXTURE_PATH),
        json.load(open(fixture_path)),
    ) for fixture_path in FIXTURES_PATHS
    if ("Stress" not in fixture_path and "Complexity" not in fixture_path
        and "EIP150" not in fixture_path and "EIP158" not in fixture_path))

FIXTURES = tuple((
    "{0}:{1}".format(fixture_filename, key),
    normalize_statetest_fixture(fixtures[key]),
) for fixture_filename, fixtures in RAW_FIXTURES
                 for key in sorted(fixtures.keys()) if 'post' in fixtures[key])


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))