From 32b14c63e0acabdb0f55d18ec677437e2da9f42d Mon Sep 17 00:00:00 2001 From: Binye Barwe Date: Tue, 26 Dec 2023 23:49:25 +0100 Subject: [PATCH 1/5] remove event heap fee --- .../src/instructions/cancel_all_and_place_orders.rs | 5 ----- programs/openbook-v2/src/instructions/place_order.rs | 5 ----- .../openbook-v2/src/instructions/place_take_order.rs | 10 ---------- 3 files changed, 20 deletions(-) diff --git a/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs b/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs index ed256a760..5da945d35 100644 --- a/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs +++ b/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs @@ -29,7 +29,6 @@ pub fn cancel_all_and_place_orders( asks: ctx.accounts.asks.load_mut()?, }; let mut event_heap = ctx.accounts.event_heap.load_mut()?; - let event_heap_size_before = event_heap.len(); let now_ts: u64 = clock.unix_timestamp.try_into().unwrap(); @@ -126,10 +125,6 @@ pub fn cancel_all_and_place_orders( market.base_deposit_total += deposit_base_amount; market.quote_deposit_total += deposit_quote_amount; - if event_heap.len() > event_heap_size_before { - position.penalty_heap_count += 1; - } - token_transfer( deposit_quote_amount, &ctx.accounts.token_program, diff --git a/programs/openbook-v2/src/instructions/place_order.rs b/programs/openbook-v2/src/instructions/place_order.rs index 15428c5aa..52cfad407 100644 --- a/programs/openbook-v2/src/instructions/place_order.rs +++ b/programs/openbook-v2/src/instructions/place_order.rs @@ -37,7 +37,6 @@ pub fn place_order(ctx: Context, order: Order, limit: u8) -> Result< asks: ctx.accounts.asks.load_mut()?, }; let mut event_heap = ctx.accounts.event_heap.load_mut()?; - let event_heap_size_before = event_heap.len(); let now_ts: u64 = clock.unix_timestamp.try_into().unwrap(); @@ -100,10 +99,6 @@ pub fn place_order(ctx: Context, order: Order, limit: u8) -> Result< } }; - if event_heap.len() > event_heap_size_before { - position.penalty_heap_count += 1; - } - token_transfer( deposit_amount, &ctx.accounts.token_program, diff --git a/programs/openbook-v2/src/instructions/place_take_order.rs b/programs/openbook-v2/src/instructions/place_take_order.rs index 2e80b98d7..ab7be9d27 100644 --- a/programs/openbook-v2/src/instructions/place_take_order.rs +++ b/programs/openbook-v2/src/instructions/place_take_order.rs @@ -33,7 +33,6 @@ pub fn place_take_order<'info>( }; let mut event_heap = ctx.accounts.event_heap.load_mut()?; - let event_heap_size_before = event_heap.len(); let now_ts: u64 = clock.unix_timestamp.try_into().unwrap(); @@ -89,15 +88,6 @@ pub fn place_take_order<'info>( drop(market); - if event_heap.len() > event_heap_size_before { - system_program_transfer( - PENALTY_EVENT_HEAP, - &ctx.accounts.system_program, - &ctx.accounts.penalty_payer, - &ctx.accounts.market, - )?; - } - let (user_deposit_acc, user_withdraw_acc, market_deposit_acc, market_withdraw_acc) = match side { Side::Bid => ( From 47e1b5e103c343b987f715f3e201c6366576ee6e Mon Sep 17 00:00:00 2001 From: Binye Barwe Date: Wed, 27 Dec 2023 09:57:36 +0100 Subject: [PATCH 2/5] remove penalty fee payer --- lib/client/src/client.rs | 1 - lib/client/src/jup.rs | 1 - programs/openbook-v2/fuzz/Cargo.lock | 12 ++++++++++++ programs/openbook-v2/fuzz/src/lib.rs | 2 -- .../openbook-v2/src/accounts_ix/place_take_order.rs | 2 -- programs/openbook-v2/src/accounts_ix/settle_funds.rs | 2 -- .../src/accounts_ix/settle_funds_expired.rs | 3 --- .../openbook-v2/src/instructions/settle_funds.rs | 10 ---------- .../openbook-v2/src/state/open_orders_account.rs | 3 +-- programs/openbook-v2/tests/program_test/client.rs | 3 --- 10 files changed, 13 insertions(+), 26 deletions(-) diff --git a/lib/client/src/client.rs b/lib/client/src/client.rs index dc9ac3760..c6b29717a 100644 --- a/lib/client/src/client.rs +++ b/lib/client/src/client.rs @@ -541,7 +541,6 @@ impl OpenBookClient { anchor_lang::ToAccountMetas::to_account_metas( &openbook_v2::accounts::SettleFunds { owner: self.owner(), - penalty_payer: self.owner(), open_orders_account: self.open_orders_account, market: market_address, market_authority: market.market_authority, diff --git a/lib/client/src/jup.rs b/lib/client/src/jup.rs index 4c289a54f..518142996 100644 --- a/lib/client/src/jup.rs +++ b/lib/client/src/jup.rs @@ -205,7 +205,6 @@ impl Amm for OpenBookMarket { let accounts = PlaceTakeOrder { signer: *user_transfer_authority, - penalty_payer: *user_transfer_authority, market: self.key, market_authority: self.market.market_authority, bids: self.market.bids, diff --git a/programs/openbook-v2/fuzz/Cargo.lock b/programs/openbook-v2/fuzz/Cargo.lock index 256fa1b5b..cab94afd9 100644 --- a/programs/openbook-v2/fuzz/Cargo.lock +++ b/programs/openbook-v2/fuzz/Cargo.lock @@ -1005,6 +1005,17 @@ dependencies = [ "rayon", ] +[[package]] +name = "default-env" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f753eb82d29277e79efc625e84aecacfd4851ee50e05a8573a4740239a77bfd3" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "syn 0.15.44", +] + [[package]] name = "derivation-path" version = "0.2.0" @@ -2239,6 +2250,7 @@ dependencies = [ "arbitrary", "arrayref", "bytemuck", + "default-env", "derivative", "fixed", "itertools 0.10.5", diff --git a/programs/openbook-v2/fuzz/src/lib.rs b/programs/openbook-v2/fuzz/src/lib.rs index be364ce42..c8dc0539f 100644 --- a/programs/openbook-v2/fuzz/src/lib.rs +++ b/programs/openbook-v2/fuzz/src/lib.rs @@ -469,7 +469,6 @@ impl FuzzContext { let accounts = openbook_v2::accounts::PlaceTakeOrder { signer: user.owner, - penalty_payer: user.owner, user_base_account: user.base_vault, user_quote_account: user.quote_vault, market: self.market, @@ -765,7 +764,6 @@ impl FuzzContext { let accounts = openbook_v2::accounts::SettleFunds { owner: user.owner, - penalty_payer: user.owner, open_orders_account: user.open_orders, user_base_account: user.base_vault, user_quote_account: user.quote_vault, diff --git a/programs/openbook-v2/src/accounts_ix/place_take_order.rs b/programs/openbook-v2/src/accounts_ix/place_take_order.rs index f41a239ad..274cb22d4 100644 --- a/programs/openbook-v2/src/accounts_ix/place_take_order.rs +++ b/programs/openbook-v2/src/accounts_ix/place_take_order.rs @@ -8,8 +8,6 @@ use anchor_spl::token::{Token, TokenAccount}; pub struct PlaceTakeOrder<'info> { #[account(mut)] pub signer: Signer<'info>, - #[account(mut)] - pub penalty_payer: Signer<'info>, #[account( mut, diff --git a/programs/openbook-v2/src/accounts_ix/settle_funds.rs b/programs/openbook-v2/src/accounts_ix/settle_funds.rs index 50eb5ecc3..faa73800f 100644 --- a/programs/openbook-v2/src/accounts_ix/settle_funds.rs +++ b/programs/openbook-v2/src/accounts_ix/settle_funds.rs @@ -7,8 +7,6 @@ use anchor_spl::token::{Token, TokenAccount}; pub struct SettleFunds<'info> { #[account(mut)] pub owner: Signer<'info>, - #[account(mut)] - pub penalty_payer: Signer<'info>, #[account( mut, diff --git a/programs/openbook-v2/src/accounts_ix/settle_funds_expired.rs b/programs/openbook-v2/src/accounts_ix/settle_funds_expired.rs index 23f712547..34e754278 100644 --- a/programs/openbook-v2/src/accounts_ix/settle_funds_expired.rs +++ b/programs/openbook-v2/src/accounts_ix/settle_funds_expired.rs @@ -9,8 +9,6 @@ pub struct SettleFundsExpired<'info> { pub close_market_admin: Signer<'info>, #[account(mut)] pub owner: Signer<'info>, - #[account(mut)] - pub penalty_payer: Signer<'info>, #[account( mut, has_one = market, @@ -56,7 +54,6 @@ impl<'info> SettleFundsExpired<'info> { pub fn to_settle_funds_accounts(&self) -> SettleFunds<'info> { SettleFunds { owner: self.owner.clone(), - penalty_payer: self.penalty_payer.clone(), open_orders_account: self.open_orders_account.clone(), market: self.market.clone(), market_authority: self.market_authority.clone(), diff --git a/programs/openbook-v2/src/instructions/settle_funds.rs b/programs/openbook-v2/src/instructions/settle_funds.rs index 7f19b87e8..77d3a2bc7 100644 --- a/programs/openbook-v2/src/instructions/settle_funds.rs +++ b/programs/openbook-v2/src/instructions/settle_funds.rs @@ -34,16 +34,6 @@ pub fn settle_funds<'info>(ctx: Context<'_, '_, '_, 'info, SettleFunds<'info>>) drop(market); - if pa.penalty_heap_count > 0 { - system_program_transfer( - pa.penalty_heap_count * PENALTY_EVENT_HEAP, - &ctx.accounts.system_program, - &ctx.accounts.penalty_payer, - &ctx.accounts.market, - )?; - pa.penalty_heap_count = 0; - } - if let Some(referrer_account) = &ctx.accounts.referrer_account { token_transfer_signed( referrer_rebate, diff --git a/programs/openbook-v2/src/state/open_orders_account.rs b/programs/openbook-v2/src/state/open_orders_account.rs index 66a8d0767..67a87533b 100644 --- a/programs/openbook-v2/src/state/open_orders_account.rs +++ b/programs/openbook-v2/src/state/open_orders_account.rs @@ -340,8 +340,7 @@ pub struct Position { pub locked_maker_fees: u64, pub referrer_rebates_available: u64, - /// Count of ixs when events are added to the heap - /// To avoid this, send remaining accounts in order to process the events + /// Not implemented at the moment pub penalty_heap_count: u64, /// Cumulative maker volume in quote native units (display only) diff --git a/programs/openbook-v2/tests/program_test/client.rs b/programs/openbook-v2/tests/program_test/client.rs index 1255ecb6a..05698205d 100644 --- a/programs/openbook-v2/tests/program_test/client.rs +++ b/programs/openbook-v2/tests/program_test/client.rs @@ -589,7 +589,6 @@ impl ClientInstruction for PlaceTakeOrderInstruction { oracle_a: market.oracle_a.into(), oracle_b: market.oracle_b.into(), signer: self.signer.pubkey(), - penalty_payer: self.signer.pubkey(), user_base_account: self.user_base_account, user_quote_account: self.user_quote_account, market_base_vault: self.market_base_vault, @@ -834,7 +833,6 @@ impl ClientInstruction for SettleFundsInstruction { let market: Market = account_loader.load(&self.market).await.unwrap(); let accounts = Self::Accounts { owner: self.owner.pubkey(), - penalty_payer: self.owner.pubkey(), open_orders_account: self.open_orders_account, market: self.market, market_authority: market.market_authority, @@ -882,7 +880,6 @@ impl ClientInstruction for SettleFundsExpiredInstruction { let accounts = Self::Accounts { close_market_admin: self.close_market_admin.pubkey(), owner: self.owner.pubkey(), - penalty_payer: self.owner.pubkey(), open_orders_account: self.open_orders_account, market: self.market, market_authority: market.market_authority, From 2e3bd7585f01e8b1d451109d7a57b42c933afa3f Mon Sep 17 00:00:00 2001 From: Binye Barwe Date: Wed, 27 Dec 2023 10:37:53 +0100 Subject: [PATCH 3/5] Revert "remove penalty fee payer" This reverts commit 47e1b5e103c343b987f715f3e201c6366576ee6e. --- lib/client/src/client.rs | 1 + lib/client/src/jup.rs | 1 + programs/openbook-v2/fuzz/Cargo.lock | 12 ------------ programs/openbook-v2/fuzz/src/lib.rs | 2 ++ .../openbook-v2/src/accounts_ix/place_take_order.rs | 2 ++ programs/openbook-v2/src/accounts_ix/settle_funds.rs | 2 ++ .../src/accounts_ix/settle_funds_expired.rs | 3 +++ .../openbook-v2/src/instructions/settle_funds.rs | 10 ++++++++++ .../openbook-v2/src/state/open_orders_account.rs | 3 ++- programs/openbook-v2/tests/program_test/client.rs | 3 +++ 10 files changed, 26 insertions(+), 13 deletions(-) diff --git a/lib/client/src/client.rs b/lib/client/src/client.rs index c6b29717a..dc9ac3760 100644 --- a/lib/client/src/client.rs +++ b/lib/client/src/client.rs @@ -541,6 +541,7 @@ impl OpenBookClient { anchor_lang::ToAccountMetas::to_account_metas( &openbook_v2::accounts::SettleFunds { owner: self.owner(), + penalty_payer: self.owner(), open_orders_account: self.open_orders_account, market: market_address, market_authority: market.market_authority, diff --git a/lib/client/src/jup.rs b/lib/client/src/jup.rs index 518142996..4c289a54f 100644 --- a/lib/client/src/jup.rs +++ b/lib/client/src/jup.rs @@ -205,6 +205,7 @@ impl Amm for OpenBookMarket { let accounts = PlaceTakeOrder { signer: *user_transfer_authority, + penalty_payer: *user_transfer_authority, market: self.key, market_authority: self.market.market_authority, bids: self.market.bids, diff --git a/programs/openbook-v2/fuzz/Cargo.lock b/programs/openbook-v2/fuzz/Cargo.lock index cab94afd9..256fa1b5b 100644 --- a/programs/openbook-v2/fuzz/Cargo.lock +++ b/programs/openbook-v2/fuzz/Cargo.lock @@ -1005,17 +1005,6 @@ dependencies = [ "rayon", ] -[[package]] -name = "default-env" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f753eb82d29277e79efc625e84aecacfd4851ee50e05a8573a4740239a77bfd3" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", -] - [[package]] name = "derivation-path" version = "0.2.0" @@ -2250,7 +2239,6 @@ dependencies = [ "arbitrary", "arrayref", "bytemuck", - "default-env", "derivative", "fixed", "itertools 0.10.5", diff --git a/programs/openbook-v2/fuzz/src/lib.rs b/programs/openbook-v2/fuzz/src/lib.rs index c8dc0539f..be364ce42 100644 --- a/programs/openbook-v2/fuzz/src/lib.rs +++ b/programs/openbook-v2/fuzz/src/lib.rs @@ -469,6 +469,7 @@ impl FuzzContext { let accounts = openbook_v2::accounts::PlaceTakeOrder { signer: user.owner, + penalty_payer: user.owner, user_base_account: user.base_vault, user_quote_account: user.quote_vault, market: self.market, @@ -764,6 +765,7 @@ impl FuzzContext { let accounts = openbook_v2::accounts::SettleFunds { owner: user.owner, + penalty_payer: user.owner, open_orders_account: user.open_orders, user_base_account: user.base_vault, user_quote_account: user.quote_vault, diff --git a/programs/openbook-v2/src/accounts_ix/place_take_order.rs b/programs/openbook-v2/src/accounts_ix/place_take_order.rs index 274cb22d4..f41a239ad 100644 --- a/programs/openbook-v2/src/accounts_ix/place_take_order.rs +++ b/programs/openbook-v2/src/accounts_ix/place_take_order.rs @@ -8,6 +8,8 @@ use anchor_spl::token::{Token, TokenAccount}; pub struct PlaceTakeOrder<'info> { #[account(mut)] pub signer: Signer<'info>, + #[account(mut)] + pub penalty_payer: Signer<'info>, #[account( mut, diff --git a/programs/openbook-v2/src/accounts_ix/settle_funds.rs b/programs/openbook-v2/src/accounts_ix/settle_funds.rs index faa73800f..50eb5ecc3 100644 --- a/programs/openbook-v2/src/accounts_ix/settle_funds.rs +++ b/programs/openbook-v2/src/accounts_ix/settle_funds.rs @@ -7,6 +7,8 @@ use anchor_spl::token::{Token, TokenAccount}; pub struct SettleFunds<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(mut)] + pub penalty_payer: Signer<'info>, #[account( mut, diff --git a/programs/openbook-v2/src/accounts_ix/settle_funds_expired.rs b/programs/openbook-v2/src/accounts_ix/settle_funds_expired.rs index 34e754278..23f712547 100644 --- a/programs/openbook-v2/src/accounts_ix/settle_funds_expired.rs +++ b/programs/openbook-v2/src/accounts_ix/settle_funds_expired.rs @@ -9,6 +9,8 @@ pub struct SettleFundsExpired<'info> { pub close_market_admin: Signer<'info>, #[account(mut)] pub owner: Signer<'info>, + #[account(mut)] + pub penalty_payer: Signer<'info>, #[account( mut, has_one = market, @@ -54,6 +56,7 @@ impl<'info> SettleFundsExpired<'info> { pub fn to_settle_funds_accounts(&self) -> SettleFunds<'info> { SettleFunds { owner: self.owner.clone(), + penalty_payer: self.penalty_payer.clone(), open_orders_account: self.open_orders_account.clone(), market: self.market.clone(), market_authority: self.market_authority.clone(), diff --git a/programs/openbook-v2/src/instructions/settle_funds.rs b/programs/openbook-v2/src/instructions/settle_funds.rs index 77d3a2bc7..7f19b87e8 100644 --- a/programs/openbook-v2/src/instructions/settle_funds.rs +++ b/programs/openbook-v2/src/instructions/settle_funds.rs @@ -34,6 +34,16 @@ pub fn settle_funds<'info>(ctx: Context<'_, '_, '_, 'info, SettleFunds<'info>>) drop(market); + if pa.penalty_heap_count > 0 { + system_program_transfer( + pa.penalty_heap_count * PENALTY_EVENT_HEAP, + &ctx.accounts.system_program, + &ctx.accounts.penalty_payer, + &ctx.accounts.market, + )?; + pa.penalty_heap_count = 0; + } + if let Some(referrer_account) = &ctx.accounts.referrer_account { token_transfer_signed( referrer_rebate, diff --git a/programs/openbook-v2/src/state/open_orders_account.rs b/programs/openbook-v2/src/state/open_orders_account.rs index 67a87533b..66a8d0767 100644 --- a/programs/openbook-v2/src/state/open_orders_account.rs +++ b/programs/openbook-v2/src/state/open_orders_account.rs @@ -340,7 +340,8 @@ pub struct Position { pub locked_maker_fees: u64, pub referrer_rebates_available: u64, - /// Not implemented at the moment + /// Count of ixs when events are added to the heap + /// To avoid this, send remaining accounts in order to process the events pub penalty_heap_count: u64, /// Cumulative maker volume in quote native units (display only) diff --git a/programs/openbook-v2/tests/program_test/client.rs b/programs/openbook-v2/tests/program_test/client.rs index 05698205d..1255ecb6a 100644 --- a/programs/openbook-v2/tests/program_test/client.rs +++ b/programs/openbook-v2/tests/program_test/client.rs @@ -589,6 +589,7 @@ impl ClientInstruction for PlaceTakeOrderInstruction { oracle_a: market.oracle_a.into(), oracle_b: market.oracle_b.into(), signer: self.signer.pubkey(), + penalty_payer: self.signer.pubkey(), user_base_account: self.user_base_account, user_quote_account: self.user_quote_account, market_base_vault: self.market_base_vault, @@ -833,6 +834,7 @@ impl ClientInstruction for SettleFundsInstruction { let market: Market = account_loader.load(&self.market).await.unwrap(); let accounts = Self::Accounts { owner: self.owner.pubkey(), + penalty_payer: self.owner.pubkey(), open_orders_account: self.open_orders_account, market: self.market, market_authority: market.market_authority, @@ -880,6 +882,7 @@ impl ClientInstruction for SettleFundsExpiredInstruction { let accounts = Self::Accounts { close_market_admin: self.close_market_admin.pubkey(), owner: self.owner.pubkey(), + penalty_payer: self.owner.pubkey(), open_orders_account: self.open_orders_account, market: self.market, market_authority: market.market_authority, From f576d81288227669a30256fde48b08dd32769e49 Mon Sep 17 00:00:00 2001 From: Binye Barwe Date: Wed, 27 Dec 2023 10:38:45 +0100 Subject: [PATCH 4/5] Revert "remove event heap fee" This reverts commit 32b14c63e0acabdb0f55d18ec677437e2da9f42d. --- .../src/instructions/cancel_all_and_place_orders.rs | 5 +++++ programs/openbook-v2/src/instructions/place_order.rs | 5 +++++ .../openbook-v2/src/instructions/place_take_order.rs | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs b/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs index 5da945d35..ed256a760 100644 --- a/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs +++ b/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs @@ -29,6 +29,7 @@ pub fn cancel_all_and_place_orders( asks: ctx.accounts.asks.load_mut()?, }; let mut event_heap = ctx.accounts.event_heap.load_mut()?; + let event_heap_size_before = event_heap.len(); let now_ts: u64 = clock.unix_timestamp.try_into().unwrap(); @@ -125,6 +126,10 @@ pub fn cancel_all_and_place_orders( market.base_deposit_total += deposit_base_amount; market.quote_deposit_total += deposit_quote_amount; + if event_heap.len() > event_heap_size_before { + position.penalty_heap_count += 1; + } + token_transfer( deposit_quote_amount, &ctx.accounts.token_program, diff --git a/programs/openbook-v2/src/instructions/place_order.rs b/programs/openbook-v2/src/instructions/place_order.rs index 52cfad407..15428c5aa 100644 --- a/programs/openbook-v2/src/instructions/place_order.rs +++ b/programs/openbook-v2/src/instructions/place_order.rs @@ -37,6 +37,7 @@ pub fn place_order(ctx: Context, order: Order, limit: u8) -> Result< asks: ctx.accounts.asks.load_mut()?, }; let mut event_heap = ctx.accounts.event_heap.load_mut()?; + let event_heap_size_before = event_heap.len(); let now_ts: u64 = clock.unix_timestamp.try_into().unwrap(); @@ -99,6 +100,10 @@ pub fn place_order(ctx: Context, order: Order, limit: u8) -> Result< } }; + if event_heap.len() > event_heap_size_before { + position.penalty_heap_count += 1; + } + token_transfer( deposit_amount, &ctx.accounts.token_program, diff --git a/programs/openbook-v2/src/instructions/place_take_order.rs b/programs/openbook-v2/src/instructions/place_take_order.rs index ab7be9d27..2e80b98d7 100644 --- a/programs/openbook-v2/src/instructions/place_take_order.rs +++ b/programs/openbook-v2/src/instructions/place_take_order.rs @@ -33,6 +33,7 @@ pub fn place_take_order<'info>( }; let mut event_heap = ctx.accounts.event_heap.load_mut()?; + let event_heap_size_before = event_heap.len(); let now_ts: u64 = clock.unix_timestamp.try_into().unwrap(); @@ -88,6 +89,15 @@ pub fn place_take_order<'info>( drop(market); + if event_heap.len() > event_heap_size_before { + system_program_transfer( + PENALTY_EVENT_HEAP, + &ctx.accounts.system_program, + &ctx.accounts.penalty_payer, + &ctx.accounts.market, + )?; + } + let (user_deposit_acc, user_withdraw_acc, market_deposit_acc, market_withdraw_acc) = match side { Side::Bid => ( From 6a2174a80369d6383fd5fcf81259dbdb1d3108c8 Mon Sep 17 00:00:00 2001 From: Binye Barwe Date: Wed, 27 Dec 2023 10:41:59 +0100 Subject: [PATCH 5/5] PENALTY_EVENT_HEAP=0 --- programs/openbook-v2/src/state/market.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/openbook-v2/src/state/market.rs b/programs/openbook-v2/src/state/market.rs index e80d17594..fb834b6af 100644 --- a/programs/openbook-v2/src/state/market.rs +++ b/programs/openbook-v2/src/state/market.rs @@ -12,7 +12,7 @@ use crate::{accounts_zerocopy::KeyedAccountReader, state::orderbook::Side}; use super::{orderbook, OracleConfig}; pub const FEES_SCALE_FACTOR: i128 = 1_000_000; -pub const PENALTY_EVENT_HEAP: u64 = 5_000; +pub const PENALTY_EVENT_HEAP: u64 = 0; #[account(zero_copy)] #[derive(Debug)]