From c90fafe2b6f82597de24a6b2e196ab828dcff511 Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Thu, 18 Jan 2024 20:06:10 +0400 Subject: [PATCH] changes as per steb's review --- actors/market/src/lib.rs | 8 ++++---- actors/miner/src/lib.rs | 5 +++-- actors/verifreg/src/lib.rs | 3 ++- integration_tests/src/tests/terminate_test.rs | 7 +------ 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/actors/market/src/lib.rs b/actors/market/src/lib.rs index 68332c8e2..81fc860cf 100644 --- a/actors/market/src/lib.rs +++ b/actors/market/src/lib.rs @@ -54,7 +54,7 @@ pub mod policy; pub mod testing; mod deal; -pub mod emit; +mod emit; mod state; mod types; @@ -470,13 +470,13 @@ impl Actor { // notify clients, any failures cause the entire publish_storage_deals method to fail // it's unsafe to ignore errors here, since that could be used to attack storage contract clients // that might be unaware they're making storage deals - for (i, valid_deal) in valid_deals.iter().enumerate() { + for (valid_deal, &deal_id) in valid_deals.iter().zip(&new_deal_ids) { _ = extract_send_result(rt.send_simple( &valid_deal.proposal.client, MARKET_NOTIFY_DEAL_METHOD, IpldBlock::serialize_cbor(&MarketNotifyDealParams { proposal: valid_deal.serialized_proposal.to_vec(), - deal_id: new_deal_ids[i], + deal_id, })?, TokenAmount::zero(), )) @@ -488,7 +488,7 @@ impl Actor { rt, valid_deal.proposal.client.id().unwrap(), valid_deal.proposal.provider.id().unwrap(), - new_deal_ids[i], + deal_id, )?; } diff --git a/actors/miner/src/lib.rs b/actors/miner/src/lib.rs index 35c84d659..5673029b8 100644 --- a/actors/miner/src/lib.rs +++ b/actors/miner/src/lib.rs @@ -91,7 +91,7 @@ pub mod testing; mod types; mod vesting_state; -pub mod emit; +mod emit; /// Storage Miner actor methods available #[derive(FromPrimitive)] @@ -1026,7 +1026,8 @@ impl Actor { .context_code(ExitCode::USR_ILLEGAL_STATE, "failed to load sectors array")?; let mut sector_infos = Vec::with_capacity(params.sector_updates.len()); let mut updates = Vec::with_capacity(params.sector_updates.len()); - let mut sector_commds: HashMap = HashMap::new(); + let mut sector_commds: HashMap = + HashMap::with_capacity(params.sector_updates.len()); for (i, update) in params.sector_updates.iter().enumerate() { sector_infos.push(sectors.must_get(update.sector)?); let sector_type = sector_infos.last().unwrap().seal_proof; diff --git a/actors/verifreg/src/lib.rs b/actors/verifreg/src/lib.rs index 31661fda6..d44cfa974 100644 --- a/actors/verifreg/src/lib.rs +++ b/actors/verifreg/src/lib.rs @@ -42,7 +42,8 @@ pub use self::types::*; #[cfg(feature = "fil-actor")] fil_actors_runtime::wasm_trampoline!(Actor); -pub mod emit; +mod emit; + pub mod expiration; pub mod ext; pub mod state; diff --git a/integration_tests/src/tests/terminate_test.rs b/integration_tests/src/tests/terminate_test.rs index 1b24593d5..120043ae1 100644 --- a/integration_tests/src/tests/terminate_test.rs +++ b/integration_tests/src/tests/terminate_test.rs @@ -276,12 +276,7 @@ pub fn terminate_sectors_test(v: &dyn VM) { Expect::power_current_total(miner_id), Expect::burn(miner_id, None), Expect::power_update_pledge(miner_id, None), - Expect::market_sectors_terminate( - miner_id, - epoch, - [sector_number].to_vec(), - deal_clients, - ), + Expect::market_sectors_terminate(miner_id, epoch, vec![sector_number], deal_clients), Expect::power_update_claim(miner_id, sector_power.neg()), ]), events: vec![expect_event],