Skip to content

Commit

Permalink
Updating tests and fixing CI
Browse files Browse the repository at this point in the history
  • Loading branch information
godmodegalactus committed Sep 11, 2023
1 parent 1abd8fb commit 891a42c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-code-review-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: 1.70.0
profile: minimal
components: rustc

Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test TEST_NAME:
cargo test-sbf --features enable-gpl -- {{ TEST_NAME }}

test-all:
(cd ./programs/openbook-v2 && RUST_LOG=ERROR cargo test-sbf --features enable-gpl)
(cd ./programs/openbook-v2 && RUST_LOG=ERROR cargo +1.70.0 test-sbf --features enable-gpl)

test-dev:
(find programs) | entr -s 'just test-all'
Expand Down
9 changes: 6 additions & 3 deletions programs/openbook-v2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! A central-limit order book (CLOB) program that targets the Sealevel runtime.
use anchor_lang::prelude::{*, borsh::{BorshDeserialize, BorshSerialize}};
use anchor_lang::prelude::{
borsh::{BorshDeserialize, BorshSerialize},
*,
};

declare_id!("opnbkNkqux64GppQhwbyEVc3axhssFhVYuwar8rDHCu");

Expand All @@ -21,10 +24,10 @@ pub mod types;
pub mod instructions;

use accounts_ix::*;
use accounts_ix::{StubOracleCreate, StubOracleSet};
use error::*;
use state::{OracleConfigParams, Order, OrderParams, PlaceOrderType, SelfTradeBehavior, Side};
use std::cmp;
use accounts_ix::{StubOracleCreate, StubOracleSet};

#[cfg(all(not(feature = "no-entrypoint"), not(feature = "enable-gpl")))]
compile_error!("compiling the program entrypoint without 'enable-gpl' makes no sense, enable it or use the 'cpi' or 'client' features");
Expand Down Expand Up @@ -548,7 +551,7 @@ pub mod openbook_v2 {
}
}

#[derive(AnchorSerialize, AnchorDeserialize, Debug, Copy, Clone)]
#[derive(AnchorSerialize, AnchorDeserialize, Debug, Copy, Clone)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct PlaceOrderArgs {
pub side: Side,
Expand Down
9 changes: 2 additions & 7 deletions programs/openbook-v2/tests/program_test/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use anchor_lang::prelude::*;
use anchor_spl::token::Token;
use fixed::types::I80F48;
use solana_program::instruction::Instruction;
use solana_program_test::BanksClientError;
use solana_sdk::instruction;
Expand Down Expand Up @@ -997,9 +996,7 @@ impl ClientInstruction for StubOracleSetInstruction {
_loader: impl ClientAccountLoader + 'async_trait,
) -> (Self::Accounts, Instruction) {
let program_id = openbook_v2::id();
let instruction = Self::Instruction {
price: I80F48::from_num(self.price),
};
let instruction = Self::Instruction { price: self.price };

let oracle = Pubkey::find_program_address(
&[
Expand Down Expand Up @@ -1040,9 +1037,7 @@ impl ClientInstruction for StubOracleCreate {
_loader: impl ClientAccountLoader + 'async_trait,
) -> (Self::Accounts, Instruction) {
let program_id = openbook_v2::id();
let instruction = Self::Instruction {
price: I80F48::from_num(1.0),
};
let instruction = Self::Instruction { price: 1.0 };

let oracle = Pubkey::find_program_address(
&[
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.72.0"
channel = "1.70.0"

0 comments on commit 891a42c

Please sign in to comment.