From 615d759a9d5cb08b1fc638be974251961f62304e Mon Sep 17 00:00:00 2001 From: metaproph3t Date: Mon, 31 Oct 2022 02:45:26 +0000 Subject: [PATCH] chore: slightly improve readability of account number validation --- dex/src/state.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dex/src/state.rs b/dex/src/state.rs index d42f800e..febef06c 100644 --- a/dex/src/state.rs +++ b/dex/src/state.rs @@ -1740,7 +1740,8 @@ pub(crate) mod account_parser { f: impl FnOnce(SendTakeArgs) -> DexResult, ) -> DexResult { const MIN_ACCOUNTS: usize = 12; - check_assert!(accounts.len() == MIN_ACCOUNTS || accounts.len() == MIN_ACCOUNTS + 1)?; + const MAX_ACCOUNTS: usize = 13; + check_assert!(accounts.len() >= MIN_ACCOUNTS && accounts.len() <= MAX_ACCOUNTS)?; let (fixed_accounts, fee_discount_account): ( &'a [AccountInfo<'b>; MIN_ACCOUNTS], &'a [AccountInfo<'b>], @@ -1833,11 +1834,8 @@ pub(crate) mod account_parser { f: impl FnOnce(NewOrderV3Args) -> DexResult, ) -> DexResult { const MIN_ACCOUNTS: usize = 12; - check_assert!( - accounts.len() == MIN_ACCOUNTS - || accounts.len() == MIN_ACCOUNTS + 1 - || accounts.len() == MIN_ACCOUNTS + 2 - )?; + const MAX_ACCOUNTS: usize = 14; + check_assert!(accounts.len() >= MIN_ACCOUNTS && accounts.len() <= MAX_ACCOUNTS)?; let (fixed_accounts, fee_discount_account): ( &'a [AccountInfo<'b>; MIN_ACCOUNTS], &'a [AccountInfo<'b>],