From 2fb109d83d1db294d158b7c7347a2815042db465 Mon Sep 17 00:00:00 2001 From: 0xbigz <83473873+0xbigz@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:43:58 -0400 Subject: [PATCH 1/2] bigz/add-validate_perp_market-in-update-max-imbalances --- programs/drift/src/instructions/admin.rs | 3 +++ 1 file changed, 3 insertions(+) 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(()) } From 41b9861e267ff0600f9f765d0d4f3dd3bffbc9da Mon Sep 17 00:00:00 2001 From: 0xbigz <83473873+0xbigz@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:45:09 -0400 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c14b8801c..1efa6678e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,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