File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
programs/drift/src/controller Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
1414### Fixes
1515
16+ - program: safely use saturating sub number_of_users fields per market ([ #1616 ] ( https://github.com/drift-labs/protocol-v2/pull/1616 ) )
17+
1618### Breaking
1719
1820## [ 2.120.0] - 2025-04-29
Original file line number Diff line number Diff line change @@ -192,10 +192,10 @@ pub fn update_position_and_market(
192192 market. number_of_users_with_base = market. number_of_users_with_base . safe_add ( 1 ) ?;
193193 } else if let PositionUpdateType :: Close = update_type {
194194 if new_base_asset_amount == 0 && new_quote_asset_amount == 0 {
195- market. number_of_users = market. number_of_users . safe_sub ( 1 ) ? ;
195+ market. number_of_users = market. number_of_users . saturating_sub ( 1 ) ;
196196 }
197197
198- market. number_of_users_with_base = market. number_of_users_with_base . safe_sub ( 1 ) ? ;
198+ market. number_of_users_with_base = market. number_of_users_with_base . saturating_sub ( 1 ) ;
199199 }
200200
201201 market. amm . quote_asset_amount = market
You can’t perform that action at this time.
0 commit comments