@@ -158,7 +158,7 @@ impl EstimationResult {
158158 Self :: Revert { limit, reason : output. clone ( ) , gas_used : * gas_used }
159159 }
160160 ExecutionResult :: Halt { reason, gas_used } => {
161- Self :: Halt { limit, reason : * reason, gas_used : * gas_used }
161+ Self :: Halt { limit, reason : reason. clone ( ) , gas_used : * gas_used }
162162 }
163163 }
164164 }
@@ -245,14 +245,11 @@ impl EstimationResult {
245245 }
246246
247247 /// Adjust the binary search range based on the estimation outcome.
248- pub ( crate ) const fn adjust_binary_search_range (
249- & self ,
250- range : & mut SearchRange ,
251- ) -> Result < ( ) , Self > {
248+ pub ( crate ) fn adjust_binary_search_range ( & self , range : & mut SearchRange ) -> Result < ( ) , Self > {
252249 match self {
253250 Self :: Success { limit, .. } => range. set_max ( * limit) ,
254251 Self :: Revert { limit, .. } => range. set_min ( * limit) ,
255- Self :: Halt { limit, reason, gas_used } => {
252+ Self :: Halt { limit, reason, .. } => {
256253 // Both `OutOfGas` and `InvalidEFOpcode` can occur dynamically
257254 // if the gas left is too low. Treat this as an out of gas
258255 // condition, knowing that the call succeeds with a
@@ -263,8 +260,7 @@ impl EstimationResult {
263260 if matches ! ( reason, HaltReason :: OutOfGas ( _) | HaltReason :: InvalidFEOpcode ) {
264261 range. set_min ( * limit) ;
265262 } else {
266- // NB: can't clone here as this is a const fn.
267- return Err ( Self :: Halt { limit : * limit, reason : * reason, gas_used : * gas_used } ) ;
263+ return Err ( self . clone ( ) ) ;
268264 }
269265 }
270266 }
0 commit comments