fix: no value for staticcall call traces (#5117)

This commit is contained in:
Matthias Seitz
2023-10-21 11:43:26 +02:00
committed by GitHub
parent 33df4e5766
commit c6d279c01a

View File

@ -32,14 +32,22 @@ pub enum CallKind {
impl CallKind { impl CallKind {
/// Returns true if the call is a create /// Returns true if the call is a create
#[inline]
pub fn is_any_create(&self) -> bool { pub fn is_any_create(&self) -> bool {
matches!(self, CallKind::Create | CallKind::Create2) matches!(self, CallKind::Create | CallKind::Create2)
} }
/// Returns true if the call is a delegate of some sorts /// Returns true if the call is a delegate of some sorts
#[inline]
pub fn is_delegate(&self) -> bool { pub fn is_delegate(&self) -> bool {
matches!(self, CallKind::DelegateCall | CallKind::CallCode) matches!(self, CallKind::DelegateCall | CallKind::CallCode)
} }
/// Returns true if the call is [CallKind::StaticCall].
#[inline]
pub fn is_static_call(&self) -> bool {
matches!(self, CallKind::StaticCall)
}
} }
impl std::fmt::Display for CallKind { impl std::fmt::Display for CallKind {
@ -413,6 +421,11 @@ impl CallTraceNode {
logs: Default::default(), logs: Default::default(),
}; };
if self.trace.kind.is_static_call() {
// STATICCALL frames don't have a value
call_frame.value = None;
}
// we need to populate error and revert reason // we need to populate error and revert reason
if !self.trace.success { if !self.trace.success {
call_frame.revert_reason = decode_revert_reason(self.trace.output.as_ref()); call_frame.revert_reason = decode_revert_reason(self.trace.output.as_ref());