Skip to content

UX improve for precompile benchmark test cases #2739

@LouisTsai-Csie

Description

@LouisTsai-Csie

Summary

Improve test case readability, raw hex arrays in parametrized tests are hard to parse without knowing the argument structure of each precompile. For example:

@pytest.mark.parametrize(
    "precompile_address,calldata,target",
    [
        pytest.param(
            0x06,
            concatenate_parameters(
                [
                    "18B18ACFB4C2C30276DB5411368E7185B311DD124691610C5D3B74034E093DC9",
                    "063C909C4720840CB5134CB9F59FA749755796819658D32EFC0D288198F37266",
                    ...
                ]
            ),
            ...
        ),
    ],
)

It's unclear what each hex string represents (e.g. x-coordinate, y-coordinate, field element).

Proposed Improvements

  • Define named constants for precompile addresses (e.g. instead of raw 0x06)
  • Add helper/factory functions per precompile, similar to the existing create_modexp_test_cases, so inputs are constructed with labeled parameters

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions