Skip to content

Commit

Permalink
Merge branch 'develop' into fix/139/configure-time-units-for-testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
th7nder authored Jul 22, 2024
2 parents 0b8439f + 5457501 commit 28ec866
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pallets/market/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ pub mod pallet {
unsuccessful: BoundedVec<(DealId, DealSettlementError), MaxSettleDeals<T>>,
},
/// Deal was slashed.
/// It means that the `provider_collateral` was burned and the entire client's lockup returned.
///
/// Currently it's emitted only when a deal was supposed to be activated on a given block, but was not.
/// [`Hooks::on_finalize`] checks deals and slashes them when necessary.
DealSlashed(DealId),

/// Deal has been terminated.
Expand Down Expand Up @@ -1418,6 +1422,8 @@ pub mod pallet {
log::error!(target: LOG_TARGET, "on_finalize: invariant violated, cannot slash the deal {}", deal_id);
continue;
};

Self::deposit_event(Event::<T>::DealSlashed(deal_id));
}
DealState::Active(_) => {
log::info!(
Expand Down
10 changes: 10 additions & 0 deletions pallets/market/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,16 @@ fn verifies_deals_on_block_finalization() {
);

assert!(!DealsForBlock::<Test>::get(&bob_start_block).contains(&bob_deal_id));
assert_eq!(
events(),
[
RuntimeEvent::Balances(pallet_balances::Event::<Test>::Withdraw {
who: Market::account_id(),
amount: 15
}),
RuntimeEvent::Market(Event::<Test>::DealSlashed(bob_deal_id))
]
)
});
}

Expand Down

0 comments on commit 28ec866

Please sign in to comment.