diff --git a/crates/primitives/src/result.rs b/crates/primitives/src/result.rs index 514214ed46..0f2e8a0b16 100644 --- a/crates/primitives/src/result.rs +++ b/crates/primitives/src/result.rs @@ -24,7 +24,7 @@ pub enum ExecutionResult { output: Output, }, /// Reverted by `REVERT` opcode that doesn't spend all gas. - Revert { gas_used: u64 }, + Revert { gas_used: u64, output: Bytes }, /// Reverted for various reasons and spend all gas. Halt { reason: Halt, @@ -51,7 +51,7 @@ impl ExecutionResult { pub fn gas_used(&self) -> u64 { let (Self::Success { gas_used, .. } - | Self::Revert { gas_used } + | Self::Revert { gas_used, .. } | Self::Halt { gas_used, .. }) = self; *gas_used diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 7a3b952cf7..458e4b7cd2 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -212,7 +212,13 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> Transact logs, output, }, - SuccessOrHalt::Revert => ExecutionResult::Revert { gas_used }, + SuccessOrHalt::Revert => ExecutionResult::Revert { + gas_used, + output: match output { + Output::Call(return_value) => return_value, + Output::Create(return_value, _) => return_value, + }, + }, SuccessOrHalt::Halt(reason) => ExecutionResult::Halt { reason, gas_used }, SuccessOrHalt::FatalExternalError => { return Err(EVMError::Database(self.data.error.take().unwrap()))