diff --git a/core/lib/types/src/debug_flat_call.rs b/core/lib/types/src/debug_flat_call.rs index 5809026e521c..3488b0e5b42c 100644 --- a/core/lib/types/src/debug_flat_call.rs +++ b/core/lib/types/src/debug_flat_call.rs @@ -16,6 +16,7 @@ pub struct DebugCallFlat { pub action: Action, pub result: Option, pub subtraces: usize, + pub error: Option, pub trace_address: Vec, pub transaction_position: usize, pub transaction_hash: H256, diff --git a/core/node/api_server/src/web3/namespaces/debug.rs b/core/node/api_server/src/web3/namespaces/debug.rs index 726f35ac29a9..4fd32c1b5223 100644 --- a/core/node/api_server/src/web3/namespaces/debug.rs +++ b/core/node/api_server/src/web3/namespaces/debug.rs @@ -96,13 +96,16 @@ impl DebugNamespace { CallType::NearCall => unreachable!("We have to filter our near calls before"), }; - let result = if call.error.is_none() { - Some(CallResult { - output: web3::Bytes::from(call.output), - gas_used: U256::from(call.gas_used), - }) + let (result, error) = if let Some(error) = call.revert_reason { + (None, Some(error)) } else { - None + ( + Some(CallResult { + output: web3::Bytes::from(call.output), + gas_used: U256::from(call.gas_used), + }), + None, + ) }; calls.push(DebugCallFlat { @@ -116,6 +119,7 @@ impl DebugNamespace { }, result, subtraces, + error, trace_address: trace_address.clone(), // Clone the current trace address transaction_position: meta.index_in_block, transaction_hash: meta.tx_hash,