Skip to content

Commit

Permalink
fix(tracer): adds vm error to error field if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter committed Dec 10, 2024
1 parent f6422cd commit 95fadf1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions core/node/api_server/src/web3/namespaces/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,22 @@ impl DebugNamespace {
CallType::NearCall => unreachable!("We have to filter our near calls before"),
};

let (result, error) = if let Some(error) = call.revert_reason {
(None, Some(error))
} else {
(
let (result, error) = match (call.revert_reason, call.error) {
(Some(revert_reason), _) => {
// If revert_reason exists, it takes priority over VM error
(None, Some(revert_reason))
}
(None, Some(vm_error)) => {
// If no revert_reason but VM error exists
(None, Some(vm_error))
}
(None, None) => (
Some(CallResult {
output: web3::Bytes::from(call.output),
gas_used: U256::from(call.gas_used),
}),
None,
)
),
};

calls.push(DebugCallFlat {
Expand Down

0 comments on commit 95fadf1

Please sign in to comment.