Esempio n. 1
0
    def ssz_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
        # Apply changes to presets, this affects some of the vector types.
        presets = loader.load_presets(configs_path, config_name)
        spec.apply_constants_preset(presets)

        # Reproducible RNG
        rng = Random(seed)

        random_mode_name = mode.to_name()

        suite_name = f"ssz_{config_name}_{random_mode_name}{'_chaos' if chaos else ''}"

        count = cases_if_random if chaos or mode.is_changing() else 1
        print(
            f"generating SSZ-static suite ({count} cases per ssz type): {suite_name}"
        )

        return (
            suite_name, "core",
            gen_suite.render_suite(
                title=
                f"ssz testing, with {config_name} config, randomized with mode {random_mode_name}{' and with chaos applied' if chaos else ''}",
                summary="Test suite for ssz serialization and hash-tree-root",
                forks_timeline="testing",
                forks=["phase0"],
                config=config_name,
                runner="ssz",
                handler="static",
                test_cases=ssz_static_cases(rng, mode, chaos, count)))
Esempio n. 2
0
def bls_sign_msg_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
    return ("sign_msg", "sign_msg", gen_suite.render_suite(
        title="BLS sign msg",
        summary="BLS Sign a message",
        forks_timeline="mainnet",
        forks=["phase0"],
        config="mainnet",
        runner="bls",
        handler="sign_msg",
        test_cases=case04_sign_messages()))
Esempio n. 3
0
def bls_aggregate_pubkeys_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
    return ("aggregate_pubkeys", "aggregate_pubkeys", gen_suite.render_suite(
        title="BLS aggregate pubkeys",
        summary="BLS Aggregate public keys",
        forks_timeline="mainnet",
        forks=["phase0"],
        config="mainnet",
        runner="bls",
        handler="aggregate_pubkeys",
        test_cases=case07_aggregate_pubkeys()))
Esempio n. 4
0
def bls_msg_hash_compressed_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
    return ("g2_compressed", "msg_hash_g2_compressed", gen_suite.render_suite(
        title="BLS G2 Compressed msg hash",
        summary="BLS G2 Compressed msg hash",
        forks_timeline="mainnet",
        forks=["phase0"],
        config="mainnet",
        runner="bls",
        handler="msg_hash_compressed",
        test_cases=case02_message_hash_G2_compressed()))
Esempio n. 5
0
def bls_priv_to_pub_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
    return ("priv_to_pub", "priv_to_pub", gen_suite.render_suite(
        title="BLS private key to pubkey",
        summary="BLS Convert private key to public key",
        forks_timeline="mainnet",
        forks=["phase0"],
        config="mainnet",
        runner="bls",
        handler="priv_to_pub",
        test_cases=case03_private_to_public_key()))
Esempio n. 6
0
def ssz_wrong_uint_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
    return ("uint_wrong_length", "uint",
            gen_suite.render_suite(
                title="UInt Wrong Length",
                summary="Serialized integers that are too short or too long",
                forks_timeline="mainnet",
                forks=["phase0"],
                config="mainnet",
                runner="ssz",
                handler="uint",
                test_cases=generate_uint_wrong_length_test_cases()))
Esempio n. 7
0
def ssz_random_uint_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
    return (
        "uint_random", "uint",
        gen_suite.render_suite(
            title="UInt Random",
            summary=
            "Random integers chosen uniformly over the allowed value range",
            forks_timeline="mainnet",
            forks=["phase0"],
            config="mainnet",
            runner="ssz",
            handler="uint",
            test_cases=generate_random_uint_test_cases()))
Esempio n. 8
0
    def suite_definition(configs_path: str) -> gen_typing.TestSuiteOutput:
        presets = loader.load_presets(configs_path, config_name)
        spec.apply_constants_preset(presets)

        return ("%s_%s" % (transition_name, config_name), transition_name, gen_suite.render_suite(
            title="%s epoch processing" % transition_name,
            summary="Test suite for %s type epoch processing" % transition_name,
            forks_timeline="testing",
            forks=["phase0"],
            config=config_name,
            runner="epoch_processing",
            handler=transition_name,
            test_cases=get_cases()))
Esempio n. 9
0
def ssz_uint_bounds_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
    return (
        "uint_bounds", "uint",
        gen_suite.render_suite(
            title="UInt Bounds",
            summary=
            "Integers right at or beyond the bounds of the allowed value range",
            forks_timeline="mainnet",
            forks=["phase0"],
            config="mainnet",
            runner="ssz",
            handler="uint",
            test_cases=generate_uint_bounds_test_cases() +
            generate_uint_out_of_bounds_test_cases()))
Esempio n. 10
0
def full_deposits_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
    presets = loader.load_presets(configs_path, 'mainnet')
    spec.apply_constants_preset(presets)

    return ("deposit_full", "deposits",
            gen_suite.render_suite(
                title="deposit operation",
                summary="Test suite for deposit type operation processing",
                forks_timeline="mainnet",
                forks=["phase0"],
                config="mainnet",
                runner="operations",
                handler="deposits",
                test_cases=deposit_cases()))
Esempio n. 11
0
    def suite_definition(configs_path: str) -> gen_typing.TestSuiteOutput:
        presets = loader.load_presets(configs_path, config_name)
        spec_phase0.apply_constants_preset(presets)
        spec_phase1.apply_constants_preset(presets)

        return ("sanity_%s_%s" % (handler_name, config_name), handler_name, gen_suite.render_suite(
            title="sanity testing",
            summary="Sanity test suite, %s type, generated from pytests" % handler_name,
            forks_timeline="testing",
            forks=["phase0"],
            config=config_name,
            runner="sanity",
            handler=handler_name,
            test_cases=get_cases()))
Esempio n. 12
0
def full_shuffling_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
    presets = loader.load_presets(configs_path, 'mainnet')
    spec.apply_constants_preset(presets)

    return (
        "shuffling_full", "core",
        gen_suite.render_suite(
            title="Swap-or-Not Shuffling tests with mainnet config",
            summary=
            "Swap or not shuffling, with normal configured (secure) mainnet round-count",
            forks_timeline="mainnet",
            forks=["phase0"],
            config="mainnet",
            runner="shuffling",
            handler="core",
            test_cases=shuffling_test_cases()))