Skip to content

Commit 485ff27

Browse files
authored
feat(tests): EIP-7883: triple modexp gas price (#1881)
* chore(tests): triple modexp gas price. * chore(tests): update modexp eip-7883 vectors. * chore(tests): small clarifactions.
1 parent 28d2299 commit 485ff27

File tree

3 files changed

+35
-31
lines changed

3 files changed

+35
-31
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Users can select any of the artifacts depending on their testing needs for their
121121
- 🔀 Refactored `SELFDESTRUCT` opcode collision tests to use the `pre_alloc` plugin in order to avoid contract and EOA address collisions ([#1643](https://github.com/ethereum/execution-spec-tests/pull/1643)).
122122
- ✨ EIP-7594: Sanity test cases to send blob transactions and verify `engine_getBlobsVX` using the `execute` command ([#1644](https://github.com/ethereum/execution-spec-tests/pull/1644)).
123123
- 🔀 Refactored EIP-145 static tests into python ([#1683](https://github.com/ethereum/execution-spec-tests/pull/1683)).
124-
- ✨ EIP-7823, EIP-7883: Add test cases for ModExp precompile gas-cost updates and input limits on Osaka ([#1579](https://github.com/ethereum/execution-spec-tests/pull/1579), [#1729](https://github.com/ethereum/execution-spec-tests/pull/1729)).
124+
- ✨ EIP-7823, EIP-7883: Add test cases for ModExp precompile gas-cost updates and input limits on Osaka ([#1579](https://github.com/ethereum/execution-spec-tests/pull/1579), [#1729](https://github.com/ethereum/execution-spec-tests/pull/1729), [#1881](https://github.com/ethereum/execution-spec-tests/pull/1881)).
125125
-[EIP-7825](https://eips.ethereum.org/EIPS/eip-7825): Add test cases for the transaction gas limit of 2^24 gas ([#1711](https://github.com/ethereum/execution-spec-tests/pull/1711), [#1882](https://github.com/ethereum/execution-spec-tests/pull/1882)).
126126
-[EIP-7951](https://eips.ethereum.org/EIPS/eip-7951): add test cases for `P256VERIFY` precompile to support secp256r1 curve [#1670](https://github.com/ethereum/execution-spec-tests/pull/1670).
127127
- ✨ Introduce blockchain tests for benchmark to cover the scenario of pure ether transfers [#1742](https://github.com/ethereum/execution-spec-tests/pull/1742).

tests/osaka/eip7883_modexp_gas_increase/spec.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def calculate_iteration_count(cls, exponent_length: int, exponent: bytes) -> int
6868
def calculate_gas_cost(
6969
cls, base_length: int, modulus_length: int, exponent_length: int, exponent: bytes
7070
) -> int:
71-
"""Calculate the ModExp gas cost according to EIP-7883 specification."""
71+
"""Calculate the ModExp gas cost according to EIP-2565 specification."""
7272
multiplication_complexity = cls.calculate_multiplication_complexity(
7373
base_length, modulus_length
7474
)
@@ -78,13 +78,17 @@ def calculate_gas_cost(
7878

7979
@dataclass(frozen=True)
8080
class Spec7883(Spec):
81-
"""Constants and helpers for the ModExp gas cost increase EIP."""
81+
"""
82+
Constants and helpers for the ModExp gas cost increase EIP.
83+
These override the original Spec class variables for EIP-7883.
84+
"""
8285

8386
MODEXP_ADDRESS = 0x05
8487
MIN_GAS = 500
8588

8689
LARGE_BASE_MODULUS_MULTIPLIER = 2
8790
EXPONENT_BYTE_MULTIPLIER = 16
91+
GAS_DIVISOR = 1 # Overrides the original Spec class GAS_DIVISOR
8892

8993
@classmethod
9094
def calculate_multiplication_complexity(cls, base_length: int, modulus_length: int) -> int:

0 commit comments

Comments
 (0)