@@ -3414,6 +3414,8 @@ enum GasEstimationCallResult {
34143414}
34153415
34163416/// Converts the result of a call to revm EVM into a [`GasEstimationCallResult`].
3417+ ///
3418+ /// Expected to stay up to date with: <https://github.com/bluealloy/revm/blob/main/crates/interpreter/src/instruction_result.rs>
34173419impl TryFrom < Result < ( InstructionResult , Option < Output > , u128 , State ) > > for GasEstimationCallResult {
34183420 type Error = BlockchainError ;
34193421
@@ -3427,20 +3429,26 @@ impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEs
34273429 Ok ( ( exit, output, gas, _) ) => match exit {
34283430 return_ok ! ( ) | InstructionResult :: CallOrCreate => Ok ( Self :: Success ( gas) ) ,
34293431
3432+ // Revert opcodes:
34303433 InstructionResult :: Revert => Ok ( Self :: Revert ( output. map ( |o| o. into_data ( ) ) ) ) ,
3434+ InstructionResult :: CallTooDeep |
3435+ InstructionResult :: OutOfFunds |
3436+ InstructionResult :: CreateInitCodeStartingEF00 |
3437+ InstructionResult :: InvalidEOFInitCode |
3438+ InstructionResult :: InvalidExtDelegateCallTarget => Ok ( Self :: EvmError ( exit) ) ,
34313439
3440+ // Out of gas errors:
34323441 InstructionResult :: OutOfGas |
34333442 InstructionResult :: MemoryOOG |
34343443 InstructionResult :: MemoryLimitOOG |
34353444 InstructionResult :: PrecompileOOG |
34363445 InstructionResult :: InvalidOperandOOG |
34373446 InstructionResult :: ReentrancySentryOOG => Ok ( Self :: OutOfGas ) ,
34383447
3448+ // Other errors:
34393449 InstructionResult :: OpcodeNotFound |
34403450 InstructionResult :: CallNotAllowedInsideStatic |
34413451 InstructionResult :: StateChangeDuringStaticCall |
3442- InstructionResult :: InvalidExtDelegateCallTarget |
3443- InstructionResult :: InvalidEXTCALLTarget |
34443452 InstructionResult :: InvalidFEOpcode |
34453453 InstructionResult :: InvalidJump |
34463454 InstructionResult :: NotActivated |
@@ -3455,17 +3463,12 @@ impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEs
34553463 InstructionResult :: CreateContractStartingWithEF |
34563464 InstructionResult :: CreateInitCodeSizeLimit |
34573465 InstructionResult :: FatalExternalError |
3458- InstructionResult :: OutOfFunds |
3459- InstructionResult :: CallTooDeep => Ok ( Self :: EvmError ( exit) ) ,
3460-
3461- // Handle Revm EOF InstructionResults: not supported
34623466 InstructionResult :: ReturnContractInNotInitEOF |
34633467 InstructionResult :: EOFOpcodeDisabledInLegacy |
34643468 InstructionResult :: SubRoutineStackOverflow |
3465- InstructionResult :: CreateInitCodeStartingEF00 |
3466- InstructionResult :: InvalidEOFInitCode |
34673469 InstructionResult :: EofAuxDataOverflow |
3468- InstructionResult :: EofAuxDataTooSmall => Ok ( Self :: EvmError ( exit) ) ,
3470+ InstructionResult :: EofAuxDataTooSmall |
3471+ InstructionResult :: InvalidEXTCALLTarget => Ok ( Self :: EvmError ( exit) ) ,
34693472 } ,
34703473 }
34713474 }
0 commit comments