File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/ethereum/osaka/vm/precompiled_contracts Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,11 @@ def complexity(base_length: U256, modulus_length: U256) -> Uint:
95
95
"""
96
96
max_length = max (Uint (base_length ), Uint (modulus_length ))
97
97
words = (max_length + Uint (7 )) // Uint (8 )
98
- return words ** Uint (2 )
98
+ complexity = words ** Uint (2 )
99
+ if max_length <= Uint (32 ):
100
+ return complexity
101
+ else :
102
+ return Uint (2 ) * complexity
99
103
100
104
101
105
def iterations (exponent_length : U256 , exponent_head : U256 ) -> Uint :
@@ -129,7 +133,7 @@ def iterations(exponent_length: U256, exponent_head: U256) -> Uint:
129
133
130
134
count = bit_length
131
135
else :
132
- length_part = Uint (8 ) * (Uint (exponent_length ) - Uint (32 ))
136
+ length_part = Uint (16 ) * (Uint (exponent_length ) - Uint (32 ))
133
137
bits_part = exponent_head .bit_length ()
134
138
135
139
if bits_part > Uint (0 ):
@@ -175,4 +179,4 @@ def gas_cost(
175
179
iteration_count = iterations (exponent_length , exponent_head )
176
180
cost = multiplication_complexity * iteration_count
177
181
cost //= GQUADDIVISOR
178
- return max (Uint (200 ), cost )
182
+ return max (Uint (500 ), cost )
You can’t perform that action at this time.
0 commit comments