@@ -59,58 +59,9 @@ def test_vectors_from_legacy_tests(
59
59
)
60
60
61
61
62
- def create_modexp_input (
63
- bsize : int , esize : int , msize : int , e_data : str = "" , m_data : str = "" , b_data : str = ""
64
- ) -> bytes :
65
- """
66
- Create ModExp input data with specified sizes and data.
67
-
68
- Args:
69
- bsize: Base size in bytes
70
- esize: Exponent size in bytes
71
- msize: Modulus size in bytes
72
- e_data: Exponent data (hex string, if not provided, will be padded with FF)
73
- m_data: Modulus data (hex string, if not provided, will be padded with FF)
74
- b_data: Base data (hex string, if not provided, will be padded with FF)
75
-
76
- Returns:
77
- ModExp input as bytes
78
-
79
- """
80
- e_padded = "FF" * esize if not e_data else e_data
81
- m_padded = "FF" * msize if not m_data else m_data
82
- b_padded = "FF" * bsize if not b_data else b_data
83
-
84
- # Format sizes as 32-byte hex strings
85
- bsize_hex = format (bsize , "032x" )
86
- esize_hex = format (esize , "032x" )
87
- msize_hex = format (msize , "032x" )
88
-
89
- # Concatenate all parts
90
- input_hex = bsize_hex + esize_hex + msize_hex + e_padded + m_padded + b_padded
91
- return bytes .fromhex (input_hex )
92
-
93
-
94
62
@pytest .mark .parametrize (
95
63
"modexp_input," ,
96
64
[
97
- pytest .param (bytes (), id = "zero-length-calldata" ),
98
- pytest .param (
99
- create_modexp_input (10 , 11 , 12 , b_data = "FF" * 9 ),
100
- id = "b-too-short" ,
101
- ),
102
- pytest .param (
103
- create_modexp_input (10 , 11 , 12 , m_data = "FF" * 10 ),
104
- id = "m-too-short" ,
105
- ),
106
- pytest .param (
107
- create_modexp_input (10 , 11 , 12 , e_data = "FF" * 11 ),
108
- id = "e-too-short" ,
109
- ),
110
- pytest .param (
111
- create_modexp_input (0 , 0 , 0 ),
112
- id = "all-zeros" ,
113
- ),
114
65
# These invalid inputs are from EIP-7823.
115
66
# Ref: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7823.md#analysis
116
67
pytest .param (
0 commit comments