Skip to content
This repository was archived by the owner on Jul 2, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ def create_modexp_variable_gas_test_cases():
# Test case definitions: (base, exponent, modulus, expected_result, test_id)
test_cases = [
("", "", "", "", "Z0"),
("01" * 32, "00" * 32, "", "", "Z1"),
("01" * 1024, "00" * 32, "", "", "Z2"),
("01" * 32, "00" * 1024, "", "", "Z3"),
("01" * 32, "00" * 1023 + "01", "", "", "Z4"),
("", "", "01" * 32, "00" * 31 + "01", "Z5"),
("", "01" * 32, "01" * 32, "00" * 32, "Z6"),
("", "00" * 31 + "01", "01" * 1024, "00" * 1024, "Z7"),
("01" * 16, "00" * 16, "02" * 16, "00" * 15 + "01", "S0"),
("01" * 16, "00" * 15 + "03", "02" * 16, "01" * 16, "S1"),
("01" * 32, "FF" * 32, "02" * 32, "01" * 32, "S2"),
Expand All @@ -307,9 +314,14 @@ def create_modexp_variable_gas_test_cases():
("01" * 33, "01", "02" * 31, "00" * 29 + "01" * 2, "B2"),
("01" * 33, "01", "02" * 33, "01" * 33, "B4"),
# Zero value edge cases
("00" * 32, "00" * 32, "01" * 32, "00" * 31 + "01", "Z1"),
("01" * 32, "00" * 32, "00" * 32, "00" * 32, "Z2"),
("00" * 32, "01" * 32, "02" * 32, "00" * 32, "Z3"),
("00" * 32, "00" * 32, "01" * 32, "00" * 31 + "01", "Z8"),
("01" * 32, "00" * 32, "00" * 32, "00" * 32, "Z9"),
("00" * 32, "01" * 32, "02" * 32, "00" * 32, "Z10"),
("00" * 32, "00" * 33, "01" * 32, "00" * 31 + "01", "Z11"),
("00" * 32, "00" * 1024, "01" * 32, "00" * 31 + "01", "Z12"),
("00" * 1024, "00" * 32, "01" * 32, "00" * 31 + "01", "Z13"),
("01" * 32, "00" * 1024, "00" * 32, "00" * 32, "Z14"),
("01" * 32, "00" * 31 + "01", "00" * 1024, "00" * 1024, "Z15"),
# Maximum value stress tests
("FF" * 64, "FF" * 64, "FF" * 64, "00" * 64, "M1"),
("FF" * 32, "01", "FF" * 32, "00" * 32, "M2"),
Expand Down Expand Up @@ -356,6 +368,13 @@ def create_modexp_variable_gas_test_cases():
# β”‚ ID β”‚ Comp β”‚ Rel β”‚ Iter β”‚ Clamp β”‚ Gas β”‚ Description β”‚
# β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
# β”‚ Z0 β”‚ - β”‚ - β”‚ - β”‚ - β”‚ 500 β”‚ Zero case – empty inputs β”‚
# β”‚ Z1 β”‚ S β”‚ - β”‚ A β”‚ True β”‚ 500 β”‚ Non-zero base, zero exp, empty modulus β”‚
# β”‚ Z2 β”‚ L β”‚ - β”‚ A β”‚ False β”‚ 32768 β”‚ Large base (1024B), zero exp, empty modulus β”‚
# β”‚ Z3 β”‚ S β”‚ - β”‚ C β”‚ False β”‚253936 β”‚ Base, large zero exp (1024B), empty modulus β”‚
# β”‚ Z4 β”‚ S β”‚ - β”‚ D β”‚ False β”‚253952 β”‚ Base, large exp (last byte=1), empty modulus β”‚
# β”‚ Z5 β”‚ S β”‚ < β”‚ A β”‚ True β”‚ 500 β”‚ Empty base/exp, non-zero modulus only β”‚
# β”‚ Z6 β”‚ S β”‚ < β”‚ B β”‚ False β”‚ 3968 β”‚ Empty base, non-zero exp and modulus β”‚
# β”‚ Z7 β”‚ L β”‚ < β”‚ B β”‚ False β”‚ 32768 β”‚ Empty base, small exp, large modulus β”‚
# β”‚ S0 β”‚ S β”‚ = β”‚ A β”‚ True β”‚ 500 β”‚ Small, equal, zero exp, clamped β”‚
# β”‚ S1 β”‚ S β”‚ = β”‚ B β”‚ True β”‚ 500 β”‚ Small, equal, small exp, clamped β”‚
# β”‚ S2 β”‚ S β”‚ = β”‚ B β”‚ False β”‚ 4080 β”‚ Small, equal, large exp, unclamped β”‚
Expand All @@ -372,9 +391,14 @@ def create_modexp_variable_gas_test_cases():
# β”‚ B1 β”‚ L β”‚ < β”‚ B β”‚ True β”‚ 500 β”‚ Cross 32-byte boundary (31/33) β”‚
# β”‚ B2 β”‚ L β”‚ > β”‚ B β”‚ True β”‚ 500 β”‚ Cross 32-byte boundary (33/31) β”‚
# β”‚ B4 β”‚ L β”‚ = β”‚ B β”‚ True β”‚ 500 β”‚ Just over 32-byte boundary β”‚
# β”‚ Z1 β”‚ S β”‚ = β”‚ A β”‚ True β”‚ 500 β”‚ All zeros except modulus β”‚
# β”‚ Z2 β”‚ S β”‚ = β”‚ A β”‚ True β”‚ 500 β”‚ Zero modulus special case β”‚
# β”‚ Z3 β”‚ S β”‚ = β”‚ B β”‚ False β”‚ 3968 β”‚ Zero base, large exponent β”‚
# β”‚ Z8 β”‚ S β”‚ = β”‚ A β”‚ True β”‚ 500 β”‚ All zeros except modulus β”‚
# β”‚ Z9 β”‚ S β”‚ = β”‚ A β”‚ True β”‚ 500 β”‚ Zero modulus special case β”‚
# β”‚ Z10 β”‚ S β”‚ = β”‚ B β”‚ False β”‚ 3968 β”‚ Zero base, large exponent β”‚
# β”‚ Z11 β”‚ S β”‚ = β”‚ C β”‚ True β”‚ 500 β”‚ Zero base, 33B zero exp, non-zero modulus β”‚
# β”‚ Z12 β”‚ S β”‚ = β”‚ C β”‚ False β”‚253936 β”‚ Zero base, large zero exp, non-zero modulus β”‚
# β”‚ Z13 β”‚ L β”‚ > β”‚ A β”‚ False β”‚ 32768 β”‚ Large zero base, zero exp, non-zero modulus β”‚
# β”‚ Z14 β”‚ S β”‚ = β”‚ C β”‚ False β”‚253936 β”‚ Base, large zero exp, zero modulus β”‚
# β”‚ Z15 β”‚ L β”‚ < β”‚ B β”‚ False β”‚ 32768 β”‚ Base, small exp, large zero modulus β”‚
# β”‚ M1 β”‚ L β”‚ = β”‚ D β”‚ False β”‚ 98176 β”‚ Maximum values stress test β”‚
# β”‚ M2 β”‚ S β”‚ = β”‚ B β”‚ True β”‚ 500 β”‚ Max base/mod, small exponent β”‚
# β”‚ M3 β”‚ L β”‚ < β”‚ D β”‚ False β”‚ 98176 β”‚ Small base, max exponent/mod β”‚
Expand Down
Loading