Skip to content

Commit 2d7dac9

Browse files
committed
feat(tests): tests for modexp precompile (sizes & parities)
1 parent 946e8be commit 2d7dac9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/byzantium/eip198_modexp_precompile/test_modexp.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,37 @@
145145
),
146146
id="EIP-198-case5-raw-input",
147147
),
148+
# different declared moduli lengths and parities
149+
pytest.param(
150+
ModExpInput(
151+
base="1234",
152+
exponent="234",
153+
modulus="1000",
154+
declared_modulus_length=256,
155+
),
156+
ModExpOutput(
157+
returned_data=Bytes(
158+
"07be9ec040921bf6ffa9faad54b5e88c503ea4511cc15505e36fc9569cf20698"
159+
"933819b8c4b15e52a51f64261954708f55432c5a7011dc7d1787c64a8ece6f20"
160+
"65772d1dbc3ea9e96e3f55eeec7477bc92cb587ae416c8316fb3fa825ee25410"
161+
"811fad4f98ade2eaa665b48e930247bb30b25100000000000000000000000000"
162+
+ (256 - 4 * 32)
163+
* "00"
164+
)
165+
),
166+
id="EIP-198-case1-mod-power2-declared-length-256-bytes",
167+
),
168+
pytest.param(
169+
ModExpInput(
170+
base="1234",
171+
exponent="234",
172+
modulus="1010",
173+
declared_modulus_length=128,
174+
),
175+
ModExpOutput(returned_data=Bytes("00") + Bytes(hex(2**1014))),
176+
id="EIP-198-case1-mod-even-declared-length-128-bytes",
177+
),
178+
# out of gas cases
148179
pytest.param(
149180
Bytes(
150181
"0000000000000000000000000000000000000000000000000000000000000001"

0 commit comments

Comments
 (0)