Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert backtrace frame from entrypoint to method #1956

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions fvm/src/call_manager/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ use std::fmt::Display;

use fvm_shared::address::Address;
use fvm_shared::error::{ErrorNumber, ExitCode};
use fvm_shared::ActorID;
use fvm_shared::{ActorID, MethodNum};

use crate::kernel::SyscallError;

use super::Entrypoint;

/// A call backtrace records the actors an error was propagated through, from
/// the moment it was emitted. The original error is the _cause_. Backtraces are
/// useful for identifying the root cause of an error.
Expand Down Expand Up @@ -78,8 +76,8 @@ impl Backtrace {
pub struct Frame {
/// The actor that exited with this code.
pub source: ActorID,
/// The entrypoint that was invoked.
pub entrypoint: Entrypoint,
/// The method that was invoked.
pub method: MethodNum,
/// The exit code.
pub code: ExitCode,
/// The abort message.
Expand All @@ -92,7 +90,7 @@ impl Display for Frame {
f,
"{} (method {}) -- {} ({})",
Address::new_id(self.source),
self.entrypoint,
self.method,
&self.message,
self.code,
)
Expand Down
23 changes: 14 additions & 9 deletions fvm/src/call_manager/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,16 +859,21 @@ where
};

if !code.is_success() {
if let Some(err) = last_error {
cm.backtrace.begin(err);
// Only record backtrace frames for explicit messages sent by the user. We
// may want to record frames for failed upgrades, but that complicates
// things a bit and I'd like to keep this API the same for now.
if let &Entrypoint::Invoke(method) = &entrypoint {
if let Some(err) = last_error {
cm.backtrace.begin(err);
}

cm.backtrace.push_frame(Frame {
source: to,
method,
message,
code,
});
}

cm.backtrace.push_frame(Frame {
source: to,
entrypoint,
message,
code,
});
}

res
Expand Down