diff --git a/CHANGELOG.md b/CHANGELOG.md index b91cb9787..cf33ffb0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - program: add positive perp funding rate offset ([#576](https://github.com/drift-labs/protocol-v2/pull/576/files)) ### Fixes +- program: add validation check in update max imbalances ([#667](https://github.com/drift-labs/protocol-v2/pull/667)) ### Breaking diff --git a/programs/drift/src/instructions/admin.rs b/programs/drift/src/instructions/admin.rs index a95eb279a..eeca06ad5 100644 --- a/programs/drift/src/instructions/admin.rs +++ b/programs/drift/src/instructions/admin.rs @@ -1424,6 +1424,9 @@ pub fn handle_update_perp_market_max_imbalances( perp_market.unrealized_pnl_max_imbalance = unrealized_max_imbalance; perp_market.insurance_claim.quote_max_insurance = quote_max_insurance; + // ensure altered max_revenue_withdraw_per_period doesn't break invariant check + crate::validation::perp_market::validate_perp_market(perp_market)?; + Ok(()) }