diff --git a/actors/market/src/lib.rs b/actors/market/src/lib.rs index 1946f0db05..3275f3e569 100644 --- a/actors/market/src/lib.rs +++ b/actors/market/src/lib.rs @@ -1005,6 +1005,7 @@ impl Actor { rt: &impl Runtime, params: ProcessDealsParams, ) -> Result { + rt.validate_immediate_caller_accept_any()?; let curr_epoch = rt.curr_epoch(); let mut total_slashed = TokenAmount::zero(); let mut expired_deals: Vec = Vec::new(); diff --git a/actors/market/src/state.rs b/actors/market/src/state.rs index 2d82b92b5d..98a9159835 100644 --- a/actors/market/src/state.rs +++ b/actors/market/src/state.rs @@ -675,13 +675,9 @@ impl State { let ever_slashed = state.slash_epoch != EPOCH_UNDEFINED; if !ever_updated { - self.remove_pending_deal(store, *deal_cid)?.ok_or_else(|| { - actor_error!( - illegal_state, - "failed to delete pending proposal: cid {} does not exist", - deal_cid - ) - })?; + // pending deal might have already been removed in first cron_tick, so we don't care if + // it's already missing + self.remove_pending_deal(store, *deal_cid)?; } // if the deal was ever updated, make sure it didn't happen in the future diff --git a/integration_tests/src/tests/verified_claim_test.rs b/integration_tests/src/tests/verified_claim_test.rs index 0389ac0b7f..c1e0e2d12d 100644 --- a/integration_tests/src/tests/verified_claim_test.rs +++ b/integration_tests/src/tests/verified_claim_test.rs @@ -34,9 +34,9 @@ use crate::util::{ advance_by_deadline_to_index, advance_to_proving_deadline, assert_invariants, create_accounts, create_miner, cron_tick, datacap_extend_claim, datacap_get_balance, expect_invariants, invariant_failure_patterns, market_add_balance, market_publish_deal, - miner_extend_sector_expiration2, miner_precommit_sector, miner_prove_sector, sector_deadline, - submit_windowed_post, verifreg_add_client, verifreg_add_verifier, verifreg_extend_claim_terms, - verifreg_remove_expired_allocations, + miner_extend_sector_expiration2, miner_precommit_sector, miner_prove_sector, + provider_process_deal_updates, sector_deadline, submit_windowed_post, verifreg_add_client, + verifreg_add_verifier, verifreg_extend_claim_terms, verifreg_remove_expired_allocations, }; /// Tests a scenario involving a verified deal from the built-in market, with associated @@ -356,6 +356,10 @@ pub fn verified_claim_scenario_test(v: &dyn VM) { assert_eq!(vec![claim_id], ret.considered); assert!(ret.results.all_ok(), "results had failures {}", ret.results); + // provider must process the deals to receive payment and cleanup state + provider_process_deal_updates(v, &miner_id, &deals); + // TODO: assert that the right payouts have been made + expect_invariants( v, &Policy::default(), diff --git a/integration_tests/src/util/workflows.rs b/integration_tests/src/util/workflows.rs index 3726bbabf4..bec453dc94 100644 --- a/integration_tests/src/util/workflows.rs +++ b/integration_tests/src/util/workflows.rs @@ -1,5 +1,6 @@ use std::cmp::min; +use fil_actor_market::ProcessDealsParams; use frc46_token::receiver::FRC46TokenReceived; use frc46_token::receiver::FRC46_TOKEN_TYPE; use frc46_token::token::types::TransferFromParams; @@ -523,6 +524,18 @@ pub fn miner_extend_sector_expiration2( .matches(v.take_invocations().last().unwrap()); } +pub fn provider_process_deal_updates(v: &dyn VM, provider: &Address, deals: &[DealID]) { + let params = ProcessDealsParams { deal_ids: deals.to_vec() }; + apply_ok( + v, + provider, + &STORAGE_MARKET_ACTOR_ADDR, + &TokenAmount::zero(), + MarketMethod::ProcessDealUpdatesExported as u64, + Some(params), + ); +} + pub fn advance_by_deadline_to_epoch(v: &dyn VM, maddr: &Address, e: ChainEpoch) -> DeadlineInfo { // keep advancing until the epoch of interest is within the deadline // if e is dline.last() == dline.close -1 cron is not run