Skip to content

Commit ec541f2

Browse files
test: add extra casefor modexp invalid input
1 parent e188a6c commit ec541f2

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,33 +77,45 @@ def create_modexp_input(
7777

7878

7979
@pytest.mark.parametrize(
80-
"modexp_input,modexp_expected,call_succeeds",
80+
"modexp_input,",
8181
[
82-
pytest.param(bytes(), bytes(), False, id="zero-length-calldata"),
82+
pytest.param(bytes(), id="zero-length-calldata"),
8383
pytest.param(
8484
create_modexp_input(10, 11, 12, b_data="FF" * 9),
85-
bytes(),
86-
False,
8785
id="b-too-short",
8886
),
8987
pytest.param(
9088
create_modexp_input(10, 11, 12, m_data="FF" * 10),
91-
bytes(),
92-
False,
9389
id="m-too-short",
9490
),
9591
pytest.param(
9692
create_modexp_input(10, 11, 12, e_data="FF" * 11),
97-
bytes(),
98-
False,
9993
id="e-too-short",
10094
),
10195
pytest.param(
10296
create_modexp_input(0, 0, 0),
103-
bytes(),
104-
False,
10597
id="all-zeros",
10698
),
99+
# These invalid inputs are from EIP-7823.
100+
# Ref: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7823.md#analysis
101+
pytest.param(
102+
bytes.fromhex("9e5faafc"),
103+
id="invalid-case-1",
104+
),
105+
pytest.param(
106+
bytes.fromhex("85474728"),
107+
id="invalid-case-2",
108+
),
109+
pytest.param(
110+
bytes.fromhex("9e281a98" + "00" * 54 + "021e19e0c9bab2400000"),
111+
id="invalid-case-3",
112+
),
113+
],
114+
)
115+
@pytest.mark.parametrize(
116+
"modexp_expected,call_succeeds",
117+
[
118+
pytest.param(bytes(), False),
107119
],
108120
)
109121
@EIPChecklist.Precompile.Test.Inputs.AllZeros

0 commit comments

Comments
 (0)