Skip to content

Commit

Permalink
add bankrun test, pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wphan committed Feb 12, 2025
1 parent d484a96 commit 18f6412
Show file tree
Hide file tree
Showing 20 changed files with 16,689 additions and 352 deletions.
8 changes: 4 additions & 4 deletions Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ wallet = "~/.config/solana/id.json"

[[test.genesis]]
address = "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"
program = "./deps/drift.so"
program = "./tests/fixtures/drift.so"

[[test.genesis]]
address = "FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH"
program = "./deps/pyth.so"
program = "./tests/fixtures/pyth.so"

[[test.genesis]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
program = "./deps/metaplex/metaplex.so"
program = "./tests/fixtures/metaplex/metaplex.so"

[[test.validator.account]]
address = "PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT"
filename = "./deps/metaplex/PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT.json"
filename = "./tests/fixtures/metaplex/PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT.json"

[scripts]
test = "yarn anchor-tests"
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: [
//'**/tests/**/*.test.ts'
'**/tests/**/*.ts'
],
testPathIgnorePatterns: [
'./tests/testHelpers.ts'
'tests/common/',
//'tests/driftVaults.ts'
],
testTimeout: 1000000, // This matches your current 1000000ms timeout
transform: {
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@types/jest-expect-message": "1.1.0",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"anchor-bankrun": "0.3.0",
"eslint": "^7.29.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
Expand All @@ -35,6 +36,8 @@
"jest-expect-message": "^1.1.3",
"prettier": "^2.6.2",
"rpc-websockets": "7.5.1",
"solana-bankrun": "0.3.0",
"spl-token-bankrun": "^0.2.6",
"ts-jest": "^29.2.5",
"ts-node": "7.0.1",
"typescript": "5.6.2"
Expand Down
5 changes: 3 additions & 2 deletions programs/drift_vaults/src/instructions/reset_fuel_season.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use anchor_lang::prelude::*;
use drift::state::events::FuelSeasonRecord;
use drift::ids::admin_hot_wallet;
use drift::state::state::State;
use drift::state::user::{FuelOverflowStatus, UserStats};

use crate::constraints::{is_user_stats_for_vault, is_vault_for_vault_depositor};
use crate::state::events::FuelSeasonRecord;
use crate::state::{FuelOverflowProvider, Vault, VaultProtocolProvider};
use crate::VaultDepositor;

Expand Down Expand Up @@ -59,7 +60,7 @@ pub struct ResetFuelSeason<'info> {
)]
pub vault_depositor: AccountLoader<'info, VaultDepositor>,
#[account(
constraint = admin.key() == drift_state.admin
constraint = admin.key() == drift_state.admin || admin.key() == admin_hot_wallet::id()
)]
pub admin: Signer<'info>,
#[account(
Expand Down
1 change: 1 addition & 0 deletions programs/drift_vaults/src/state/events.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anchor_lang::prelude::*;
use borsh::{BorshDeserialize, BorshSerialize};
pub use drift::state::events::FuelSeasonRecord;

#[event]
#[derive(Default)]
Expand Down
Loading

0 comments on commit 18f6412

Please sign in to comment.