Skip to content

feat(tests): additional test cases for eip-7883 #1791

@spencer-tb

Description

@spencer-tb

Extra Test Cases EIP-7883

ModExp Gas Cost Increase

I didn’t create a separate PR for #1971, as it depends on the infrastructure introduced in this PR.

There are 37 test cases in the legacy modexpFiller.json test. Most of them have been ported, but the following cases are still pending and require further analysis:

Case 2: Would parse a base length of 0, a modulus length of 32, and an exponent length of 2256 - 1, where the base is empty, the modulus is 2256 - 2 and the exponent is (2256 - 3) * 256(2**256 - 33) (yes, that's a really big number). It would then immediately fail, as it's not possible to provide enough gas to make that computation.
Case 28: base length 4TiB
Case 29: exp length 4TiB; returns 0 because mod is zero
Case 30: base and mod have zero-length. exp's length is 2^255. Since mod is zero, the result should be zero.

Case 36: the input found on 10 Oct. 2017 that overflows the gas calculation

Case 37: input found in July 2022, overflows the gas calculation

Based on the description of case 2, 28, 29 and 30, they will fail as eip7623 introduces the upper bound for each field, we already have similar test in test_modexp_invalid_inputs.
For case 36, 37, I am checking if it is valid after Fusaka.

I initially created test cases for two scenarios:

base/exponent is invalid while modulus is valid.
All components are invalid.

However, I later realized that these tests fail not due to the input upper bound, but because they exceed the transaction gas limit cap (see explanation #1929 (comment)).

While filling each component with 0xFF bytes makes such scenarios impossible in practice, I believe it may still be possible to construct cases that trigger this condition. I explored how to generate these cases but have not much idea now.

Please comment any additional test cases or edit the issue and add more.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fork:osakaOsaka hardforkscope:testsScope: Changes EL client test cases in `./tests`type:feattype: Feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions