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: use custom errors for the runtime #197

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion actors/runtime/src/builtin/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use fvm_shared::address::Address;
use fvm_shared::METHOD_SEND;

use crate::runtime::Runtime;
use anyhow::Context;

pub const HAMT_BIT_WIDTH: u32 = 5;

Expand All @@ -24,7 +25,7 @@ where

// send 0 balance to the account so an ID address for it is created and then try to resolve
rt.send(*address, METHOD_SEND, Default::default(), Default::default())
.map_err(|e| e.wrap(&format!("failed to send zero balance to address {}", address)))?;
.with_context(|| format!("failed to send zero balance to address {}", address))?;

rt.resolve_address(address).ok_or_else(|| {
anyhow::anyhow!(
Expand Down
3 changes: 2 additions & 1 deletion actors/runtime/src/runtime/actor_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ pub trait ActorCode {
// hold onto state between transactions.
// https://github.com/filecoin-project/builtin-actors/issues/133
BS: Blockstore + Clone,
RT: Runtime<BS>;
RT: Runtime<BS>,
ActorError: From<RT::Error>;
}
Loading