From d7505640c37f20e8c80c8aa6e0e6aeb4dc30c00a Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 1 Nov 2023 09:08:43 +0400 Subject: [PATCH] replace deal_id with id in market events --- actors/market/src/emit.rs | 12 ++++-------- actors/market/tests/cron_tick_deal_expiry.rs | 12 ++---------- actors/market/tests/harness.rs | 11 ++++------- actors/market/tests/market_actor_test.rs | 14 +++++--------- actors/market/tests/on_miner_sectors_terminate.rs | 2 +- .../market/tests/publish_storage_deals_failures.rs | 2 +- 6 files changed, 17 insertions(+), 36 deletions(-) diff --git a/actors/market/src/emit.rs b/actors/market/src/emit.rs index 0ce3145e0..b1548bfd3 100644 --- a/actors/market/src/emit.rs +++ b/actors/market/src/emit.rs @@ -15,28 +15,24 @@ pub fn deal_published( .typ("deal-published") .field_indexed("client", &client) .field_indexed("provider", &provider) - .field_indexed("deal_id", &deal_id) + .field_indexed("id", &deal_id) .build()?, ) } /// Indicates a deal has been activated. pub fn deal_activated(rt: &impl Runtime, deal_id: DealID) -> Result<(), ActorError> { - rt.emit_event( - &EventBuilder::new().typ("deal-activated").field_indexed("deal_id", &deal_id).build()?, - ) + rt.emit_event(&EventBuilder::new().typ("deal-activated").field_indexed("id", &deal_id).build()?) } /// Indicates a deal has been terminated. pub fn deal_terminated(rt: &impl Runtime, deal_id: DealID) -> Result<(), ActorError> { rt.emit_event( - &EventBuilder::new().typ("deal-terminated").field_indexed("deal_id", &deal_id).build()?, + &EventBuilder::new().typ("deal-terminated").field_indexed("id", &deal_id).build()?, ) } /// Indicates a deal has been completed successfully. pub fn deal_completed(rt: &impl Runtime, deal_id: DealID) -> Result<(), ActorError> { - rt.emit_event( - &EventBuilder::new().typ("deal-completed").field_indexed("deal_id", &deal_id).build()?, - ) + rt.emit_event(&EventBuilder::new().typ("deal-completed").field_indexed("id", &deal_id).build()?) } diff --git a/actors/market/tests/cron_tick_deal_expiry.rs b/actors/market/tests/cron_tick_deal_expiry.rs index 2eb074cd6..f00306abd 100644 --- a/actors/market/tests/cron_tick_deal_expiry.rs +++ b/actors/market/tests/cron_tick_deal_expiry.rs @@ -171,11 +171,7 @@ fn expired_deal_should_unlock_the_remaining_client_and_provider_locked_balance_a // move the current epoch so that deal is expired rt.expect_emitted_event( - EventBuilder::new() - .typ("deal-completed") - .field_indexed("deal_id", &deal_id) - .build() - .unwrap(), + EventBuilder::new().typ("deal-completed").field_indexed("id", &deal_id).build().unwrap(), ); rt.set_epoch(END_EPOCH + 1000); cron_tick(&rt); @@ -213,11 +209,7 @@ fn all_payments_are_made_for_a_deal_client_withdraws_collateral_and_client_accou // move the current epoch so that deal is expired rt.set_epoch(END_EPOCH + 100); rt.expect_emitted_event( - EventBuilder::new() - .typ("deal-completed") - .field_indexed("deal_id", &deal_id) - .build() - .unwrap(), + EventBuilder::new().typ("deal-completed").field_indexed("id", &deal_id).build().unwrap(), ); cron_tick(&rt); assert_eq!(deal_proposal.client_collateral, get_balance(&rt, &CLIENT_ADDR).balance); diff --git a/actors/market/tests/harness.rs b/actors/market/tests/harness.rs index a3bb16099..9b7370215 100644 --- a/actors/market/tests/harness.rs +++ b/actors/market/tests/harness.rs @@ -404,7 +404,7 @@ pub fn batch_activate_deals_raw( rt.expect_emitted_event( EventBuilder::new() .typ("deal-activated") - .field_indexed("deal_id", &deal_id) + .field_indexed("id", &deal_id) .build() .unwrap(), ); @@ -528,7 +528,7 @@ pub fn cron_tick_and_assert_balances( rt.expect_emitted_event( EventBuilder::new() .typ("deal-completed") - .field_indexed("deal_id", &deal_id) + .field_indexed("id", &deal_id) .build() .unwrap(), ); @@ -730,7 +730,7 @@ pub fn publish_deals( .typ("deal-published") .field_indexed("client", &deal.client.id().unwrap()) .field_indexed("provider", &deal.provider.id().unwrap()) - .field_indexed("deal_id", &deal_id) + .field_indexed("id", &deal_id) .build() .unwrap(), ); @@ -1197,10 +1197,7 @@ pub fn terminate_deals_raw( for deal_id in terminated_deals { rt.expect_emitted_event( - EventBuilder::new() - .typ("deal-terminated") - .field_indexed("deal_id", &deal_id) - .build()?, + EventBuilder::new().typ("deal-terminated").field_indexed("id", &deal_id).build()?, ); } diff --git a/actors/market/tests/market_actor_test.rs b/actors/market/tests/market_actor_test.rs index b62e9fa0e..ce3a30f1d 100644 --- a/actors/market/tests/market_actor_test.rs +++ b/actors/market/tests/market_actor_test.rs @@ -949,7 +949,7 @@ fn provider_and_client_addresses_are_resolved_before_persisting_state_and_sent_t .typ("deal-published") .field_indexed("client", &client_resolved.id().unwrap()) .field_indexed("provider", &provider_resolved.id().unwrap()) - .field_indexed("deal_id", &deal_id) + .field_indexed("id", &deal_id) .build() .unwrap(), ); @@ -1937,11 +1937,7 @@ fn locked_fund_tracking_states() { ); rt.expect_emitted_event( - EventBuilder::new() - .typ("deal-completed") - .field_indexed("deal_id", &deal_id2) - .build() - .unwrap(), + EventBuilder::new().typ("deal-completed").field_indexed("id", &deal_id2).build().unwrap(), ); cron_tick(&rt); assert_locked_fund_states(&rt, csf, plc, clc); @@ -2158,7 +2154,7 @@ fn insufficient_client_balance_in_a_batch() { .typ("deal-published") .field_indexed("client", &deal2.client.id().unwrap()) .field_indexed("provider", &deal2.provider.id().unwrap()) - .field_indexed("deal_id", &next_deal_id) + .field_indexed("id", &next_deal_id) .build() .unwrap(), ); @@ -2307,7 +2303,7 @@ fn insufficient_provider_balance_in_a_batch() { .typ("deal-published") .field_indexed("client", &deal2.client.id().unwrap()) .field_indexed("provider", &deal2.provider.id().unwrap()) - .field_indexed("deal_id", &next_deal_id) + .field_indexed("id", &next_deal_id) .build() .unwrap(), ); @@ -2459,7 +2455,7 @@ fn psd_restricted_correctly() { .typ("deal-published") .field_indexed("client", &deal.client.id().unwrap()) .field_indexed("provider", &deal.provider.id().unwrap()) - .field_indexed("deal_id", &next_deal_id) + .field_indexed("id", &next_deal_id) .build() .unwrap(), ); diff --git a/actors/market/tests/on_miner_sectors_terminate.rs b/actors/market/tests/on_miner_sectors_terminate.rs index 97fef51ec..a373a07ca 100644 --- a/actors/market/tests/on_miner_sectors_terminate.rs +++ b/actors/market/tests/on_miner_sectors_terminate.rs @@ -177,7 +177,7 @@ fn terminate_valid_deals_along_with_expired_and_cleaned_up_deal() { rt.expect_emitted_event( EventBuilder::new() .typ("deal-completed") - .field_indexed("deal_id", &deal_ids[1]) + .field_indexed("id", &deal_ids[1]) .build() .unwrap(), ); diff --git a/actors/market/tests/publish_storage_deals_failures.rs b/actors/market/tests/publish_storage_deals_failures.rs index edc32c860..939765af2 100644 --- a/actors/market/tests/publish_storage_deals_failures.rs +++ b/actors/market/tests/publish_storage_deals_failures.rs @@ -381,7 +381,7 @@ fn fail_when_deals_have_different_providers() { .typ("deal-published") .field_indexed("client", &deal1.client.id().unwrap()) .field_indexed("provider", &deal1.provider.id().unwrap()) - .field_indexed("deal_id", &next_deal_id) + .field_indexed("id", &next_deal_id) .build() .unwrap(), );