diff --git a/.github/workflows/no-cashing-tests.yaml b/.github/workflows/no-cashing-tests.yaml index 7799ab1a3e..b44d37851b 100644 --- a/.github/workflows/no-cashing-tests.yaml +++ b/.github/workflows/no-cashing-tests.yaml @@ -247,7 +247,7 @@ jobs: path: tests/interface - cmd: cd tests/lockup && anchor test --skip-lint path: tests/lockup - - cmd: cd tests/swap/deps/serum-dex/dex && cargo build-bpf -- --locked && cd ../../../ && anchor test --skip-lint + - cmd: cd tests/swap/deps/openbook-dex/dex && cargo build-bpf -- --locked && cd ../../../ && anchor test --skip-lint path: tests/swap - cmd: cd tests/escrow && anchor test --skip-lint && npx tsc --noEmit path: tests/escrow @@ -271,7 +271,7 @@ jobs: path: tests/chat - cmd: cd tests/ido-pool && anchor test --skip-lint path: tests/ido-pool - - cmd: cd tests/cfo && anchor run test-with-build && cd deps/stake && git checkout Cargo.lock && cd ../swap && git checkout Cargo.lock + - cmd: cd tests/cfo && anchor run test-with-build && cd deps/stake && git checkout Cargo.lock path: tests/cfo - cmd: cd tests/auction-house && yarn --frozen-lockfile && anchor test --skip-lint && git checkout Cargo.lock path: tests/auction-house diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4adbc1310b..36494608f2 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -358,7 +358,7 @@ jobs: path: tests/interface - cmd: cd tests/lockup && anchor test --skip-lint path: tests/lockup - - cmd: cd tests/swap/deps/serum-dex/dex && cargo build-bpf -- --locked && cd ../../../ && anchor test --skip-lint + - cmd: cd tests/swap/deps/openbook-dex/dex && cargo build-bpf -- --locked && cd ../../../ && anchor test --skip-lint path: tests/swap - cmd: cd tests/escrow && anchor test --skip-lint && npx tsc --noEmit path: tests/escrow @@ -384,7 +384,7 @@ jobs: path: tests/chat - cmd: cd tests/ido-pool && anchor test --skip-lint path: tests/ido-pool - - cmd: cd tests/cfo && anchor run test-with-build && cd deps/stake && git checkout Cargo.lock && cd ../swap && git checkout Cargo.lock + - cmd: cd tests/cfo && anchor run test-with-build && cd deps/stake && git checkout Cargo.lock path: tests/cfo - cmd: cd tests/auction-house && yarn --frozen-lockfile && anchor test --skip-lint && git checkout Cargo.lock path: tests/auction-house diff --git a/.gitmodules b/.gitmodules index ec5d673782..e529699220 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,3 @@ -[submodule "examples/swap/deps/serum-dex"] - path = tests/swap/deps/serum-dex - url = https://github.com/project-serum/serum-dex -[submodule "examples/cfo/deps/serum-dex"] - path = tests/cfo/deps/serum-dex - url = https://github.com/project-serum/serum-dex [submodule "examples/cfo/deps/swap"] path = tests/cfo/deps/swap url = https://github.com/project-serum/swap.git @@ -19,3 +13,6 @@ path = tests/auction-house url = https://github.com/armaniferrante/auction-house branch = armani/pda +[submodule "tests/swap/deps/openbook-dex"] + path = tests/swap/deps/openbook-dex + url = https://github.com/openbook-dex/program diff --git a/Cargo.lock b/Cargo.lock index 0b90bed6b7..e74a6467f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -272,7 +272,7 @@ dependencies = [ "anchor-lang", "borsh", "mpl-token-metadata", - "serum_dex", + "openbook_dex", "solana-program", "spl-associated-token-account", "spl-token", @@ -2270,6 +2270,30 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openbook_dex" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2795442782f5eff209621e49e0ac00f9d1f209fc0f879e345d30b67479ba2b" +dependencies = [ + "arrayref", + "bincode", + "bytemuck", + "byteorder", + "enumflags2", + "field-offset", + "itertools 0.9.0", + "num-traits", + "num_enum", + "safe-transmute", + "serde", + "solana-program", + "spl-token", + "static_assertions", + "thiserror", + "without-alloc", +] + [[package]] name = "openssl" version = "0.10.42" @@ -3092,29 +3116,6 @@ dependencies = [ "yaml-rust", ] -[[package]] -name = "serum_dex" -version = "0.4.0" -source = "git+https://github.com/project-serum/serum-dex?rev=1be91f2#1be91f2863d8ecede32daaae7e768034e24bbc79" -dependencies = [ - "arrayref", - "bincode", - "bytemuck", - "byteorder", - "enumflags2", - "field-offset", - "itertools 0.9.0", - "num-traits", - "num_enum", - "safe-transmute", - "serde", - "solana-program", - "spl-token", - "static_assertions", - "thiserror", - "without-alloc", -] - [[package]] name = "sha-1" version = "0.10.0" diff --git a/Cargo.toml b/Cargo.toml index f2de96cf89..364d9db8ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ members = [ "spl", ] exclude = [ - "tests/swap/deps/serum-dex", - "tests/cfo/deps/serum-dex", - "tests/permissioned-markets/deps/serum-dex", + "tests/swap/deps/openbook-dex", + "tests/cfo/deps/openbook-dex", + "tests/permissioned-markets/deps/openbook-dex", ] diff --git a/docs/src/pages/docs/manifest.md b/docs/src/pages/docs/manifest.md index b36ea39d9c..8faba1780a 100644 --- a/docs/src/pages/docs/manifest.md +++ b/docs/src/pages/docs/manifest.md @@ -116,7 +116,7 @@ Example ```toml [[test.genesis]] -address = "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin" +address = "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX" program = "dex.so" [[test.genesis]] diff --git a/spl/Cargo.toml b/spl/Cargo.toml index 558490d980..9a7b435bc0 100644 --- a/spl/Cargo.toml +++ b/spl/Cargo.toml @@ -17,12 +17,12 @@ shmem = [] stake = ["borsh"] devnet = [] metadata = ["mpl-token-metadata"] -dex = ["serum_dex"] +dex = ["openbook_dex"] [dependencies] anchor-lang = { path = "../lang", version = "0.25.0", features = ["derive"] } borsh = { version = "^0.9", optional = true } -serum_dex = { git = "https://github.com/project-serum/serum-dex", rev = "1be91f2", version = "0.4.0", features = ["no-entrypoint"], optional = true } +openbook_dex = { version = "0.5.6", features = ["no-entrypoint"], optional = true } solana-program = "1.13.5" spl-token = { version = "3.5.0", features = ["no-entrypoint"], optional = true } spl-associated-token-account = { version = "1.1.1", features = ["no-entrypoint"], optional = true } diff --git a/spl/src/dex.rs b/spl/src/dex.rs index 460f9cbe77..e044b4b8c3 100644 --- a/spl/src/dex.rs +++ b/spl/src/dex.rs @@ -2,17 +2,17 @@ use anchor_lang::solana_program::account_info::AccountInfo; use anchor_lang::solana_program::program_error::ProgramError; use anchor_lang::solana_program::pubkey::Pubkey; use anchor_lang::{context::CpiContext, Accounts, Result, ToAccountInfos}; -use serum_dex::instruction::SelfTradeBehavior; -use serum_dex::matching::{OrderType, Side}; +use openbook_dex::instruction::SelfTradeBehavior; +use openbook_dex::matching::{OrderType, Side}; use std::num::NonZeroU64; -pub use serum_dex; +pub use openbook_dex; #[cfg(not(feature = "devnet"))] -anchor_lang::solana_program::declare_id!("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"); +anchor_lang::solana_program::declare_id!("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"); #[cfg(feature = "devnet")] -anchor_lang::solana_program::declare_id!("DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY"); +anchor_lang::solana_program::declare_id!("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"); #[allow(clippy::too_many_arguments)] pub fn new_order_v3<'info>( @@ -25,9 +25,10 @@ pub fn new_order_v3<'info>( order_type: OrderType, client_order_id: u64, limit: u16, + max_ts: i64, ) -> Result<()> { let referral = ctx.remaining_accounts.get(0); - let ix = serum_dex::instruction::new_order( + let ix = openbook_dex::instruction::new_order( ctx.accounts.market.key, ctx.accounts.open_orders.key, ctx.accounts.request_queue.key, @@ -50,6 +51,7 @@ pub fn new_order_v3<'info>( self_trade_behavior, limit, max_native_pc_qty_including_fees, + max_ts, ) .map_err(|pe| ProgramError::from(pe))?; solana_program::program::invoke_signed( @@ -65,7 +67,7 @@ pub fn cancel_order_v2<'info>( side: Side, order_id: u128, ) -> Result<()> { - let ix = serum_dex::instruction::cancel_order( + let ix = openbook_dex::instruction::cancel_order( &ID, ctx.accounts.market.key, ctx.accounts.market_bids.key, @@ -87,7 +89,7 @@ pub fn cancel_order_v2<'info>( pub fn settle_funds<'info>(ctx: CpiContext<'_, '_, '_, 'info, SettleFunds<'info>>) -> Result<()> { let referral = ctx.remaining_accounts.get(0); - let ix = serum_dex::instruction::settle_funds( + let ix = openbook_dex::instruction::settle_funds( &ID, ctx.accounts.market.key, ctx.accounts.token_program.key, @@ -112,7 +114,7 @@ pub fn settle_funds<'info>(ctx: CpiContext<'_, '_, '_, 'info, SettleFunds<'info> pub fn init_open_orders<'info>( ctx: CpiContext<'_, '_, '_, 'info, InitOpenOrders<'info>>, ) -> Result<()> { - let ix = serum_dex::instruction::init_open_orders( + let ix = openbook_dex::instruction::init_open_orders( &ID, ctx.accounts.open_orders.key, ctx.accounts.authority.key, @@ -131,7 +133,7 @@ pub fn init_open_orders<'info>( pub fn close_open_orders<'info>( ctx: CpiContext<'_, '_, '_, 'info, CloseOpenOrders<'info>>, ) -> Result<()> { - let ix = serum_dex::instruction::close_open_orders( + let ix = openbook_dex::instruction::close_open_orders( &ID, ctx.accounts.open_orders.key, ctx.accounts.authority.key, @@ -148,7 +150,7 @@ pub fn close_open_orders<'info>( } pub fn sweep_fees<'info>(ctx: CpiContext<'_, '_, '_, 'info, SweepFees<'info>>) -> Result<()> { - let ix = serum_dex::instruction::sweep_fees( + let ix = openbook_dex::instruction::sweep_fees( &ID, ctx.accounts.market.key, ctx.accounts.pc_vault.key, @@ -175,7 +177,8 @@ pub fn initialize_market<'info>( ) -> Result<()> { let authority = ctx.remaining_accounts.get(0); let prune_authority = ctx.remaining_accounts.get(1); - let ix = serum_dex::instruction::initialize_market( + let consume_events_authority = ctx.remaining_accounts.get(2); + let ix = openbook_dex::instruction::initialize_market( ctx.accounts.market.key, &ID, ctx.accounts.coin_mint.key, @@ -184,6 +187,7 @@ pub fn initialize_market<'info>( ctx.accounts.pc_vault.key, authority.map(|r| r.key), prune_authority.map(|r| r.key), + consume_events_authority.map(|r| r.key), ctx.accounts.bids.key, ctx.accounts.asks.key, ctx.accounts.req_q.key, diff --git a/tests/cfo/Anchor.toml b/tests/cfo/Anchor.toml index 903bbe80dc..6d218a56c7 100644 --- a/tests/cfo/Anchor.toml +++ b/tests/cfo/Anchor.toml @@ -17,8 +17,7 @@ test-with-build = "anchor run build && anchor test --skip-build --skip-lint" # Build the program and all CPI dependencies. # build = "anchor run build-deps && anchor build --skip-lint" -build-deps = "anchor run build-dex && anchor run build-swap && anchor run build-stake" -build-dex = "pushd deps/serum-dex/dex/ && cargo build-bpf && popd" +build-deps = "anchor run build-swap && anchor run build-stake" build-swap = "cd deps/swap && pwd && anchor build --skip-lint && cd ../../" build-stake = "pushd deps/stake && anchor build --skip-lint && popd" # @@ -27,8 +26,8 @@ build-stake = "pushd deps/stake && anchor build --skip-lint && popd" localnet = "./scripts/localnet.sh" [[test.genesis]] -address = "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin" -program = "./deps/serum-dex/dex/target/deploy/serum_dex.so" +address = "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX" +program = "./deps/openbook-dex/dex/target/deploy/openbook_dex.so" [[test.genesis]] address = "22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD" diff --git a/tests/cfo/Cargo.toml b/tests/cfo/Cargo.toml index 5f959cf9ca..8be2caae6d 100644 --- a/tests/cfo/Cargo.toml +++ b/tests/cfo/Cargo.toml @@ -3,7 +3,7 @@ members = [ "programs/*" ] exclude = [ - "deps/serum-dex", + "deps/openbook-dex", "deps/stake", "deps/swap" ] diff --git a/tests/cfo/deps/serum-dex b/tests/cfo/deps/serum-dex deleted file mode 160000 index ed9d54a717..0000000000 --- a/tests/cfo/deps/serum-dex +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ed9d54a717bec01de2924f6e6ca465f942b072aa diff --git a/tests/cfo/programs/cfo/Cargo.toml b/tests/cfo/programs/cfo/Cargo.toml index 90f65e72fb..cebebb0369 100644 --- a/tests/cfo/programs/cfo/Cargo.toml +++ b/tests/cfo/programs/cfo/Cargo.toml @@ -21,6 +21,6 @@ anchor-lang = { path = "../../../../lang" } anchor-spl = { path = "../../../../spl" } spl-token = { version = "3.5.0", features = ["no-entrypoint"] } swap = { path = "../../deps/swap/programs/swap", features = ["cpi"] } -serum_dex = { path = "../../deps/serum-dex/dex", features = ["no-entrypoint"] } +openbook_dex = { version = "0.5.6", features = ["no-entrypoint"] } registry = { path = "../../deps/stake/programs/registry", features = ["cpi"] } lockup = { path = "../../deps/stake/programs/lockup", features = ["cpi"] } diff --git a/tests/cfo/programs/cfo/src/lib.rs b/tests/cfo/programs/cfo/src/lib.rs index 04f323bc56..dc4a5f534d 100644 --- a/tests/cfo/programs/cfo/src/lib.rs +++ b/tests/cfo/programs/cfo/src/lib.rs @@ -5,9 +5,9 @@ use anchor_lang::solana_program::sysvar::instructions as tx_instructions; use anchor_spl::dex::{self, Dex}; use anchor_spl::token::{self, Mint, Token, TokenAccount}; use lockup::program::Lockup; +use openbook_dex::state::OpenOrders; use registry::program::Registry; use registry::{Registrar, RewardVendorKind}; -use serum_dex::state::OpenOrders; use std::convert::TryInto; use std::mem::size_of; use swap::program::Swap; diff --git a/tests/cfo/scripts/fees.js b/tests/cfo/scripts/fees.js index 742877beb0..b559330bea 100755 --- a/tests/cfo/scripts/fees.js +++ b/tests/cfo/scripts/fees.js @@ -11,7 +11,7 @@ const secret = JSON.parse(fs.readFileSync("./scripts/market-maker.json")); const MARKET_MAKER = new Account(secret); const PublicKey = anchor.web3.PublicKey; -const DEX_PID = new PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"); +const DEX_PID = new PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"); async function main() { const market = new PublicKey(process.argv[2]); diff --git a/tests/cfo/scripts/localnet.sh b/tests/cfo/scripts/localnet.sh index e24eef8164..579e19b412 100755 --- a/tests/cfo/scripts/localnet.sh +++ b/tests/cfo/scripts/localnet.sh @@ -4,7 +4,7 @@ set -euo pipefail source scripts/common.sh -DEX_PID="9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin" +DEX_PID="srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX" PAYER_FILEPATH="$HOME/.config/solana/id.json" CRANK="/home/armaniferrante/Documents/code/src/github.com/project-serum/serum-dex/target/debug/crank" VALIDATOR_OUT="./validator-stdout.txt" @@ -23,7 +23,7 @@ main () { echo "Starting local network..." solana-test-validator \ - --bpf-program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin ./deps/serum-dex/dex/target/deploy/serum_dex.so \ + --bpf-program srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX ./deps/serum-dex/dex/target/deploy/serum_dex.so \ --bpf-program 22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD ./deps/swap/target/deploy/swap.so \ --bpf-program GrAkKfEpTKQuVHG2Y97Y2FF4i7y7Q5AHLK94JBy7Y5yv ./deps/stake/target/deploy/registry.so \ --bpf-program 6ebQNeTPZ1j7k3TtkCCtEPRvG7GQsucQrZ7sSEDQi9Ks ./deps/stake/target/deploy/lockup.so \ diff --git a/tests/cfo/tests/cfo.js b/tests/cfo/tests/cfo.js index 307bc6c6cd..c5ed409657 100644 --- a/tests/cfo/tests/cfo.js +++ b/tests/cfo/tests/cfo.js @@ -8,7 +8,7 @@ const { PublicKey, SystemProgram, Keypair, SYSVAR_RENT_PUBKEY } = anchor.web3; const utils = require("./utils"); const { setupStakePool } = require("./utils/stake"); -const DEX_PID = new PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"); +const DEX_PID = new PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"); const SWAP_PID = new PublicKey("22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD"); const TOKEN_PID = new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"); const REGISTRY_PID = new PublicKey( diff --git a/tests/cfo/tests/utils/index.js b/tests/cfo/tests/utils/index.js index b0830d3f94..369ca3f47c 100644 --- a/tests/cfo/tests/utils/index.js +++ b/tests/cfo/tests/utils/index.js @@ -18,7 +18,7 @@ const Account = web3.Account; const Transaction = web3.Transaction; const PublicKey = web3.PublicKey; const SystemProgram = web3.SystemProgram; -const DEX_PID = new PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"); +const DEX_PID = new PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"); const secret = JSON.parse( require("fs").readFileSync("./scripts/market-maker.json") ); diff --git a/tests/swap/Anchor.toml b/tests/swap/Anchor.toml index fa7d2b91f0..d2f76a02f6 100644 --- a/tests/swap/Anchor.toml +++ b/tests/swap/Anchor.toml @@ -6,8 +6,8 @@ wallet = "~/.config/solana/id.json" swap = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" [[test.genesis]] -address = "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin" -program = "./deps/serum-dex/dex/target/deploy/serum_dex.so" +address = "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX" +program = "./deps/openbook-dex/dex/target/deploy/openbook_dex.so" [scripts] test = "yarn run mocha -t 1000000 tests/" diff --git a/tests/swap/Cargo.toml b/tests/swap/Cargo.toml index 52ed11f4d9..0f111d03ab 100644 --- a/tests/swap/Cargo.toml +++ b/tests/swap/Cargo.toml @@ -3,5 +3,5 @@ members = [ "programs/*" ] exclude = [ - "deps/serum-dex" + "deps/opendex-dex" ] \ No newline at end of file diff --git a/tests/swap/README.md b/tests/swap/README.md index 60778c2750..70f9e405a5 100644 --- a/tests/swap/README.md +++ b/tests/swap/README.md @@ -22,7 +22,7 @@ git submodule update Build it ``` -cd deps/serum-dex/dex/ && cargo build-bpf && cd ../../../ +cd deps/openbook-dex/dex/ && cargo build-bpf && cd ../../../ ``` ### Run the Test diff --git a/tests/swap/deps/openbook-dex b/tests/swap/deps/openbook-dex new file mode 160000 index 0000000000..7191475292 --- /dev/null +++ b/tests/swap/deps/openbook-dex @@ -0,0 +1 @@ +Subproject commit 71914752922df0db9d4136780eca1e2fe9f6b0a9 diff --git a/tests/swap/deps/serum-dex b/tests/swap/deps/serum-dex deleted file mode 160000 index 5420646709..0000000000 --- a/tests/swap/deps/serum-dex +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5420646709df6edaaea90162d4f7476328077293 diff --git a/tests/swap/programs/swap/Cargo.toml b/tests/swap/programs/swap/Cargo.toml index 28d1d145b7..2508cae388 100644 --- a/tests/swap/programs/swap/Cargo.toml +++ b/tests/swap/programs/swap/Cargo.toml @@ -18,4 +18,4 @@ default = [] [dependencies] anchor-lang = { path = "../../../../lang" } anchor-spl = { path = "../../../../spl", features = ["dex"] } -serum_dex = { git = "https://github.com/project-serum/serum-dex", rev = "1be91f2", version = "0.4.0", features = ["no-entrypoint"] } +openbook_dex = { version = "0.5.6", features = ["no-entrypoint"] } diff --git a/tests/swap/programs/swap/src/lib.rs b/tests/swap/programs/swap/src/lib.rs index 1e4fa5f44c..9cfd5d6cdd 100644 --- a/tests/swap/programs/swap/src/lib.rs +++ b/tests/swap/programs/swap/src/lib.rs @@ -9,9 +9,9 @@ use anchor_lang::prelude::*; use anchor_spl::dex; use anchor_spl::token; -use serum_dex::instruction::SelfTradeBehavior; -use serum_dex::matching::{OrderType, Side as SerumSide}; -use serum_dex::state::MarketState; +use openbook_dex::instruction::SelfTradeBehavior; +use openbook_dex::matching::{OrderType, Side as SerumSide}; +use openbook_dex::state::MarketState; use std::num::NonZeroU64; declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); @@ -278,15 +278,17 @@ impl<'info> OrderbookClient<'info> { let limit_price = 1; let max_coin_qty = { // The loaded market must be dropped before CPI. - let market = MarketState::load(&self.market.market, &dex::ID) + let market = MarketState::load(&self.market.market, &dex::ID, false) .map_err(|de| ProgramError::from(de))?; coin_lots(&market, base_amount) }; let max_native_pc_qty = u64::MAX; + let max_ts = i64::MAX; self.order_cpi( limit_price, max_coin_qty, max_native_pc_qty, + max_ts, Side::Ask, referral, ) @@ -301,10 +303,12 @@ impl<'info> OrderbookClient<'info> { let limit_price = u64::MAX; let max_coin_qty = u64::MAX; let max_native_pc_qty = quote_amount; + let max_ts = i64::MAX; self.order_cpi( limit_price, max_coin_qty, max_native_pc_qty, + max_ts, Side::Bid, referral, ) @@ -323,6 +327,7 @@ impl<'info> OrderbookClient<'info> { limit_price: u64, max_coin_qty: u64, max_native_pc_qty: u64, + max_ts: i64, side: Side, referral: Option>, ) -> Result<()> { @@ -361,6 +366,7 @@ impl<'info> OrderbookClient<'info> { OrderType::ImmediateOrCancel, client_order_id, limit, + max_ts, ) } diff --git a/tests/swap/tests/utils/index.js b/tests/swap/tests/utils/index.js index 63f8a12b73..d53f0a04ab 100644 --- a/tests/swap/tests/utils/index.js +++ b/tests/swap/tests/utils/index.js @@ -17,7 +17,7 @@ const Account = web3.Account; const Transaction = web3.Transaction; const PublicKey = web3.PublicKey; const SystemProgram = web3.SystemProgram; -const DEX_PID = new PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"); +const DEX_PID = new PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"); async function setupTwoMarkets({ provider }) { // Setup mints with initial tokens owned by the provider. diff --git a/ts/packages/anchor/tests/error.spec.ts b/ts/packages/anchor/tests/error.spec.ts index 5e871edf93..5904971d94 100644 --- a/ts/packages/anchor/tests/error.spec.ts +++ b/ts/packages/anchor/tests/error.spec.ts @@ -17,9 +17,9 @@ describe("ProgramErrorStack", () => { it("basic multiple ix", () => { const logs = [ - "Program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin invoke [1]", - "Program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin consumed 4308 of 200000 compute units", - "Program 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin success", + "Program srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX invoke [1]", + "Program srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX consumed 4308 of 200000 compute units", + "Program srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX success", "Program ERRM6YCMsccM22TEaPuu35KVU4iCY3GLCz4qMsKLYReE invoke [1]", "Program ERRM6YCMsccM22TEaPuu35KVU4iCY3GLCz4qMsKLYReE consumed 3797 of 200000 compute units", "Program ERRM6YCMsccM22TEaPuu35KVU4iCY3GLCz4qMsKLYReE failed: custom program error: 0x29",