Skip to content

Commit

Permalink
Swallow deal termination error in cron (#1125)
Browse files Browse the repository at this point in the history
Co-authored-by: zenground0 <[email protected]>
  • Loading branch information
ZenGround0 and ZenGround0 authored Feb 10, 2023
1 parent 9ccfd89 commit 2d0b49c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions actors/miner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ use fil_actors_runtime::runtime::{ActorCode, DomainSeparationTag, Policy, Runtim
use fil_actors_runtime::{
actor_dispatch, actor_error, deserialize_block, extract_send_result, ActorContext,
ActorDowncast, ActorError, BURNT_FUNDS_ACTOR_ADDR, INIT_ACTOR_ADDR, REWARD_ACTOR_ADDR,
STORAGE_MARKET_ACTOR_ADDR, STORAGE_POWER_ACTOR_ADDR, VERIFIED_REGISTRY_ACTOR_ADDR,
STORAGE_MARKET_ACTOR_ADDR, STORAGE_POWER_ACTOR_ADDR, SYSTEM_ACTOR_ADDR,
VERIFIED_REGISTRY_ACTOR_ADDR,
};
use fvm_ipld_encoding::ipld_block::IpldBlock;
pub use monies::*;
Expand Down Expand Up @@ -4184,17 +4185,25 @@ fn request_terminate_deals(
deal_ids: Vec<DealID>,
) -> Result<(), ActorError> {
const MAX_LENGTH: usize = 8192;

for chunk in deal_ids.chunks(MAX_LENGTH) {
extract_send_result(rt.send_simple(
let res = extract_send_result(rt.send_simple(
&STORAGE_MARKET_ACTOR_ADDR,
ext::market::ON_MINER_SECTORS_TERMINATE_METHOD,
IpldBlock::serialize_cbor(&ext::market::OnMinerSectorsTerminateParamsRef {
epoch,
deal_ids: chunk,
})?,
TokenAmount::zero(),
))?;
));
// If running in a system / cron context intentionally swallow this error to prevent
// frozen market cron corruption from also freezing this miner cron.
if rt.message().origin() == SYSTEM_ACTOR_ADDR {
if let Err(e) = res {
error!("OnSectorsTerminate event failed from cron caller {}", e)
}
} else {
res?;
}
}

Ok(())
Expand Down

0 comments on commit 2d0b49c

Please sign in to comment.