From a7f352b0df5fbcde114ecc8ed5af0e34d624548b Mon Sep 17 00:00:00 2001 From: bigzPubkey <83473873+0xbigz@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:01:29 -0400 Subject: [PATCH] bigz/add-validate_perp_market-in-update-max-imbalances (#667) * bigz/add-validate_perp_market-in-update-max-imbalances * update changelog --- CHANGELOG.md | 1 + programs/drift/src/instructions/admin.rs | 3 +++ 2 files changed, 4 insertions(+) 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(()) }