Skip to content

Commit 66179b4

Browse files
committed
feat(tests): tests for even modexp with long trailing zeros
1 parent dedec64 commit 66179b4

File tree

2 files changed

+82
-1
lines changed

2 files changed

+82
-1
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Test fixtures for use by clients are available for each release on the [Github r
3030
- ✨ Expand EIP-6110 modified contract tests, where the extra event log has no topics at all ([#1693](https://github.com/ethereum/execution-specs/pull/1693)).
3131
- ✨ Add a CREATE/2 test cases for when it runs OOG on code deposit ([#1705](https://github.com/ethereum/execution-specs/pull/1705)).
3232
- ✨ Expand cases to test *CALL opcodes causing OOG ([#1703](https://github.com/ethereum/execution-specs/pull/1703)).
33-
- ✨ Add tests for `modexp` and `ripemd` precompiled contracts ([#1691](https://github.com/ethereum/execution-specs/pull/1691)).
33+
- ✨ Add tests for `modexp` and `ripemd` precompiled contracts ([#1691](https://github.com/ethereum/execution-specs/pull/1691), [#1781](https://github.com/ethereum/execution-specs/pull/1781)).
3434
- ✨ Add `ecrecover` precompile tests originating form `evmone` unittests ([#1685](https://github.com/ethereum/execution-specs/pull/1685)).
3535

3636
## [v5.3.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v5.3.0) - 2025-10-09

tests/byzantium/eip198_modexp_precompile/test_modexp.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,87 @@
318318
),
319319
id="immunefi-38958-by-omik-overflow",
320320
),
321+
pytest.param(
322+
ModExpInput(
323+
base="03",
324+
exponent="52",
325+
modulus=8 * "ff" + 8 * "00",
326+
),
327+
ModExpOutput(
328+
returned_data="e8ca816be3ddb8a1243d253d80487649",
329+
),
330+
id="mod-16-even-ctz-8",
331+
),
332+
pytest.param(
333+
ModExpInput(
334+
base="03",
335+
exponent="83",
336+
modulus=8 * "ff" + 16 * "00",
337+
),
338+
ModExpOutput(
339+
returned_data="b05147078624b9661557222e8610fb9986f829a99c2ede1b",
340+
),
341+
id="mod-24-even-ctz-16",
342+
),
343+
pytest.param(
344+
ModExpInput(
345+
base="03",
346+
exponent="0100",
347+
modulus=16 * "ff" + 24 * "00",
348+
),
349+
ModExpOutput(
350+
returned_data="4af58b4c59a562ee7345b3805ed8b417fed242815e55bc8375a205de07597d51"
351+
"d2105f2f0730f401",
352+
),
353+
id="mod-40-even-ctz-24",
354+
),
355+
pytest.param(
356+
ModExpInput(
357+
base="03",
358+
exponent="0200",
359+
modulus=40 * "ff" + 32 * "00",
360+
),
361+
ModExpOutput(
362+
returned_data="e33fcb0f1a5abfca90c5036512aca2cb657acf53b0e31fed3e122d5dec19ee8c"
363+
"2e60be065d0b77059483760fbd2a7e5335bd075f4d13ebbd7679ef1b4306890c"
364+
"1d660d1276f1e801",
365+
),
366+
id="mod-72-even-ctz-32",
367+
),
368+
pytest.param(
369+
ModExpInput(
370+
base="03",
371+
exponent="0300",
372+
modulus=96 * "ff" + 40 * "00",
373+
),
374+
ModExpOutput(
375+
returned_data="4059444789547ff685087bca8a144d32556b2251613171aa4cf05d8a005015d9"
376+
"b8408ba5f7c89595e76d925173cf80e552a856b1ce217c1f33940f8241e6adcf"
377+
"76b672c4935a40f4bb36410ee24654c114cd718bea878742c703dc5abddbdbfa"
378+
"17d12328a2a6bb9d6e80dc0bc224eef03128625977a1e2c1d189336e303567d7"
379+
"442488538f42dc01",
380+
),
381+
id="mod-136-even-ctz-40",
382+
),
383+
pytest.param(
384+
ModExpInput(
385+
base="03",
386+
exponent="0600",
387+
modulus=216 * "ff" + 48 * "00",
388+
),
389+
ModExpOutput(
390+
returned_data="b2eb4387ee3ad0b4cfe1e05b3962718e2de238b02cc2c2ce80ae1a3c13ffe387"
391+
"2a5b829fc77634ec4b2d07f57862a019d4e7a3dc035851d60a4dabfed7bc5a2d"
392+
"44d5f7840e621678a3dbfeb9c37a78350e7f98e1440cc8d7d601be78db75e3ed"
393+
"79a1b5200f3290263da23ee75df076a34b600b670226e21aee2ccfaa51aa7ad2"
394+
"76b55e50ca6c4854070e5f115a377f2b4177fd5f3803408989454bf61789f4b1"
395+
"4241d7e0cf2606929f8d5da04c743e3b44a9d692e60bfcd077ab7cc8ad3d70ec"
396+
"eac9a053acb9f436612e986706f715c3580fbe4b0485724f9363912131c1dedb"
397+
"9706f4241afc62d706153951fe69b5b5b754d8301063494791b58250ebf50ad9"
398+
"a78f7be54b95b801",
399+
),
400+
id="mod-264-even-ctz-48",
401+
),
321402
],
322403
ids=lambda param: param.__repr__(), # only required to remove parameter
323404
# names (input/output)

0 commit comments

Comments
 (0)