@@ -3414,6 +3414,8 @@ enum GasEstimationCallResult {
3414
3414
}
3415
3415
3416
3416
/// 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>
3417
3419
impl TryFrom < Result < ( InstructionResult , Option < Output > , u128 , State ) > > for GasEstimationCallResult {
3418
3420
type Error = BlockchainError ;
3419
3421
@@ -3427,20 +3429,26 @@ impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEs
3427
3429
Ok ( ( exit, output, gas, _) ) => match exit {
3428
3430
return_ok ! ( ) | InstructionResult :: CallOrCreate => Ok ( Self :: Success ( gas) ) ,
3429
3431
3432
+ // Revert opcodes:
3430
3433
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) ) ,
3431
3439
3440
+ // Out of gas errors:
3432
3441
InstructionResult :: OutOfGas |
3433
3442
InstructionResult :: MemoryOOG |
3434
3443
InstructionResult :: MemoryLimitOOG |
3435
3444
InstructionResult :: PrecompileOOG |
3436
3445
InstructionResult :: InvalidOperandOOG |
3437
3446
InstructionResult :: ReentrancySentryOOG => Ok ( Self :: OutOfGas ) ,
3438
3447
3448
+ // Other errors:
3439
3449
InstructionResult :: OpcodeNotFound |
3440
3450
InstructionResult :: CallNotAllowedInsideStatic |
3441
3451
InstructionResult :: StateChangeDuringStaticCall |
3442
- InstructionResult :: InvalidExtDelegateCallTarget |
3443
- InstructionResult :: InvalidEXTCALLTarget |
3444
3452
InstructionResult :: InvalidFEOpcode |
3445
3453
InstructionResult :: InvalidJump |
3446
3454
InstructionResult :: NotActivated |
@@ -3455,17 +3463,12 @@ impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEs
3455
3463
InstructionResult :: CreateContractStartingWithEF |
3456
3464
InstructionResult :: CreateInitCodeSizeLimit |
3457
3465
InstructionResult :: FatalExternalError |
3458
- InstructionResult :: OutOfFunds |
3459
- InstructionResult :: CallTooDeep => Ok ( Self :: EvmError ( exit) ) ,
3460
-
3461
- // Handle Revm EOF InstructionResults: not supported
3462
3466
InstructionResult :: ReturnContractInNotInitEOF |
3463
3467
InstructionResult :: EOFOpcodeDisabledInLegacy |
3464
3468
InstructionResult :: SubRoutineStackOverflow |
3465
- InstructionResult :: CreateInitCodeStartingEF00 |
3466
- InstructionResult :: InvalidEOFInitCode |
3467
3469
InstructionResult :: EofAuxDataOverflow |
3468
- InstructionResult :: EofAuxDataTooSmall => Ok ( Self :: EvmError ( exit) ) ,
3470
+ InstructionResult :: EofAuxDataTooSmall |
3471
+ InstructionResult :: InvalidEXTCALLTarget => Ok ( Self :: EvmError ( exit) ) ,
3469
3472
} ,
3470
3473
}
3471
3474
}
0 commit comments