Skip to content

Commit

Permalink
Add support for actor upgrades (#1866)
Browse files Browse the repository at this point in the history
This PR adds support for actor upgrades through a new `sdk::actor::upgrade_actor` syscall. This allows actors to upgrade to a new version while still keeping the same address, balance, etc.

Instead of introducing a separate syscall to fetch `get_old_code_cid` this PR implements the alternative where we pass a upgrade metadata to the upgrade endpoint as proposed [here](filecoin-project/FIPs#396 (comment)).

fixes #171
  • Loading branch information
fridrik01 authored Oct 26, 2023
1 parent 1c13285 commit c412b3a
Show file tree
Hide file tree
Showing 37 changed files with 1,100 additions and 321 deletions.
24 changes: 24 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions fvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ cuda-supraseal = ["filecoin-proofs-api/cuda-supraseal"]
testing = []
arb = ["arbitrary", "quickcheck", "fvm_shared/arb", "cid/arb"]
m2-native = []
upgrade-actor = []
gas_calibration = []
10 changes: 6 additions & 4 deletions fvm/src/call_manager/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ use std::fmt::Display;

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

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 @@ -76,8 +78,8 @@ impl Backtrace {
pub struct Frame {
/// The actor that exited with this code.
pub source: ActorID,
/// The method that was invoked.
pub method: MethodNum,
/// The entrypoint that was invoked.
pub entrypoint: Entrypoint,
/// The exit code.
pub code: ExitCode,
/// The abort message.
Expand All @@ -90,7 +92,7 @@ impl Display for Frame {
f,
"{} (method {}) -- {} ({})",
Address::new_id(self.source),
self.method,
self.entrypoint,
&self.message,
self.code,
)
Expand Down
Loading

0 comments on commit c412b3a

Please sign in to comment.