From b57b6066a7f2c3ff6206c9665ef1481529c6af5b Mon Sep 17 00:00:00 2001 From: jon-mobile Date: Fri, 28 Mar 2025 16:09:38 -0400 Subject: [PATCH 01/38] emmode init (WIP) --- guides/EMODECHANGELOG.md | 1 + .../instructions/marginfi_group/configure.rs | 3 + programs/marginfi/src/lib.rs | 3 +- programs/marginfi/src/state/emode.rs | 106 +++++++++ programs/marginfi/src/state/marginfi_group.rs | 34 ++- programs/marginfi/src/state/mod.rs | 1 + .../tests/admin_actions/bankruptcy_auth.rs | 4 +- .../tests/admin_actions/setup_bank.rs | 6 +- .../tests/admin_actions/withdraw_fees.rs | 2 +- test-utils/src/marginfi_group.rs | 5 + tests/02_configGroup.spec.ts | 4 +- tests/e01_initGroup.spec.ts | 225 ++++++++++++++++++ tests/rootHooks.ts | 13 +- tests/utils/group-instructions.ts | 9 +- 14 files changed, 398 insertions(+), 18 deletions(-) create mode 100644 guides/EMODECHANGELOG.md create mode 100644 programs/marginfi/src/state/emode.rs create mode 100644 tests/e01_initGroup.spec.ts diff --git a/guides/EMODECHANGELOG.md b/guides/EMODECHANGELOG.md new file mode 100644 index 000000000..3c300112d --- /dev/null +++ b/guides/EMODECHANGELOG.md @@ -0,0 +1 @@ +add new admin arg to config \ No newline at end of file diff --git a/programs/marginfi/src/instructions/marginfi_group/configure.rs b/programs/marginfi/src/instructions/marginfi_group/configure.rs index f45f98d0f..f1aa19fe9 100644 --- a/programs/marginfi/src/instructions/marginfi_group/configure.rs +++ b/programs/marginfi/src/instructions/marginfi_group/configure.rs @@ -14,13 +14,16 @@ use anchor_lang::prelude::*; pub fn configure( ctx: Context, new_admin: Pubkey, + new_emode_admin: Pubkey, is_arena_group: bool, ) -> MarginfiResult { let marginfi_group = &mut ctx.accounts.marginfi_group.load_mut()?; marginfi_group.update_admin(new_admin); + marginfi_group.update_emode_admin(new_emode_admin); marginfi_group.set_arena_group(is_arena_group)?; + msg!("flags set to: {:?}", marginfi_group.group_flags); emit!(MarginfiGroupConfigureEvent { diff --git a/programs/marginfi/src/lib.rs b/programs/marginfi/src/lib.rs index 2b0b3cef7..410f40c3f 100644 --- a/programs/marginfi/src/lib.rs +++ b/programs/marginfi/src/lib.rs @@ -39,9 +39,10 @@ pub mod marginfi { pub fn marginfi_group_configure( ctx: Context, new_admin: Pubkey, + new_emode_admin: Pubkey, is_arena_group: bool, ) -> MarginfiResult { - marginfi_group::configure(ctx, new_admin, is_arena_group) + marginfi_group::configure(ctx, new_admin, new_emode_admin, is_arena_group) } pub fn lending_pool_add_bank( diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs new file mode 100644 index 000000000..fbd99df19 --- /dev/null +++ b/programs/marginfi/src/state/emode.rs @@ -0,0 +1,106 @@ +use super::marginfi_group::WrappedI80F48; +use crate::{ + assert_struct_align, assert_struct_size, check, errors::MarginfiError, prelude::MarginfiResult, +}; +use anchor_lang::prelude::*; +use bytemuck::{Pod, Zeroable}; +use fixed::types::I80F48; +use type_layout::TypeLayout; + +pub const MAX_EMODE_ENTRIES: usize = 10; +pub const EMODE_TAG_EMPTY: u16 = 0; + +assert_struct_size!(EmodeSettings, 424); +assert_struct_align!(EmodeSettings, 8); +#[repr(C)] +#[derive( + AnchorDeserialize, AnchorSerialize, Copy, Clone, Zeroable, Pod, PartialEq, Eq, TypeLayout, Debug, +)] +/// Controls the bank's e-mode configuration, allowing certain collateral sources to be treated more +/// favorably as collateral when used to borrow from this bank. +pub struct EmodeSettings { + /// This bank's NON-unique id that other banks will use to determine what emode rate to use when + /// this bank is offered as collateral. + /// + /// For example, all stablecoin banks might share the same emode_tag, and in their entries, each + /// such stablecoin bank will recognize that collateral sources with this "stable" tag get + /// preferrential weights. When a new stablecoin is added that is considered riskier, it may get + /// a new, less favorable emode tag, and eventually get ugraded to the same one as the other + /// stables + /// + /// * 0 is in an invalid tag and will do nothing. + pub emode_tag: u16, + // To next 8-byte multiple + pub pad0: [u8; 6], + + /// Unix timestamp from the system clock when emode state was last updated + pub timestamp: i64, + /// Reserved for future use + pub flags: u64, + /// This bank's emode configurations. + pub entries: [EmodeEntry; MAX_EMODE_ENTRIES], +} + +impl Default for EmodeSettings { + fn default() -> Self { + Self::zeroed() + } +} + +impl EmodeSettings { + pub fn validate_entries(&self) -> MarginfiResult { + for entry in self.entries { + if entry.is_empty() { + continue; + } + let asset_init_w: I80F48 = I80F48::from(entry.asset_weight_init); + let asset_maint_w: I80F48 = I80F48::from(entry.asset_weight_maint); + + check!( + asset_init_w >= I80F48::ZERO && asset_init_w <= I80F48::ONE, + MarginfiError::InvalidConfig + ); + check!(asset_maint_w >= asset_init_w, MarginfiError::InvalidConfig); + } + + // TODO check each tag is unique and appears just once + + Ok(()) + } + + pub fn find_with_tag(&self, tag: u16) -> Option<&EmodeEntry> { + self.entries.iter().find(|e| e.tag_equals(tag)) + } +} + +pub const APPLIES_TO_ISOLATED: u16 = 1; + +assert_struct_size!(EmodeEntry, 40); +assert_struct_align!(EmodeEntry, 8); +#[repr(C)] +#[derive( + AnchorDeserialize, AnchorSerialize, Copy, Clone, Zeroable, Pod, PartialEq, Eq, TypeLayout, Debug, +)] +pub struct EmodeEntry { + /// emode_tag of the bank(s) whose collateral you wish to treat preferrentially. + pub collateral_bank_emode_tag: u16, + /// * APPLIES_TO_ISOLATED (1) - if set, isolated banks with this tag also benefit. If not set, + /// isolated banks continue to offer zero collateral, even if they use this tag. + /// * 2, 4, 8, 16, 32, etc - reserved for future use + pub flags: u8, + // To next 8-byte multiple + pub pad0: [u8; 5], + /// Note: If set below the collateral bank's weight, does nothing. + pub asset_weight_init: WrappedI80F48, + /// Note: If set below the collateral bank's weight, does nothing. + pub asset_weight_maint: WrappedI80F48, +} + +impl EmodeEntry { + pub fn is_empty(&self) -> bool { + self.collateral_bank_emode_tag == EMODE_TAG_EMPTY + } + pub fn tag_equals(&self, tag: u16) -> bool { + self.collateral_bank_emode_tag == tag + } +} diff --git a/programs/marginfi/src/state/marginfi_group.rs b/programs/marginfi/src/state/marginfi_group.rs index 1f283fc14..b06e03493 100644 --- a/programs/marginfi/src/state/marginfi_group.rs +++ b/programs/marginfi/src/state/marginfi_group.rs @@ -1,6 +1,5 @@ use super::{ - marginfi_account::{BalanceSide, RequirementType}, - price::{OraclePriceFeedAdapter, OracleSetup}, + emode::EmodeSettings, marginfi_account::{BalanceSide, RequirementType}, price::{OraclePriceFeedAdapter, OracleSetup} }; #[cfg(not(feature = "client"))] use crate::events::{GroupEventHeader, LendingPoolBankAccrueInterestEvent}; @@ -59,8 +58,12 @@ pub struct MarginfiGroup { // 0.1.2 went live. pub banks: u16, pub pad0: [u8; 6], + /// This admin can configure collateral ratios above (but not below) the + /// collateral ratio of certain banks , e.g. allow SOL to count as 90% + /// collateral when borrowing an LST instead of the default rate. + pub emode_admin: Pubkey, - pub _padding_0: [[u64; 2]; 26], + pub _padding_0: [[u64; 2]; 24], pub _padding_1: [[u64; 2]; 32], pub _padding_3: u64, pub _padding_4: u64, @@ -87,6 +90,20 @@ impl MarginfiGroup { } } + pub fn update_emode_admin(&mut self, new_emode_admin: Pubkey) { + if self.emode_admin == new_emode_admin { + msg!("No change to emode admin: {:?}", new_emode_admin); + // do nothing + } else { + msg!( + "Set emode admin from {:?} to {:?}", + self.admin, + new_emode_admin + ); + self.emode_admin = new_emode_admin; + } + } + /// Set the group parameters when initializing a group. /// This should be called only when the group is first initialized. #[allow(clippy::too_many_arguments)] @@ -499,8 +516,8 @@ pub struct Bank { /// - FREEZE_SETTINGS: 8 /// pub flags: u64, - /// Emissions APR. - /// Number of emitted tokens (emissions_mint) per 1e(bank.mint_decimal) tokens (bank mint) (native amount) per 1 YEAR. + /// Emissions APR. Number of emitted tokens (emissions_mint) per 1e(bank.mint_decimal) tokens + /// (bank mint) (native amount) per 1 YEAR. pub emissions_rate: u64, pub emissions_remaining: WrappedI80F48, pub emissions_mint: Pubkey, @@ -508,7 +525,11 @@ pub struct Bank { /// Fees collected and pending withdraw for the `FeeState.global_fee_wallet`'s cannonical ATA for `mint` pub collected_program_fees_outstanding: WrappedI80F48, - pub _padding_0: [[u64; 2]; 27], + /// Controls this bank's emode configuration, which enables some banks to treat the assets of + /// certain other banks more preferrentially as collateral. + pub emode: EmodeSettings, + + pub _padding_0: [u8; 8], pub _padding_1: [[u64; 2]; 32], // 16 * 2 * 32 = 1024B } @@ -558,6 +579,7 @@ impl Bank { emissions_remaining: I80F48::ZERO.into(), emissions_mint: Pubkey::default(), collected_program_fees_outstanding: I80F48::ZERO.into(), + emode: EmodeSettings::zeroed(), ..Default::default() } } diff --git a/programs/marginfi/src/state/mod.rs b/programs/marginfi/src/state/mod.rs index 66865081b..e59b72157 100644 --- a/programs/marginfi/src/state/mod.rs +++ b/programs/marginfi/src/state/mod.rs @@ -1,3 +1,4 @@ +pub mod emode; pub mod fee_state; pub mod health_cache; pub mod marginfi_account; diff --git a/programs/marginfi/tests/admin_actions/bankruptcy_auth.rs b/programs/marginfi/tests/admin_actions/bankruptcy_auth.rs index 24d3da9e1..74037d8f9 100644 --- a/programs/marginfi/tests/admin_actions/bankruptcy_auth.rs +++ b/programs/marginfi/tests/admin_actions/bankruptcy_auth.rs @@ -91,7 +91,7 @@ async fn marginfi_group_handle_bankruptcy_unauthorized() -> anyhow::Result<()> { test_f .marginfi_group - .try_update(Pubkey::new_unique(), false) + .try_update(Pubkey::new_unique(), Pubkey::new_unique(), false) .await?; let bank = test_f.get_bank(&BankMint::Usdc); @@ -196,7 +196,7 @@ async fn marginfi_group_handle_bankruptcy_perimssionless() -> anyhow::Result<()> test_f .marginfi_group - .try_update(Pubkey::new_unique(), false) + .try_update(Pubkey::new_unique(), Pubkey::new_unique(), false) .await?; let res = test_f diff --git a/programs/marginfi/tests/admin_actions/setup_bank.rs b/programs/marginfi/tests/admin_actions/setup_bank.rs index b985519f3..9b0664a5a 100644 --- a/programs/marginfi/tests/admin_actions/setup_bank.rs +++ b/programs/marginfi/tests/admin_actions/setup_bank.rs @@ -430,7 +430,7 @@ async fn add_too_many_arena_banks() -> anyhow::Result<()> { let res = test_f .marginfi_group - .try_update(group_before.admin, true) + .try_update(group_before.admin, group_before.emode_admin, true) .await; assert!(res.is_ok()); let group_after = test_f.marginfi_group.load().await; @@ -479,7 +479,7 @@ async fn add_too_many_arena_banks() -> anyhow::Result<()> { let res = test_f .marginfi_group - .try_update(group_before.admin, false) + .try_update(group_before.admin, group_before.emode_admin, false) .await; assert!(res.is_err()); assert_custom_error!(res.unwrap_err(), MarginfiError::ArenaSettingCannotChange); @@ -524,7 +524,7 @@ async fn config_group_as_arena_too_many_banks() -> anyhow::Result<()> { let group_before = test_f.marginfi_group.load().await; let res = test_f .marginfi_group - .try_update(group_before.admin, true) + .try_update(group_before.admin, group_before.emode_admin, true) .await; assert!(res.is_err()); diff --git a/programs/marginfi/tests/admin_actions/withdraw_fees.rs b/programs/marginfi/tests/admin_actions/withdraw_fees.rs index 1caf3531b..403d8e815 100644 --- a/programs/marginfi/tests/admin_actions/withdraw_fees.rs +++ b/programs/marginfi/tests/admin_actions/withdraw_fees.rs @@ -99,7 +99,7 @@ async fn marginfi_group_withdraw_fees_and_insurance_fund_as_non_admin_failure( // Update the admin of the marginfi group test_f .marginfi_group - .try_update(Pubkey::new_unique(), false) + .try_update(Pubkey::new_unique(), Pubkey::new_unique(), false) .await?; // Mint `insurance_vault_balance` USDC to the insurance vault diff --git a/test-utils/src/marginfi_group.rs b/test-utils/src/marginfi_group.rs index f2f9865c1..58ec0bc95 100644 --- a/test-utils/src/marginfi_group.rs +++ b/test-utils/src/marginfi_group.rs @@ -75,7 +75,10 @@ impl MarginfiGroupFixture { } .to_account_metas(Some(true)), data: marginfi::instruction::MarginfiGroupConfigure { + // Payer is both admins in most test cases for simplicity, + // generally this is not true in production new_admin: admin, + new_emode_admin: admin, is_arena_group: false, } .data(), @@ -416,6 +419,7 @@ impl MarginfiGroupFixture { pub async fn try_update( &self, new_admin: Pubkey, + new_emode_admin:Pubkey, is_arena_group: bool, ) -> Result<(), BanksClientError> { let ix = Instruction { @@ -427,6 +431,7 @@ impl MarginfiGroupFixture { .to_account_metas(Some(true)), data: marginfi::instruction::MarginfiGroupConfigure { new_admin, + new_emode_admin, is_arena_group, } .data(), diff --git a/tests/02_configGroup.spec.ts b/tests/02_configGroup.spec.ts index 91ae1c7a4..be248416e 100644 --- a/tests/02_configGroup.spec.ts +++ b/tests/02_configGroup.spec.ts @@ -1,5 +1,5 @@ import { Program, workspace } from "@coral-xyz/anchor"; -import { Keypair, Transaction } from "@solana/web3.js"; +import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; import { groupConfigure } from "./utils/group-instructions"; import { Marginfi } from "../target/types/marginfi"; import { groupAdmin, marginfiGroup } from "./rootHooks"; @@ -44,7 +44,7 @@ describe("Config group", () => { await groupAdmin.mrgnProgram.provider.sendAndConfirm!( new Transaction().add( await groupAdmin.mrgnProgram.methods - .marginfiGroupConfigure(groupAdmin.wallet.publicKey, false) + .marginfiGroupConfigure(groupAdmin.wallet.publicKey, PublicKey.default, false) .accountsPartial({ marginfiGroup: marginfiGroup.publicKey, admin: newAdmin.publicKey, diff --git a/tests/e01_initGroup.spec.ts b/tests/e01_initGroup.spec.ts new file mode 100644 index 000000000..82a1c0a67 --- /dev/null +++ b/tests/e01_initGroup.spec.ts @@ -0,0 +1,225 @@ +import { BN } from "@coral-xyz/anchor"; +import { AccountMeta, Transaction } from "@solana/web3.js"; +import { + addBankWithSeed, + groupConfigure, + groupInitialize, +} from "./utils/group-instructions"; +import { + bankrunContext, + bankrunProgram, + banksClient, + ecosystem, + EMODE_SEED, + emodeAdmin, + emodeGroup, + groupAdmin, + oracles, + verbose, +} from "./rootHooks"; +import { assertKeyDefault, assertKeysEqual } from "./utils/genericTests"; +import { + ASSET_TAG_DEFAULT, + ASSET_TAG_SOL, + defaultBankConfig, + ORACLE_SETUP_PYTH_LEGACY, + ORACLE_SETUP_PYTH_PUSH, +} from "./utils/types"; +import { assert } from "chai"; +import { getBankrunBlockhash } from "./utils/spl-staking-utils"; +import { deriveBankWithSeed } from "./utils/pdas"; + +describe("Init e-mode enabled group", () => { + const seed = new BN(EMODE_SEED); + + it("(admin) Init group - happy path", async () => { + let tx = new Transaction(); + + tx.add( + await groupInitialize(groupAdmin.mrgnBankrunProgram, { + marginfiGroup: emodeGroup.publicKey, + admin: groupAdmin.wallet.publicKey, + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(groupAdmin.wallet, emodeGroup); + await banksClient.processTransaction(tx); + + let group = await bankrunProgram.account.marginfiGroup.fetch( + emodeGroup.publicKey + ); + assertKeysEqual(group.admin, groupAdmin.wallet.publicKey); + assertKeyDefault(group.emodeAdmin); + if (verbose) { + console.log("*init group: " + emodeGroup.publicKey); + console.log(" group admin: " + group.admin); + } + }); + + it("(admin) Set the emode admin - happy path", async () => { + let tx = new Transaction(); + + tx.add( + await groupConfigure(groupAdmin.mrgnBankrunProgram, { + marginfiGroup: emodeGroup.publicKey, + newEmodeAdmin: emodeAdmin.wallet.publicKey + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(groupAdmin.wallet, emodeGroup); + await banksClient.processTransaction(tx); + + let group = await bankrunProgram.account.marginfiGroup.fetch( + emodeGroup.publicKey + ); + assertKeysEqual(group.emodeAdmin, emodeAdmin.wallet.publicKey); + }); + + + it("(admin) Add bank (USDC)", async () => { + let setConfig = defaultBankConfig(); + const [bankKey] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.usdcMint.publicKey, + seed + ); + const oracle = oracles.usdcOracle.publicKey; + const oracleMeta: AccountMeta = { + pubkey: oracle, + isSigner: false, + isWritable: false, + }; + const config_ix = await groupAdmin.mrgnProgram.methods + .lendingPoolConfigureBankOracle(ORACLE_SETUP_PYTH_LEGACY, oracle) + .accountsPartial({ + group: emodeGroup.publicKey, + bank: bankKey, + admin: groupAdmin.wallet.publicKey, + }) + .remainingAccounts([oracleMeta]) + .instruction(); + + let tx = new Transaction(); + tx.add( + await addBankWithSeed(groupAdmin.mrgnBankrunProgram, { + marginfiGroup: emodeGroup.publicKey, + feePayer: groupAdmin.wallet.publicKey, + bankMint: ecosystem.usdcMint.publicKey, + bank: bankKey, + config: setConfig, + seed: seed, + }), + config_ix + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(groupAdmin.wallet); + await banksClient.processTransaction(tx); + + if (verbose) { + console.log("*init USDC bank " + bankKey); + } + + const bank = await bankrunProgram.account.bank.fetch(bankKey); + assert.equal(bank.config.assetTag, ASSET_TAG_DEFAULT); + }); + + it("(admin) Add bank (SOL)", async () => { + let setConfig = defaultBankConfig(); + setConfig.assetTag = ASSET_TAG_SOL; + const [bankKey] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.wsolMint.publicKey, + seed + ); + const oracle = oracles.wsolOracle.publicKey; + const oracleMeta: AccountMeta = { + pubkey: oracle, + isSigner: false, + isWritable: false, + }; + const config_ix = await groupAdmin.mrgnProgram.methods + .lendingPoolConfigureBankOracle(ORACLE_SETUP_PYTH_LEGACY, oracle) + .accountsPartial({ + group: emodeGroup.publicKey, + bank: bankKey, + admin: groupAdmin.wallet.publicKey, + }) + .remainingAccounts([oracleMeta]) + .instruction(); + + let tx = new Transaction(); + tx.add( + await addBankWithSeed(groupAdmin.mrgnBankrunProgram, { + marginfiGroup: emodeGroup.publicKey, + feePayer: groupAdmin.wallet.publicKey, + bankMint: ecosystem.wsolMint.publicKey, + bank: bankKey, + config: setConfig, + seed: seed, + }), + config_ix + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(groupAdmin.wallet); + await banksClient.processTransaction(tx); + + if (verbose) { + console.log("*init SOL bank " + bankKey); + } + + const bank = await bankrunProgram.account.bank.fetch(bankKey); + assert.equal(bank.config.assetTag, ASSET_TAG_SOL); + }); + + it("(admin) Add bank (LST)", async () => { + let setConfig = defaultBankConfig(); + const [bankKey] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.lstAlphaMint.publicKey, + seed + ); + const oracleMeta: AccountMeta = { + pubkey: oracles.pythPullLst.publicKey, // NOTE: This is the Price V2 update + isSigner: false, + isWritable: false, + }; + + let tx = new Transaction(); + tx.add( + await addBankWithSeed(groupAdmin.mrgnBankrunProgram, { + marginfiGroup: emodeGroup.publicKey, + feePayer: groupAdmin.wallet.publicKey, + bankMint: ecosystem.lstAlphaMint.publicKey, + bank: bankKey, + config: setConfig, + seed: seed, + }), + await groupAdmin.mrgnProgram.methods + // Note: This is the feed id + .lendingPoolConfigureBankOracle( + ORACLE_SETUP_PYTH_PUSH, + oracles.pythPullLstOracleFeed.publicKey + ) + .accountsPartial({ + group: emodeGroup.publicKey, + bank: bankKey, + admin: groupAdmin.wallet.publicKey, + }) + .remainingAccounts([oracleMeta]) + .instruction() + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(groupAdmin.wallet); + await banksClient.processTransaction(tx); + + if (verbose) { + console.log("*init WSOL bank " + bankKey); + } + + const bank = await bankrunProgram.account.bank.fetch(bankKey); + assert.equal(bank.config.assetTag, ASSET_TAG_DEFAULT); + }); +}); diff --git a/tests/rootHooks.ts b/tests/rootHooks.ts index 4309aa584..ea04e31df 100644 --- a/tests/rootHooks.ts +++ b/tests/rootHooks.ts @@ -50,6 +50,8 @@ export const printBuffers = false; export let globalProgramAdmin: MockUser = undefined; /** Administers the mrgnlend group and/or stake holder accounts */ export let groupAdmin: MockUser = undefined; +/** Administers the emode group configuration */ +export let emodeAdmin: MockUser = undefined; /** Administers valiator votes and withdraws */ export let validatorAdmin: MockUser = undefined; export const users: MockUser[] = []; @@ -65,8 +67,10 @@ export const INIT_POOL_ORIGINATION_FEE = 1000; export const PROGRAM_FEE_FIXED = 0.01; export const PROGRAM_FEE_RATE = 0.02; -/** Group used for all happy-path tests */ +/** Group used for most regular e2e tests */ export const marginfiGroup = Keypair.generate(); +/** Group used for e-mode tests */ +export const emodeGroup = Keypair.generate(); /** Bank for USDC */ export const bankKeypairUsdc = Keypair.generate(); /** Bank for token A */ @@ -87,6 +91,9 @@ export const PYTH_ORACLE_SAMPLE = new PublicKey( "H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG" ); +/** Banks in the emode test suite use this seed */ +export const EMODE_SEED = 44; + /** keys copied into the bankrun instance */ let copyKeys: PublicKey[] = [PYTH_ORACLE_FEED_SAMPLE, PYTH_ORACLE_SAMPLE]; @@ -209,6 +216,7 @@ export const mochaHooks = { }; groupAdmin = await setupTestUser(provider, wallet.payer, setupUserOptions); + emodeAdmin = await setupTestUser(provider, wallet.payer, setupUserOptions); validatorAdmin = await setupTestUser( provider, wallet.payer, @@ -217,7 +225,8 @@ export const mochaHooks = { copyKeys.push( groupAdmin.usdcAccount, groupAdmin.tokenBAccount, - groupAdmin.wallet.publicKey + groupAdmin.wallet.publicKey, + emodeAdmin.wallet.publicKey ); for (let i = 0; i < numUsers; i++) { diff --git a/tests/utils/group-instructions.ts b/tests/utils/group-instructions.ts index 8aad81891..af5e1df7d 100644 --- a/tests/utils/group-instructions.ts +++ b/tests/utils/group-instructions.ts @@ -137,11 +137,13 @@ export const addBankWithSeed = ( /** * newAdmin - (Optional) pass null to keep current admin + * newEModeAdmin - (Optional) pass null to keep current emode admin * marginfiGroup's admin - must sign * isArena - default false */ export type GroupConfigureArgs = { newAdmin?: PublicKey | null; // optional; pass null or leave undefined to keep current admin + newEmodeAdmin?: PublicKey | null; marginfiGroup: PublicKey; isArena?: boolean; // optional; defaults to false if not provided }; @@ -156,8 +158,13 @@ export const groupConfigure = async ( const group = await program.account.marginfiGroup.fetch(args.marginfiGroup); newAdmin = group.admin; } + let newEmodeAdmin = args.newEmodeAdmin; + if (newEmodeAdmin == null) { + const group = await program.account.marginfiGroup.fetch(args.marginfiGroup); + newEmodeAdmin = group.emodeAdmin; + } const ix = program.methods - .marginfiGroupConfigure(newAdmin, isArena) + .marginfiGroupConfigure(newAdmin, newEmodeAdmin, isArena) .accounts({ marginfiGroup: args.marginfiGroup, // admin: // implied from group From dd2b1824ba0ab85df57e3c2d07a7a27d48cc905c Mon Sep 17 00:00:00 2001 From: jon-mobile Date: Mon, 31 Mar 2025 13:31:15 -0400 Subject: [PATCH 02/38] More emode boilerplate --- .../marginfi_group/config_bank_emode.rs | 45 +++++++++++++++++++ .../src/instructions/marginfi_group/mod.rs | 2 + programs/marginfi/src/lib.rs | 10 +++++ programs/marginfi/src/state/marginfi_group.rs | 7 +-- tests/utils/group-instructions.ts | 3 +- 5 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs diff --git a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs new file mode 100644 index 000000000..a09b98759 --- /dev/null +++ b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs @@ -0,0 +1,45 @@ +use crate::state::emode::{EmodeEntry, MAX_EMODE_ENTRIES}; +use crate::{ + state::marginfi_group::{Bank, MarginfiGroup}, + MarginfiResult, +}; +use anchor_lang::prelude::*; + +pub fn lending_pool_configure_bank_emode( + ctx: Context, + emode_tag: u16, + flags: u64, + entries: [EmodeEntry; MAX_EMODE_ENTRIES], +) -> MarginfiResult { + let mut bank = ctx.accounts.bank.load_mut()?; + + bank.emode.emode_tag = emode_tag; + bank.emode.flags = flags; + bank.emode.entries = entries; + bank.emode.timestamp = Clock::get()?.unix_timestamp; + bank.emode.validate_entries()?; + + msg!( + "emode tag set to {:?} status set to: {:?}", + emode_tag, + entries + ); + + Ok(()) +} + +#[derive(Accounts)] +pub struct LendingPoolConfigureBankEmode<'info> { + #[account( + has_one = emode_admin + )] + pub group: AccountLoader<'info, MarginfiGroup>, + + pub emode_admin: Signer<'info>, + + #[account( + mut, + has_one = group, + )] + pub bank: AccountLoader<'info, Bank>, +} diff --git a/programs/marginfi/src/instructions/marginfi_group/mod.rs b/programs/marginfi/src/instructions/marginfi_group/mod.rs index e8c3ef92d..e52457d76 100644 --- a/programs/marginfi/src/instructions/marginfi_group/mod.rs +++ b/programs/marginfi/src/instructions/marginfi_group/mod.rs @@ -4,6 +4,7 @@ mod add_pool_common; mod add_pool_permissionless; mod add_pool_with_seed; mod collect_bank_fees; +mod config_bank_emode; pub mod config_bank_oracle; mod config_group_fee; mod configure; @@ -23,6 +24,7 @@ pub use add_pool_common::*; pub use add_pool_permissionless::*; pub use add_pool_with_seed::*; pub use collect_bank_fees::*; +pub use config_bank_emode::*; pub use config_bank_oracle::*; pub use config_group_fee::*; pub use configure::*; diff --git a/programs/marginfi/src/lib.rs b/programs/marginfi/src/lib.rs index 410f40c3f..0ddbba26b 100644 --- a/programs/marginfi/src/lib.rs +++ b/programs/marginfi/src/lib.rs @@ -10,6 +10,7 @@ pub mod utils; use anchor_lang::prelude::*; use instructions::*; use prelude::*; +use state::emode::{EmodeEntry, MAX_EMODE_ENTRIES}; use state::marginfi_group::WrappedI80F48; use state::marginfi_group::{BankConfigCompact, BankConfigOpt}; @@ -85,6 +86,15 @@ pub mod marginfi { marginfi_group::lending_pool_configure_bank_oracle(ctx, setup, oracle) } + pub fn lending_pool_configure_bank_emode( + ctx: Context, + emode_tag: u16, + flags: u64, + entries: [EmodeEntry; MAX_EMODE_ENTRIES], + ) -> MarginfiResult { + marginfi_group::lending_pool_configure_bank_emode(ctx, emode_tag, flags, entries) + } + pub fn lending_pool_setup_emissions( ctx: Context, flags: u64, diff --git a/programs/marginfi/src/state/marginfi_group.rs b/programs/marginfi/src/state/marginfi_group.rs index b06e03493..453476361 100644 --- a/programs/marginfi/src/state/marginfi_group.rs +++ b/programs/marginfi/src/state/marginfi_group.rs @@ -58,9 +58,9 @@ pub struct MarginfiGroup { // 0.1.2 went live. pub banks: u16, pub pad0: [u8; 6], - /// This admin can configure collateral ratios above (but not below) the - /// collateral ratio of certain banks , e.g. allow SOL to count as 90% - /// collateral when borrowing an LST instead of the default rate. + /// This admin can configure collateral ratios above (but not below) the collateral ratio of + /// certain banks , e.g. allow SOL to count as 90% collateral when borrowing an LST instead of + /// the default rate. pub emode_admin: Pubkey, pub _padding_0: [[u64; 2]; 24], @@ -1449,6 +1449,7 @@ impl BankConfig { requirement_type: RequirementType, balance_side: BalanceSide, ) -> I80F48 { + // TODO emode determination... match (requirement_type, balance_side) { (RequirementType::Initial, BalanceSide::Assets) => self.asset_weight_init.into(), (RequirementType::Initial, BalanceSide::Liabilities) => { diff --git a/tests/utils/group-instructions.ts b/tests/utils/group-instructions.ts index af5e1df7d..f3e7c42b2 100644 --- a/tests/utils/group-instructions.ts +++ b/tests/utils/group-instructions.ts @@ -153,14 +153,13 @@ export const groupConfigure = async ( args: GroupConfigureArgs ) => { const isArena = args.isArena ?? false; + const group = await program.account.marginfiGroup.fetch(args.marginfiGroup); let newAdmin = args.newAdmin; if (newAdmin == null) { - const group = await program.account.marginfiGroup.fetch(args.marginfiGroup); newAdmin = group.admin; } let newEmodeAdmin = args.newEmodeAdmin; if (newEmodeAdmin == null) { - const group = await program.account.marginfiGroup.fetch(args.marginfiGroup); newEmodeAdmin = group.emodeAdmin; } const ix = program.methods From 85f2393f6aea2b839e3028402ab3c47fe536e706 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Mon, 31 Mar 2025 16:13:52 -0400 Subject: [PATCH 03/38] Emode setup and cargo tests --- clients/rust/marginfi-cli/src/entrypoint.rs | 7 +- .../rust/marginfi-cli/src/processor/mod.rs | 2 + guides/DEPLOY_GUIDE.md | 2 +- guides/DEPLOY_GUIDE_STAGING.md | 2 +- programs/marginfi/src/errors.rs | 2 + .../marginfi_group/config_bank_emode.rs | 22 +++- programs/marginfi/src/lib.rs | 3 +- programs/marginfi/src/state/emode.rs | 115 +++++++++++++++++- .../tests/admin_actions/setup_bank.rs | 4 +- programs/marginfi/tests/misc/regression.rs | 2 +- 10 files changed, 144 insertions(+), 17 deletions(-) diff --git a/clients/rust/marginfi-cli/src/entrypoint.rs b/clients/rust/marginfi-cli/src/entrypoint.rs index 27091cceb..9efb8cd54 100644 --- a/clients/rust/marginfi-cli/src/entrypoint.rs +++ b/clients/rust/marginfi-cli/src/entrypoint.rs @@ -103,6 +103,8 @@ pub enum GroupCommand { #[clap(long)] new_admin: Pubkey, #[clap(long)] + new_emode_admin: Pubkey, + #[clap(long)] is_arena_group: bool, }, AddBank { @@ -606,8 +608,11 @@ fn group(subcmd: GroupCommand, global_options: &GlobalOptions) -> Result<()> { GroupCommand::Update { new_admin, + new_emode_admin, is_arena_group, - } => processor::group_configure(config, profile, new_admin, is_arena_group), + } => { + processor::group_configure(config, profile, new_admin, new_emode_admin, is_arena_group) + } GroupCommand::AddBank { mint: bank_mint, diff --git a/clients/rust/marginfi-cli/src/processor/mod.rs b/clients/rust/marginfi-cli/src/processor/mod.rs index 5247c3c69..160df7f62 100644 --- a/clients/rust/marginfi-cli/src/processor/mod.rs +++ b/clients/rust/marginfi-cli/src/processor/mod.rs @@ -261,6 +261,7 @@ pub fn group_configure( config: Config, profile: Profile, new_admin: Pubkey, + new_emode_admin: Pubkey, is_arena_group: bool, ) -> Result<()> { let rpc_client = config.mfi_program.rpc(); @@ -282,6 +283,7 @@ pub fn group_configure( }) .args(marginfi::instruction::MarginfiGroupConfigure { new_admin, + new_emode_admin, is_arena_group, }) .instructions()?; diff --git a/guides/DEPLOY_GUIDE.md b/guides/DEPLOY_GUIDE.md index 9179600e6..a88b479d3 100644 --- a/guides/DEPLOY_GUIDE.md +++ b/guides/DEPLOY_GUIDE.md @@ -42,7 +42,7 @@ Here we list recent deployments to staging/mainnet. The hash is always the first * 0.1.0: Jan 30, 2025 ~2:35pm ET -- Hash: a4dd3e7 * 0.1.1: Feb 7, 2025 ~8:15am ET -- Hash: 03455c -* 0.1.2: Pending +* 0.1.2: March 14, 2025 ~3:00pm ET -- Hash 65bbbe ### MAINNET diff --git a/guides/DEPLOY_GUIDE_STAGING.md b/guides/DEPLOY_GUIDE_STAGING.md index e37e04a89..9ca699bcc 100644 --- a/guides/DEPLOY_GUIDE_STAGING.md +++ b/guides/DEPLOY_GUIDE_STAGING.md @@ -47,7 +47,7 @@ solana program deploy --use-rpc \ --url \ --buffer recovered-buffer.json ``` -* Program buffer full? Use: +* Program buffer full (e.g. `account data too small for instruction`)? Use: ``` solana program extend \ --url \ diff --git a/programs/marginfi/src/errors.rs b/programs/marginfi/src/errors.rs index b707619f9..3a3ec532a 100644 --- a/programs/marginfi/src/errors.rs +++ b/programs/marginfi/src/errors.rs @@ -152,6 +152,8 @@ pub enum MarginfiError { ArenaBankLimit, #[msg("Arena groups cannot return to non-arena status")] // 6074 ArenaSettingCannotChange, + #[msg("The Emode config was invalid")] // 6075 + BadEmodeConfig, } impl From for ProgramError { diff --git a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs index a09b98759..ff63f3fd1 100644 --- a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs +++ b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs @@ -8,21 +8,33 @@ use anchor_lang::prelude::*; pub fn lending_pool_configure_bank_emode( ctx: Context, emode_tag: u16, - flags: u64, entries: [EmodeEntry; MAX_EMODE_ENTRIES], ) -> MarginfiResult { let mut bank = ctx.accounts.bank.load_mut()?; + let mut sorted_entries = entries; + sorted_entries.sort_by(|a, b| { + a.collateral_bank_emode_tag + .cmp(&b.collateral_bank_emode_tag) + }); + bank.emode.emode_tag = emode_tag; - bank.emode.flags = flags; - bank.emode.entries = entries; + bank.emode.entries = sorted_entries; bank.emode.timestamp = Clock::get()?.unix_timestamp; bank.emode.validate_entries()?; + if bank.emode.has_entries() { + msg!("emode entries detected and activated"); + bank.emode.set_emode_enabled(true); + } else { + msg!("no emode entries detected"); + bank.emode.set_emode_enabled(false); + } + msg!( - "emode tag set to {:?} status set to: {:?}", + "emode tag set to {:?} entries set to: {:?}", emode_tag, - entries + sorted_entries ); Ok(()) diff --git a/programs/marginfi/src/lib.rs b/programs/marginfi/src/lib.rs index 0ddbba26b..3623c58c3 100644 --- a/programs/marginfi/src/lib.rs +++ b/programs/marginfi/src/lib.rs @@ -89,10 +89,9 @@ pub mod marginfi { pub fn lending_pool_configure_bank_emode( ctx: Context, emode_tag: u16, - flags: u64, entries: [EmodeEntry; MAX_EMODE_ENTRIES], ) -> MarginfiResult { - marginfi_group::lending_pool_configure_bank_emode(ctx, emode_tag, flags, entries) + marginfi_group::lending_pool_configure_bank_emode(ctx, emode_tag, entries) } pub fn lending_pool_setup_emissions( diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs index fbd99df19..0626b71c0 100644 --- a/programs/marginfi/src/state/emode.rs +++ b/programs/marginfi/src/state/emode.rs @@ -7,6 +7,8 @@ use bytemuck::{Pod, Zeroable}; use fixed::types::I80F48; use type_layout::TypeLayout; +pub const EMODE_ON: u64 = 1; + pub const MAX_EMODE_ENTRIES: usize = 10; pub const EMODE_TAG_EMPTY: u16 = 0; @@ -35,7 +37,8 @@ pub struct EmodeSettings { /// Unix timestamp from the system clock when emode state was last updated pub timestamp: i64, - /// Reserved for future use + /// EMODE_ON (1) - If set, at least one entry is configured + /// 2, 4, 8, etc, Reserved for future use pub flags: u64, /// This bank's emode configurations. pub entries: [EmodeEntry; MAX_EMODE_ENTRIES], @@ -58,19 +61,52 @@ impl EmodeSettings { check!( asset_init_w >= I80F48::ZERO && asset_init_w <= I80F48::ONE, - MarginfiError::InvalidConfig + MarginfiError::BadEmodeConfig ); - check!(asset_maint_w >= asset_init_w, MarginfiError::InvalidConfig); + check!(asset_maint_w >= asset_init_w, MarginfiError::BadEmodeConfig); } - // TODO check each tag is unique and appears just once + // Validate that no duplicates exist (other than EMODE_TAG_EMPTY - 0) + self.check_dupes()?; Ok(()) } + /// Note: expects entries to be sorted, invalid otherwise. + fn check_dupes(&self) -> MarginfiResult { + let non_empty_tags: Vec = self + .entries + .iter() + .filter(|e| !e.is_empty()) + .map(|e| e.collateral_bank_emode_tag) + .collect(); + + if non_empty_tags.windows(2).any(|w| w[0] == w[1]) { + return err!(MarginfiError::BadEmodeConfig); + } else { + Ok(()) + } + } + pub fn find_with_tag(&self, tag: u16) -> Option<&EmodeEntry> { self.entries.iter().find(|e| e.tag_equals(tag)) } + /// True if any entries are present in the mode configuration. Typically, this is the definition + /// of flag `EMODE_ON` + pub fn has_entries(&self) -> bool { + self.entries.iter().any(|e| !e.is_empty()) + } + /// True if an emode configuration has been set (EMODE_ON) + pub fn is_enabled(&self) -> bool { + self.flags & EMODE_ON != 0 + } + pub fn set_emode_enabled(&mut self, enabled: bool) { + if enabled { + self.flags |= EMODE_ON; + } else { + self.flags &= !EMODE_ON; + } + } } pub const APPLIES_TO_ISOLATED: u16 = 1; @@ -104,3 +140,74 @@ impl EmodeEntry { self.collateral_bank_emode_tag == tag } } + +#[cfg(test)] +mod tests { + use super::*; + use fixed_macro::types::I80F48; + + fn create_generic_entry(tag: u16) -> EmodeEntry { + EmodeEntry { + collateral_bank_emode_tag: tag, + flags: 0, + pad0: [0u8; 5], + asset_weight_init: I80F48!(0.7).into(), + asset_weight_maint: I80F48!(0.8).into(), + } + } + + #[test] + fn test_emode_valid_entries() { + let mut settings = EmodeSettings::zeroed(); + settings.entries[0] = create_generic_entry(1); + settings.entries[1] = create_generic_entry(2); + settings.entries[2] = create_generic_entry(3); + // Note: The remaining entries stay zeroed (and are skipped during validation). + assert!(settings.validate_entries().is_ok()); + } + + #[test] + fn test_emode_invalid_duplicate_tags() { + let mut settings = EmodeSettings::zeroed(); + settings.entries[0] = create_generic_entry(1); + settings.entries[1] = create_generic_entry(1); // Duplicate tag: 1. + settings.entries[2] = create_generic_entry(2); + let result = settings.validate_entries(); + assert!(result.is_err()); + assert_eq!(result.err().unwrap(), MarginfiError::BadEmodeConfig.into()); + } + + #[test] + fn test_emode_invalid_weight_too_high() { + let mut settings = EmodeSettings::zeroed(); + // Using a weight greater than 1.0 is invalid. + let entry = EmodeEntry { + collateral_bank_emode_tag: 1, + flags: 0, + pad0: [0u8; 5], + asset_weight_init: I80F48!(1.2).into(), + asset_weight_maint: I80F48!(1.3).into(), + }; + settings.entries[0] = entry; + let result = settings.validate_entries(); + assert!(result.is_err()); + assert_eq!(result.err().unwrap(), MarginfiError::BadEmodeConfig.into()); + } + + #[test] + fn test_emode_invalid_weight_main_le_init() { + let mut settings = EmodeSettings::zeroed(); + // Maint must be greater than init + let entry = EmodeEntry { + collateral_bank_emode_tag: 1, + flags: 0, + pad0: [0u8; 5], + asset_weight_init: I80F48!(0.8).into(), + asset_weight_maint: I80F48!(0.7).into(), + }; + settings.entries[0] = entry; + let result = settings.validate_entries(); + assert!(result.is_err()); + assert_eq!(result.err().unwrap(), MarginfiError::BadEmodeConfig.into()); + } +} diff --git a/programs/marginfi/tests/admin_actions/setup_bank.rs b/programs/marginfi/tests/admin_actions/setup_bank.rs index 9b0664a5a..781856b81 100644 --- a/programs/marginfi/tests/admin_actions/setup_bank.rs +++ b/programs/marginfi/tests/admin_actions/setup_bank.rs @@ -119,7 +119,7 @@ async fn add_bank_success() -> anyhow::Result<()> { assert_eq!(emissions_remaining, I80F48!(0.0).into()); assert_eq!(collected_program_fees_outstanding, I80F48!(0.0).into()); - assert_eq!(_padding_0, <[[u64; 2]; 27] as Default>::default()); + assert_eq!(_padding_0, <[u8; 8] as Default>::default()); assert_eq!(_padding_1, <[[u64; 2]; 32] as Default>::default()); // this is the only loosely checked field @@ -254,7 +254,7 @@ async fn add_bank_with_seed_success() -> anyhow::Result<()> { assert_eq!(emissions_remaining, I80F48!(0.0).into()); assert_eq!(collected_program_fees_outstanding, I80F48!(0.0).into()); - assert_eq!(_padding_0, <[[u64; 2]; 27] as Default>::default()); + assert_eq!(_padding_0, <[u8; 8] as Default>::default()); assert_eq!(_padding_1, <[[u64; 2]; 32] as Default>::default()); // this is the only loosely checked field diff --git a/programs/marginfi/tests/misc/regression.rs b/programs/marginfi/tests/misc/regression.rs index 430260f34..92661f5be 100644 --- a/programs/marginfi/tests/misc/regression.rs +++ b/programs/marginfi/tests/misc/regression.rs @@ -674,7 +674,7 @@ async fn bank_field_values_reg() -> anyhow::Result<()> { I80F48::from_str("0").unwrap() ); - assert_eq!(bank._padding_0, [[0, 0]; 27]); + assert_eq!(bank._padding_0, [0; 8]); assert_eq!(bank._padding_1, [[0, 0]; 32]); Ok(()) From 4fe393cd69fff7b91a621be25f3eddf5d82f1e41 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Tue, 1 Apr 2025 16:00:34 -0400 Subject: [PATCH 04/38] Emode reconcilliation mechanism --- .../marginfi_group/config_bank_emode.rs | 7 +- programs/marginfi/src/state/emode.rs | 252 ++++++++++++++++-- 2 files changed, 238 insertions(+), 21 deletions(-) diff --git a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs index ff63f3fd1..b9dba0757 100644 --- a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs +++ b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs @@ -13,13 +13,10 @@ pub fn lending_pool_configure_bank_emode( let mut bank = ctx.accounts.bank.load_mut()?; let mut sorted_entries = entries; - sorted_entries.sort_by(|a, b| { - a.collateral_bank_emode_tag - .cmp(&b.collateral_bank_emode_tag) - }); + sorted_entries.sort_by_key(|e| e.collateral_bank_emode_tag); bank.emode.emode_tag = emode_tag; - bank.emode.entries = sorted_entries; + bank.emode.emode_config.entries = sorted_entries; bank.emode.timestamp = Clock::get()?.unix_timestamp; bank.emode.validate_entries()?; diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs index 0626b71c0..42e5efea6 100644 --- a/programs/marginfi/src/state/emode.rs +++ b/programs/marginfi/src/state/emode.rs @@ -40,10 +40,40 @@ pub struct EmodeSettings { /// EMODE_ON (1) - If set, at least one entry is configured /// 2, 4, 8, etc, Reserved for future use pub flags: u64, - /// This bank's emode configurations. + + pub emode_config: EmodeConfig, +} + +assert_struct_size!(EmodeConfig, 400); +assert_struct_align!(EmodeConfig, 8); +#[repr(C)] +#[derive( + AnchorDeserialize, AnchorSerialize, Copy, Clone, Zeroable, Pod, PartialEq, Eq, TypeLayout, Debug, +)] +/// A bank's emode configurations. +pub struct EmodeConfig { pub entries: [EmodeEntry; MAX_EMODE_ENTRIES], } +impl EmodeConfig { + /// Creates an EmodeConfig from a list of EmodeEntry items. + /// Entries will be sorted by tag. + /// Panics if more than MAX_EMODE_ENTRIES are provided. + pub fn from_entries(mut entries: Vec) -> Self { + if entries.len() > MAX_EMODE_ENTRIES { + panic!( + "Too many EmodeEntry items {:?}, maximum allowed {:?}", + entries.len(), + MAX_EMODE_ENTRIES + ); + } + entries.sort_by_key(|e| e.collateral_bank_emode_tag); + let mut config = Self::zeroed(); + config.entries[..entries.len()].copy_from_slice(&entries); + config + } +} + impl Default for EmodeSettings { fn default() -> Self { Self::zeroed() @@ -52,7 +82,7 @@ impl Default for EmodeSettings { impl EmodeSettings { pub fn validate_entries(&self) -> MarginfiResult { - for entry in self.entries { + for entry in self.emode_config.entries { if entry.is_empty() { continue; } @@ -75,6 +105,7 @@ impl EmodeSettings { /// Note: expects entries to be sorted, invalid otherwise. fn check_dupes(&self) -> MarginfiResult { let non_empty_tags: Vec = self + .emode_config .entries .iter() .filter(|e| !e.is_empty()) @@ -89,12 +120,12 @@ impl EmodeSettings { } pub fn find_with_tag(&self, tag: u16) -> Option<&EmodeEntry> { - self.entries.iter().find(|e| e.tag_equals(tag)) + self.emode_config.entries.iter().find(|e| e.tag_equals(tag)) } /// True if any entries are present in the mode configuration. Typically, this is the definition /// of flag `EMODE_ON` pub fn has_entries(&self) -> bool { - self.entries.iter().any(|e| !e.is_empty()) + self.emode_config.entries.iter().any(|e| !e.is_empty()) } /// True if an emode configuration has been set (EMODE_ON) pub fn is_enabled(&self) -> bool { @@ -141,27 +172,133 @@ impl EmodeEntry { } } +/// Users who borrow multiple e-mode assets at the same time get the LEAST FAVORABLE treatment +/// between the borrowed assets, regardless of the amount of each asset borrowed. For example, if +/// borrowing an LST and USDC against SOL, the user would normally get an emode benefit for LST/SOL, +/// but since they are also borrowing USDC, they get only standard rates. +/// +/// Returns the INTERSECTION of EmodeConfigs. If passed configs have the same +/// `collateral_bank_emode_tag`, we will take the one that has: +/// 1) The lesser of the flags (e.g. if just one has APPLIES_TO_ISOLATED, we take flags = 0) +/// 2) The lesser of both asset_weight_init and asset_weight_maint +/// +/// If one config has a collateral_bank_emode_tag and the others do not, ***we don't make an +/// EmodeEntry for it at all***, i.e. there is no benefit for that collateral +/// +/// ***Example 1*** +/// * entry | tag | flags | init | maint +/// * 0 101 1 70 75 +/// * 1 101 0 60 80 +/// Result +/// * tag | flags | init | maint +/// * 101 0 60 75 +/// +/// +/// ***Example 2*** +/// * entry | tag | flags | init | maint +/// * 0 99 1 70 75 +/// * 1 101 0 60 80 +/// Result +/// * tag | flags | init | maint +/// * empty +/// +/// +/// ***Example 3*** +/// * entry | tag | flags | init | maint +/// * 0 101 1 70 75 +/// * 1 101 0 60 80 +/// * 2 101 0 60 80 +/// * 2 99 0 60 80 +/// Result +/// * tag | flags | init | maint +/// * 101 0 60 75 +pub fn reconcile_emode_configs(configs: Vec) -> EmodeConfig { + // TODO benchmark this in the mock program + // If no configs, return a zeroed config. + if configs.is_empty() { + return EmodeConfig::zeroed(); + } + // If only one config, return it. + if configs.len() == 1 { + return configs.into_iter().next().unwrap(); + } + + let num_configs = configs.len(); + // Stores (tag, (entry, tag_count)), where tag_count is how many times we've seen this tag. This + // BTreeMap is logically easier on the eyes, but is probably fairly CU expensive, and should be + // benchmarked at some point, a simple Vec might actually be more performant here + let mut merged_entries: std::collections::BTreeMap = + std::collections::BTreeMap::new(); + + for config in &configs { + for entry in config.entries.iter() { + if entry.is_empty() { + continue; + } + // Note: We assume that entries is de-duped and each tag appears at most one time! + let tag = entry.collateral_bank_emode_tag; + // Insert or merge the entry: if an entry with the same tag already exists, take the + // lesser of each field, increment how many times we've seen this tag + merged_entries + .entry(tag) + .and_modify(|(merged, tag_count)| { + // Note: More complex flag merging logic may be needed in the future + merged.flags = merged.flags.min(entry.flags); + let current_init: I80F48 = merged.asset_weight_init.into(); + let new_init: I80F48 = entry.asset_weight_init.into(); + if new_init < current_init { + merged.asset_weight_init = entry.asset_weight_init; + } + let current_maint: I80F48 = merged.asset_weight_maint.into(); + let new_maint: I80F48 = entry.asset_weight_maint.into(); + if new_maint < current_maint { + merged.asset_weight_maint = entry.asset_weight_maint; + } + *tag_count += 1; + }) + .or_insert((*entry, 1)); + } + } + + // Collect only the tags that appear in EVERY config. + let final_entries: Vec = merged_entries + .into_iter() + .filter(|(_, (_, tag_count))| *tag_count == num_configs) + .map(|(_, (merged_entry, _))| merged_entry) + .collect(); + + // Sort the entries by tag and build a config from them + let final_config = EmodeConfig::from_entries(final_entries); + + final_config +} + #[cfg(test)] mod tests { use super::*; use fixed_macro::types::I80F48; - fn create_generic_entry(tag: u16) -> EmodeEntry { + fn create_entry(tag: u16, flags: u8, init: f32, maint: f32) -> EmodeEntry { EmodeEntry { collateral_bank_emode_tag: tag, - flags: 0, + flags, pad0: [0u8; 5], - asset_weight_init: I80F48!(0.7).into(), - asset_weight_maint: I80F48!(0.8).into(), + asset_weight_init: I80F48::from_num(init).into(), + asset_weight_maint: I80F48::from_num(maint).into(), } } + /// "Standard" entry with flags=0, init=0.7, maint=0.8. + fn generic_entry(tag: u16) -> EmodeEntry { + create_entry(tag, 0, 0.7, 0.8) + } + #[test] fn test_emode_valid_entries() { let mut settings = EmodeSettings::zeroed(); - settings.entries[0] = create_generic_entry(1); - settings.entries[1] = create_generic_entry(2); - settings.entries[2] = create_generic_entry(3); + settings.emode_config.entries[0] = generic_entry(1); + settings.emode_config.entries[1] = generic_entry(2); + settings.emode_config.entries[2] = generic_entry(3); // Note: The remaining entries stay zeroed (and are skipped during validation). assert!(settings.validate_entries().is_ok()); } @@ -169,9 +306,9 @@ mod tests { #[test] fn test_emode_invalid_duplicate_tags() { let mut settings = EmodeSettings::zeroed(); - settings.entries[0] = create_generic_entry(1); - settings.entries[1] = create_generic_entry(1); // Duplicate tag: 1. - settings.entries[2] = create_generic_entry(2); + settings.emode_config.entries[0] = generic_entry(1); + settings.emode_config.entries[1] = generic_entry(1); // Duplicate tag: 1. + settings.emode_config.entries[2] = generic_entry(2); let result = settings.validate_entries(); assert!(result.is_err()); assert_eq!(result.err().unwrap(), MarginfiError::BadEmodeConfig.into()); @@ -188,7 +325,7 @@ mod tests { asset_weight_init: I80F48!(1.2).into(), asset_weight_maint: I80F48!(1.3).into(), }; - settings.entries[0] = entry; + settings.emode_config.entries[0] = entry; let result = settings.validate_entries(); assert!(result.is_err()); assert_eq!(result.err().unwrap(), MarginfiError::BadEmodeConfig.into()); @@ -205,9 +342,92 @@ mod tests { asset_weight_init: I80F48!(0.8).into(), asset_weight_maint: I80F48!(0.7).into(), }; - settings.entries[0] = entry; + settings.emode_config.entries[0] = entry; let result = settings.validate_entries(); assert!(result.is_err()); assert_eq!(result.err().unwrap(), MarginfiError::BadEmodeConfig.into()); } + + #[test] + fn test_reconcile_emode_single_common_tag() { + // Example 1: + // * Config1 has an entry with tag 101, flags 1, init 0.7, maint 0.75. + // * Config2 has an entry with tag 101, flags 0, init 0.6, maint 0.8. + let entry1 = create_entry(101, 1, 0.7, 0.75); + let entry2 = create_entry(101, 0, 0.6, 0.8); + let config1 = EmodeConfig::from_entries(vec![entry1]); + let config2 = EmodeConfig::from_entries(vec![entry2]); + + let reconciled = reconcile_emode_configs(vec![config1, config2]); + + // Expected: For tag 101, flags = min(1,0)=0, init = min(0.7,0.6)=0.6, maint = min(0.75,0.8)=0.75. + let expected_entry = create_entry(101, 0, 0.6, 0.75); + + assert_eq!(reconciled.entries[0], expected_entry); + // The rest of the entries should be zeroed. + for entry in reconciled.entries.iter().skip(1) { + assert!(entry.is_empty()); + } + } + + #[test] + fn test_reconcile_emode_no_common_tags() { + // Example 2: + // * Config1 has an entry with tag 99. + // * Config2 has an entry with tag 101. + // * Since there is no common tag across both, the result should be an empty (zeroed) config. + let config1 = EmodeConfig::from_entries(vec![generic_entry(99)]); + let config2 = EmodeConfig::from_entries(vec![generic_entry(101)]); + + let reconciled = reconcile_emode_configs(vec![config1, config2]); + + // Verify that all entries are empty. + assert!(reconciled.entries.iter().all(|entry| entry.is_empty())); + } + + #[test] + fn test_reconcile_emode_multiple_configs() { + // Example 3: + // * Config1 has entries with tags 101 and 99. + // * Config2 has an entry with tag 101. + // * Config3 has an entry with tag 101. + // * Only tag 101 is common to all configs. + // * For tag 101: + // - Config1: flags 1, init 0.7, maint 0.75. + // - Config2: flags 0, init 0.6, maint 0.8. + // - Config3: flags 0, init 0.65, maint 0.8. + // * The reconciled entry should have: + // - flags = min(1, 0, 0) = 0, + // - init = min(0.7, 0.6, 0.65) = 0.6, + // - maint = min(0.75, 0.8, 0.8) = 0.75. + let entry1 = create_entry(101, 1, 0.7, 0.75); + let entry2 = create_entry(101, 0, 0.6, 0.8); + let entry3 = create_entry(101, 0, 0.65, 0.8); + + let config1 = EmodeConfig::from_entries(vec![entry1, generic_entry(99)]); + let config2 = EmodeConfig::from_entries(vec![entry2]); + let config3 = EmodeConfig::from_entries(vec![entry3]); + + let reconciled = reconcile_emode_configs(vec![config1, config2, config3]); + + let expected_entry = create_entry(101, 0, 0.6, 0.75); + + assert_eq!(reconciled.entries[0], expected_entry); + // All other entries should be zeroed. + for entry in reconciled.entries.iter().skip(1) { + assert!(entry.is_empty()); + } + } + + #[test] + #[should_panic(expected = "Too many EmodeEntry items")] + fn test_emode_from_entries_panics_on_too_many_entries() { + // Generate more entries than allowed. + let mut entries = Vec::new(); + for i in 0..(MAX_EMODE_ENTRIES as u16 + 1) { + entries.push(generic_entry(i)); + } + // This call should panic. + let _ = EmodeConfig::from_entries(entries); + } } From c6cb9173bb7c78f7eb7a41a51831495b2d6cf668 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Tue, 1 Apr 2025 16:12:45 -0400 Subject: [PATCH 05/38] Refactor risk engine loading to remove wasteful bank multiple loads --- .../marginfi/src/state/marginfi_account.rs | 61 ++++--------------- 1 file changed, 13 insertions(+), 48 deletions(-) diff --git a/programs/marginfi/src/state/marginfi_account.rs b/programs/marginfi/src/state/marginfi_account.rs index 3ef0ed96d..735f20f5d 100644 --- a/programs/marginfi/src/state/marginfi_account.rs +++ b/programs/marginfi/src/state/marginfi_account.rs @@ -14,7 +14,7 @@ use crate::{ prelude::{MarginfiError, MarginfiResult}, utils::NumTraitsWithTolerance, }; -use anchor_lang::{prelude::*, Discriminator}; +use anchor_lang::prelude::*; use anchor_spl::token_interface::Mint; use bytemuck::{Pod, Zeroable}; use fixed::types::I80F48; @@ -186,8 +186,8 @@ impl RequirementType { } } -pub struct BankAccountWithPriceFeed<'a, 'info> { - bank: AccountInfo<'info>, +pub struct BankAccountWithPriceFeed<'a> { + bank: Box, price_feed: Box>, balance: &'a Balance, } @@ -197,11 +197,11 @@ pub enum BalanceSide { Liabilities, } -impl<'info> BankAccountWithPriceFeed<'_, 'info> { +impl<'info> BankAccountWithPriceFeed<'_> { pub fn load<'a>( lending_account: &'a LendingAccount, remaining_ais: &'info [AccountInfo<'info>], - ) -> MarginfiResult>> { + ) -> MarginfiResult>> { let clock = Clock::get()?; let mut account_index = 0; @@ -240,7 +240,7 @@ impl<'info> BankAccountWithPriceFeed<'_, 'info> { account_index += num_accounts; Ok(BankAccountWithPriceFeed { - bank: bank_ai.clone(), + bank: Box::new(*bank), price_feed: price_adapter, balance, }) @@ -270,30 +270,7 @@ impl<'info> BankAccountWithPriceFeed<'_, 'info> { { match self.balance.get_side() { Some(side) => { - // We want lifetime <'a> but we have <'info> and it's a pain to modify everything... - // To avoid an unsafe transmuation we just interpret the bank from bytes. Here we - // repeat some of the sanity checks from AccountLoader - if self.bank.owner != &Bank::owner() { - panic!("bank owned by wrong program, this should never happen"); - } - let bank_data = &self.bank.try_borrow_data()?; - if bank_data.len() < Bank::LEN + 8 { - panic!("bank too short, this should never happen"); - } - let bank_discrim: &[u8] = &bank_data[0..8]; - if bank_discrim != Bank::DISCRIMINATOR { - panic!("bad bank discriminator, this should never happen"); - } - let bank_data: &[u8] = &bank_data[8..]; - let bank = *bytemuck::from_bytes(bank_data); - - // Our alternative is this transmute, which is probably fine because we are - // shortening 'info to 'a, but better not to tempt fate with transmute in case - // Anchor messes with lifetimes in a later version. - - // let shorter_bank: &'a AccountInfo<'a> = unsafe { core::mem::transmute(&self.bank) }; - // let bank_al = AccountLoader::::try_from(&shorter_bank)?; - // let bank = bank_al.load()?; + let bank = &self.bank; match side { BalanceSide::Assets => { @@ -488,16 +465,16 @@ impl RiskRequirementType { } } -pub struct RiskEngine<'a, 'info> { +pub struct RiskEngine<'a> { marginfi_account: &'a MarginfiAccount, - bank_accounts_with_price: Vec>, + bank_accounts_with_price: Vec>, } -impl<'info> RiskEngine<'_, 'info> { +impl<'info> RiskEngine<'_> { pub fn new<'a>( marginfi_account: &'a MarginfiAccount, remaining_ais: &'info [AccountInfo<'info>], - ) -> MarginfiResult> { + ) -> MarginfiResult> { check!( !marginfi_account.get_flag(ACCOUNT_IN_FLASHLOAN), MarginfiError::AccountInFlashloan @@ -511,7 +488,7 @@ impl<'info> RiskEngine<'_, 'info> { fn new_no_flashloan_check<'a>( marginfi_account: &'a MarginfiAccount, remaining_ais: &'info [AccountInfo<'info>], - ) -> MarginfiResult> { + ) -> MarginfiResult> { let bank_accounts_with_price = BankAccountWithPriceFeed::load(&marginfi_account.lending_account, remaining_ais)?; @@ -769,19 +746,7 @@ impl<'info> RiskEngine<'_, 'info> { let mut is_in_isolated_risk_tier = false; for a in balances_with_liablities { - if a.bank.owner != &Bank::owner() { - panic!("bank owned by wrong program, this should never happen"); - } - let bank_data = a.bank.try_borrow_data()?; - if bank_data.len() < Bank::LEN + 8 { - panic!("bank too short, this should never happen"); - } - let bank_discrim = &bank_data[0..8]; - if bank_discrim != Bank::DISCRIMINATOR { - panic!("bad bank discriminator, this should never happen"); - } - let bank_data = &bank_data[8..]; - let bank: Bank = *bytemuck::from_bytes(bank_data); + let bank = &a.bank; if bank.config.risk_tier == RiskTier::Isolated { is_in_isolated_risk_tier = true; break; From a8c7c3694cdc8c7a5d42360f41a65f70c1685577 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Tue, 1 Apr 2025 17:36:43 -0400 Subject: [PATCH 06/38] Begin boilerplate test setup --- .../marginfi_account/liquidate.rs | 3 + .../marginfi_group/config_bank_emode.rs | 9 +- programs/marginfi/src/state/emode.rs | 22 +- .../marginfi/src/state/marginfi_account.rs | 69 ++++-- tests/e01_initGroup.spec.ts | 234 ++++++++---------- tests/e02_configEmode.spec.ts | 65 +++++ tests/utils/group-instructions.ts | 62 +++++ tests/utils/types.ts | 26 +- 8 files changed, 331 insertions(+), 159 deletions(-) create mode 100644 tests/e02_configEmode.spec.ts diff --git a/programs/marginfi/src/instructions/marginfi_account/liquidate.rs b/programs/marginfi/src/instructions/marginfi_account/liquidate.rs index 1328d22fd..a0f3c1516 100644 --- a/programs/marginfi/src/instructions/marginfi_account/liquidate.rs +++ b/programs/marginfi/src/instructions/marginfi_account/liquidate.rs @@ -384,6 +384,9 @@ pub fn lending_account_liquidate<'info>( // TODO consider if health cache update here is worth blowing the extra CU + // TODO is this even neccessary? Under what circumstances can a liquidator put themselves + // underwater after a liquidation? + // Verify liquidator account health RiskEngine::check_account_init_health( &liquidator_marginfi_account, diff --git a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs index b9dba0757..9db055f2a 100644 --- a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs +++ b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs @@ -15,12 +15,19 @@ pub fn lending_pool_configure_bank_emode( let mut sorted_entries = entries; sorted_entries.sort_by_key(|e| e.collateral_bank_emode_tag); + // Prevent footguns from passing data in padding, which could interfere with future values in + // that assumed-empty space. Yes, we could simply take a struct without padding as input, but + // having a seperate config type has proved to be more of a pain than dealing with padding. + for entry in sorted_entries.iter_mut() { + entry.pad0 = [0; 5]; + } + bank.emode.emode_tag = emode_tag; bank.emode.emode_config.entries = sorted_entries; bank.emode.timestamp = Clock::get()?.unix_timestamp; bank.emode.validate_entries()?; - if bank.emode.has_entries() { + if bank.emode.emode_config.has_entries() { msg!("emode entries detected and activated"); bank.emode.set_emode_enabled(true); } else { diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs index 42e5efea6..7eb8a55e9 100644 --- a/programs/marginfi/src/state/emode.rs +++ b/programs/marginfi/src/state/emode.rs @@ -50,7 +50,10 @@ assert_struct_align!(EmodeConfig, 8); #[derive( AnchorDeserialize, AnchorSerialize, Copy, Clone, Zeroable, Pod, PartialEq, Eq, TypeLayout, Debug, )] -/// A bank's emode configurations. +/// An emode configuration. Each bank has one such configuration, but this may also be the +/// intersection of many configurations (see `reconcile_emode_configs`). For example, the risk +/// engine creates such an intersection from all the emode config of all banks the user is borrowing +/// from. pub struct EmodeConfig { pub entries: [EmodeEntry; MAX_EMODE_ENTRIES], } @@ -72,6 +75,15 @@ impl EmodeConfig { config.entries[..entries.len()].copy_from_slice(&entries); config } + + pub fn find_with_tag(&self, tag: u16) -> Option<&EmodeEntry> { + self.entries.iter().find(|e| e.tag_equals(tag)) + } + /// True if any entries are present in the mode configuration. Typically, this is the definition + /// of flag `EMODE_ON` + pub fn has_entries(&self) -> bool { + self.entries.iter().any(|e| !e.is_empty()) + } } impl Default for EmodeSettings { @@ -119,14 +131,6 @@ impl EmodeSettings { } } - pub fn find_with_tag(&self, tag: u16) -> Option<&EmodeEntry> { - self.emode_config.entries.iter().find(|e| e.tag_equals(tag)) - } - /// True if any entries are present in the mode configuration. Typically, this is the definition - /// of flag `EMODE_ON` - pub fn has_entries(&self) -> bool { - self.emode_config.entries.iter().any(|e| !e.is_empty()) - } /// True if an emode configuration has been set (EMODE_ON) pub fn is_enabled(&self) -> bool { self.flags & EMODE_ON != 0 diff --git a/programs/marginfi/src/state/marginfi_account.rs b/programs/marginfi/src/state/marginfi_account.rs index 735f20f5d..2c2fded1a 100644 --- a/programs/marginfi/src/state/marginfi_account.rs +++ b/programs/marginfi/src/state/marginfi_account.rs @@ -1,4 +1,5 @@ use super::{ + emode::{reconcile_emode_configs, EmodeConfig}, health_cache::HealthCache, marginfi_group::{Bank, RiskTier, WrappedI80F48}, price::{OraclePriceFeedAdapter, OraclePriceType, PriceAdapter, PriceBias}, @@ -18,10 +19,7 @@ use anchor_lang::prelude::*; use anchor_spl::token_interface::Mint; use bytemuck::{Pod, Zeroable}; use fixed::types::I80F48; -use std::{ - cmp::{max, min}, - ops::Not, -}; +use std::cmp::{max, min}; use type_layout::TypeLayout; assert_struct_size!(MarginfiAccount, 2304); @@ -264,10 +262,8 @@ impl<'info> BankAccountWithPriceFeed<'_> { fn calc_weighted_value<'a>( &'a self, requirement_type: RequirementType, - ) -> MarginfiResult<(I80F48, I80F48, I80F48)> - where - 'info: 'a, - { + emode_config: &EmodeConfig, + ) -> MarginfiResult<(I80F48, I80F48, I80F48)> { match self.balance.get_side() { Some(side) => { let bank = &self.bank; @@ -275,7 +271,7 @@ impl<'info> BankAccountWithPriceFeed<'_> { match side { BalanceSide::Assets => { let (value, price) = - self.calc_weighted_asset_value(requirement_type, &bank)?; + self.calc_weighted_asset_value(requirement_type, &bank, emode_config)?; Ok((value, I80F48::ZERO, price)) } @@ -296,6 +292,7 @@ impl<'info> BankAccountWithPriceFeed<'_> { &'a self, requirement_type: RequirementType, bank: &'a Bank, + emode_config: &EmodeConfig, ) -> MarginfiResult<(I80F48, I80F48)> { match bank.config.risk_tier { RiskTier::Collateral => { @@ -311,9 +308,28 @@ impl<'info> BankAccountWithPriceFeed<'_> { let price_feed = price_feed?; - let mut asset_weight = bank - .config - .get_weight(requirement_type, BalanceSide::Assets); + // If an emode entry exists for this bank's emode tag in the reconciled config of + // all borrowing banks, use its weight, otherwise use the weight designated on the + // collateral bank itself. If the bank's weight is higher, always use that weight. + let mut asset_weight = + if let Some(emode_entry) = emode_config.find_with_tag(bank.emode.emode_tag) { + let bank_weight = bank + .config + .get_weight(requirement_type, BalanceSide::Assets); + let emode_weight = match requirement_type { + RequirementType::Initial => I80F48::from(emode_entry.asset_weight_init), + RequirementType::Maintenance => { + I80F48::from(emode_entry.asset_weight_maint) + } + // Note: For equity (which is only used for bankruptcies) emode does not + // apply, as the asset weight is always 1 + RequirementType::Equity => I80F48::ONE, + }; + max(bank_weight, emode_weight) + } else { + bank.config + .get_weight(requirement_type, BalanceSide::Assets) + }; let lower_price = price_feed.get_price_of_type( requirement_type.get_oracle_price_type(), @@ -468,6 +484,7 @@ impl RiskRequirementType { pub struct RiskEngine<'a> { marginfi_account: &'a MarginfiAccount, bank_accounts_with_price: Vec>, + emode_config: EmodeConfig, } impl<'info> RiskEngine<'_> { @@ -492,9 +509,18 @@ impl<'info> RiskEngine<'_> { let bank_accounts_with_price = BankAccountWithPriceFeed::load(&marginfi_account.lending_account, remaining_ais)?; + // Load the reconciled Emode configuration for all banks where the user has borrowed + let emode_configs: Vec = bank_accounts_with_price + .iter() + .filter(|b_w_p| !b_w_p.balance.is_empty(BalanceSide::Liabilities)) + .map(|b_w_p| b_w_p.bank.emode.emode_config) + .collect(); + let reconciled_emode_config = reconcile_emode_configs(emode_configs); + Ok(RiskEngine { marginfi_account, bank_accounts_with_price, + emode_config: reconciled_emode_config, }) } @@ -532,7 +558,7 @@ impl<'info> RiskEngine<'_> { for (i, bank_account) in self.bank_accounts_with_price.iter().enumerate() { let requirement_type = requirement_type.to_weight_type(); let (asset_val, liab_val, price) = - bank_account.calc_weighted_value(requirement_type)?; + bank_account.calc_weighted_value(requirement_type, &self.emode_config)?; if let Some(health_cache) = health_cache { health_cache.prices[i] = price.into(); @@ -613,9 +639,7 @@ impl<'info> RiskEngine<'_> { .ok_or(MarginfiError::LendingAccountBalanceNotFound)?; check!( - liability_bank_balance - .is_empty(BalanceSide::Liabilities) - .not(), + !liability_bank_balance.is_empty(BalanceSide::Liabilities), MarginfiError::NoLiabilitiesInLiabilityBank ); @@ -669,9 +693,7 @@ impl<'info> RiskEngine<'_> { .unwrap(); check!( - liability_bank_balance - .is_empty(BalanceSide::Liabilities) - .not(), + !liability_bank_balance.is_empty(BalanceSide::Liabilities), MarginfiError::ExhaustedLiability ); @@ -732,14 +754,13 @@ impl<'info> RiskEngine<'_> { Ok(()) } - fn check_account_risk_tiers<'a>(&'a self) -> MarginfiResult - where - 'info: 'a, - { + // TODO this function seems excessive relative to the trivial check it performs, it performs + // like 4x O(N) loops and should be optimized at minimum. + fn check_account_risk_tiers<'a>(&'a self) -> MarginfiResult { let balances_with_liablities = self .bank_accounts_with_price .iter() - .filter(|a| a.balance.is_empty(BalanceSide::Liabilities).not()); + .filter(|a| !a.balance.is_empty(BalanceSide::Liabilities)); let n_balances_with_liablities = balances_with_liablities.clone().count(); diff --git a/tests/e01_initGroup.spec.ts b/tests/e01_initGroup.spec.ts index 82a1c0a67..d72cf9f88 100644 --- a/tests/e01_initGroup.spec.ts +++ b/tests/e01_initGroup.spec.ts @@ -1,5 +1,5 @@ import { BN } from "@coral-xyz/anchor"; -import { AccountMeta, Transaction } from "@solana/web3.js"; +import { AccountMeta, PublicKey, Transaction } from "@solana/web3.js"; import { addBankWithSeed, groupConfigure, @@ -29,7 +29,7 @@ import { assert } from "chai"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; -describe("Init e-mode enabled group", () => { +describe("Init e-mode enabled group and banks", () => { const seed = new BN(EMODE_SEED); it("(admin) Init group - happy path", async () => { @@ -62,7 +62,7 @@ describe("Init e-mode enabled group", () => { tx.add( await groupConfigure(groupAdmin.mrgnBankrunProgram, { marginfiGroup: emodeGroup.publicKey, - newEmodeAdmin: emodeAdmin.wallet.publicKey + newEmodeAdmin: emodeAdmin.wallet.publicKey, }) ); tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); @@ -75,72 +75,112 @@ describe("Init e-mode enabled group", () => { assertKeysEqual(group.emodeAdmin, emodeAdmin.wallet.publicKey); }); - it("(admin) Add bank (USDC)", async () => { - let setConfig = defaultBankConfig(); - const [bankKey] = deriveBankWithSeed( - bankrunProgram.programId, - emodeGroup.publicKey, - ecosystem.usdcMint.publicKey, - seed - ); - const oracle = oracles.usdcOracle.publicKey; - const oracleMeta: AccountMeta = { - pubkey: oracle, - isSigner: false, - isWritable: false, - }; - const config_ix = await groupAdmin.mrgnProgram.methods - .lendingPoolConfigureBankOracle(ORACLE_SETUP_PYTH_LEGACY, oracle) - .accountsPartial({ - group: emodeGroup.publicKey, - bank: bankKey, - admin: groupAdmin.wallet.publicKey, - }) - .remainingAccounts([oracleMeta]) - .instruction(); + await addBankTest({ + bankMint: ecosystem.usdcMint.publicKey, + oracle: oracles.usdcOracle.publicKey, + oracleMeta: { + pubkey: oracles.usdcOracle.publicKey, + isSigner: false, + isWritable: false, + }, + seed: seed, + verboseMessage: "*init USDC bank:", + }); + }); - let tx = new Transaction(); - tx.add( - await addBankWithSeed(groupAdmin.mrgnBankrunProgram, { - marginfiGroup: emodeGroup.publicKey, - feePayer: groupAdmin.wallet.publicKey, - bankMint: ecosystem.usdcMint.publicKey, - bank: bankKey, - config: setConfig, - seed: seed, - }), - config_ix - ); - tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); - tx.sign(groupAdmin.wallet); - await banksClient.processTransaction(tx); + it("(admin) Add bank (SOL)", async () => { + await addBankTest({ + assetTag: ASSET_TAG_SOL, + bankMint: ecosystem.wsolMint.publicKey, + oracle: oracles.wsolOracle.publicKey, + oracleMeta: { + pubkey: oracles.wsolOracle.publicKey, + isSigner: false, + isWritable: false, + }, + seed: seed, + verboseMessage: "*init SOL bank:", + }); + }); - if (verbose) { - console.log("*init USDC bank " + bankKey); - } + it("(admin) Add bank (LST)", async () => { + await addBankTest({ + bankMint: ecosystem.lstAlphaMint.publicKey, + oracle: oracles.pythPullLstOracleFeed.publicKey, + oracleMeta: { + pubkey: oracles.pythPullLst.publicKey, // NOTE: Price V2 update + isSigner: false, + isWritable: false, + }, + oracleSetup: "PUSH", + feedOracle: oracles.pythPullLstOracleFeed.publicKey, + seed: seed, + verboseMessage: "*init LST A bank:", + }); + }); - const bank = await bankrunProgram.account.bank.fetch(bankKey); - assert.equal(bank.config.assetTag, ASSET_TAG_DEFAULT); + it("(admin) Add another bank (also an LST)", async () => { + await addBankTest({ + bankMint: ecosystem.lstAlphaMint.publicKey, + oracle: oracles.pythPullLstOracleFeed.publicKey, + oracleMeta: { + pubkey: oracles.pythPullLst.publicKey, // NOTE: Price V2 update + isSigner: false, + isWritable: false, + }, + oracleSetup: "PUSH", + feedOracle: oracles.pythPullLstOracleFeed.publicKey, + seed: seed.addn(1), + verboseMessage: "*init LST B bank:", + }); }); - it("(admin) Add bank (SOL)", async () => { - let setConfig = defaultBankConfig(); - setConfig.assetTag = ASSET_TAG_SOL; + async function addBankTest(options: { + assetTag?: number; + bankMint: PublicKey; + oracle: PublicKey; + oracleMeta: AccountMeta; + // For banks (like LST) that need a different oracle setup (push vs legacy) + oracleSetup?: "LEGACY" | "PUSH"; + // Optional feed oracle in case the instruction requires it (i.e. for LST) + feedOracle?: PublicKey; + // Function to adjust the seed (for example, seed.addn(1)) + seed: BN; + verboseMessage: string; + }) { + const { + assetTag, + bankMint, + oracle, + oracleMeta, + oracleSetup = "LEGACY", + feedOracle, + seed, + verboseMessage, + } = options; + + // Set configuration; override assetTag if provided + const config = defaultBankConfig(); + if (assetTag) { + config.assetTag = assetTag; + } + + // Calculate bank key using the (optionally modified) seed const [bankKey] = deriveBankWithSeed( bankrunProgram.programId, emodeGroup.publicKey, - ecosystem.wsolMint.publicKey, + bankMint, seed ); - const oracle = oracles.wsolOracle.publicKey; - const oracleMeta: AccountMeta = { - pubkey: oracle, - isSigner: false, - isWritable: false, - }; + + const setupType = + oracleSetup === "PUSH" + ? ORACLE_SETUP_PYTH_PUSH + : ORACLE_SETUP_PYTH_LEGACY; + const targetOracle = feedOracle ?? oracle; const config_ix = await groupAdmin.mrgnProgram.methods - .lendingPoolConfigureBankOracle(ORACLE_SETUP_PYTH_LEGACY, oracle) + .lendingPoolConfigureBankOracle(setupType, targetOracle) .accountsPartial({ group: emodeGroup.publicKey, bank: bankKey, @@ -149,77 +189,23 @@ describe("Init e-mode enabled group", () => { .remainingAccounts([oracleMeta]) .instruction(); - let tx = new Transaction(); - tx.add( - await addBankWithSeed(groupAdmin.mrgnBankrunProgram, { - marginfiGroup: emodeGroup.publicKey, - feePayer: groupAdmin.wallet.publicKey, - bankMint: ecosystem.wsolMint.publicKey, - bank: bankKey, - config: setConfig, - seed: seed, - }), - config_ix - ); - tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); - tx.sign(groupAdmin.wallet); - await banksClient.processTransaction(tx); - - if (verbose) { - console.log("*init SOL bank " + bankKey); - } - - const bank = await bankrunProgram.account.bank.fetch(bankKey); - assert.equal(bank.config.assetTag, ASSET_TAG_SOL); - }); - - it("(admin) Add bank (LST)", async () => { - let setConfig = defaultBankConfig(); - const [bankKey] = deriveBankWithSeed( - bankrunProgram.programId, - emodeGroup.publicKey, - ecosystem.lstAlphaMint.publicKey, - seed - ); - const oracleMeta: AccountMeta = { - pubkey: oracles.pythPullLst.publicKey, // NOTE: This is the Price V2 update - isSigner: false, - isWritable: false, - }; - - let tx = new Transaction(); - tx.add( - await addBankWithSeed(groupAdmin.mrgnBankrunProgram, { - marginfiGroup: emodeGroup.publicKey, - feePayer: groupAdmin.wallet.publicKey, - bankMint: ecosystem.lstAlphaMint.publicKey, - bank: bankKey, - config: setConfig, - seed: seed, - }), - await groupAdmin.mrgnProgram.methods - // Note: This is the feed id - .lendingPoolConfigureBankOracle( - ORACLE_SETUP_PYTH_PUSH, - oracles.pythPullLstOracleFeed.publicKey - ) - .accountsPartial({ - group: emodeGroup.publicKey, - bank: bankKey, - admin: groupAdmin.wallet.publicKey, - }) - .remainingAccounts([oracleMeta]) - .instruction() - ); + const addBankIx = await addBankWithSeed(groupAdmin.mrgnBankrunProgram, { + marginfiGroup: emodeGroup.publicKey, + feePayer: groupAdmin.wallet.publicKey, + bankMint: bankMint, + bank: bankKey, + config: config, + seed, + }); + + const tx = new Transaction(); + tx.add(addBankIx, config_ix); tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); tx.sign(groupAdmin.wallet); await banksClient.processTransaction(tx); if (verbose) { - console.log("*init WSOL bank " + bankKey); + console.log(`${verboseMessage} ${bankKey}`); } - - const bank = await bankrunProgram.account.bank.fetch(bankKey); - assert.equal(bank.config.assetTag, ASSET_TAG_DEFAULT); - }); + } }); diff --git a/tests/e02_configEmode.spec.ts b/tests/e02_configEmode.spec.ts new file mode 100644 index 000000000..fdcc9ef22 --- /dev/null +++ b/tests/e02_configEmode.spec.ts @@ -0,0 +1,65 @@ +import { BN } from "@coral-xyz/anchor"; +import { AccountMeta, PublicKey, Transaction } from "@solana/web3.js"; +import { + addBankWithSeed, + groupConfigure, + groupInitialize, +} from "./utils/group-instructions"; +import { + bankrunContext, + bankrunProgram, + banksClient, + ecosystem, + EMODE_SEED, + emodeAdmin, + emodeGroup, + groupAdmin, + oracles, + verbose, +} from "./rootHooks"; +import { assertKeyDefault, assertKeysEqual } from "./utils/genericTests"; +import { + ASSET_TAG_DEFAULT, + ASSET_TAG_SOL, + defaultBankConfig, + ORACLE_SETUP_PYTH_LEGACY, + ORACLE_SETUP_PYTH_PUSH, +} from "./utils/types"; +import { assert } from "chai"; +import { getBankrunBlockhash } from "./utils/spl-staking-utils"; +import { deriveBankWithSeed } from "./utils/pdas"; + +describe("Init e-mode enabled group", () => { + const seed = new BN(EMODE_SEED); + + before: async () => { + // TODO + console.log("derive bank keys:") + + } + + it("(emode admin) Configures the 4 banks - happy path", async () => { + let tx = new Transaction(); + + // TODO + + // let actual = await bankrunProgram.account.bank.fetch(PublicKey.default); + // let entry = actual.emode.emodeConfig.entries[0]; + + // tx.add( + // await groupConfigure(groupAdmin.mrgnBankrunProgram, { + // marginfiGroup: emodeGroup.publicKey, + // newEmodeAdmin: emodeAdmin.wallet.publicKey + // }) + // ); + // tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + // tx.sign(groupAdmin.wallet, emodeGroup); + // await banksClient.processTransaction(tx); + + // let group = await bankrunProgram.account.marginfiGroup.fetch( + // emodeGroup.publicKey + // ); + // assertKeysEqual(group.emodeAdmin, emodeAdmin.wallet.publicKey); + }); + +}); diff --git a/tests/utils/group-instructions.ts b/tests/utils/group-instructions.ts index f3e7c42b2..35c0b3626 100644 --- a/tests/utils/group-instructions.ts +++ b/tests/utils/group-instructions.ts @@ -14,6 +14,11 @@ import { import { BankConfig, BankConfigOptWithAssetTag, + EmodeEntry, + I80F48_ONE, + I80F48_ZERO, + MAX_EMODE_ENTRIES, + newEmodeEntry, SINGLE_POOL_PROGRAM_ID, StakedSettingsConfig, StakedSettingsEdit, @@ -528,3 +533,60 @@ export const addBankPermissionless = ( return ix; }; + +export type ConfigureBankEmodeArgs = { + bank: PublicKey; + tag: number; + /** Must be `MAX_EMODE_ENTRIES` or fewer */ + entries: EmodeEntry[]; +}; + +export const configBankEmode = ( + program: Program, + args: ConfigureBankEmodeArgs +) => { + const paddedEntries = padEmodeEntries(args.entries); + const ent: EmodeEntry[] = [ + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), + newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE) + ]; + + + const ix = program.methods + .lendingPoolConfigureBankEmode(args.tag, ent) + .accounts({ + // group: // implied from bank + // emode_admin: // implied from group + bank: args.bank, + }) + .instruction(); + + return ix; +}; + +const padEmodeEntries = (entries: EmodeEntry[]): EmodeEntry[] => { + if (entries.length > MAX_EMODE_ENTRIES) { + throw new Error( + `Too many entries provided. Maximum allowed is ${MAX_EMODE_ENTRIES}` + ); + } + const padded = [...entries]; + while (padded.length < MAX_EMODE_ENTRIES) { + padded.push({ + collateral_bank_emode_tag: 0, + flags: 0, + pad0: [0, 0, 0, 0, 0], + asset_weight_init: I80F48_ZERO, + asset_weight_maint: I80F48_ZERO, + }); + } + return padded; +}; diff --git a/tests/utils/types.ts b/tests/utils/types.ts index e1d75b460..abb11ffa0 100644 --- a/tests/utils/types.ts +++ b/tests/utils/types.ts @@ -42,7 +42,6 @@ export const HEALTH_CACHE_NONE = 0; export const HEALTH_CACHE_HEALTHY = 1; export const HEALTH_CACHE_ENGINE_OK = 2; - /** * The default bank config has * * all weights are 1 @@ -283,3 +282,28 @@ export interface StakedSettingsEdit { oracleMaxAge: number | null; riskTier: { collateral: {} } | { isolated: {} } | null; } + +export const MAX_EMODE_ENTRIES = 10; + +export type EmodeEntry = { + collateral_bank_emode_tag: number; + flags: number; + pad0: [0, 0, 0, 0, 0]; + asset_weight_init: WrappedI80F48; + asset_weight_maint: WrappedI80F48; +}; + +export function newEmodeEntry( + collateral_bank_emode_tag: number, + flags: number, + asset_weight_init: WrappedI80F48, + asset_weight_maint: WrappedI80F48 +): EmodeEntry { + return { + collateral_bank_emode_tag, + flags, + pad0: [0, 0, 0, 0, 0], + asset_weight_init, + asset_weight_maint, + }; +} From fc19c685a8cccc7645a283eccb3d0ce0bb9a4dce Mon Sep 17 00:00:00 2001 From: jon-mobile Date: Tue, 1 Apr 2025 18:08:36 -0400 Subject: [PATCH 07/38] More emode boilerplate, admin config setup --- programs/marginfi/src/state/marginfi_group.rs | 1 - tests/e02_configEmode.spec.ts | 40 ++++++++++++++----- tests/utils/group-instructions.ts | 23 +++-------- tests/utils/types.ts | 20 +++++----- 4 files changed, 46 insertions(+), 38 deletions(-) diff --git a/programs/marginfi/src/state/marginfi_group.rs b/programs/marginfi/src/state/marginfi_group.rs index 453476361..38481abdf 100644 --- a/programs/marginfi/src/state/marginfi_group.rs +++ b/programs/marginfi/src/state/marginfi_group.rs @@ -1449,7 +1449,6 @@ impl BankConfig { requirement_type: RequirementType, balance_side: BalanceSide, ) -> I80F48 { - // TODO emode determination... match (requirement_type, balance_side) { (RequirementType::Initial, BalanceSide::Assets) => self.asset_weight_init.into(), (RequirementType::Initial, BalanceSide::Liabilities) => { diff --git a/tests/e02_configEmode.spec.ts b/tests/e02_configEmode.spec.ts index fdcc9ef22..00b9bc868 100644 --- a/tests/e02_configEmode.spec.ts +++ b/tests/e02_configEmode.spec.ts @@ -29,14 +29,37 @@ import { assert } from "chai"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; -describe("Init e-mode enabled group", () => { - const seed = new BN(EMODE_SEED); - - before: async () => { - // TODO - console.log("derive bank keys:") +const seed = new BN(EMODE_SEED); +let usdcBank: PublicKey; +let solBank: PublicKey; +let lstABank: PublicKey; +let lstBBank: PublicKey; - } +describe("Init e-mode enabled group", () => { + [usdcBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.usdcMint.publicKey, + seed + ); + [solBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.wsolMint.publicKey, + seed + ); + [lstABank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.lstAlphaMint.publicKey, + seed + ); + [lstBBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.lstAlphaMint.publicKey, + seed.addn(1) + ); it("(emode admin) Configures the 4 banks - happy path", async () => { let tx = new Transaction(); @@ -45,7 +68,7 @@ describe("Init e-mode enabled group", () => { // let actual = await bankrunProgram.account.bank.fetch(PublicKey.default); // let entry = actual.emode.emodeConfig.entries[0]; - + // tx.add( // await groupConfigure(groupAdmin.mrgnBankrunProgram, { // marginfiGroup: emodeGroup.publicKey, @@ -61,5 +84,4 @@ describe("Init e-mode enabled group", () => { // ); // assertKeysEqual(group.emodeAdmin, emodeAdmin.wallet.publicKey); }); - }); diff --git a/tests/utils/group-instructions.ts b/tests/utils/group-instructions.ts index 35c0b3626..49b7ca5ba 100644 --- a/tests/utils/group-instructions.ts +++ b/tests/utils/group-instructions.ts @@ -537,7 +537,7 @@ export const addBankPermissionless = ( export type ConfigureBankEmodeArgs = { bank: PublicKey; tag: number; - /** Must be `MAX_EMODE_ENTRIES` or fewer */ + /** Must be `MAX_EMODE_ENTRIES` or fewer, see `newEmodeEntry` */ entries: EmodeEntry[]; }; @@ -546,22 +546,9 @@ export const configBankEmode = ( args: ConfigureBankEmodeArgs ) => { const paddedEntries = padEmodeEntries(args.entries); - const ent: EmodeEntry[] = [ - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE), - newEmodeEntry(5, 1, I80F48_ONE, I80F48_ONE) - ]; - const ix = program.methods - .lendingPoolConfigureBankEmode(args.tag, ent) + .lendingPoolConfigureBankEmode(args.tag, paddedEntries) .accounts({ // group: // implied from bank // emode_admin: // implied from group @@ -581,11 +568,11 @@ const padEmodeEntries = (entries: EmodeEntry[]): EmodeEntry[] => { const padded = [...entries]; while (padded.length < MAX_EMODE_ENTRIES) { padded.push({ - collateral_bank_emode_tag: 0, + collateralBankEmodeTag: 0, flags: 0, pad0: [0, 0, 0, 0, 0], - asset_weight_init: I80F48_ZERO, - asset_weight_maint: I80F48_ZERO, + assetWeightInit: I80F48_ZERO, + assetWeightMaint: I80F48_ZERO, }); } return padded; diff --git a/tests/utils/types.ts b/tests/utils/types.ts index abb11ffa0..1cf01c935 100644 --- a/tests/utils/types.ts +++ b/tests/utils/types.ts @@ -286,24 +286,24 @@ export interface StakedSettingsEdit { export const MAX_EMODE_ENTRIES = 10; export type EmodeEntry = { - collateral_bank_emode_tag: number; + collateralBankEmodeTag: number; flags: number; - pad0: [0, 0, 0, 0, 0]; - asset_weight_init: WrappedI80F48; - asset_weight_maint: WrappedI80F48; + pad0: number[]; + assetWeightInit: WrappedI80F48; + assetWeightMaint: WrappedI80F48; }; export function newEmodeEntry( - collateral_bank_emode_tag: number, + collateralBankEmodeTag: number, flags: number, - asset_weight_init: WrappedI80F48, - asset_weight_maint: WrappedI80F48 + assetWeightInit: WrappedI80F48, + assetWeightMaint: WrappedI80F48 ): EmodeEntry { return { - collateral_bank_emode_tag, + collateralBankEmodeTag, flags, pad0: [0, 0, 0, 0, 0], - asset_weight_init, - asset_weight_maint, + assetWeightInit, + assetWeightMaint, }; } From 0e300f950c66b7ffa69dbd483e1813906eebe5de Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Tue, 1 Apr 2025 18:54:51 -0400 Subject: [PATCH 08/38] Happy path emode setup --- .../marginfi_group/config_bank_emode.rs | 3 +- programs/marginfi/src/state/emode.rs | 3 + tests/e02_configEmode.spec.ts | 161 +++++++++++++----- tests/rootHooks.ts | 9 + tests/utils/types.ts | 1 + 5 files changed, 135 insertions(+), 42 deletions(-) diff --git a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs index 9db055f2a..9e58b0fb3 100644 --- a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs +++ b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs @@ -1,4 +1,5 @@ use crate::state::emode::{EmodeEntry, MAX_EMODE_ENTRIES}; +use crate::MarginfiError; use crate::{ state::marginfi_group::{Bank, MarginfiGroup}, MarginfiResult, @@ -47,7 +48,7 @@ pub fn lending_pool_configure_bank_emode( #[derive(Accounts)] pub struct LendingPoolConfigureBankEmode<'info> { #[account( - has_one = emode_admin + has_one = emode_admin @ MarginfiError::Unauthorized )] pub group: AccountLoader<'info, MarginfiGroup>, diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs index 7eb8a55e9..d3f2fb925 100644 --- a/programs/marginfi/src/state/emode.rs +++ b/programs/marginfi/src/state/emode.rs @@ -77,6 +77,9 @@ impl EmodeConfig { } pub fn find_with_tag(&self, tag: u16) -> Option<&EmodeEntry> { + if tag == EMODE_TAG_EMPTY { + return None; + } self.entries.iter().find(|e| e.tag_equals(tag)) } /// True if any entries are present in the mode configuration. Typically, this is the definition diff --git a/tests/e02_configEmode.spec.ts b/tests/e02_configEmode.spec.ts index 00b9bc868..faca432b3 100644 --- a/tests/e02_configEmode.spec.ts +++ b/tests/e02_configEmode.spec.ts @@ -2,6 +2,7 @@ import { BN } from "@coral-xyz/anchor"; import { AccountMeta, PublicKey, Transaction } from "@solana/web3.js"; import { addBankWithSeed, + configBankEmode, groupConfigure, groupInitialize, } from "./utils/group-instructions"; @@ -15,19 +16,32 @@ import { emodeGroup, groupAdmin, oracles, + users, verbose, } from "./rootHooks"; -import { assertKeyDefault, assertKeysEqual } from "./utils/genericTests"; +import { + assertBankrunTxFailed, + assertKeyDefault, + assertKeysEqual, +} from "./utils/genericTests"; import { ASSET_TAG_DEFAULT, ASSET_TAG_SOL, defaultBankConfig, + EMODE_APPLIES_TO_ISOLATED, + newEmodeEntry, ORACLE_SETUP_PYTH_LEGACY, ORACLE_SETUP_PYTH_PUSH, } from "./utils/types"; import { assert } from "chai"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; +import { bigNumberToWrappedI80F48 } from "@mrgnlabs/mrgn-common"; + +// By convention, all tags must be in 13375p34k (kidding, but only sorta) +const EMODE_STABLE_TAG = 5748; // STAB because 574813 is out of range +const EMODE_SOL_TAG = 501; +const EMODE_LST_TAG = 157; const seed = new BN(EMODE_SEED); let usdcBank: PublicKey; @@ -36,52 +50,117 @@ let lstABank: PublicKey; let lstBBank: PublicKey; describe("Init e-mode enabled group", () => { - [usdcBank] = deriveBankWithSeed( - bankrunProgram.programId, - emodeGroup.publicKey, - ecosystem.usdcMint.publicKey, - seed - ); - [solBank] = deriveBankWithSeed( - bankrunProgram.programId, - emodeGroup.publicKey, - ecosystem.wsolMint.publicKey, - seed - ); - [lstABank] = deriveBankWithSeed( - bankrunProgram.programId, - emodeGroup.publicKey, - ecosystem.lstAlphaMint.publicKey, - seed - ); - [lstBBank] = deriveBankWithSeed( - bankrunProgram.programId, - emodeGroup.publicKey, - ecosystem.lstAlphaMint.publicKey, - seed.addn(1) - ); + before(async () => { + [usdcBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.usdcMint.publicKey, + seed + ); + [solBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.wsolMint.publicKey, + seed + ); + [lstABank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.lstAlphaMint.publicKey, + seed + ); + [lstBBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.lstAlphaMint.publicKey, + seed.addn(1) + ); + }); + + it("(user 1) Bad admin tries to edit - should fail", async () => { + let tx = new Transaction(); + tx.add( + await configBankEmode(users[1].mrgnBankrunProgram, { + bank: usdcBank, + tag: EMODE_STABLE_TAG, + entries: [], + }) + ); + + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(users[1].wallet); + let result = await banksClient.tryProcessTransaction(tx); + // 6042 (Unauthorized) + assertBankrunTxFailed(result, "0x179a"); + }); + + // Note: you can pack two emode configure ixes into one tx, but that's it, since the data payload + // is just over 400 bytes. it("(emode admin) Configures the 4 banks - happy path", async () => { let tx = new Transaction(); - // TODO + tx.add( + await configBankEmode(emodeAdmin.mrgnBankrunProgram, { + bank: usdcBank, + tag: EMODE_STABLE_TAG, + entries: [ + // USDC doesn't have any favored entries + ], + }) + ); + + tx.add( + await configBankEmode(emodeAdmin.mrgnBankrunProgram, { + bank: solBank, + tag: EMODE_SOL_TAG, + entries: [ + newEmodeEntry( + EMODE_LST_TAG, + EMODE_APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(0.9), + bigNumberToWrappedI80F48(0.95) + ), + ], + }) + ); + + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(emodeAdmin.wallet); + await banksClient.processTransaction(tx); - // let actual = await bankrunProgram.account.bank.fetch(PublicKey.default); - // let entry = actual.emode.emodeConfig.entries[0]; + tx = new Transaction().add( + await configBankEmode(emodeAdmin.mrgnBankrunProgram, { + bank: lstABank, + tag: EMODE_LST_TAG, + entries: [ + newEmodeEntry( + EMODE_SOL_TAG, + EMODE_APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(0.85), + bigNumberToWrappedI80F48(0.9) + ), + ], + }) + ); - // tx.add( - // await groupConfigure(groupAdmin.mrgnBankrunProgram, { - // marginfiGroup: emodeGroup.publicKey, - // newEmodeAdmin: emodeAdmin.wallet.publicKey - // }) - // ); - // tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); - // tx.sign(groupAdmin.wallet, emodeGroup); - // await banksClient.processTransaction(tx); + tx.add( + await configBankEmode(emodeAdmin.mrgnBankrunProgram, { + bank: lstBBank, + tag: EMODE_LST_TAG, + entries: [ + newEmodeEntry( + EMODE_SOL_TAG, + EMODE_APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(0.85), + bigNumberToWrappedI80F48(0.9) + ), + ], + }) + ); - // let group = await bankrunProgram.account.marginfiGroup.fetch( - // emodeGroup.publicKey - // ); - // assertKeysEqual(group.emodeAdmin, emodeAdmin.wallet.publicKey); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(emodeAdmin.wallet); + await banksClient.processTransaction(tx); }); }); diff --git a/tests/rootHooks.ts b/tests/rootHooks.ts index ea04e31df..3927da585 100644 --- a/tests/rootHooks.ts +++ b/tests/rootHooks.ts @@ -331,6 +331,15 @@ export const mochaHooks = { ) ); + emodeAdmin.mrgnBankrunProgram = new Program( + mrgnProgram.idl, + new AnchorProvider( + bankRunProvider.connection, + new Wallet(emodeAdmin.wallet), + {} + ) + ); + banksClient = bankrunContext.banksClient; if (verbose) { diff --git a/tests/utils/types.ts b/tests/utils/types.ts index 1cf01c935..96e569a43 100644 --- a/tests/utils/types.ts +++ b/tests/utils/types.ts @@ -284,6 +284,7 @@ export interface StakedSettingsEdit { } export const MAX_EMODE_ENTRIES = 10; +export const EMODE_APPLIES_TO_ISOLATED = 1; export type EmodeEntry = { collateralBankEmodeTag: number; From 2e44b5412ed4ebd10c85b4b5fa8d0966c43f40b5 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 2 Apr 2025 00:49:58 -0400 Subject: [PATCH 09/38] Minor doc update, use reduced weights in emode test suite --- tests/e01_initGroup.spec.ts | 4 +++ tests/e02_configEmode.spec.ts | 53 +++++++++++++++++------------------ 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/tests/e01_initGroup.spec.ts b/tests/e01_initGroup.spec.ts index d72cf9f88..ebeeebcba 100644 --- a/tests/e01_initGroup.spec.ts +++ b/tests/e01_initGroup.spec.ts @@ -28,6 +28,7 @@ import { import { assert } from "chai"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; +import { bigNumberToWrappedI80F48 } from "@mrgnlabs/mrgn-common"; describe("Init e-mode enabled group and banks", () => { const seed = new BN(EMODE_SEED); @@ -162,6 +163,9 @@ describe("Init e-mode enabled group and banks", () => { // Set configuration; override assetTag if provided const config = defaultBankConfig(); + // Use a reduced weight for this test suite to see the impact of emode. + config.assetWeightInit = bigNumberToWrappedI80F48(0.5); + config.assetWeightMaint = bigNumberToWrappedI80F48(0.6); if (assetTag) { config.assetTag = assetTag; } diff --git a/tests/e02_configEmode.spec.ts b/tests/e02_configEmode.spec.ts index faca432b3..fc983bc5b 100644 --- a/tests/e02_configEmode.spec.ts +++ b/tests/e02_configEmode.spec.ts @@ -1,11 +1,6 @@ import { BN } from "@coral-xyz/anchor"; -import { AccountMeta, PublicKey, Transaction } from "@solana/web3.js"; -import { - addBankWithSeed, - configBankEmode, - groupConfigure, - groupInitialize, -} from "./utils/group-instructions"; +import { PublicKey, Transaction } from "@solana/web3.js"; +import { configBankEmode } from "./utils/group-instructions"; import { bankrunContext, bankrunProgram, @@ -14,26 +9,10 @@ import { EMODE_SEED, emodeAdmin, emodeGroup, - groupAdmin, - oracles, users, - verbose, } from "./rootHooks"; -import { - assertBankrunTxFailed, - assertKeyDefault, - assertKeysEqual, -} from "./utils/genericTests"; -import { - ASSET_TAG_DEFAULT, - ASSET_TAG_SOL, - defaultBankConfig, - EMODE_APPLIES_TO_ISOLATED, - newEmodeEntry, - ORACLE_SETUP_PYTH_LEGACY, - ORACLE_SETUP_PYTH_PUSH, -} from "./utils/types"; -import { assert } from "chai"; +import { assertBankrunTxFailed } from "./utils/genericTests"; +import { EMODE_APPLIES_TO_ISOLATED, newEmodeEntry } from "./utils/types"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; import { bigNumberToWrappedI80F48 } from "@mrgnlabs/mrgn-common"; @@ -95,8 +74,11 @@ describe("Init e-mode enabled group", () => { assertBankrunTxFailed(result, "0x179a"); }); - // Note: you can pack two emode configure ixes into one tx, but that's it, since the data payload - // is just over 400 bytes. + // * Note: you can pack two emode configure ixes into one tx, but that's it, since the data + // payload is just over 400 bytes. In production, when editing multiple banks, the emode admin + // should use a jito bundle to ensure they all update at the same time and don't trigger + // liquidations accidentally. + // * Note: The default init/maint weight for all banks in this test suite is 0.5/0.6 it("(emode admin) Configures the 4 banks - happy path", async () => { let tx = new Transaction(); @@ -140,6 +122,17 @@ describe("Init e-mode enabled group", () => { bigNumberToWrappedI80F48(0.85), bigNumberToWrappedI80F48(0.9) ), + // Note: borrowing LST against another LST is a fairly common use-case and generally + // considered little to no risk. In this scenario, the entry is also the bank's own emode + // tag, and this is not an issue, as you cannot borrow against an asset you are already + // lending anyways. Here lstBBank shares the same emode risk tag, so borrows of lstBBank + // against lstABank positions will be treated more favorably. + newEmodeEntry( + EMODE_LST_TAG, + EMODE_APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(0.9), + bigNumberToWrappedI80F48(0.95) + ), ], }) ); @@ -155,6 +148,12 @@ describe("Init e-mode enabled group", () => { bigNumberToWrappedI80F48(0.85), bigNumberToWrappedI80F48(0.9) ), + newEmodeEntry( + EMODE_LST_TAG, + EMODE_APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(0.9), + bigNumberToWrappedI80F48(0.95) + ), ], }) ); From 3194f27ed8638d1edaf07ea28c6bae3921509a36 Mon Sep 17 00:00:00 2001 From: jon-mobile Date: Wed, 2 Apr 2025 18:19:20 -0400 Subject: [PATCH 10/38] emode config testing and borrow test setup --- tests/e01_initGroup.spec.ts | 22 ++--- tests/e02_configEmode.spec.ts | 136 +++++++++++++++++++++++++++-- tests/e03_emodeBorrow.spec.ts | 160 ++++++++++++++++++++++++++++++++++ tests/rootHooks.ts | 3 + tests/s03_deposit.spec.ts | 6 +- tests/utils/mocks.ts | 2 + tests/utils/types.ts | 4 + 7 files changed, 313 insertions(+), 20 deletions(-) create mode 100644 tests/e03_emodeBorrow.spec.ts diff --git a/tests/e01_initGroup.spec.ts b/tests/e01_initGroup.spec.ts index ebeeebcba..991e2fc31 100644 --- a/tests/e01_initGroup.spec.ts +++ b/tests/e01_initGroup.spec.ts @@ -34,9 +34,7 @@ describe("Init e-mode enabled group and banks", () => { const seed = new BN(EMODE_SEED); it("(admin) Init group - happy path", async () => { - let tx = new Transaction(); - - tx.add( + let tx = new Transaction().add( await groupInitialize(groupAdmin.mrgnBankrunProgram, { marginfiGroup: emodeGroup.publicKey, admin: groupAdmin.wallet.publicKey, @@ -58,16 +56,14 @@ describe("Init e-mode enabled group and banks", () => { }); it("(admin) Set the emode admin - happy path", async () => { - let tx = new Transaction(); - - tx.add( + let tx = new Transaction().add( await groupConfigure(groupAdmin.mrgnBankrunProgram, { marginfiGroup: emodeGroup.publicKey, newEmodeAdmin: emodeAdmin.wallet.publicKey, }) ); tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); - tx.sign(groupAdmin.wallet, emodeGroup); + tx.sign(groupAdmin.wallet); await banksClient.processTransaction(tx); let group = await bankrunProgram.account.marginfiGroup.fetch( @@ -114,7 +110,7 @@ describe("Init e-mode enabled group and banks", () => { isSigner: false, isWritable: false, }, - oracleSetup: "PUSH", + oracleSetup: "PULL", feedOracle: oracles.pythPullLstOracleFeed.publicKey, seed: seed, verboseMessage: "*init LST A bank:", @@ -130,7 +126,7 @@ describe("Init e-mode enabled group and banks", () => { isSigner: false, isWritable: false, }, - oracleSetup: "PUSH", + oracleSetup: "PULL", feedOracle: oracles.pythPullLstOracleFeed.publicKey, seed: seed.addn(1), verboseMessage: "*init LST B bank:", @@ -142,9 +138,9 @@ describe("Init e-mode enabled group and banks", () => { bankMint: PublicKey; oracle: PublicKey; oracleMeta: AccountMeta; - // For banks (like LST) that need a different oracle setup (push vs legacy) - oracleSetup?: "LEGACY" | "PUSH"; - // Optional feed oracle in case the instruction requires it (i.e. for LST) + // For banks (like LST) that need a different oracle setup (pull vs legacy) + oracleSetup?: "LEGACY" | "PULL"; + // Optional feed oracle in case the instruction requires it (i.e. for pull) feedOracle?: PublicKey; // Function to adjust the seed (for example, seed.addn(1)) seed: BN; @@ -179,7 +175,7 @@ describe("Init e-mode enabled group and banks", () => { ); const setupType = - oracleSetup === "PUSH" + oracleSetup === "PULL" ? ORACLE_SETUP_PYTH_PUSH : ORACLE_SETUP_PYTH_LEGACY; const targetOracle = feedOracle ?? oracle; diff --git a/tests/e02_configEmode.spec.ts b/tests/e02_configEmode.spec.ts index fc983bc5b..deb288af0 100644 --- a/tests/e02_configEmode.spec.ts +++ b/tests/e02_configEmode.spec.ts @@ -1,4 +1,11 @@ -import { BN } from "@coral-xyz/anchor"; +import { + AnchorProvider, + BN, + getProvider, + Program, + Wallet, + workspace, +} from "@coral-xyz/anchor"; import { PublicKey, Transaction } from "@solana/web3.js"; import { configBankEmode } from "./utils/group-instructions"; import { @@ -9,6 +16,7 @@ import { EMODE_SEED, emodeAdmin, emodeGroup, + groupAdmin, users, } from "./rootHooks"; import { assertBankrunTxFailed } from "./utils/genericTests"; @@ -16,6 +24,8 @@ import { EMODE_APPLIES_TO_ISOLATED, newEmodeEntry } from "./utils/types"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; import { bigNumberToWrappedI80F48 } from "@mrgnlabs/mrgn-common"; +import { createMintToInstruction } from "@solana/spl-token"; +import { Marginfi } from "../target/types/marginfi"; // By convention, all tags must be in 13375p34k (kidding, but only sorta) const EMODE_STABLE_TAG = 5748; // STAB because 574813 is out of range @@ -28,7 +38,7 @@ let solBank: PublicKey; let lstABank: PublicKey; let lstBBank: PublicKey; -describe("Init e-mode enabled group", () => { +describe("Init e-mode settings for a set of banks", () => { before(async () => { [usdcBank] = deriveBankWithSeed( bankrunProgram.programId, @@ -56,7 +66,7 @@ describe("Init e-mode enabled group", () => { ); }); - it("(user 1) Bad admin tries to edit - should fail", async () => { + it("(user 1) Bad admin tries to edit emode - should fail", async () => { let tx = new Transaction(); tx.add( @@ -74,12 +84,58 @@ describe("Init e-mode enabled group", () => { assertBankrunTxFailed(result, "0x179a"); }); + it("(emode admin) Bad emode settings - should fail", async () => { + // init > maint weight + let tx = new Transaction(); + tx.add( + await configBankEmode(emodeAdmin.mrgnBankrunProgram, { + bank: solBank, + tag: EMODE_SOL_TAG, + entries: [ + newEmodeEntry( + EMODE_LST_TAG, + EMODE_APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(0.95), + bigNumberToWrappedI80F48(0.9) + ), + ], + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(emodeAdmin.wallet); + let result = await banksClient.tryProcessTransaction(tx); + // 6075 (BadEmodeConfig) + assertBankrunTxFailed(result, "0x17bb"); + + // weight > 1 + tx = new Transaction(); + tx.add( + await configBankEmode(emodeAdmin.mrgnBankrunProgram, { + bank: solBank, + tag: EMODE_SOL_TAG, + entries: [ + newEmodeEntry( + EMODE_LST_TAG, + EMODE_APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(1.9), + bigNumberToWrappedI80F48(1.95) + ), + ], + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(emodeAdmin.wallet); + result = await banksClient.tryProcessTransaction(tx); + // 6075 (BadEmodeConfig) + assertBankrunTxFailed(result, "0x17bb"); + }); + // * Note: you can pack two emode configure ixes into one tx, but that's it, since the data // payload is just over 400 bytes. In production, when editing multiple banks, the emode admin // should use a jito bundle to ensure they all update at the same time and don't trigger // liquidations accidentally. // * Note: The default init/maint weight for all banks in this test suite is 0.5/0.6 - it("(emode admin) Configures the 4 banks - happy path", async () => { + it("(emode admin) Configures bank emodes - happy path", async () => { let tx = new Transaction(); tx.add( @@ -125,8 +181,8 @@ describe("Init e-mode enabled group", () => { // Note: borrowing LST against another LST is a fairly common use-case and generally // considered little to no risk. In this scenario, the entry is also the bank's own emode // tag, and this is not an issue, as you cannot borrow against an asset you are already - // lending anyways. Here lstBBank shares the same emode risk tag, so borrows of lstBBank - // against lstABank positions will be treated more favorably. + // lending anyways. Since lstBBank shares the same emode risk tag, borrows of lstBBank + // against lstABank positions will be treated more favorably, as expected. newEmodeEntry( EMODE_LST_TAG, EMODE_APPLIES_TO_ISOLATED, @@ -162,4 +218,72 @@ describe("Init e-mode enabled group", () => { tx.sign(emodeAdmin.wallet); await banksClient.processTransaction(tx); }); + + it("(Fund users/admin USDC/WSOL/LST token accounts", async () => { + const provider = getProvider() as AnchorProvider; + const wallet = provider.wallet as Wallet; + for (let i = 0; i < users.length; i++) { + let tx = new Transaction(); + // Note: WSOL is really just an spl token in this implementation, we don't simulate the + // exchange of SOL for WSOL, but that doesn't really matter. + tx.add( + createMintToInstruction( + ecosystem.wsolMint.publicKey, + users[i].wsolAccount, + wallet.publicKey, + 100 * 10 ** ecosystem.wsolDecimals + ) + ); + tx.add( + createMintToInstruction( + ecosystem.usdcMint.publicKey, + users[i].usdcAccount, + wallet.publicKey, + 10000 * 10 ** ecosystem.usdcDecimals + ) + ); + tx.add( + createMintToInstruction( + ecosystem.lstAlphaMint.publicKey, + users[i].lstAlphaAccount, + wallet.publicKey, + 10000 * 10 ** ecosystem.lstAlphaDecimals + ) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(wallet.payer); + await banksClient.processTransaction(tx); + } + + // Seed the admin with funds as well + let tx = new Transaction(); + tx.add( + createMintToInstruction( + ecosystem.wsolMint.publicKey, + groupAdmin.wsolAccount, + wallet.publicKey, + 100 * 10 ** ecosystem.wsolDecimals + ) + ); + tx.add( + createMintToInstruction( + ecosystem.usdcMint.publicKey, + groupAdmin.usdcAccount, + wallet.publicKey, + 10000 * 10 ** ecosystem.usdcDecimals + ) + ); + tx.add( + createMintToInstruction( + ecosystem.lstAlphaMint.publicKey, + groupAdmin.lstAlphaAccount, + wallet.publicKey, + 10000 * 10 ** ecosystem.lstAlphaDecimals + ) + ); + + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(wallet.payer); + await banksClient.processTransaction(tx); + }); }); diff --git a/tests/e03_emodeBorrow.spec.ts b/tests/e03_emodeBorrow.spec.ts new file mode 100644 index 000000000..cdc11413b --- /dev/null +++ b/tests/e03_emodeBorrow.spec.ts @@ -0,0 +1,160 @@ +import { + AnchorProvider, + BN, + getProvider, + Program, + Wallet, + workspace, +} from "@coral-xyz/anchor"; +import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; +import { configBankEmode } from "./utils/group-instructions"; +import { + bankKeypairUsdc, + bankrunContext, + bankrunProgram, + banksClient, + ecosystem, + EMODE_SEED, + emodeAdmin, + emodeGroup, + groupAdmin, + marginfiGroup, + users, +} from "./rootHooks"; +import { assertBankrunTxFailed } from "./utils/genericTests"; +import { EMODE_APPLIES_TO_ISOLATED, newEmodeEntry } from "./utils/types"; +import { getBankrunBlockhash } from "./utils/spl-staking-utils"; +import { deriveBankWithSeed } from "./utils/pdas"; +import { bigNumberToWrappedI80F48 } from "@mrgnlabs/mrgn-common"; +import { createMintToInstruction } from "@solana/spl-token"; +import { Marginfi } from "../target/types/marginfi"; +import { program } from "@coral-xyz/anchor/dist/cjs/native/system"; +import { USER_ACCOUNT, USER_ACCOUNT_E } from "./utils/mocks"; +import { accountInit, depositIx } from "./utils/user-instructions"; +import { dumpBankrunLogs } from "./utils/tools"; + +// By convention, all tags must be in 13375p34k (kidding, but only sorta) +const EMODE_STABLE_TAG = 5748; // STAB because 574813 is out of range +const EMODE_SOL_TAG = 501; +const EMODE_LST_TAG = 157; + +const seed = new BN(EMODE_SEED); +let usdcBank: PublicKey; +let solBank: PublicKey; +let lstABank: PublicKey; +let lstBBank: PublicKey; + +describe("Emode borrowing", () => { + before(async () => { + [usdcBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.usdcMint.publicKey, + seed + ); + [solBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.wsolMint.publicKey, + seed + ); + [lstABank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.lstAlphaMint.publicKey, + seed + ); + [lstBBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.lstAlphaMint.publicKey, + seed.addn(1) + ); + }); + + it("Initialize user accounts (if needed)", async () => { + for (let i = 0; i < users.length; i++) { + if (users[i].accounts.get(USER_ACCOUNT_E)) { + console.log("Skipped creating user " + i); + continue; + } + const userAccKeypair = Keypair.generate(); + const userAccount = userAccKeypair.publicKey; + users[i].accounts.set(USER_ACCOUNT_E, userAccount); + + let userinitTx: Transaction = new Transaction(); + userinitTx.add( + await accountInit(users[i].mrgnBankrunProgram, { + marginfiGroup: emodeGroup.publicKey, + marginfiAccount: userAccount, + authority: users[i].wallet.publicKey, + feePayer: users[i].wallet.publicKey, + }) + ); + userinitTx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + userinitTx.sign(users[i].wallet, userAccKeypair); + await banksClient.processTransaction(userinitTx); + } + + if (emodeAdmin.accounts.get(USER_ACCOUNT_E)) { + console.log("Skipped creating emode admin"); + return; + } + const userAccKeypair = Keypair.generate(); + const userAccount = userAccKeypair.publicKey; + emodeAdmin.accounts.set(USER_ACCOUNT_E, userAccount); + + let userinitTx: Transaction = new Transaction(); + userinitTx.add( + await accountInit(emodeAdmin.mrgnBankrunProgram, { + marginfiGroup: emodeGroup.publicKey, + marginfiAccount: userAccount, + authority: emodeAdmin.wallet.publicKey, + feePayer: emodeAdmin.wallet.publicKey, + }) + ); + userinitTx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + userinitTx.sign(emodeAdmin.wallet, userAccKeypair); + await banksClient.processTransaction(userinitTx); + }); + + it("(admin) Seeds liquidity in the banks", async () => { + const user = users[0]; + const userAccount = user.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: usdcBank, + tokenAccount: user.usdcAccount, + amount: new BN(10 * 10 ** ecosystem.usdcDecimals), + depositUpToLimit: false, + }), + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: solBank, + tokenAccount: user.wsolAccount, + amount: new BN(10 * 10 ** ecosystem.wsolDecimals), + depositUpToLimit: false, + }), + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: lstABank, + tokenAccount: user.lstAlphaAccount, + amount: new BN(10 * 10 ** ecosystem.lstAlphaDecimals), + depositUpToLimit: false, + }), + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: lstBBank, + tokenAccount: user.lstAlphaAccount, + amount: new BN(10 * 10 ** ecosystem.lstAlphaDecimals), + depositUpToLimit: false, + }) + ); + + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.tryProcessTransaction(tx); + }); +}); diff --git a/tests/rootHooks.ts b/tests/rootHooks.ts index 3927da585..8c929836b 100644 --- a/tests/rootHooks.ts +++ b/tests/rootHooks.ts @@ -223,8 +223,11 @@ export const mochaHooks = { setupUserOptions ); copyKeys.push( + groupAdmin.wsolAccount, groupAdmin.usdcAccount, + groupAdmin.tokenAAccount, groupAdmin.tokenBAccount, + groupAdmin.lstAlphaAccount, groupAdmin.wallet.publicKey, emodeAdmin.wallet.publicKey ); diff --git a/tests/s03_deposit.spec.ts b/tests/s03_deposit.spec.ts index 97b337626..76659d7c8 100644 --- a/tests/s03_deposit.spec.ts +++ b/tests/s03_deposit.spec.ts @@ -58,8 +58,12 @@ describe("Deposit funds (included staked assets)", () => { await banksClient.processTransaction(tx); }); - it("Initialize user accounts", async () => { + it("Initialize user accounts (if needed)", async () => { for (let i = 0; i < users.length; i++) { + // ???: should we be recycling these between the main test suite and bankrun? + if (users[i].accounts.get(USER_ACCOUNT)) { + console.log("Warn: Over-writing user acc for user " + i); + } const userAccKeypair = Keypair.generate(); const userAccount = userAccKeypair.publicKey; users[i].accounts.set(USER_ACCOUNT, userAccount); diff --git a/tests/utils/mocks.ts b/tests/utils/mocks.ts index 3b61c0f34..506922bdc 100644 --- a/tests/utils/mocks.ts +++ b/tests/utils/mocks.ts @@ -123,6 +123,8 @@ export type MockUser = { /** in mockUser.accounts, key used to get/set the users's account for group 0 */ export const USER_ACCOUNT: string = "g0_acc"; +/** in mockUser.accounts, key used to get/set the users's account for the emode group */ +export const USER_ACCOUNT_E: string = "ge_acc"; /** in mockUser.accounts, key used to get/set the users's LST ATA for validator 0 */ export const LST_ATA = "v0_lstAta"; /** in mockUser.accounts, key used to get/set the users's LST stake account for validator 0 */ diff --git a/tests/utils/types.ts b/tests/utils/types.ts index 96e569a43..8a7ee3fbc 100644 --- a/tests/utils/types.ts +++ b/tests/utils/types.ts @@ -34,6 +34,10 @@ export const ASSET_TAG_STAKED = 2; export const ORACLE_SETUP_NONE = 0; export const ORACLE_SETUP_PYTH_LEGACY = 1; export const ORACLE_SETUP_SWITCHBOARD_v2 = 2; +/** + * Yes, it should technically be called "pull", but this is what we call it on-chain, and + * consistency is king... + * */ export const ORACLE_SETUP_PYTH_PUSH = 3; export const ORACLE_SETUP_SWITCHBOARD_PULL = 4; export const ORACLE_SETUP_STAKED_WITH_PYTH_PUSH = 5; From b2f3df22caabba1502ce2ec578f9eb9bc44d32d3 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 2 Apr 2025 22:00:22 -0400 Subject: [PATCH 11/38] Happy path testing for emode complete --- .../marginfi/src/state/marginfi_account.rs | 7 +- programs/marginfi/src/state/marginfi_group.rs | 42 +++-- tests/e01_initGroup.spec.ts | 3 + tests/e02_configEmode.spec.ts | 68 +++++-- tests/e03_emodeBorrow.spec.ts | 171 +++++++++++++----- tests/e04_emodeLiquidation.spec.ts | 52 ++++++ tests/p01_initPythPull.spec.ts | 4 +- tests/rootHooks.ts | 6 +- tests/s04_borrow.spec.ts | 2 - tests/utils/genericTests.ts | 8 + tests/utils/pyth_mocks.ts | 1 + tests/utils/types.ts | 3 + 12 files changed, 284 insertions(+), 83 deletions(-) create mode 100644 tests/e04_emodeLiquidation.spec.ts diff --git a/programs/marginfi/src/state/marginfi_account.rs b/programs/marginfi/src/state/marginfi_account.rs index 2c2fded1a..8d53d73b4 100644 --- a/programs/marginfi/src/state/marginfi_account.rs +++ b/programs/marginfi/src/state/marginfi_account.rs @@ -5,7 +5,7 @@ use super::{ price::{OraclePriceFeedAdapter, OraclePriceType, PriceAdapter, PriceBias}, }; use crate::{ - assert_struct_align, assert_struct_size, check, + assert_struct_align, assert_struct_size, check, check_eq, constants::{ ASSET_TAG_DEFAULT, ASSET_TAG_SOL, ASSET_TAG_STAKED, BANKRUPT_THRESHOLD, EMISSIONS_FLAG_BORROW_ACTIVE, EMISSIONS_FLAG_LENDING_ACTIVE, EMPTY_BALANCE_THRESHOLD, @@ -219,8 +219,9 @@ impl<'info> BankAccountWithPriceFeed<'_> { // Determine number of accounts to process for this balance let num_accounts = get_remaining_accounts_per_balance(balance)?; - check!( - balance.bank_pk.eq(bank_ai.key), + check_eq!( + balance.bank_pk, + *bank_ai.key, MarginfiError::InvalidBankAccount ); let bank = bank_al.load()?; diff --git a/programs/marginfi/src/state/marginfi_group.rs b/programs/marginfi/src/state/marginfi_group.rs index 38481abdf..1521dda63 100644 --- a/programs/marginfi/src/state/marginfi_group.rs +++ b/programs/marginfi/src/state/marginfi_group.rs @@ -1,5 +1,7 @@ use super::{ - emode::EmodeSettings, marginfi_account::{BalanceSide, RequirementType}, price::{OraclePriceFeedAdapter, OracleSetup} + emode::EmodeSettings, + marginfi_account::{BalanceSide, RequirementType}, + price::{OraclePriceFeedAdapter, OracleSetup}, }; #[cfg(not(feature = "client"))] use crate::events::{GroupEventHeader, LendingPoolBankAccrueInterestEvent}; @@ -31,10 +33,7 @@ use fixed::types::I80F48; use pyth_solana_receiver_sdk::price_update::FeedId; #[cfg(feature = "client")] use std::fmt::Display; -use std::{ - fmt::{Debug, Formatter}, - ops::Not, -}; +use std::fmt::{Debug, Formatter}; use type_layout::TypeLayout; pub const PROGRAM_FEES_ENABLED: u64 = 1; @@ -623,10 +622,12 @@ impl Bank { let total_deposits_amount = self.get_asset_amount(self.total_asset_shares.into())?; let deposit_limit = I80F48::from_num(self.config.deposit_limit); - check!( - total_deposits_amount < deposit_limit, - crate::prelude::MarginfiError::BankAssetCapacityExceeded - ) + if total_deposits_amount >= deposit_limit { + let deposits_num: f64 = total_deposits_amount.to_num(); + let limit_num: f64 = deposit_limit.to_num(); + msg!("deposits: {:?} deposit lim: {:?}", deposits_num, limit_num); + return err!(MarginfiError::BankAssetCapacityExceeded); + } } Ok(()) @@ -684,16 +685,17 @@ impl Bank { .ok_or_else(math_error!())? .into(); - if bypass_borrow_limit.not() && shares.is_positive() && self.config.is_borrow_limit_active() - { + if !bypass_borrow_limit && shares.is_positive() && self.config.is_borrow_limit_active() { let total_liability_amount = self.get_liability_amount(self.total_liability_shares.into())?; let borrow_limit = I80F48::from_num(self.config.borrow_limit); - check!( - total_liability_amount < borrow_limit, - crate::prelude::MarginfiError::BankLiabilityCapacityExceeded - ) + if total_liability_amount >= borrow_limit { + let liab_num: f64 = total_liability_amount.to_num(); + let borrow_num: f64 = borrow_limit.to_num(); + msg!("amt: {:?} borrow lim: {:?}", liab_num, borrow_num); + return err!(MarginfiError::BankLiabilityCapacityExceeded); + } } Ok(()) @@ -703,10 +705,12 @@ impl Bank { let total_assets = self.get_asset_amount(self.total_asset_shares.into())?; let total_liabilities = self.get_liability_amount(self.total_liability_shares.into())?; - check!( - total_assets >= total_liabilities, - crate::prelude::MarginfiError::IllegalUtilizationRatio - ); + if total_assets < total_liabilities { + let assets_num: f64 = total_assets.to_num(); + let liabs_num: f64 = total_liabilities.to_num(); + msg!("assets: {:?} liabs: {:?}", assets_num, liabs_num); + return err!(MarginfiError::IllegalUtilizationRatio); + } Ok(()) } diff --git a/tests/e01_initGroup.spec.ts b/tests/e01_initGroup.spec.ts index 991e2fc31..a32fb1406 100644 --- a/tests/e01_initGroup.spec.ts +++ b/tests/e01_initGroup.spec.ts @@ -162,6 +162,9 @@ describe("Init e-mode enabled group and banks", () => { // Use a reduced weight for this test suite to see the impact of emode. config.assetWeightInit = bigNumberToWrappedI80F48(0.5); config.assetWeightMaint = bigNumberToWrappedI80F48(0.6); + // The default limit is somewhat small for SOL/LST with 9 decimals, so we bump it here. + config.depositLimit = new BN(100_000_000_000_000); + config.borrowLimit = new BN(100_000_000_000_000); if (assetTag) { config.assetTag = assetTag; } diff --git a/tests/e02_configEmode.spec.ts b/tests/e02_configEmode.spec.ts index deb288af0..beb639d37 100644 --- a/tests/e02_configEmode.spec.ts +++ b/tests/e02_configEmode.spec.ts @@ -13,19 +13,30 @@ import { bankrunProgram, banksClient, ecosystem, + EMODE_INIT_RATE_LST_TO_LST, + EMODE_INIT_RATE_SOL_TO_LST, + EMODE_MAINT_RATE_LST_TO_LST, + EMODE_MAINT_RATE_SOL_TO_LST, EMODE_SEED, emodeAdmin, emodeGroup, groupAdmin, users, } from "./rootHooks"; -import { assertBankrunTxFailed } from "./utils/genericTests"; +import { + assertBankrunTxFailed, + assertBNApproximately, + assertBNEqual, + assertI80F48Approx, + assertI80F48Equal, +} from "./utils/genericTests"; import { EMODE_APPLIES_TO_ISOLATED, newEmodeEntry } from "./utils/types"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; import { bigNumberToWrappedI80F48 } from "@mrgnlabs/mrgn-common"; import { createMintToInstruction } from "@solana/spl-token"; import { Marginfi } from "../target/types/marginfi"; +import { assert } from "chai"; // By convention, all tags must be in 13375p34k (kidding, but only sorta) const EMODE_STABLE_TAG = 5748; // STAB because 574813 is out of range @@ -156,8 +167,8 @@ describe("Init e-mode settings for a set of banks", () => { newEmodeEntry( EMODE_LST_TAG, EMODE_APPLIES_TO_ISOLATED, - bigNumberToWrappedI80F48(0.9), - bigNumberToWrappedI80F48(0.95) + bigNumberToWrappedI80F48(EMODE_INIT_RATE_SOL_TO_LST), + bigNumberToWrappedI80F48(EMODE_MAINT_RATE_SOL_TO_LST) ), ], }) @@ -175,8 +186,9 @@ describe("Init e-mode settings for a set of banks", () => { newEmodeEntry( EMODE_SOL_TAG, EMODE_APPLIES_TO_ISOLATED, - bigNumberToWrappedI80F48(0.85), - bigNumberToWrappedI80F48(0.9) + // Here SOL can be borrowed against LST at a reciprocal rate + bigNumberToWrappedI80F48(EMODE_INIT_RATE_SOL_TO_LST), + bigNumberToWrappedI80F48(EMODE_MAINT_RATE_SOL_TO_LST) ), // Note: borrowing LST against another LST is a fairly common use-case and generally // considered little to no risk. In this scenario, the entry is also the bank's own emode @@ -186,8 +198,8 @@ describe("Init e-mode settings for a set of banks", () => { newEmodeEntry( EMODE_LST_TAG, EMODE_APPLIES_TO_ISOLATED, - bigNumberToWrappedI80F48(0.9), - bigNumberToWrappedI80F48(0.95) + bigNumberToWrappedI80F48(EMODE_INIT_RATE_LST_TO_LST), + bigNumberToWrappedI80F48(EMODE_MAINT_RATE_LST_TO_LST) ), ], }) @@ -201,22 +213,56 @@ describe("Init e-mode settings for a set of banks", () => { newEmodeEntry( EMODE_SOL_TAG, EMODE_APPLIES_TO_ISOLATED, - bigNumberToWrappedI80F48(0.85), - bigNumberToWrappedI80F48(0.9) + bigNumberToWrappedI80F48(EMODE_INIT_RATE_SOL_TO_LST), + bigNumberToWrappedI80F48(EMODE_MAINT_RATE_SOL_TO_LST) ), newEmodeEntry( EMODE_LST_TAG, EMODE_APPLIES_TO_ISOLATED, - bigNumberToWrappedI80F48(0.9), - bigNumberToWrappedI80F48(0.95) + bigNumberToWrappedI80F48(EMODE_INIT_RATE_LST_TO_LST), + bigNumberToWrappedI80F48(EMODE_MAINT_RATE_LST_TO_LST) ), ], }) ); + const now = Date.now() / 1000; tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); tx.sign(emodeAdmin.wallet); await banksClient.processTransaction(tx); + + let lstBBankAcc = await bankrunProgram.account.bank.fetch(lstBBank); + let emode = lstBBankAcc.emode; + assert.equal(emode.emodeTag, EMODE_LST_TAG); + assertBNEqual(emode.flags, 1); // is active + + let lastUpdate = emode.timestamp.toNumber(); + // Date checks in bankrun are wonky, this is close enough... + assert.approximately(lastUpdate, now, 100); + + // When the entries are sorted ascending, sol (501) will be last, and lst (157) just prior. + let entrySol = + emode.emodeConfig.entries[emode.emodeConfig.entries.length - 1]; + assert.equal(entrySol.collateralBankEmodeTag, EMODE_SOL_TAG); + assert.equal(entrySol.flags, EMODE_APPLIES_TO_ISOLATED); + assertI80F48Approx(entrySol.assetWeightInit, EMODE_INIT_RATE_SOL_TO_LST); + assertI80F48Approx(entrySol.assetWeightMaint, EMODE_MAINT_RATE_SOL_TO_LST); + + let entryLst = + emode.emodeConfig.entries[emode.emodeConfig.entries.length - 2]; + assert.equal(entryLst.collateralBankEmodeTag, EMODE_LST_TAG); + assert.equal(entryLst.flags, EMODE_APPLIES_TO_ISOLATED); + assertI80F48Approx(entryLst.assetWeightInit, EMODE_INIT_RATE_LST_TO_LST); + assertI80F48Approx(entryLst.assetWeightMaint, EMODE_MAINT_RATE_LST_TO_LST); + + // The rest is blank + for (let i = 0; i < emode.emodeConfig.entries.length - 2; i++) { + let entry = emode.emodeConfig.entries[i]; + assert.equal(entry.collateralBankEmodeTag, 0); + assert.equal(entry.flags, 0); + assertI80F48Equal(entry.assetWeightInit, 0); + assertI80F48Equal(entry.assetWeightMaint, 0); + } }); it("(Fund users/admin USDC/WSOL/LST token accounts", async () => { diff --git a/tests/e03_emodeBorrow.spec.ts b/tests/e03_emodeBorrow.spec.ts index cdc11413b..335166b5b 100644 --- a/tests/e03_emodeBorrow.spec.ts +++ b/tests/e03_emodeBorrow.spec.ts @@ -19,18 +19,23 @@ import { emodeGroup, groupAdmin, marginfiGroup, + oracles, users, + verbose, } from "./rootHooks"; import { assertBankrunTxFailed } from "./utils/genericTests"; import { EMODE_APPLIES_TO_ISOLATED, newEmodeEntry } from "./utils/types"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; -import { bigNumberToWrappedI80F48 } from "@mrgnlabs/mrgn-common"; +import { + bigNumberToWrappedI80F48, + wrappedI80F48toBigNumber, +} from "@mrgnlabs/mrgn-common"; import { createMintToInstruction } from "@solana/spl-token"; import { Marginfi } from "../target/types/marginfi"; import { program } from "@coral-xyz/anchor/dist/cjs/native/system"; import { USER_ACCOUNT, USER_ACCOUNT_E } from "./utils/mocks"; -import { accountInit, depositIx } from "./utils/user-instructions"; +import { accountInit, borrowIx, depositIx } from "./utils/user-instructions"; import { dumpBankrunLogs } from "./utils/tools"; // By convention, all tags must be in 13375p34k (kidding, but only sorta) @@ -96,65 +101,139 @@ describe("Emode borrowing", () => { await banksClient.processTransaction(userinitTx); } - if (emodeAdmin.accounts.get(USER_ACCOUNT_E)) { - console.log("Skipped creating emode admin"); + if (groupAdmin.accounts.get(USER_ACCOUNT_E)) { + console.log("Skipped creating admin account"); return; } const userAccKeypair = Keypair.generate(); const userAccount = userAccKeypair.publicKey; - emodeAdmin.accounts.set(USER_ACCOUNT_E, userAccount); + groupAdmin.accounts.set(USER_ACCOUNT_E, userAccount); let userinitTx: Transaction = new Transaction(); userinitTx.add( - await accountInit(emodeAdmin.mrgnBankrunProgram, { + await accountInit(groupAdmin.mrgnBankrunProgram, { marginfiGroup: emodeGroup.publicKey, marginfiAccount: userAccount, - authority: emodeAdmin.wallet.publicKey, - feePayer: emodeAdmin.wallet.publicKey, + authority: groupAdmin.wallet.publicKey, + feePayer: groupAdmin.wallet.publicKey, }) ); userinitTx.recentBlockhash = await getBankrunBlockhash(bankrunContext); - userinitTx.sign(emodeAdmin.wallet, userAccKeypair); + userinitTx.sign(groupAdmin.wallet, userAccKeypair); await banksClient.processTransaction(userinitTx); }); it("(admin) Seeds liquidity in the banks", async () => { - const user = users[0]; - const userAccount = user.accounts.get(USER_ACCOUNT_E); - - let tx = new Transaction().add( - await depositIx(user.mrgnBankrunProgram, { - marginfiAccount: userAccount, - bank: usdcBank, - tokenAccount: user.usdcAccount, - amount: new BN(10 * 10 ** ecosystem.usdcDecimals), - depositUpToLimit: false, - }), - await depositIx(user.mrgnBankrunProgram, { - marginfiAccount: userAccount, - bank: solBank, - tokenAccount: user.wsolAccount, - amount: new BN(10 * 10 ** ecosystem.wsolDecimals), - depositUpToLimit: false, - }), - await depositIx(user.mrgnBankrunProgram, { - marginfiAccount: userAccount, - bank: lstABank, - tokenAccount: user.lstAlphaAccount, - amount: new BN(10 * 10 ** ecosystem.lstAlphaDecimals), - depositUpToLimit: false, - }), - await depositIx(user.mrgnBankrunProgram, { - marginfiAccount: userAccount, - bank: lstBBank, - tokenAccount: user.lstAlphaAccount, - amount: new BN(10 * 10 ** ecosystem.lstAlphaDecimals), - depositUpToLimit: false, - }) - ); - - tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); - tx.sign(user.wallet); - await banksClient.tryProcessTransaction(tx); + const user = groupAdmin; + const userAccount = user.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: usdcBank, + tokenAccount: user.usdcAccount, + amount: new BN(100 * 10 ** ecosystem.usdcDecimals), + depositUpToLimit: false, + }), + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: solBank, + tokenAccount: user.wsolAccount, + amount: new BN(100 * 10 ** ecosystem.wsolDecimals), + depositUpToLimit: false, + }), + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: lstABank, + tokenAccount: user.lstAlphaAccount, + amount: new BN(100 * 10 ** ecosystem.lstAlphaDecimals), + depositUpToLimit: false, + }), + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: lstBBank, + tokenAccount: user.lstAlphaAccount, + amount: new BN(100 * 10 ** ecosystem.lstAlphaDecimals), + depositUpToLimit: false, + }) + ); + + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); }); + + /* + * SOL is worth $150, and LST is worth $175. Against a 10 SOL position, worth $1500, with a + * `EMODE_INIT_RATE_SOL_TO_LST` of 90% we expect to borrow .9 * 1500 / 175 ~= 7.71428571429 LST. + * + * Due to confidence adjustments the actual SOL price used for risk purposes is ~99% of $150 and + * the LST liability is ~102% of $175 so .9 * (1500 * .99) / (175 * 1.0424) ~= 7.3264992874 LST + * + * With the bank's default rate sans-emode (50%), we could only borrow ~4.28571428571 LST + * + * Note: the liability weight was assumed to be 1 in the calculations above, emode never modifies + * liability weights. + * + * Note: To derive the conf bands above, the confidence of Pyth Legacy is 1%, and Pyth Pull is 2%, + * and we apply a 2.12 constant multiplier, see health pulse printout for actual internal pricing. + */ + it("(user 0) borrows LST A against SOL at a favorable rate - happy path", async () => { + const user = users[0]; + const userAccount = user.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: solBank, + tokenAccount: user.wsolAccount, + amount: new BN(10 * 10 ** ecosystem.wsolDecimals), + depositUpToLimit: false, + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); + + tx = new Transaction().add( + await borrowIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: lstABank, + tokenAccount: user.lstAlphaAccount, + remaining: [ + solBank, + oracles.wsolOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + ], + amount: new BN(7.3 * 10 ** ecosystem.lstAlphaDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); + + let userAcc = await bankrunProgram.account.marginfiAccount.fetch( + userAccount + ); + const cacheAfter = userAcc.healthCache; + const assetValue = wrappedI80F48toBigNumber(cacheAfter.assetValue); + const liabValue = wrappedI80F48toBigNumber(cacheAfter.liabilityValue); + if (verbose) { + console.log("---user health state---"); + console.log("asset value: " + assetValue.toString()); + console.log("liab value: " + liabValue.toString()); + console.log("prices: "); + for (let i = 0; i < cacheAfter.prices.length; i++) { + const price = wrappedI80F48toBigNumber(cacheAfter.prices[i]).toNumber(); + if (price != 0) { + console.log(" [" + i + "] " + price); + } + } + } + + // TODO assert balances + }); + + // TODO moar tests.... }); diff --git a/tests/e04_emodeLiquidation.spec.ts b/tests/e04_emodeLiquidation.spec.ts new file mode 100644 index 000000000..109b4c232 --- /dev/null +++ b/tests/e04_emodeLiquidation.spec.ts @@ -0,0 +1,52 @@ +import { BN } from "@coral-xyz/anchor"; +import { PublicKey } from "@solana/web3.js"; +import { bankrunProgram, ecosystem, EMODE_SEED, emodeGroup } from "./rootHooks"; +import { deriveBankWithSeed } from "./utils/pdas"; + +// By convention, all tags must be in 13375p34k (kidding, but only sorta) +const EMODE_STABLE_TAG = 5748; // STAB because 574813 is out of range +const EMODE_SOL_TAG = 501; +const EMODE_LST_TAG = 157; + +const seed = new BN(EMODE_SEED); +let usdcBank: PublicKey; +let solBank: PublicKey; +let lstABank: PublicKey; +let lstBBank: PublicKey; + +describe("Emode liquidation", () => { + before(async () => { + [usdcBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.usdcMint.publicKey, + seed + ); + [solBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.wsolMint.publicKey, + seed + ); + [lstABank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.lstAlphaMint.publicKey, + seed + ); + [lstBBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.lstAlphaMint.publicKey, + seed.addn(1) + ); + }); + + it("Emode in effect - Can't liquidate", async () => { + // TODO can't liquidate + }); + + it("Emode reduced - Can liquidate", async () => { + // TODO can liquidate after emode reduction/removal + }); +}); diff --git a/tests/p01_initPythPull.spec.ts b/tests/p01_initPythPull.spec.ts index 4b223a99f..6c7a381ce 100644 --- a/tests/p01_initPythPull.spec.ts +++ b/tests/p01_initPythPull.spec.ts @@ -26,6 +26,7 @@ import { ORACLE_SETUP_PYTH_PUSH, HEALTH_CACHE_ENGINE_OK, HEALTH_CACHE_HEALTHY, + CONF_INTERVAL_MULTIPLE, } from "./utils/types"; import { deriveBankWithSeed } from "./utils/pdas"; import { createMintToInstruction } from "@solana/spl-token"; @@ -255,7 +256,8 @@ describe("Pyth pull oracles in localnet", () => { ); assertBNEqual(cache.flags, HEALTH_CACHE_HEALTHY + HEALTH_CACHE_ENGINE_OK); const priceExpected = - oracles.lstAlphaPrice - oracles.lstAlphaPrice * oracles.confidenceValue; + oracles.lstAlphaPrice - + oracles.lstAlphaPrice * oracles.confidenceValue * CONF_INTERVAL_MULTIPLE; assertI80F48Approx(cache.prices[0], priceExpected); assertI80F48Approx(cache.assetValue, priceExpected * depositAmount); }); diff --git a/tests/rootHooks.ts b/tests/rootHooks.ts index 8c929836b..82ab6695a 100644 --- a/tests/rootHooks.ts +++ b/tests/rootHooks.ts @@ -93,6 +93,10 @@ export const PYTH_ORACLE_SAMPLE = new PublicKey( /** Banks in the emode test suite use this seed */ export const EMODE_SEED = 44; +export const EMODE_INIT_RATE_SOL_TO_LST = .9; +export const EMODE_MAINT_RATE_SOL_TO_LST = .95; +export const EMODE_INIT_RATE_LST_TO_LST = .8; +export const EMODE_MAINT_RATE_LST_TO_LST = .85; /** keys copied into the bankrun instance */ let copyKeys: PublicKey[] = [PYTH_ORACLE_FEED_SAMPLE, PYTH_ORACLE_SAMPLE]; @@ -261,7 +265,7 @@ export const mochaHooks = { ecosystem.tokenBDecimals, 175, ecosystem.lstAlphaDecimals, - 0.02, // confidnece interval + 0.02, // confidence interval verbose ); copyKeys.push( diff --git a/tests/s04_borrow.spec.ts b/tests/s04_borrow.spec.ts index 7f791ddcb..61a20f868 100644 --- a/tests/s04_borrow.spec.ts +++ b/tests/s04_borrow.spec.ts @@ -27,8 +27,6 @@ import { USER_ACCOUNT } from "./utils/mocks"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; describe("Deposit funds (included staked assets)", () => { - const program = workspace.Marginfi as Program; - // User 0 has a USDC deposit position // User 1 has a SOL [0] and validator 0 Staked [1] deposit position diff --git a/tests/utils/genericTests.ts b/tests/utils/genericTests.ts index 64b1b9c6b..974d458dd 100644 --- a/tests/utils/genericTests.ts +++ b/tests/utils/genericTests.ts @@ -62,6 +62,10 @@ export const assertI80F48Equal = ( throw new Error("Unsupported type for comparison"); } + if (bigA.isNaN() || bigB.isNaN()) { + throw new Error("One of the values is NaN"); + } + assert.equal(bigA.toString(), bigB.toString()); }; @@ -89,6 +93,10 @@ export const assertI80F48Approx = ( throw new Error("Unsupported type for comparison"); } + if (bigA.isNaN() || bigB.isNaN()) { + throw new Error("One of the values is NaN"); + } + const diff = bigA.minus(bigB).abs(); const allowedDifference = new BigNumber(tolerance); diff --git a/tests/utils/pyth_mocks.ts b/tests/utils/pyth_mocks.ts index 10e865a87..f1a5c8005 100644 --- a/tests/utils/pyth_mocks.ts +++ b/tests/utils/pyth_mocks.ts @@ -511,6 +511,7 @@ export const setupPythOracles = async ( fakeUsdc: fakeUsdcPythOracle.publicKey, pythPullLst: lstPythPullOracle, pythPullLstOracleFeed: lstPythPullOracleFeed, + confidenceValue: oracleConfDefault }; return oracles; }; diff --git a/tests/utils/types.ts b/tests/utils/types.ts index 8a7ee3fbc..6f81dbaae 100644 --- a/tests/utils/types.ts +++ b/tests/utils/types.ts @@ -46,6 +46,9 @@ export const HEALTH_CACHE_NONE = 0; export const HEALTH_CACHE_HEALTHY = 1; export const HEALTH_CACHE_ENGINE_OK = 2; +/** Confidence intervals are multiplied by this constant internally */ +export const CONF_INTERVAL_MULTIPLE = 2.12; + /** * The default bank config has * * all weights are 1 From f6497ad49c41cde93bbde8d5817adf9309e3666a Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 2 Apr 2025 22:00:47 -0400 Subject: [PATCH 12/38] Minor doc update --- tests/e03_emodeBorrow.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/e03_emodeBorrow.spec.ts b/tests/e03_emodeBorrow.spec.ts index 335166b5b..ae2a1c0de 100644 --- a/tests/e03_emodeBorrow.spec.ts +++ b/tests/e03_emodeBorrow.spec.ts @@ -163,12 +163,13 @@ describe("Emode borrowing", () => { await banksClient.processTransaction(tx); }); + // TODO why isn't the SOL pricing getting a confidence discount? /* * SOL is worth $150, and LST is worth $175. Against a 10 SOL position, worth $1500, with a * `EMODE_INIT_RATE_SOL_TO_LST` of 90% we expect to borrow .9 * 1500 / 175 ~= 7.71428571429 LST. * - * Due to confidence adjustments the actual SOL price used for risk purposes is ~99% of $150 and - * the LST liability is ~102% of $175 so .9 * (1500 * .99) / (175 * 1.0424) ~= 7.3264992874 LST + * Due to confidence adjustments the actual price of the LST liability is ~104% of $175 so: + * - 0.9 * 1500 / (175 * 1.0424) ~= 7.3264992874 LST * * With the bank's default rate sans-emode (50%), we could only borrow ~4.28571428571 LST * From af8f67711e963cd363f2985cbc66fc575b523280 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Fri, 4 Apr 2025 16:17:40 -0400 Subject: [PATCH 13/38] More economic tests for emode enabled --- tests/e03_emodeBorrow.spec.ts | 153 ++++++++++++++++++++++++++++++++-- 1 file changed, 147 insertions(+), 6 deletions(-) diff --git a/tests/e03_emodeBorrow.spec.ts b/tests/e03_emodeBorrow.spec.ts index ae2a1c0de..0ed983137 100644 --- a/tests/e03_emodeBorrow.spec.ts +++ b/tests/e03_emodeBorrow.spec.ts @@ -14,6 +14,8 @@ import { bankrunProgram, banksClient, ecosystem, + EMODE_INIT_RATE_LST_TO_LST, + EMODE_INIT_RATE_SOL_TO_LST, EMODE_SEED, emodeAdmin, emodeGroup, @@ -23,8 +25,15 @@ import { users, verbose, } from "./rootHooks"; -import { assertBankrunTxFailed } from "./utils/genericTests"; -import { EMODE_APPLIES_TO_ISOLATED, newEmodeEntry } from "./utils/types"; +import { + assertBankrunTxFailed, + assertI80F48Approx, +} from "./utils/genericTests"; +import { + CONF_INTERVAL_MULTIPLE, + EMODE_APPLIES_TO_ISOLATED, + newEmodeEntry, +} from "./utils/types"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; import { @@ -163,7 +172,7 @@ describe("Emode borrowing", () => { await banksClient.processTransaction(tx); }); - // TODO why isn't the SOL pricing getting a confidence discount? + // TODO why isn't the SOL pricing getting a confidence discount (legacy oracle issue)? /* * SOL is worth $150, and LST is worth $175. Against a 10 SOL position, worth $1500, with a * `EMODE_INIT_RATE_SOL_TO_LST` of 90% we expect to borrow .9 * 1500 / 175 ~= 7.71428571429 LST. @@ -181,6 +190,8 @@ describe("Emode borrowing", () => { */ it("(user 0) borrows LST A against SOL at a favorable rate - happy path", async () => { const user = users[0]; + const solDeposit = 10; + const lstBorrow = 7.3; const userAccount = user.accounts.get(USER_ACCOUNT_E); let tx = new Transaction().add( @@ -188,7 +199,7 @@ describe("Emode borrowing", () => { marginfiAccount: userAccount, bank: solBank, tokenAccount: user.wsolAccount, - amount: new BN(10 * 10 ** ecosystem.wsolDecimals), + amount: new BN(solDeposit * 10 ** ecosystem.wsolDecimals), depositUpToLimit: false, }) ); @@ -207,7 +218,7 @@ describe("Emode borrowing", () => { lstABank, oracles.pythPullLst.publicKey, ], - amount: new BN(7.3 * 10 ** ecosystem.lstAlphaDecimals), + amount: new BN(lstBorrow * 10 ** ecosystem.lstAlphaDecimals), }) ); tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); @@ -233,8 +244,138 @@ describe("Emode borrowing", () => { } } - // TODO assert balances + const assetsExpected = + oracles.wsolPrice * solDeposit * EMODE_INIT_RATE_SOL_TO_LST; + assertI80F48Approx(cacheAfter.assetValue, assetsExpected); + + const liabsExpected = + oracles.lstAlphaPrice * + lstBorrow * + (1 + oracles.confidenceValue * CONF_INTERVAL_MULTIPLE) * + 1; // Note: Liability weight 1 for banks in this test + // TODO the expected liability value is still about 1% higher than the computed why? + assertI80F48Approx( + cacheAfter.liabilityValue, + liabsExpected, + liabsExpected * 0.02 + ); }); + // This illustrates a possible emode footgun: the user tries to borrow USDC, which would cause + // them to lose the emode benefit from their LST borrow. Even this trivial borrow amount fails + // because breaking the emode benefit would put this user significantly under water. + it("(user 0) tries to borrow a trivial amount of USDC - fails, emode error", async () => { + const user = users[0]; + const userAccount = user.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await borrowIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: usdcBank, + tokenAccount: user.usdcAccount, + remaining: [ + solBank, + oracles.wsolOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + usdcBank, + oracles.usdcOracle.publicKey, + ], + amount: new BN(0.0001 * 10 ** ecosystem.usdcDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + let result = await banksClient.tryProcessTransaction(tx); + // 6009 (RiskEngineInitRejected) + assertBankrunTxFailed(result, "0x1779"); + }); + + /* + * Both LST are worth $175. With an LST to LST emode rate of 80%, we expect: + * .8 * 1750 / 175 = 8 LST B borrowed + * + * And with the confidence adjustment: + * - (0.8 * 1750 * (1 - 0.02 * 2.12)) / (175 * 1.0424) ~= 7.34919416731 LST + */ + it("(user 1) borrows LST A against LST B at a favorable rate - happy path", async () => { + const user = users[1]; + const lstADeposit = 10; + const lstBBorrow = 7.2; + const userAccount = user.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: lstABank, + tokenAccount: user.lstAlphaAccount, + amount: new BN(lstADeposit * 10 ** ecosystem.lstAlphaDecimals), + depositUpToLimit: false, + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); + + tx = new Transaction().add( + await borrowIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: lstBBank, + tokenAccount: user.lstAlphaAccount, + remaining: [ + lstABank, + oracles.pythPullLst.publicKey, + lstBBank, + oracles.pythPullLst.publicKey, + ], + amount: new BN(lstBBorrow * 10 ** ecosystem.lstAlphaDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); + + let userAcc = await bankrunProgram.account.marginfiAccount.fetch( + userAccount + ); + const cacheAfter = userAcc.healthCache; + const assetValue = wrappedI80F48toBigNumber(cacheAfter.assetValue); + const liabValue = wrappedI80F48toBigNumber(cacheAfter.liabilityValue); + if (verbose) { + console.log("---user health state---"); + console.log("asset value: " + assetValue.toString()); + console.log("liab value: " + liabValue.toString()); + console.log("prices: "); + for (let i = 0; i < cacheAfter.prices.length; i++) { + const price = wrappedI80F48toBigNumber(cacheAfter.prices[i]).toNumber(); + if (price != 0) { + console.log(" [" + i + "] " + price); + } + } + } + + // (0.8 * 1750 * (1 - 0.02 * 2.12)) + const assetsExpected = + oracles.lstAlphaPrice * + lstADeposit * + EMODE_INIT_RATE_LST_TO_LST * + (1 - oracles.confidenceValue * CONF_INTERVAL_MULTIPLE); + assertI80F48Approx(cacheAfter.assetValue, assetsExpected); + + const liabsExpected = + oracles.lstAlphaPrice * + lstBBorrow * + (1 + oracles.confidenceValue * CONF_INTERVAL_MULTIPLE) * + 1; // Note: Liability weight 1 for banks in this test + // TODO Again the liability is very slightly (about 1%) overvalue + assertI80F48Approx( + cacheAfter.liabilityValue, + liabsExpected, + liabsExpected * 0.02 + ); + }); + + // TODO borrow SOL, no impact due to MORE favorable rate (and health does not change) + // TODO moar tests.... }); From 198de5c0b7fe144a1f8d6b164476a6dd4fc83996 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Fri, 4 Apr 2025 23:09:54 -0400 Subject: [PATCH 14/38] Removed origination fees from emode test suite, liability math now checks out as expected. --- tests/e01_initGroup.spec.ts | 3 +++ tests/e03_emodeBorrow.spec.ts | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/e01_initGroup.spec.ts b/tests/e01_initGroup.spec.ts index a32fb1406..41cc0892e 100644 --- a/tests/e01_initGroup.spec.ts +++ b/tests/e01_initGroup.spec.ts @@ -22,6 +22,7 @@ import { ASSET_TAG_DEFAULT, ASSET_TAG_SOL, defaultBankConfig, + I80F48_ZERO, ORACLE_SETUP_PYTH_LEGACY, ORACLE_SETUP_PYTH_PUSH, } from "./utils/types"; @@ -165,6 +166,8 @@ describe("Init e-mode enabled group and banks", () => { // The default limit is somewhat small for SOL/LST with 9 decimals, so we bump it here. config.depositLimit = new BN(100_000_000_000_000); config.borrowLimit = new BN(100_000_000_000_000); + // We don't want origination fees messing with debt here + config.interestRateConfig.protocolOriginationFee = I80F48_ZERO; if (assetTag) { config.assetTag = assetTag; } diff --git a/tests/e03_emodeBorrow.spec.ts b/tests/e03_emodeBorrow.spec.ts index 0ed983137..8cf376779 100644 --- a/tests/e03_emodeBorrow.spec.ts +++ b/tests/e03_emodeBorrow.spec.ts @@ -253,11 +253,10 @@ describe("Emode borrowing", () => { lstBorrow * (1 + oracles.confidenceValue * CONF_INTERVAL_MULTIPLE) * 1; // Note: Liability weight 1 for banks in this test - // TODO the expected liability value is still about 1% higher than the computed why? assertI80F48Approx( cacheAfter.liabilityValue, liabsExpected, - liabsExpected * 0.02 + liabsExpected * 0.001 ); }); @@ -367,11 +366,10 @@ describe("Emode borrowing", () => { lstBBorrow * (1 + oracles.confidenceValue * CONF_INTERVAL_MULTIPLE) * 1; // Note: Liability weight 1 for banks in this test - // TODO Again the liability is very slightly (about 1%) overvalue assertI80F48Approx( cacheAfter.liabilityValue, liabsExpected, - liabsExpected * 0.02 + liabsExpected * 0.001 ); }); From 1864a7d31958ba66549622f69e0b7e0600c977bc Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Fri, 4 Apr 2025 23:18:03 -0400 Subject: [PATCH 15/38] Test for second asset borrow when asset class is superior to existing emode class --- tests/e03_emodeBorrow.spec.ts | 80 ++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/tests/e03_emodeBorrow.spec.ts b/tests/e03_emodeBorrow.spec.ts index 8cf376779..64ba40f78 100644 --- a/tests/e03_emodeBorrow.spec.ts +++ b/tests/e03_emodeBorrow.spec.ts @@ -256,7 +256,7 @@ describe("Emode borrowing", () => { assertI80F48Approx( cacheAfter.liabilityValue, liabsExpected, - liabsExpected * 0.001 + liabsExpected * 0.0001 ); }); @@ -280,7 +280,7 @@ describe("Emode borrowing", () => { usdcBank, oracles.usdcOracle.publicKey, ], - amount: new BN(0.0001 * 10 ** ecosystem.usdcDecimals), + amount: new BN(0.000001 * 10 ** ecosystem.usdcDecimals), }) ); tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); @@ -297,10 +297,10 @@ describe("Emode borrowing", () => { * And with the confidence adjustment: * - (0.8 * 1750 * (1 - 0.02 * 2.12)) / (175 * 1.0424) ~= 7.34919416731 LST */ + const lstADeposit = 10; + const lstBBorrow = 7.3; it("(user 1) borrows LST A against LST B at a favorable rate - happy path", async () => { const user = users[1]; - const lstADeposit = 10; - const lstBBorrow = 7.2; const userAccount = user.accounts.get(USER_ACCOUNT_E); let tx = new Transaction().add( @@ -369,11 +369,79 @@ describe("Emode borrowing", () => { assertI80F48Approx( cacheAfter.liabilityValue, liabsExpected, - liabsExpected * 0.001 + liabsExpected * 0.0001 ); }); - // TODO borrow SOL, no impact due to MORE favorable rate (and health does not change) + // Here the user adds a SOL borrow, which is fine, because SOL has a better emode pairing with LST + // A than LST B does. The lesser emode value (from the LST B borrow) is used for collateral + // purposes, but the position doesn't blow up like with the earlier attempted USDC borrow, its + // value doesn't change other than the trivial increase from the SOL borrow. + it("(user 1) tries to also borrow a trivial amount of SOL - succeeds, no change", async () => { + const user = users[1]; + const wsolBorrow = 0.000001; + const userAccount = user.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await borrowIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: solBank, + tokenAccount: user.wsolAccount, + remaining: [ + lstABank, + oracles.pythPullLst.publicKey, + lstBBank, + oracles.pythPullLst.publicKey, + solBank, + oracles.wsolOracle.publicKey, + ], + amount: new BN(0.000001 * 10 ** ecosystem.wsolDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); + + // Note: essentially no change + let userAcc = await bankrunProgram.account.marginfiAccount.fetch( + userAccount + ); + const cacheAfter = userAcc.healthCache; + const assetValue = wrappedI80F48toBigNumber(cacheAfter.assetValue); + const liabValue = wrappedI80F48toBigNumber(cacheAfter.liabilityValue); + if (verbose) { + console.log("---user health state---"); + console.log("asset value: " + assetValue.toString()); + console.log("liab value: " + liabValue.toString()); + console.log("prices: "); + for (let i = 0; i < cacheAfter.prices.length; i++) { + const price = wrappedI80F48toBigNumber(cacheAfter.prices[i]).toNumber(); + if (price != 0) { + console.log(" [" + i + "] " + price); + } + } + } + + // (0.8 * 1750 * (1 - 0.02 * 2.12)) + const assetsExpected = + oracles.lstAlphaPrice * + lstADeposit * + EMODE_INIT_RATE_LST_TO_LST * + (1 - oracles.confidenceValue * CONF_INTERVAL_MULTIPLE); + assertI80F48Approx(cacheAfter.assetValue, assetsExpected); + + const liabsExpected = + oracles.lstAlphaPrice * + lstBBorrow * + (1 + oracles.confidenceValue * CONF_INTERVAL_MULTIPLE) * + 1 + + wsolBorrow * oracles.wsolPrice; // Close enough, the amount is trivial + assertI80F48Approx( + cacheAfter.liabilityValue, + liabsExpected, + liabsExpected * 0.001 + ); + }); // TODO moar tests.... }); From 9de48993e33b4f3c68d5d437a0625e0387fec5c8 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Mon, 7 Apr 2025 15:50:44 -0400 Subject: [PATCH 16/38] Doc and lint fixes --- .../src/instructions/marginfi_group/config_bank_emode.rs | 2 +- .../marginfi/src/instructions/marginfi_group/configure.rs | 1 - programs/marginfi/src/state/emode.rs | 6 +++--- programs/marginfi/src/state/marginfi_group.rs | 2 +- test-utils/src/marginfi_group.rs | 6 +++--- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs index 9e58b0fb3..1ab1c33ef 100644 --- a/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs +++ b/programs/marginfi/src/instructions/marginfi_group/config_bank_emode.rs @@ -18,7 +18,7 @@ pub fn lending_pool_configure_bank_emode( // Prevent footguns from passing data in padding, which could interfere with future values in // that assumed-empty space. Yes, we could simply take a struct without padding as input, but - // having a seperate config type has proved to be more of a pain than dealing with padding. + // having a separate config type has proved to be more of a pain than dealing with padding. for entry in sorted_entries.iter_mut() { entry.pad0 = [0; 5]; } diff --git a/programs/marginfi/src/instructions/marginfi_group/configure.rs b/programs/marginfi/src/instructions/marginfi_group/configure.rs index f1aa19fe9..ab8b25efc 100644 --- a/programs/marginfi/src/instructions/marginfi_group/configure.rs +++ b/programs/marginfi/src/instructions/marginfi_group/configure.rs @@ -23,7 +23,6 @@ pub fn configure( marginfi_group.update_emode_admin(new_emode_admin); marginfi_group.set_arena_group(is_arena_group)?; - msg!("flags set to: {:?}", marginfi_group.group_flags); emit!(MarginfiGroupConfigureEvent { diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs index d3f2fb925..e34b87f6b 100644 --- a/programs/marginfi/src/state/emode.rs +++ b/programs/marginfi/src/state/emode.rs @@ -26,8 +26,8 @@ pub struct EmodeSettings { /// /// For example, all stablecoin banks might share the same emode_tag, and in their entries, each /// such stablecoin bank will recognize that collateral sources with this "stable" tag get - /// preferrential weights. When a new stablecoin is added that is considered riskier, it may get - /// a new, less favorable emode tag, and eventually get ugraded to the same one as the other + /// preferential weights. When a new stablecoin is added that is considered riskier, it may get + /// a new, less favorable emode tag, and eventually get upgraded to the same one as the other /// stables /// /// * 0 is in an invalid tag and will do nothing. @@ -156,7 +156,7 @@ assert_struct_align!(EmodeEntry, 8); AnchorDeserialize, AnchorSerialize, Copy, Clone, Zeroable, Pod, PartialEq, Eq, TypeLayout, Debug, )] pub struct EmodeEntry { - /// emode_tag of the bank(s) whose collateral you wish to treat preferrentially. + /// emode_tag of the bank(s) whose collateral you wish to treat preferentially. pub collateral_bank_emode_tag: u16, /// * APPLIES_TO_ISOLATED (1) - if set, isolated banks with this tag also benefit. If not set, /// isolated banks continue to offer zero collateral, even if they use this tag. diff --git a/programs/marginfi/src/state/marginfi_group.rs b/programs/marginfi/src/state/marginfi_group.rs index 1521dda63..dac7fb764 100644 --- a/programs/marginfi/src/state/marginfi_group.rs +++ b/programs/marginfi/src/state/marginfi_group.rs @@ -525,7 +525,7 @@ pub struct Bank { pub collected_program_fees_outstanding: WrappedI80F48, /// Controls this bank's emode configuration, which enables some banks to treat the assets of - /// certain other banks more preferrentially as collateral. + /// certain other banks more preferentially as collateral. pub emode: EmodeSettings, pub _padding_0: [u8; 8], diff --git a/test-utils/src/marginfi_group.rs b/test-utils/src/marginfi_group.rs index 58ec0bc95..ab76fb5ed 100644 --- a/test-utils/src/marginfi_group.rs +++ b/test-utils/src/marginfi_group.rs @@ -155,7 +155,7 @@ impl MarginfiGroupFixture { /// Adds bank and configures the oracle. /// - /// Note: AddBank and LendingPoolConfigureBankOracle were seperated to handle a tx size issue in + /// Note: AddBank and LendingPoolConfigureBankOracle were separated to handle a tx size issue in /// squads. This test fixture packs both ixes into one tx as is typical outside of squads. pub async fn try_lending_pool_add_bank( &self, @@ -232,7 +232,7 @@ impl MarginfiGroupFixture { /// Adds bank and configures the oracle. /// - /// Note: AddBank and LendingPoolConfigureBankOracle were seperated to handle a tx size issue in + /// Note: AddBank and LendingPoolConfigureBankOracle were separated to handle a tx size issue in /// squads. This test fixture packs both ixes into one tx as is typical outside of squads. pub async fn try_lending_pool_add_bank_with_seed( &self, @@ -419,7 +419,7 @@ impl MarginfiGroupFixture { pub async fn try_update( &self, new_admin: Pubkey, - new_emode_admin:Pubkey, + new_emode_admin: Pubkey, is_arena_group: bool, ) -> Result<(), BanksClientError> { let ix = Instruction { From 6ad4f9e685b817353e19bd17b332783425ceeded Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 9 Apr 2025 17:24:45 -0400 Subject: [PATCH 17/38] Liquidation test WIP --- Anchor.toml | 5 +- .../marginfi_account/liquidate.rs | 5 - programs/marginfi/src/state/emode.rs | 5 +- tests/10_liquidate.spec.ts | 4 +- tests/e01_initGroup.spec.ts | 14 + tests/e02_configEmode.spec.ts | 28 +- tests/e03_emodeBorrow.spec.ts | 69 ++-- tests/e04_emodeLiquidation.spec.ts | 381 +++++++++++++++++- tests/utils/genericTests.ts | 19 +- tests/utils/mocks.ts | 5 + tests/utils/types.ts | 9 +- 11 files changed, 473 insertions(+), 71 deletions(-) diff --git a/Anchor.toml b/Anchor.toml index 18141c9c0..4b7b4920c 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -26,7 +26,7 @@ wallet = "~/.config/solana/id.json" # (remove RUST_LOG= to see bankRun logs) [scripts] -test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/*.spec.ts --exit --require tests/rootHooks.ts" +# test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/*.spec.ts --exit --require tests/rootHooks.ts" # Staked collateral tests only # test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/s*.spec.ts --exit --require tests/rootHooks.ts" @@ -34,6 +34,9 @@ test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/*.spec.t # Pyth pull tests only # test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/p*.spec.ts --exit --require tests/rootHooks.ts" +# Edmode tests only +test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/e*.spec.ts --exit --require tests/rootHooks.ts" + [test] startup_wait = 60000 shutdown_wait = 2000 diff --git a/programs/marginfi/src/instructions/marginfi_account/liquidate.rs b/programs/marginfi/src/instructions/marginfi_account/liquidate.rs index a0f3c1516..6f7ec482a 100644 --- a/programs/marginfi/src/instructions/marginfi_account/liquidate.rs +++ b/programs/marginfi/src/instructions/marginfi_account/liquidate.rs @@ -383,11 +383,6 @@ pub fn lending_account_liquidate<'info>( )?; // TODO consider if health cache update here is worth blowing the extra CU - - // TODO is this even neccessary? Under what circumstances can a liquidator put themselves - // underwater after a liquidation? - - // Verify liquidator account health RiskEngine::check_account_init_health( &liquidator_marginfi_account, liquidator_remaining_accounts, diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs index e34b87f6b..929bc7b8d 100644 --- a/programs/marginfi/src/state/emode.rs +++ b/programs/marginfi/src/state/emode.rs @@ -158,8 +158,9 @@ assert_struct_align!(EmodeEntry, 8); pub struct EmodeEntry { /// emode_tag of the bank(s) whose collateral you wish to treat preferentially. pub collateral_bank_emode_tag: u16, - /// * APPLIES_TO_ISOLATED (1) - if set, isolated banks with this tag also benefit. If not set, - /// isolated banks continue to offer zero collateral, even if they use this tag. + /// * APPLIES_TO_ISOLATED (1) - (NOT YET INMPLEMNENTED) if set, isolated banks with this tag + /// also benefit. If not set, isolated banks continue to offer zero collateral, even if they + /// use this tag. /// * 2, 4, 8, 16, 32, etc - reserved for future use pub flags: u8, // To next 8-byte multiple diff --git a/tests/10_liquidate.spec.ts b/tests/10_liquidate.spec.ts index f498e3e7b..f4a3863b0 100644 --- a/tests/10_liquidate.spec.ts +++ b/tests/10_liquidate.spec.ts @@ -34,7 +34,7 @@ import { bigNumberToWrappedI80F48, wrappedI80F48toBigNumber, } from "@mrgnlabs/mrgn-common"; -import { defaultBankConfigOptRaw } from "./utils/types"; +import { CONF_INTERVAL_MULTIPLE, defaultBankConfigOptRaw } from "./utils/types"; import { configureBank } from "./utils/group-instructions"; describe("Liquidate user", () => { @@ -42,7 +42,7 @@ describe("Liquidate user", () => { const provider = getProvider() as AnchorProvider; const wallet = provider.wallet as Wallet; - const confidenceInterval = 0.0212; // 1% confidence * CONF_INTERVAL_MULTIPLE + const confidenceInterval = 0.01 * CONF_INTERVAL_MULTIPLE; const liquidateAmountA = 0.2; const liquidateAmountA_native = new BN( liquidateAmountA * 10 ** ecosystem.tokenADecimals diff --git a/tests/e01_initGroup.spec.ts b/tests/e01_initGroup.spec.ts index 41cc0892e..b43557853 100644 --- a/tests/e01_initGroup.spec.ts +++ b/tests/e01_initGroup.spec.ts @@ -87,6 +87,20 @@ describe("Init e-mode enabled group and banks", () => { }); }); + it("(admin) Add bank (also a stablecoin)", async () => { + await addBankTest({ + bankMint: ecosystem.usdcMint.publicKey, + oracle: oracles.usdcOracle.publicKey, + oracleMeta: { + pubkey: oracles.usdcOracle.publicKey, + isSigner: false, + isWritable: false, + }, + seed: seed.addn(1), + verboseMessage: "*init USDC bank:", + }); + }); + it("(admin) Add bank (SOL)", async () => { await addBankTest({ assetTag: ASSET_TAG_SOL, diff --git a/tests/e02_configEmode.spec.ts b/tests/e02_configEmode.spec.ts index beb639d37..b93af21c6 100644 --- a/tests/e02_configEmode.spec.ts +++ b/tests/e02_configEmode.spec.ts @@ -30,7 +30,7 @@ import { assertI80F48Approx, assertI80F48Equal, } from "./utils/genericTests"; -import { EMODE_APPLIES_TO_ISOLATED, newEmodeEntry } from "./utils/types"; +import { EMODE_APPLIES_TO_ISOLATED, EMODE_LST_TAG, EMODE_SOL_TAG, EMODE_STABLE_TAG, newEmodeEntry } from "./utils/types"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; import { bigNumberToWrappedI80F48 } from "@mrgnlabs/mrgn-common"; @@ -38,13 +38,9 @@ import { createMintToInstruction } from "@solana/spl-token"; import { Marginfi } from "../target/types/marginfi"; import { assert } from "chai"; -// By convention, all tags must be in 13375p34k (kidding, but only sorta) -const EMODE_STABLE_TAG = 5748; // STAB because 574813 is out of range -const EMODE_SOL_TAG = 501; -const EMODE_LST_TAG = 157; - const seed = new BN(EMODE_SEED); let usdcBank: PublicKey; +let stableBank: PublicKey; let solBank: PublicKey; let lstABank: PublicKey; let lstBBank: PublicKey; @@ -57,6 +53,12 @@ describe("Init e-mode settings for a set of banks", () => { ecosystem.usdcMint.publicKey, seed ); + [stableBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.usdcMint.publicKey, + seed.addn(1) + ); [solBank] = deriveBankWithSeed( bankrunProgram.programId, emodeGroup.publicKey, @@ -160,6 +162,20 @@ describe("Init e-mode settings for a set of banks", () => { ); tx.add( + await configBankEmode(emodeAdmin.mrgnBankrunProgram, { + bank: stableBank, + tag: EMODE_STABLE_TAG, + entries: [ + // other stable bank doesn't have any favored entries + ], + }) + ); + + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(emodeAdmin.wallet); + await banksClient.processTransaction(tx); + + tx = new Transaction().add( await configBankEmode(emodeAdmin.mrgnBankrunProgram, { bank: solBank, tag: EMODE_SOL_TAG, diff --git a/tests/e03_emodeBorrow.spec.ts b/tests/e03_emodeBorrow.spec.ts index 64ba40f78..2b632004c 100644 --- a/tests/e03_emodeBorrow.spec.ts +++ b/tests/e03_emodeBorrow.spec.ts @@ -1,15 +1,6 @@ -import { - AnchorProvider, - BN, - getProvider, - Program, - Wallet, - workspace, -} from "@coral-xyz/anchor"; +import { BN } from "@coral-xyz/anchor"; import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; -import { configBankEmode } from "./utils/group-instructions"; import { - bankKeypairUsdc, bankrunContext, bankrunProgram, banksClient, @@ -17,10 +8,8 @@ import { EMODE_INIT_RATE_LST_TO_LST, EMODE_INIT_RATE_SOL_TO_LST, EMODE_SEED, - emodeAdmin, emodeGroup, groupAdmin, - marginfiGroup, oracles, users, verbose, @@ -29,31 +18,16 @@ import { assertBankrunTxFailed, assertI80F48Approx, } from "./utils/genericTests"; -import { - CONF_INTERVAL_MULTIPLE, - EMODE_APPLIES_TO_ISOLATED, - newEmodeEntry, -} from "./utils/types"; +import { CONF_INTERVAL_MULTIPLE } from "./utils/types"; import { getBankrunBlockhash } from "./utils/spl-staking-utils"; import { deriveBankWithSeed } from "./utils/pdas"; -import { - bigNumberToWrappedI80F48, - wrappedI80F48toBigNumber, -} from "@mrgnlabs/mrgn-common"; -import { createMintToInstruction } from "@solana/spl-token"; -import { Marginfi } from "../target/types/marginfi"; -import { program } from "@coral-xyz/anchor/dist/cjs/native/system"; -import { USER_ACCOUNT, USER_ACCOUNT_E } from "./utils/mocks"; +import { wrappedI80F48toBigNumber } from "@mrgnlabs/mrgn-common"; +import { USER_ACCOUNT_E } from "./utils/mocks"; import { accountInit, borrowIx, depositIx } from "./utils/user-instructions"; -import { dumpBankrunLogs } from "./utils/tools"; - -// By convention, all tags must be in 13375p34k (kidding, but only sorta) -const EMODE_STABLE_TAG = 5748; // STAB because 574813 is out of range -const EMODE_SOL_TAG = 501; -const EMODE_LST_TAG = 157; const seed = new BN(EMODE_SEED); let usdcBank: PublicKey; +let stableBank: PublicKey; let solBank: PublicKey; let lstABank: PublicKey; let lstBBank: PublicKey; @@ -66,6 +40,12 @@ describe("Emode borrowing", () => { ecosystem.usdcMint.publicKey, seed ); + [stableBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.usdcMint.publicKey, + seed.addn(1) + ); [solBank] = deriveBankWithSeed( bankrunProgram.programId, emodeGroup.publicKey, @@ -88,13 +68,19 @@ describe("Emode borrowing", () => { it("Initialize user accounts (if needed)", async () => { for (let i = 0; i < users.length; i++) { + const userAccKeypair = Keypair.generate(); + const userAccount = userAccKeypair.publicKey; if (users[i].accounts.get(USER_ACCOUNT_E)) { - console.log("Skipped creating user " + i); + if (verbose) { + console.log("Skipped creating user " + i); + } continue; + } else { + if (verbose) { + console.log("user [" + i + "]: " + userAccount); + } + users[i].accounts.set(USER_ACCOUNT_E, userAccount); } - const userAccKeypair = Keypair.generate(); - const userAccount = userAccKeypair.publicKey; - users[i].accounts.set(USER_ACCOUNT_E, userAccount); let userinitTx: Transaction = new Transaction(); userinitTx.add( @@ -144,6 +130,13 @@ describe("Emode borrowing", () => { amount: new BN(100 * 10 ** ecosystem.usdcDecimals), depositUpToLimit: false, }), + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: stableBank, + tokenAccount: user.usdcAccount, + amount: new BN(100 * 10 ** ecosystem.usdcDecimals), + depositUpToLimit: false, + }), await depositIx(user.mrgnBankrunProgram, { marginfiAccount: userAccount, bank: solBank, @@ -262,7 +255,7 @@ describe("Emode borrowing", () => { // This illustrates a possible emode footgun: the user tries to borrow USDC, which would cause // them to lose the emode benefit from their LST borrow. Even this trivial borrow amount fails - // because breaking the emode benefit would put this user significantly under water. + // because breaking the emode benefit would put this user significantly in bad health. it("(user 0) tries to borrow a trivial amount of USDC - fails, emode error", async () => { const user = users[0]; const userAccount = user.accounts.get(USER_ACCOUNT_E); @@ -435,7 +428,7 @@ describe("Emode borrowing", () => { lstBBorrow * (1 + oracles.confidenceValue * CONF_INTERVAL_MULTIPLE) * 1 + - wsolBorrow * oracles.wsolPrice; // Close enough, the amount is trivial + wsolBorrow * oracles.wsolPrice; // Close enough for wsol value, the amount is trivial assertI80F48Approx( cacheAfter.liabilityValue, liabsExpected, @@ -443,5 +436,7 @@ describe("Emode borrowing", () => { ); }); + // TODO test against isolated bank (not yet supported in program) + // TODO moar tests.... }); diff --git a/tests/e04_emodeLiquidation.spec.ts b/tests/e04_emodeLiquidation.spec.ts index 109b4c232..8cd2ad8c5 100644 --- a/tests/e04_emodeLiquidation.spec.ts +++ b/tests/e04_emodeLiquidation.spec.ts @@ -1,19 +1,65 @@ import { BN } from "@coral-xyz/anchor"; -import { PublicKey } from "@solana/web3.js"; -import { bankrunProgram, ecosystem, EMODE_SEED, emodeGroup } from "./rootHooks"; +import { PublicKey, Transaction } from "@solana/web3.js"; +import { + bankrunContext, + bankrunProgram, + banksClient, + ecosystem, + EMODE_INIT_RATE_LST_TO_LST, + EMODE_INIT_RATE_SOL_TO_LST, + EMODE_MAINT_RATE_LST_TO_LST, + EMODE_MAINT_RATE_SOL_TO_LST, + EMODE_SEED, + emodeAdmin, + emodeGroup, + oracles, + users, + verbose, +} from "./rootHooks"; import { deriveBankWithSeed } from "./utils/pdas"; - -// By convention, all tags must be in 13375p34k (kidding, but only sorta) -const EMODE_STABLE_TAG = 5748; // STAB because 574813 is out of range -const EMODE_SOL_TAG = 501; -const EMODE_LST_TAG = 157; +import { + bigNumberToWrappedI80F48, + wrappedI80F48toBigNumber, +} from "@mrgnlabs/mrgn-common"; +import { + assertBankrunTxFailed, + assertI80F48Approx, + expectFailedTxWithError, +} from "./utils/genericTests"; +import { USER_ACCOUNT_E } from "./utils/mocks"; +import { getBankrunBlockhash } from "./utils/spl-staking-utils"; +import { + CONF_INTERVAL_MULTIPLE, + EMODE_APPLIES_TO_ISOLATED, + EMODE_LST_TAG, + EMODE_SOL_TAG, + HEALTH_CACHE_HEALTHY, + newEmodeEntry, +} from "./utils/types"; +import { + depositIx, + borrowIx, + liquidateIx, + healthPulse, +} from "./utils/user-instructions"; +import { configBankEmode } from "./utils/group-instructions"; +import { dumpBankrunLogs } from "./utils/tools"; const seed = new BN(EMODE_SEED); let usdcBank: PublicKey; +let stableBank: PublicKey; let solBank: PublicKey; let lstABank: PublicKey; let lstBBank: PublicKey; +/** USDC funding for the liquidator (user 2) */ +const liquidator_usdc: number = 100; +/** SOL funding for the liquidator (user 2) */ +const liquidator_sol: number = 10; + +const REDUCED_INIT_SOL_LST_RATE = 0.85; +const REDUCED_MAINT_SOL_LST_RATE = 0.9; + describe("Emode liquidation", () => { before(async () => { [usdcBank] = deriveBankWithSeed( @@ -22,6 +68,12 @@ describe("Emode liquidation", () => { ecosystem.usdcMint.publicKey, seed ); + [stableBank] = deriveBankWithSeed( + bankrunProgram.programId, + emodeGroup.publicKey, + ecosystem.usdcMint.publicKey, + seed.addn(1) + ); [solBank] = deriveBankWithSeed( bankrunProgram.programId, emodeGroup.publicKey, @@ -42,11 +94,320 @@ describe("Emode liquidation", () => { ); }); - it("Emode in effect - Can't liquidate", async () => { - // TODO can't liquidate + it("(user 2 aka liquidator) Deposits SOLD and USDC to operate as a liquidator", async () => { + const user = users[2]; + const userAccount = user.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: usdcBank, + tokenAccount: user.usdcAccount, + amount: new BN(liquidator_usdc * 10 ** ecosystem.usdcDecimals), + depositUpToLimit: false, + }), + await depositIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: solBank, + tokenAccount: user.wsolAccount, + amount: new BN(liquidator_sol * 10 ** ecosystem.wsolDecimals), + depositUpToLimit: false, + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); + }); + + // Note: in this test, as in most real-world conditions, the liquidator is not optimizing their + // liabilities to take advantage of emode. They have a variety of liabilities that they obtain + // when liquidating positions, and typically close/offload these quickly. Here we pretend the + // liquidator got some "stable" in a previous liquidation. + // TODO test liquidator can't claim a position due to emode stance + it("(liquidator) borrows a trivial amount of stable to mock normal operation", async () => { + const user = users[2]; + const userAccount = user.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await borrowIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: stableBank, + tokenAccount: user.usdcAccount, + remaining: [ + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + stableBank, + oracles.usdcOracle.publicKey, + ], + amount: new BN(0.0001 * 10 ** ecosystem.usdcDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); + + let userAcc = await bankrunProgram.account.marginfiAccount.fetch( + userAccount + ); + const cacheAfter = userAcc.healthCache; + const assetValue = wrappedI80F48toBigNumber(cacheAfter.assetValue); + const liabValue = wrappedI80F48toBigNumber(cacheAfter.liabilityValue); + if (verbose) { + console.log("---liquidator health state---"); + console.log("asset value: " + assetValue.toString()); + console.log("liab value: " + liabValue.toString()); + console.log("prices: "); + for (let i = 0; i < cacheAfter.prices.length; i++) { + const price = wrappedI80F48toBigNumber(cacheAfter.prices[i]).toNumber(); + if (price != 0) { + console.log(" [" + i + "] " + price); + } + } + } + }); + + // Note: excluding emode, user 1 is unhealthy. Any liquidator that does not yet account for emode + // will try to do this repeatedly and fail. + it("(liquidator) Tries to liquidate user 0 with emode in effect - can't liquidate", async () => { + const liquidatee = users[0]; + const liquidator = users[2]; + + const assetBankKey = solBank; + const liabilityBankKey = lstABank; + const liquidateeAccount = liquidatee.accounts.get(USER_ACCOUNT_E); + const liquidatorAccount = liquidator.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await liquidateIx(liquidator.mrgnBankrunProgram, { + assetBankKey, + liabilityBankKey, + liquidatorMarginfiAccount: liquidatorAccount, + liquidateeMarginfiAccount: liquidateeAccount, + remaining: [ + oracles.wsolOracle.publicKey, // asset oracle + oracles.pythPullLst.publicKey, // liab oracle + + // liquidator accounts + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + stableBank, + oracles.usdcOracle.publicKey, + // Note: these accounts would be needed if the LST A position was created on the + // liquidator due to the liablity repayment + lstABank, + oracles.pythPullLst.publicKey, + + // liquidatee accounts + solBank, + oracles.wsolOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + ], + amount: new BN(0.001 * 10 ** ecosystem.wsolDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(liquidator.wallet); + let result = await banksClient.tryProcessTransaction(tx); + // 6068 (HealthyAccount) + assertBankrunTxFailed(result, 6068); + }); + + // Note: In production, reducing Emode weights is at least as risky as reducing regular weights, + // which is done rarely or never because it can trigger use liquidations. In rare instances where + // this must be done outside for security concerns or assets in freefall, it should be done + // carefully and slowly! + it("(emode admin) Reduces LST A emode settings", async () => { + let tx = new Transaction().add( + await configBankEmode(emodeAdmin.mrgnBankrunProgram, { + bank: lstABank, + tag: EMODE_LST_TAG, + entries: [ + newEmodeEntry( + EMODE_SOL_TAG, + EMODE_APPLIES_TO_ISOLATED, + // Here SOL borrowing power is drastically reduced + bigNumberToWrappedI80F48(REDUCED_INIT_SOL_LST_RATE), + bigNumberToWrappedI80F48(REDUCED_MAINT_SOL_LST_RATE) + ), + newEmodeEntry( + EMODE_LST_TAG, + EMODE_APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(EMODE_INIT_RATE_LST_TO_LST), + bigNumberToWrappedI80F48(EMODE_MAINT_RATE_LST_TO_LST) + ), + ], + }) + ); + + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(emodeAdmin.wallet); + await banksClient.processTransaction(tx); }); it("Emode reduced - Can liquidate", async () => { - // TODO can liquidate after emode reduction/removal + const liquidatee = users[0]; + const liquidator = users[2]; + + const assetBankKey = solBank; + const liabilityBankKey = lstABank; + const liquidateeAccount = liquidatee.accounts.get(USER_ACCOUNT_E); + const liquidatorAccount = liquidator.accounts.get(USER_ACCOUNT_E); + + const liqAccountDataBefore = await processHealthPulse( + liquidator, + liquidatorAccount, + [ + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + stableBank, + oracles.usdcOracle.publicKey, + // Note: the LST A liability position doesn't exist yet + ] + ); + const liqHealthCacheBefore = liqAccountDataBefore.healthCache; + if (verbose) { + logHealthCache("liquidator health state before", liqHealthCacheBefore); + } + + const leeAccountDataBefore = await processHealthPulse( + liquidatee, + liquidateeAccount, + [ + solBank, + oracles.wsolOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + ] + ); + const leeHealthCacheBefore = leeAccountDataBefore.healthCache; + if (verbose) { + logHealthCache("liquidatee health state before", leeHealthCacheBefore); + } + + let tx = new Transaction().add( + await liquidateIx(liquidator.mrgnBankrunProgram, { + assetBankKey, + liabilityBankKey, + liquidatorMarginfiAccount: liquidatorAccount, + liquidateeMarginfiAccount: liquidateeAccount, + remaining: [ + oracles.wsolOracle.publicKey, // asset oracle + oracles.pythPullLst.publicKey, // liab oracle + + // liquidator accounts + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + stableBank, + oracles.usdcOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + + // liquidatee accounts + solBank, + oracles.wsolOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + ], + amount: new BN(0.1 * 10 ** ecosystem.wsolDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(liquidator.wallet); + let result = await banksClient.tryProcessTransaction(tx); + dumpBankrunLogs(result); + console.log(""); + + const liqAccountData = await processHealthPulse( + liquidator, + liquidatorAccount, + [ + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + stableBank, + oracles.usdcOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + ] + ); + const liqHealthCache = liqAccountData.healthCache; + if (verbose) { + logHealthCache("liquidator health state after", liqHealthCache); + } + + const leeAccountData = await processHealthPulse( + liquidatee, + liquidateeAccount, + [ + solBank, + oracles.wsolOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + ] + ); + const leeHealthCache = leeAccountData.healthCache; + if (verbose) { + logHealthCache("liquidatee health state after", leeHealthCache); + } + + // Note: The health cache shows the price for init (borrowing) purposes, the actual price + // (maint) uses `OraclePriceType::RealTime` and applies the confidence interval discount! So + // instead of $150, the "actual" price of the collateral for liquidation purposes is $146.82 + // (150 * (1 - 1 * 0.0212)) + + // TODO look into above, is this a footgun with assets that have broad confidence bands? + + // SOL is worth $146.82 (see above for confidence discount) + // Liquidator will claim .1 sol worth ~= $14.682 + // We expect to repay: .1 * (1 - 0.025) * 146.82 = $14.31495 (worth of LST) + // Liquidatee will receive: .1 * (1 - 0.025- 0.025) * 146.82 = $13.9479 (worth of LST) }); + + const processHealthPulse = async ( + user: { mrgnBankrunProgram: any; wallet: any }, + userAccount: PublicKey, + remaining: Array + ) => { + const tx = new Transaction().add( + await healthPulse(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + remaining, + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); + return bankrunProgram.account.marginfiAccount.fetch(userAccount); + }; + + const logHealthCache = (header: string, healthCache: any) => { + const av = wrappedI80F48toBigNumber(healthCache.assetValue); + const lv = wrappedI80F48toBigNumber(healthCache.liabilityValue); + console.log(`---${header}---`); + if (healthCache.flags & HEALTH_CACHE_HEALTHY) { + console.log("**HEALTHY**"); + } else { + console.log("**UNHEALTHY OR INVALID**"); + } + console.log("asset value: " + av.toString()); + console.log("liab value: " + lv.toString()); + console.log("prices: "); + healthCache.prices.forEach((priceWrapped: any, i: number) => { + const price = wrappedI80F48toBigNumber(priceWrapped).toNumber(); + if (price !== 0) { + console.log(` [${i}] ${price}`); + } + }); + console.log(""); + }; }); diff --git a/tests/utils/genericTests.ts b/tests/utils/genericTests.ts index 974d458dd..a319c7db6 100644 --- a/tests/utils/genericTests.ts +++ b/tests/utils/genericTests.ts @@ -195,19 +195,26 @@ export const waitUntil = async ( * Assert a bankrun Tx executed with `tryProcessTransaction` failed with the expected error code. * Throws an error if the tx succeeded or a different error was found. * @param result - * @param expectedErrorCode - In hex, as you see in Anchor logs, e.g. for error 6047 pass `0x179f` + * @param expectedErrorCode - In hex or human readable number, as you see in Anchor logs, e.g. for + * error 6047 pass `0x179f` (a string) or 6047 (a number) */ export const assertBankrunTxFailed = ( result: BanksTransactionResultWithMeta, - expectedErrorCode: string + expectedErrorCode: string | number ) => { - expectedErrorCode = expectedErrorCode.toLocaleLowerCase(); - assert(result.meta.logMessages.length > 0); + // Convert decimal number to hex string if necessary, + // otherwise assume it's already a hex string. + const codeHex = + typeof expectedErrorCode === "number" + ? "0x" + expectedErrorCode.toString(16) + : expectedErrorCode.toLocaleLowerCase(); + + assert(result.meta.logMessages.length > 0, "empty log"); assert(result.result, "TX succeeded when it should have failed"); const lastLog = result.meta.logMessages.pop(); assert( - lastLog.includes(expectedErrorCode), - "\nExpected code " + expectedErrorCode + " but got: " + lastLog + lastLog.includes(codeHex), + "\nExpected code " + codeHex + " but got: " + lastLog ); }; diff --git a/tests/utils/mocks.ts b/tests/utils/mocks.ts index 506922bdc..c8e59ee4f 100644 --- a/tests/utils/mocks.ts +++ b/tests/utils/mocks.ts @@ -328,17 +328,22 @@ export const createSimpleMint = async ( export type Oracles = { wsolOracle: Keypair; + /** Default 150 */ wsolPrice: number; wsolDecimals: number; usdcOracle: Keypair; + /** Default 1 */ usdcPrice: number; usdcDecimals: number; tokenAOracle: Keypair; + /** Default 10 */ tokenAPrice: number; tokenADecimals: number; tokenBOracle: Keypair; + /** Default 20 */ tokenBPrice: number; tokenBDecimals: number; + /** Default 175 */ lstAlphaPrice: number; lstAlphaDecimals: number; /** By default, oracle conf is this times price */ diff --git a/tests/utils/types.ts b/tests/utils/types.ts index 6f81dbaae..fe2ccbfc0 100644 --- a/tests/utils/types.ts +++ b/tests/utils/types.ts @@ -34,9 +34,9 @@ export const ASSET_TAG_STAKED = 2; export const ORACLE_SETUP_NONE = 0; export const ORACLE_SETUP_PYTH_LEGACY = 1; export const ORACLE_SETUP_SWITCHBOARD_v2 = 2; -/** +/** * Yes, it should technically be called "pull", but this is what we call it on-chain, and - * consistency is king... + * consistency is king... * */ export const ORACLE_SETUP_PYTH_PUSH = 3; export const ORACLE_SETUP_SWITCHBOARD_PULL = 4; @@ -49,6 +49,11 @@ export const HEALTH_CACHE_ENGINE_OK = 2; /** Confidence intervals are multiplied by this constant internally */ export const CONF_INTERVAL_MULTIPLE = 2.12; +// By convention, all tags must be in 13375p34k (kidding, but only sorta) +export const EMODE_STABLE_TAG = 5748; // STAB because 574813 is out of range +export const EMODE_SOL_TAG = 501; +export const EMODE_LST_TAG = 157; + /** * The default bank config has * * all weights are 1 From d3a8f4af6eaf9836f6cc7d76ee83b2029e532c09 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Thu, 10 Apr 2025 12:16:45 -0400 Subject: [PATCH 18/38] Liquidation test complete --- Anchor.toml | 4 +- programs/marginfi/src/state/emode.rs | 2 +- tests/e04_emodeLiquidation.spec.ts | 57 ++++++++++++++++++++++++---- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/Anchor.toml b/Anchor.toml index 4b7b4920c..75ae0d1ca 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -26,7 +26,7 @@ wallet = "~/.config/solana/id.json" # (remove RUST_LOG= to see bankRun logs) [scripts] -# test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/*.spec.ts --exit --require tests/rootHooks.ts" +test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/*.spec.ts --exit --require tests/rootHooks.ts" # Staked collateral tests only # test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/s*.spec.ts --exit --require tests/rootHooks.ts" @@ -35,7 +35,7 @@ wallet = "~/.config/solana/id.json" # test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/p*.spec.ts --exit --require tests/rootHooks.ts" # Edmode tests only -test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/e*.spec.ts --exit --require tests/rootHooks.ts" +# test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/e*.spec.ts --exit --require tests/rootHooks.ts" [test] startup_wait = 60000 diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs index 929bc7b8d..2678961e2 100644 --- a/programs/marginfi/src/state/emode.rs +++ b/programs/marginfi/src/state/emode.rs @@ -158,7 +158,7 @@ assert_struct_align!(EmodeEntry, 8); pub struct EmodeEntry { /// emode_tag of the bank(s) whose collateral you wish to treat preferentially. pub collateral_bank_emode_tag: u16, - /// * APPLIES_TO_ISOLATED (1) - (NOT YET INMPLEMNENTED) if set, isolated banks with this tag + /// * APPLIES_TO_ISOLATED (1) - (NOT YET IMPLEMENTED) if set, isolated banks with this tag /// also benefit. If not set, isolated banks continue to offer zero collateral, even if they /// use this tag. /// * 2, 4, 8, 16, 32, etc - reserved for future use diff --git a/tests/e04_emodeLiquidation.spec.ts b/tests/e04_emodeLiquidation.spec.ts index 8cd2ad8c5..f7a72235d 100644 --- a/tests/e04_emodeLiquidation.spec.ts +++ b/tests/e04_emodeLiquidation.spec.ts @@ -44,6 +44,7 @@ import { } from "./utils/user-instructions"; import { configBankEmode } from "./utils/group-instructions"; import { dumpBankrunLogs } from "./utils/tools"; +import { assert } from "chai"; const seed = new BN(EMODE_SEED); let usdcBank: PublicKey; @@ -322,9 +323,7 @@ describe("Emode liquidation", () => { ); tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); tx.sign(liquidator.wallet); - let result = await banksClient.tryProcessTransaction(tx); - dumpBankrunLogs(result); - console.log(""); + await banksClient.processTransaction(tx); const liqAccountData = await processHealthPulse( liquidator, @@ -360,17 +359,59 @@ describe("Emode liquidation", () => { logHealthCache("liquidatee health state after", leeHealthCache); } - // Note: The health cache shows the price for init (borrowing) purposes, the actual price + // Note: The health cache shows the price for init (borrowing) purposes, the "actual" price // (maint) uses `OraclePriceType::RealTime` and applies the confidence interval discount! So // instead of $150, the "actual" price of the collateral for liquidation purposes is $146.82 // (150 * (1 - 1 * 0.0212)) // TODO look into above, is this a footgun with assets that have broad confidence bands? - // SOL is worth $146.82 (see above for confidence discount) - // Liquidator will claim .1 sol worth ~= $14.682 - // We expect to repay: .1 * (1 - 0.025) * 146.82 = $14.31495 (worth of LST) - // Liquidatee will receive: .1 * (1 - 0.025- 0.025) * 146.82 = $13.9479 (worth of LST) + // * SOL is worth $146.82 (see above for confidence discount) + // * Liquidator will claim .1 sol worth ~= $14.682 (this is really $15 with conf discount) + // * We expect to repay: .1 * (1 - 0.025) * 146.82 = $14.31495 (worth of LST) + // * Liquidatee will receive: .1 * (1 - 0.025- 0.025) * 146.82 = $13.9479 (worth of LST) + + // In terms of what we actually see in the health pulse: + // * Because liquidator has other borrows, they get no emode benefit on the sol they obtained. + // The SOL bank's actual asset weight is 0.5, so Liquidator's asset value increases by + // ($15 * 0.5) = $7.5 + // * The liability weight is 100%, so liquidator repays ($14.31495 * 1) = $14.31495 + // * Liquidatee loses the same asset amount, but WITH an emode benefit, so liquidatee sees a + // drop of ($14.682 * 0.85) = $12.75 and a reduction of $13.9479 in debt + + // In health terms the liquidator has lost money! In real terms the liquidator has gained $ + // value $15 - $14.31495 = $0.68505 + + const liqAvBefore = wrappedI80F48toBigNumber( + liqHealthCacheBefore.assetValue + ).toNumber(); + const liqAvAfter = wrappedI80F48toBigNumber( + liqHealthCache.assetValue + ).toNumber(); + const liqLvBefore = wrappedI80F48toBigNumber( + liqHealthCacheBefore.liabilityValue + ).toNumber(); + const liqLvAfter = wrappedI80F48toBigNumber( + liqHealthCache.liabilityValue + ).toNumber(); + + const leeAvBefore = wrappedI80F48toBigNumber( + leeHealthCacheBefore.assetValue + ).toNumber(); + const leeAvAfter = wrappedI80F48toBigNumber( + leeHealthCache.assetValue + ).toNumber(); + const leeLvBefore = wrappedI80F48toBigNumber( + leeHealthCacheBefore.liabilityValue + ).toNumber(); + const leeLvAfter = wrappedI80F48toBigNumber( + leeHealthCache.liabilityValue + ).toNumber(); + + assert.approximately(liqAvAfter - liqAvBefore, 7.5, 0.001); + assert.approximately(liqLvAfter - liqLvBefore, 14.31495, 0.001); + assert.approximately(leeAvAfter - leeAvBefore, -12.75, 0.001); + assert.approximately(leeLvAfter - leeLvBefore, -13.9479, 0.001); }); const processHealthPulse = async ( From d4bc5c31afec53f54382a9b36d83a22691ae9a2f Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Thu, 10 Apr 2025 16:44:46 -0400 Subject: [PATCH 19/38] Moar liquidation tests of rare footgun edge cases --- tests/e04_emodeLiquidation.spec.ts | 231 +++++++++++++++++++++++++---- 1 file changed, 203 insertions(+), 28 deletions(-) diff --git a/tests/e04_emodeLiquidation.spec.ts b/tests/e04_emodeLiquidation.spec.ts index f7a72235d..9a4ed05a7 100644 --- a/tests/e04_emodeLiquidation.spec.ts +++ b/tests/e04_emodeLiquidation.spec.ts @@ -41,6 +41,7 @@ import { borrowIx, liquidateIx, healthPulse, + repayIx, } from "./utils/user-instructions"; import { configBankEmode } from "./utils/group-instructions"; import { dumpBankrunLogs } from "./utils/tools"; @@ -54,9 +55,9 @@ let lstABank: PublicKey; let lstBBank: PublicKey; /** USDC funding for the liquidator (user 2) */ -const liquidator_usdc: number = 100; +const liquidator_usdc: number = 10; /** SOL funding for the liquidator (user 2) */ -const liquidator_sol: number = 10; +const liquidator_sol: number = 0.1; const REDUCED_INIT_SOL_LST_RATE = 0.85; const REDUCED_MAINT_SOL_LST_RATE = 0.9; @@ -124,7 +125,6 @@ describe("Emode liquidation", () => { // liabilities to take advantage of emode. They have a variety of liabilities that they obtain // when liquidating positions, and typically close/offload these quickly. Here we pretend the // liquidator got some "stable" in a previous liquidation. - // TODO test liquidator can't claim a position due to emode stance it("(liquidator) borrows a trivial amount of stable to mock normal operation", async () => { const user = users[2]; const userAccount = user.accounts.get(USER_ACCOUNT_E); @@ -250,7 +250,29 @@ describe("Emode liquidation", () => { await banksClient.processTransaction(tx); }); - it("Emode reduced - Can liquidate", async () => { + // Note: The health cache shows the price for init (borrowing) purposes, the "actual" price + // (maint) uses `OraclePriceType::RealTime` and applies the confidence interval discount! So + // instead of $150, the "actual" price of the collateral for liquidation purposes is $146.82 + // (150 * (1 - 1 * 0.0212)) + + // TODO look into above, is this a footgun with assets that have broad confidence bands? + + // * SOL is worth $146.82 (see above for confidence discount) + // * Liquidator will claim .1 sol worth ~= $14.682 (this is really $15 with conf discount) + // * We expect to repay: .1 * (1 - 0.025) * 146.82 = $14.31495 (worth of LST) + // * Liquidatee will receive: .1 * (1 - 0.025- 0.025) * 146.82 = $13.9479 (worth of LST) + + // In terms of what we actually see in the health pulse: + // * Because liquidator has other borrows, they get no emode benefit on the sol they obtained. + // The SOL bank's actual asset weight is 0.5, so Liquidator's asset value increases by + // ($15 * 0.5) = $7.5 + // * The liability weight is 100%, so liquidator repays ($14.31495 * 1) = $14.31495 + // * Liquidatee loses the same asset amount, but WITH an emode benefit, so liquidatee sees a + // drop of ($14.682 * 0.85) = $12.75 and a reduction of $13.9479 in debt + + // In health terms the liquidator has lost money! In real terms the liquidator has gained $ + // value $15 - $14.31495 = $0.68505 + it("(liquidator) Liquidates user 0 after emode reduced - happy path", async () => { const liquidatee = users[0]; const liquidator = users[2]; @@ -359,29 +381,6 @@ describe("Emode liquidation", () => { logHealthCache("liquidatee health state after", leeHealthCache); } - // Note: The health cache shows the price for init (borrowing) purposes, the "actual" price - // (maint) uses `OraclePriceType::RealTime` and applies the confidence interval discount! So - // instead of $150, the "actual" price of the collateral for liquidation purposes is $146.82 - // (150 * (1 - 1 * 0.0212)) - - // TODO look into above, is this a footgun with assets that have broad confidence bands? - - // * SOL is worth $146.82 (see above for confidence discount) - // * Liquidator will claim .1 sol worth ~= $14.682 (this is really $15 with conf discount) - // * We expect to repay: .1 * (1 - 0.025) * 146.82 = $14.31495 (worth of LST) - // * Liquidatee will receive: .1 * (1 - 0.025- 0.025) * 146.82 = $13.9479 (worth of LST) - - // In terms of what we actually see in the health pulse: - // * Because liquidator has other borrows, they get no emode benefit on the sol they obtained. - // The SOL bank's actual asset weight is 0.5, so Liquidator's asset value increases by - // ($15 * 0.5) = $7.5 - // * The liability weight is 100%, so liquidator repays ($14.31495 * 1) = $14.31495 - // * Liquidatee loses the same asset amount, but WITH an emode benefit, so liquidatee sees a - // drop of ($14.682 * 0.85) = $12.75 and a reduction of $13.9479 in debt - - // In health terms the liquidator has lost money! In real terms the liquidator has gained $ - // value $15 - $14.31495 = $0.68505 - const liqAvBefore = wrappedI80F48toBigNumber( liqHealthCacheBefore.assetValue ).toNumber(); @@ -414,10 +413,186 @@ describe("Emode liquidation", () => { assert.approximately(leeLvAfter - leeLvBefore, -13.9479, 0.001); }); + // This test demonstrates a new footgun that liquidators have to watch out for. On the user's + // portfolio, due to emode, a position might be more valuable than when the liquidator acquires + // it, which can make their account unhealthy and cause liquidation to fail. + // + // Here the liquidator has $20 in collateral at the end of the previous test and ~$14.31 in + // liabilties. Repeating the 7.5 and 14.31495 repayment above, the liquidator would end up with 20 + // + 7.5 = $27.5 in assets and 14.31495 + 14.31495 = $28.62 in liabilities, so the liquidator has + // put themselves in an unhealthy state! + it("(liquidator) renders their own account unhealthy due to liquidation - should fail)", async () => { + const liquidatee = users[0]; + const liquidator = users[2]; + + const assetBankKey = solBank; + const liabilityBankKey = lstABank; + const liquidateeAccount = liquidatee.accounts.get(USER_ACCOUNT_E); + const liquidatorAccount = liquidator.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await liquidateIx(liquidator.mrgnBankrunProgram, { + assetBankKey, + liabilityBankKey, + liquidatorMarginfiAccount: liquidatorAccount, + liquidateeMarginfiAccount: liquidateeAccount, + remaining: [ + oracles.wsolOracle.publicKey, // asset oracle + oracles.pythPullLst.publicKey, // liab oracle + + // liquidator accounts + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + stableBank, + oracles.usdcOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + + // liquidatee accounts + solBank, + oracles.wsolOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + ], + amount: new BN(0.1 * 10 ** ecosystem.wsolDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(liquidator.wallet); + let result = await banksClient.tryProcessTransaction(tx); + // 6009 (RiskEngineInitRejected.) + assertBankrunTxFailed(result, 6009); + }); + + it("(liquidator) repays their trivial stable position - now has an emode benefit", async () => { + const user = users[2]; + const userAccount = user.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await repayIx(user.mrgnBankrunProgram, { + marginfiAccount: userAccount, + bank: stableBank, + tokenAccount: user.usdcAccount, + repayAll: true, + remaining: [ + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + stableBank, + oracles.usdcOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + ], + amount: new BN(0.0001 * 10 ** ecosystem.usdcDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(user.wallet); + await banksClient.processTransaction(tx); + + const userAcc = await processHealthPulse(user, userAccount, [ + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + // Note: stable is now closed + lstABank, + oracles.pythPullLst.publicKey, + ]); + + const cacheAfter = userAcc.healthCache; + const assetValue = wrappedI80F48toBigNumber(cacheAfter.assetValue); + const liabValue = wrappedI80F48toBigNumber(cacheAfter.liabilityValue); + if (verbose) { + console.log("---liquidator health state---"); + console.log("asset value: " + assetValue.toString()); + console.log("liab value: " + liabValue.toString()); + console.log("prices: "); + for (let i = 0; i < cacheAfter.prices.length; i++) { + const price = wrappedI80F48toBigNumber(cacheAfter.prices[i]).toNumber(); + if (price != 0) { + console.log(" [" + i + "] " + price); + } + } + } + }); + + it("(liquidator) can now liquidate the position due its own emode benefit!)", async () => { + const liquidatee = users[0]; + const liquidator = users[2]; + + const assetBankKey = solBank; + const liabilityBankKey = lstABank; + const liquidateeAccount = liquidatee.accounts.get(USER_ACCOUNT_E); + const liquidatorAccount = liquidator.accounts.get(USER_ACCOUNT_E); + + let tx = new Transaction().add( + await liquidateIx(liquidator.mrgnBankrunProgram, { + assetBankKey, + liabilityBankKey, + liquidatorMarginfiAccount: liquidatorAccount, + liquidateeMarginfiAccount: liquidateeAccount, + remaining: [ + oracles.wsolOracle.publicKey, // asset oracle + oracles.pythPullLst.publicKey, // liab oracle + + // liquidator accounts + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + // Note: stable bank is closed + lstABank, + oracles.pythPullLst.publicKey, + + // liquidatee accounts + solBank, + oracles.wsolOracle.publicKey, + lstABank, + oracles.pythPullLst.publicKey, + ], + amount: new BN(0.1 * 10 ** ecosystem.wsolDecimals), + }) + ); + tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); + tx.sign(liquidator.wallet); + let result = await banksClient.tryProcessTransaction(tx); + dumpBankrunLogs(result); + + const userAcc = await processHealthPulse(liquidator, liquidatorAccount, [ + usdcBank, + oracles.usdcOracle.publicKey, + solBank, + oracles.wsolOracle.publicKey, + // Note: stable is now closed + lstABank, + oracles.pythPullLst.publicKey, + ]); + + const cacheAfter = userAcc.healthCache; + const assetValue = wrappedI80F48toBigNumber(cacheAfter.assetValue); + const liabValue = wrappedI80F48toBigNumber(cacheAfter.liabilityValue); + if (verbose) { + console.log("---liquidator health state---"); + console.log("asset value: " + assetValue.toString()); + console.log("liab value: " + liabValue.toString()); + console.log("prices: "); + for (let i = 0; i < cacheAfter.prices.length; i++) { + const price = wrappedI80F48toBigNumber(cacheAfter.prices[i]).toNumber(); + if (price != 0) { + console.log(" [" + i + "] " + price); + } + } + } + }); + const processHealthPulse = async ( user: { mrgnBankrunProgram: any; wallet: any }, userAccount: PublicKey, - remaining: Array + remaining: Array ) => { const tx = new Transaction().add( await healthPulse(user.mrgnBankrunProgram, { From f0594ff74de4dc46b6cbb87b1ecfe1923a7015fc Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Fri, 11 Apr 2025 14:10:37 -0400 Subject: [PATCH 20/38] Minor doc update, fix lint --- programs/marginfi/src/state/emode.rs | 6 ++---- programs/marginfi/src/state/marginfi_account.rs | 16 ++++++++-------- tests/e04_emodeLiquidation.spec.ts | 8 ++++++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs index 2678961e2..4d50251db 100644 --- a/programs/marginfi/src/state/emode.rs +++ b/programs/marginfi/src/state/emode.rs @@ -128,7 +128,7 @@ impl EmodeSettings { .collect(); if non_empty_tags.windows(2).any(|w| w[0] == w[1]) { - return err!(MarginfiError::BadEmodeConfig); + err!(MarginfiError::BadEmodeConfig) } else { Ok(()) } @@ -276,9 +276,7 @@ pub fn reconcile_emode_configs(configs: Vec) -> EmodeConfig { .collect(); // Sort the entries by tag and build a config from them - let final_config = EmodeConfig::from_entries(final_entries); - - final_config + EmodeConfig::from_entries(final_entries) } #[cfg(test)] diff --git a/programs/marginfi/src/state/marginfi_account.rs b/programs/marginfi/src/state/marginfi_account.rs index 8d53d73b4..7238b0fb6 100644 --- a/programs/marginfi/src/state/marginfi_account.rs +++ b/programs/marginfi/src/state/marginfi_account.rs @@ -260,8 +260,8 @@ impl<'info> BankAccountWithPriceFeed<'_> { /// is exceeded. /// 4. Assets are only calculated for collateral risk tier. /// 5. Oracle errors are ignored for deposits in isolated risk tier. - fn calc_weighted_value<'a>( - &'a self, + fn calc_weighted_value( + &self, requirement_type: RequirementType, emode_config: &EmodeConfig, ) -> MarginfiResult<(I80F48, I80F48, I80F48)> { @@ -272,13 +272,13 @@ impl<'info> BankAccountWithPriceFeed<'_> { match side { BalanceSide::Assets => { let (value, price) = - self.calc_weighted_asset_value(requirement_type, &bank, emode_config)?; + self.calc_weighted_asset_value(requirement_type, bank, emode_config)?; Ok((value, I80F48::ZERO, price)) } BalanceSide::Liabilities => { let (value, price) = - self.calc_weighted_liab_value(requirement_type, &bank)?; + self.calc_weighted_liab_value(requirement_type, bank)?; Ok((I80F48::ZERO, value, price)) } } @@ -289,10 +289,10 @@ impl<'info> BankAccountWithPriceFeed<'_> { /// Returns value, the net asset value in $, and the price used to determine that value. #[inline(always)] - fn calc_weighted_asset_value<'a>( - &'a self, + fn calc_weighted_asset_value( + &self, requirement_type: RequirementType, - bank: &'a Bank, + bank: &Bank, emode_config: &EmodeConfig, ) -> MarginfiResult<(I80F48, I80F48)> { match bank.config.risk_tier { @@ -757,7 +757,7 @@ impl<'info> RiskEngine<'_> { // TODO this function seems excessive relative to the trivial check it performs, it performs // like 4x O(N) loops and should be optimized at minimum. - fn check_account_risk_tiers<'a>(&'a self) -> MarginfiResult { + fn check_account_risk_tiers(&self) -> MarginfiResult { let balances_with_liablities = self .bank_accounts_with_price .iter() diff --git a/tests/e04_emodeLiquidation.spec.ts b/tests/e04_emodeLiquidation.spec.ts index 9a4ed05a7..e49acab4e 100644 --- a/tests/e04_emodeLiquidation.spec.ts +++ b/tests/e04_emodeLiquidation.spec.ts @@ -520,6 +520,11 @@ describe("Emode liquidation", () => { } }); + // Completing the possible footguns, this is a somewhat dangerous state for liquidators, since the + // liquidator may now not be able to consume any position that breaks its own emode benefit. Since + // most liquidators quickly repay debts and convert them back into a preferred currency, this is + // probably not an issue for most liquidators, but that those hold balances for longer should be + // aware of the possible footgun here. it("(liquidator) can now liquidate the position due its own emode benefit!)", async () => { const liquidatee = users[0]; const liquidator = users[2]; @@ -559,8 +564,7 @@ describe("Emode liquidation", () => { ); tx.recentBlockhash = await getBankrunBlockhash(bankrunContext); tx.sign(liquidator.wallet); - let result = await banksClient.tryProcessTransaction(tx); - dumpBankrunLogs(result); + await banksClient.processTransaction(tx); const userAcc = await processHealthPulse(liquidator, liquidatorAccount, [ usdcBank, From 1a16daaf3068d535a966862b7fe7f1ee48e5c66d Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Fri, 11 Apr 2025 14:18:45 -0400 Subject: [PATCH 21/38] Minor doc fixes --- tests/e04_emodeLiquidation.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e04_emodeLiquidation.spec.ts b/tests/e04_emodeLiquidation.spec.ts index e49acab4e..347c22e39 100644 --- a/tests/e04_emodeLiquidation.spec.ts +++ b/tests/e04_emodeLiquidation.spec.ts @@ -96,7 +96,7 @@ describe("Emode liquidation", () => { ); }); - it("(user 2 aka liquidator) Deposits SOLD and USDC to operate as a liquidator", async () => { + it("(user 2 aka liquidator) Deposits SOL and USDC to operate as a liquidator", async () => { const user = users[2]; const userAccount = user.accounts.get(USER_ACCOUNT_E); @@ -421,7 +421,7 @@ describe("Emode liquidation", () => { // liabilties. Repeating the 7.5 and 14.31495 repayment above, the liquidator would end up with 20 // + 7.5 = $27.5 in assets and 14.31495 + 14.31495 = $28.62 in liabilities, so the liquidator has // put themselves in an unhealthy state! - it("(liquidator) renders their own account unhealthy due to liquidation - should fail)", async () => { + it("(liquidator) renders their own account unhealthy due to liquidation - should fail", async () => { const liquidatee = users[0]; const liquidator = users[2]; @@ -525,7 +525,7 @@ describe("Emode liquidation", () => { // most liquidators quickly repay debts and convert them back into a preferred currency, this is // probably not an issue for most liquidators, but that those hold balances for longer should be // aware of the possible footgun here. - it("(liquidator) can now liquidate the position due its own emode benefit!)", async () => { + it("(liquidator) can now liquidate the position due to its own emode benefit!", async () => { const liquidatee = users[0]; const liquidator = users[2]; From 3874f8b59d4bbdaf97551bde886fcf01b2dfc0ad Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Tue, 15 Apr 2025 16:28:40 -0400 Subject: [PATCH 22/38] README guide for emode admin --- guides/EMODECHANGELOG.md | 3 +- guides/EMODE_ADMIN.md | 342 +++++++++++++++++++++++++++ programs/marginfi/src/state/emode.rs | 14 +- 3 files changed, 351 insertions(+), 8 deletions(-) create mode 100644 guides/EMODE_ADMIN.md diff --git a/guides/EMODECHANGELOG.md b/guides/EMODECHANGELOG.md index 3c300112d..660869f82 100644 --- a/guides/EMODECHANGELOG.md +++ b/guides/EMODECHANGELOG.md @@ -1 +1,2 @@ -add new admin arg to config \ No newline at end of file +* add new admin arg to config_group +* add ix `confige_bank_emode` diff --git a/guides/EMODE_ADMIN.md b/guides/EMODE_ADMIN.md new file mode 100644 index 000000000..3d1efa8ce --- /dev/null +++ b/guides/EMODE_ADMIN.md @@ -0,0 +1,342 @@ +# Emode Administrator Guide and General Overview + +## Glossary + +- **Emode/E-mode/EMode** - "Efficiency Mode", probably a backronym, popularized by Aave. Allows + users of a lending protocol to enjoy more borrowing power when working with certain asset + categories. For more information see [Aave's docs](https://aave.com/help/borrowing/e-mode) or + [this article on emode benefits and + risks](https://www.llamarisk.com/research/understanding-aave-v3-2-s-liquid-e-mode-a-deep-dive-into-enhanced-capital-efficiency). +- **Preferrential Asset** - When borrowing some asset A, a preferrential asset B is some asset that + is sufficiently price correlated with A that for risk purposes we would be comfortable offering a + better-than-usual collateral ratio on B. +- **Bank** - Each asset available to borrow and lend on mrgnlend has a single bank, this account + controls all the settings for the asset. +- **Asset Weight** - Each asset available to lend has two rates: The "Initial" and "Maintenance" + rates. The Maintenance rate is always higher. If attempting to execute a borrow, collateral is + valued at (price _ initial rate). If a liquidator is attempting a liquidation, collateral is + valued at (price _ maintenance rate). The range between these is sometimes called the health + buffer. For example, if a user has collateral worth \$10, and init/maint rates are 50\% and 60\% + respectively, the user can borrow \$10 _ .5 = \$5 in collateral. For liquidation purposes, their + collateral is worth \$10 _ .6 = \$6. +- **Emode Tag** - an arbitrary number (1 - 65,535) assigned to each bank by the admin. Multiple + banks can share the same number. By convention, these are the asset name in l337sp34k. For + example, SOL is 501, LST is 157, etc. If the name doesn't fit into range (1 - 65,535), we use our + imagination. +- **Emode Config** - A bank's collection of emode entries. +- **Emode Entry** - A tag we want to treat as a preferrential asset, and the initial/maintenance asset weights to use for that asset. + +## Key Differences vs AAVE + +- Opt-in by default: we don't require users to enable Emode, users automatically get the most + preferrential Emode setting that applies to their account. +- Opt-out by borrowing something else - Aave requires you to disable E-mode before you can borrow a + non-preferrential asset, in our system (at least at the program level), you can enter or exit + emode simply by changing which assets you are borrowing. This means all assets are available to + borrow, but also that users can significantly reduce their account health by borrowing a + non-preferrential asset or significantly increase health by repaying one. + +## Emode Configuration Overview + +Emode can never reduce the weights of a bank, i.e. the bank's weight is always the minimum and attempts to configure an emode entry below the bank's weights will simply do nothing. + +Users who borrow multiple emode assets at the same time get the LEAST FAVORABLE treatment between +the borrowed assets, regardless of the amount of each asset borrowed. For example, if borrowing an +LST and USDC against SOL, the user would normally get an emode benefit for LST/SOL, but since they +are also borrowing USDC, they get only standard rates on the SOL they are lending. Note that a user +that is currently lending SOL and borrowing LST, but now wants to borrow USDT, must have enough +account health to support the LST and USDT borrow without any emode advantage. + +One the biggest naunces is that we always configure the BORROWING bank not the LENDING bank. For +example, if we want users to be able to borrow more SOL against some LST, we will configure the SOL +bank. If we want users to be able to borrow more WIF against BONK, we configure WIF, and so forth. + +The first step to configuring the emode environment is to make a list of all the assets that will be +paired, for example, let's say LENDING is an asset users are lending, the NORMAL RATE is the initial +asset weight set on the bank, BORROWING is an asset they might borrowing against the LENDING asset, +and EMODE RATE is the initial asset weight users should enjoy when borrowing BORROWING and lending +LENDING. + +``` +LENDING | NORMAL RATE | BORROWING | EMODE RATE +SOL .8 LST_A .9 +SOL .8 LST_B .9 +SOL .8 LST_C .85 +SOL .8 LST_D .85 +LST_A .6 SOL .8 +LST_B .6 SOL .8 +LST_C .6 SOL .8 +LST_D .6 SOL .8 +USDC .9 USDT .95 +USDT .9 USDC .95 +``` + +From the above we have four unique pairings and need at least four tags: the SOL, LST_AB, LST_CD, +STABLE. We also have 5 unique 5 rates: LEND_SOL_BORROW_LST_AB (.9), LEND_SOL_BORROW_LST_CD (.85), +LEND_LST_BORROW_SOL (.8), LEND_STABLE_BORROW_STABLE (.95). + +Our emode config will look something like this: + +``` +bank: SOL_BANK, +tag: SOL, +entries: [ + tag: LST_AB, + rate: LEND_LST_BORROW_SOL + + tag: LST_CD, + rate: LEND_LST_BORROW_SOL +], + +bank: LST_A_BANK, +tag: LST_AB, +entries: [ + tag: SOL, + rate: LEND_SOL_BORROW_LST_AB +], +bank: LST_B_BANK, +tag: LST_AB, +entries: [ + tag: SOL, + rate: LEND_SOL_BORROW_LST_AB +], + +bank: LST_C_BANK, +tag: LST_AC, +entries: [ + tag: SOL, + rate: LEND_SOL_BORROW_LST_CD +], +bank: LST_D_BANK, +tag: LST_AC, +entries: [ + tag: SOL, + rate: LEND_SOL_BORROW_LST_CD +], + +bank: USDC_BANK, +tag: STABLE, +entries: [ + tag: STABLE, + rate: LEND_STABLE_BORROW_STABLE +], +bank: USDT_BANK, +tag: STABLE, +entries: [ + tag: STABLE, + rate: LEND_STABLE_BORROW_STABLE +], +``` + +Now let's look at some examples of what rate users would get. + +
+User lending SOL and borrowing LST_A. + +- (1) We look at SOL_BANK to see what tag it has (SOL) +- (2) we look at LST_A_BANK to read the rate for tag SOL. The rate is LEND_SOL_BORROW_LST_AB (.9) + +> The answer is .9 + +
+ +
+User lending SOL and borrowing LST_A and LST_C. + +- (1) We look at SOL_BANK to see what tag it has (SOL) +- (2) We look at LST_A_BANK to read the rate for tag SOL (LEND_SOL_BORROW_LST_AB) +- (3) We look at LST_C_BANK and read the rate for tag SOL (LEND_SOL_BORROW_LST_CD) +- (4) We take the smallest of the two rates: min(AB, CD) = LEND_SOL_BORROW_LST_CD (.85) + +> The answer is .85 + +
+ +
+User lending SOL and borrowing LST_A and USDT + +- (1) We look at SOL_BANK to see what tag it has (SOL) +- (2) We look at LST_A_BANK to read the rate for tag SOL (LEND_SOL_BORROW_LST_AB) +- (3) We look at USDT and read the rate for tag SOL, but it doesn't have one. +- (4) Since one of the borrowing assets doesn't have an entry, we fall back to SOL bank's NORMAL RATE (.8). + +> The answer is .8 + +
+ +
+User lending SOL and LST_A and borrowing LST_C + +- (1) We look at SOL_BANK to see what tag it has (SOL) +- (2) We look at LST_A_BANK to see what tag it has (LST_AB) +- (2) We look at LST_C_BANK to read the rate for tag SOL (LEND_SOL_BORROW_LST_AB) +- (3) We look at LST_C_BANK and read the rate for tag LST_AB, but it doesn't have one. +- (4) The SOL is treated at LEND_SOL_BORROW_LST_AB (.9) while LST_A is treated at the NORMAL RATE (.6) + +> The answer is .9 for SOL and .6 for LST_A + +
+ +## Applying Emode to Isolated Assets (Not Yet Implemented) + +Generally, an isolated asset is worth 0 for collateral purposes. Enabling Emode on an isolated asset allows it count as collateral in preferrential borrowing situations. This is useful to enable lending on assets that are highly correlated with some other asset but otherwise extremely risky. For example, consider a betting market with a YES and NO token where we know one asset will converge to zero eventually and the other will converge to $1. We may offer a limit emode advantage here, for position hedging, when the event is in the distant future and gradually step the emode advantage down to zero as the decision approaches. + +## Ix Construction Examples + +### Enable borrowing more SOL against LST and vice-versa + +``` +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: SOL_BANK, + tag: SOL_TAG, + entries: [ + newEmodeEntry( + EMODE_LST_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_SOL_TO_LST), + bigNumberToWrappedI80F48(MAINT_RATE_SOL_TO_LST) + ), + ], +}), +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: LST_BANK, + tag: LST_TAG, + entries: [ + newEmodeEntry( + SOL_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_SOL_TO_LST), + bigNumberToWrappedI80F48(MAINT_RATE_SOL_TO_LST) + ), + ], +}) +``` + +### Enable borrowing more Stable vs any other Stable + +``` +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: STABLE_BANK_A, + tag: STABLE_TAG, + entries: [ + newEmodeEntry( + STABLE_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_STABLE_TO_STABLE), + bigNumberToWrappedI80F48(MAINT_RATE_STABLE_TO_STABLE) + ), + ], +}), +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: STABLE_BANK_B, + tag: STABLE_TAG, + entries: [ + newEmodeEntry( + STABLE_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_STABLE_TO_STABLE), + bigNumberToWrappedI80F48(MAINT_RATE_STABLE_TO_STABLE) + ), + ], +}), +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: STABLE_BANK_C, + tag: STABLE_TAG, + entries: [ + newEmodeEntry( + STABLE_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_STABLE_TO_STABLE), + bigNumberToWrappedI80F48(MAINT_RATE_STABLE_TO_STABLE) + ), + ], +}), +``` + +- Note: A bank can have an emode entry for its own tag, but you can never borrow from a bank you are already lending into. +- Note: The `configBankEmode` is large, only two can fit in one TX. It is recommended to use a jito bundle of several txes when updating more than two banks. + +### Enable borrowing more Stable vs any other Stable, with nuances + +Let's say we now decide that stable C is considered somewhat riskier, we think the asset is prone to +depeg and may decline. We want A/B to continue to enjoy full emode advantage. We want lenders of C +to enjoy a lesser advantage when borrowing A or B. We want lenders of A or B to continue to enjoy +the full advantage when borrowing C. + +``` +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: STABLE_BANK_A, + tag: STABLE_TAG, + entries: [ + // A favorable rate for lenders of B borrowing A + newEmodeEntry( + STABLE_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_STABLE_TO_STABLE), + bigNumberToWrappedI80F48(MAINT_RATE_STABLE_TO_STABLE) + ), + // A less favorable rate for lenders of C borrowing A + newEmodeEntry( + REDUCED_STABLE_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_REDUCED_STABLE), + bigNumberToWrappedI80F48(MAINT_RATE_REDUCED_STABLE) + ), + ], +}), +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: STABLE_BANK_B, + tag: STABLE_TAG, + entries: [ + // A favorable rate for lenders of A borrowing B + newEmodeEntry( + STABLE_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_STABLE_TO_STABLE), + bigNumberToWrappedI80F48(MAINT_RATE_STABLE_TO_STABLE) + ), + // A less favorable rate for lenders of C borrowing B + newEmodeEntry( + REDUCED_STABLE_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_REDUCED_STABLE), + bigNumberToWrappedI80F48(MAINT_RATE_REDUCED_STABLE) + ), + ], +}), +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: STABLE_BANK_C, + tag: REDUCED_STABLE_TAG, // a different tag than other stable banks + entries: [ + // A favorable rate for lenders of A/B borrowing C + newEmodeEntry( + STABLE_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_STABLE_TO_STABLE), + bigNumberToWrappedI80F48(MAINT_RATE_STABLE_TO_STABLE) + ), + ], +}), +``` + +### Enable borrowing more WIF against BONK + +``` +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: WIF_BANK, + tag: WIF_TAG, // You could also leave this blank (0) + entries: [ + newEmodeEntry( + BONK_TAG, + APPLIES_TO_ISOLATED, + bigNumberToWrappedI80F48(INIT_RATE_LEND_BONK_BORROW_WIF), + bigNumberToWrappedI80F48(MAINT_RATE_LEND_BONK_BORROW_WIF) + ), + ], +}), +await configBankEmode(emodeAdmin.mrgnProgram, { + bank: BONK_BANK, + tag: BONK_TAG, + entries: [], +}) +``` diff --git a/programs/marginfi/src/state/emode.rs b/programs/marginfi/src/state/emode.rs index 4d50251db..bb3957ba8 100644 --- a/programs/marginfi/src/state/emode.rs +++ b/programs/marginfi/src/state/emode.rs @@ -194,30 +194,30 @@ impl EmodeEntry { /// EmodeEntry for it at all***, i.e. there is no benefit for that collateral /// /// ***Example 1*** -/// * entry | tag | flags | init | maint +/// * bank | tag | flags | init | maint /// * 0 101 1 70 75 /// * 1 101 0 60 80 -/// Result +/// - Result /// * tag | flags | init | maint /// * 101 0 60 75 /// /// /// ***Example 2*** -/// * entry | tag | flags | init | maint +/// * bank | tag | flags | init | maint /// * 0 99 1 70 75 /// * 1 101 0 60 80 -/// Result +/// - Result /// * tag | flags | init | maint /// * empty /// /// /// ***Example 3*** -/// * entry | tag | flags | init | maint +/// * bank | tag | flags | init | maint /// * 0 101 1 70 75 /// * 1 101 0 60 80 -/// * 2 101 0 60 80 +/// * 2 101 0 60 80 (note this bank has multiple entries) /// * 2 99 0 60 80 -/// Result +/// - Result /// * tag | flags | init | maint /// * 101 0 60 75 pub fn reconcile_emode_configs(configs: Vec) -> EmodeConfig { From 1039681de0ce74b254018974b9731b979b0a8c77 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Tue, 15 Apr 2025 17:10:25 -0400 Subject: [PATCH 23/38] Minor doc update --- guides/EMODE_ADMIN.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/guides/EMODE_ADMIN.md b/guides/EMODE_ADMIN.md index 3d1efa8ce..76aa0c48d 100644 --- a/guides/EMODE_ADMIN.md +++ b/guides/EMODE_ADMIN.md @@ -14,11 +14,11 @@ controls all the settings for the asset. - **Asset Weight** - Each asset available to lend has two rates: The "Initial" and "Maintenance" rates. The Maintenance rate is always higher. If attempting to execute a borrow, collateral is - valued at (price _ initial rate). If a liquidator is attempting a liquidation, collateral is - valued at (price _ maintenance rate). The range between these is sometimes called the health + valued at (price x initial rate). If a liquidator is attempting a liquidation, collateral is + valued at (price x maintenance rate). The range between these is sometimes called the health buffer. For example, if a user has collateral worth \$10, and init/maint rates are 50\% and 60\% - respectively, the user can borrow \$10 _ .5 = \$5 in collateral. For liquidation purposes, their - collateral is worth \$10 _ .6 = \$6. + respectively, the user can borrow \$10 x .5 = \$5 in collateral. For liquidation purposes, their + collateral is worth \$10 x .6 = \$6. - **Emode Tag** - an arbitrary number (1 - 65,535) assigned to each bank by the admin. Multiple banks can share the same number. By convention, these are the asset name in l337sp34k. For example, SOL is 501, LST is 157, etc. If the name doesn't fit into range (1 - 65,535), we use our @@ -47,7 +47,7 @@ are also borrowing USDC, they get only standard rates on the SOL they are lendin that is currently lending SOL and borrowing LST, but now wants to borrow USDT, must have enough account health to support the LST and USDT borrow without any emode advantage. -One the biggest naunces is that we always configure the BORROWING bank not the LENDING bank. For +One of the biggest naunces is that we always configure the BORROWING bank not the LENDING bank. For example, if we want users to be able to borrow more SOL against some LST, we will configure the SOL bank. If we want users to be able to borrow more WIF against BONK, we configure WIF, and so forth. From 66fae6cc05d4128f910564e8efcb21e4191d468f Mon Sep 17 00:00:00 2001 From: Ilia Zyrin Date: Thu, 17 Apr 2025 13:49:11 +0200 Subject: [PATCH 24/38] Emode rust tests (#324) * ground work for emode Rust tests + config test * invalid args test + cleanup * emode borrow tests * emode liquidation tests * improve comments a bit * attempt to fix CI build --- .vscode/tasks.json | 4 +- Cargo.lock | 5 +- Cargo.toml | 2 +- clients/rust/marginfi-cli/Cargo.toml | 2 +- programs/marginfi/fuzz/Cargo.lock | 4 +- programs/marginfi/src/errors.rs | 9 + .../tests/admin_actions/setup_bank.rs | 140 +++++++- .../marginfi/tests/user_actions/borrow.rs | 169 +++++++++- .../marginfi/tests/user_actions/liquidate.rs | 313 +++++++++++++++++- test-utils/src/marginfi_group.rs | 70 ++++ tests/e04_emodeLiquidation.spec.ts | 4 +- tools/alerting/Cargo.toml | 2 +- 12 files changed, 710 insertions(+), 14 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 533963911..78bd5f78a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -40,7 +40,7 @@ { "label": "Setup & Run Rust Tests", "type": "shell", - "command": "./scripts/build-workspace.sh && cargo fmt && ./scripts/test-program.sh all --sane", + "command": "./scripts/build-workspace.sh && cargo fmt && ./scripts/lint.sh && ./scripts/test-program.sh all --sane", "problemMatcher": [], "group": { "kind": "test", @@ -58,7 +58,7 @@ { "label": "Run Rust Tests", "type": "shell", - "command": "cargo fmt && ./scripts/test-program.sh all --sane", + "command": "cargo fmt && ./scripts/lint.sh && ./scripts/test-program.sh all --sane", "problemMatcher": [], "group": { "kind": "test", diff --git a/Cargo.lock b/Cargo.lock index 32a24c183..16fc0b9cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3976,11 +3976,12 @@ dependencies = [ [[package]] name = "pyth-solana-receiver-sdk" -version = "0.3.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b7854c4176470c8d86de301dc5b57ac84227dabb9527328b585fc332962d60b" +checksum = "8f07e92abfc18154532ed3dabaa7dac8e693b9925bfe28b2915bc8f8c1540ca0" dependencies = [ "anchor-lang 0.29.0", + "bytemuck_derive", "hex", "pythnet-sdk", "solana-program", diff --git a/Cargo.toml b/Cargo.toml index 7b107333d..9b4b6fadf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ anchor-spl = { git = "https://github.com/mrgnlabs/anchor.git", features = [ anchor-client = { git = "https://github.com/mrgnlabs/anchor.git", rev = "fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" } pyth-sdk-solana = "=0.10.1" -pyth-solana-receiver-sdk = "0.3.0" +pyth-solana-receiver-sdk = "0.6.0" switchboard-solana = "0.29.0" switchboard-on-demand = "0.1.14" borsh = "0.10.3" diff --git a/clients/rust/marginfi-cli/Cargo.toml b/clients/rust/marginfi-cli/Cargo.toml index 01ddeef5e..4c620b586 100644 --- a/clients/rust/marginfi-cli/Cargo.toml +++ b/clients/rust/marginfi-cli/Cargo.toml @@ -56,5 +56,5 @@ chrono = "0.4.23" bincode = "1.3.1" bs58 = "0.4.0" rand = "0.8.4" -pyth-solana-receiver-sdk = "0.3.0" +pyth-solana-receiver-sdk = "0.6.0" hex = "0.4.3" diff --git a/programs/marginfi/fuzz/Cargo.lock b/programs/marginfi/fuzz/Cargo.lock index f5b285a25..659222c29 100644 --- a/programs/marginfi/fuzz/Cargo.lock +++ b/programs/marginfi/fuzz/Cargo.lock @@ -3520,9 +3520,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] diff --git a/programs/marginfi/src/errors.rs b/programs/marginfi/src/errors.rs index 3a3ec532a..52845fe2e 100644 --- a/programs/marginfi/src/errors.rs +++ b/programs/marginfi/src/errors.rs @@ -154,6 +154,8 @@ pub enum MarginfiError { ArenaSettingCannotChange, #[msg("The Emode config was invalid")] // 6075 BadEmodeConfig, + #[msg("TWAP window size does not match expected duration")] // 6076 + PythPushInvalidWindowSize, } impl From for ProgramError { @@ -180,6 +182,9 @@ impl From for MarginfiError { pyth_solana_receiver_sdk::error::GetPriceError::FeedIdNonHexCharacter => { MarginfiError::PythPushFeedIdNonHexCharacter } + pyth_solana_receiver_sdk::error::GetPriceError::InvalidWindowSize => { + MarginfiError::PythPushInvalidWindowSize + } } } } @@ -258,6 +263,10 @@ impl From for MarginfiError { 6070 => MarginfiError::TooSeverePayoff, 6071 => MarginfiError::TooSevereLiquidation, 6072 => MarginfiError::WorseHealthPostLiquidation, + 6073 => MarginfiError::ArenaBankLimit, + 6074 => MarginfiError::ArenaSettingCannotChange, + 6075 => MarginfiError::BadEmodeConfig, + 6076 => MarginfiError::PythPushInvalidWindowSize, _ => MarginfiError::InternalLogicError, } } diff --git a/programs/marginfi/tests/admin_actions/setup_bank.rs b/programs/marginfi/tests/admin_actions/setup_bank.rs index 781856b81..b3d9ee0c8 100644 --- a/programs/marginfi/tests/admin_actions/setup_bank.rs +++ b/programs/marginfi/tests/admin_actions/setup_bank.rs @@ -6,11 +6,15 @@ use marginfi::{ FREEZE_SETTINGS, INIT_BANK_ORIGINATION_FEE_DEFAULT, PERMISSIONLESS_BAD_DEBT_SETTLEMENT_FLAG, }, prelude::MarginfiError, - state::marginfi_group::{Bank, BankConfig, BankConfigOpt, BankVaultType}, + state::{ + emode::{EmodeEntry, EMODE_ON}, + marginfi_group::{Bank, BankConfig, BankConfigOpt, BankVaultType}, + }, }; use pretty_assertions::assert_eq; use solana_program_test::*; use solana_sdk::pubkey::Pubkey; +use switchboard_solana::Clock; use test_case::test_case; #[tokio::test] @@ -532,3 +536,137 @@ async fn config_group_as_arena_too_many_banks() -> anyhow::Result<()> { Ok(()) } + +#[test_case(BankMint::Usdc)] +#[test_case(BankMint::PyUSD)] +#[test_case(BankMint::T22WithFee)] +#[test_case(BankMint::SolSwbPull)] +#[tokio::test] +async fn configure_bank_emode_success(bank_mint: BankMint) -> anyhow::Result<()> { + let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; + + let bank = test_f.get_bank(&bank_mint); + let old_bank = bank.load().await; + + assert_eq!(old_bank.emode.flags, 0u64); + assert_eq!(old_bank.emode.emode_tag, 0u16); + + // First try to enable emode without any entries + let empty_emode_tag = 1u16; + + let res = test_f + .marginfi_group + .try_lending_pool_configure_bank_emode(&bank, empty_emode_tag, &[]) + .await; + assert!(res.is_ok()); + + // Load bank and check that the emode settings got applied + let loaded_bank: Bank = test_f.load_and_deserialize(&bank.key).await; + let timestamp = { + let mut ctx = test_f.context.borrow_mut(); + let clock: Clock = ctx.banks_client.get_sysvar().await?; + clock.unix_timestamp + }; + + assert_eq!(loaded_bank.emode.flags, 0u64); // EMODE_ON is still not set because there are no entries + assert_eq!(loaded_bank.emode.emode_tag, empty_emode_tag); + assert_eq!(loaded_bank.emode.timestamp, timestamp); + assert_eq!(old_bank.emode.emode_config, loaded_bank.emode.emode_config); // config stays the same + assert_eq!(old_bank.config, loaded_bank.config); // everything else also stays the same + + // Now update the tag and add some entries + let emode_tag = 2u16; + let emode_entries = vec![EmodeEntry { + collateral_bank_emode_tag: emode_tag, // sharing the same tag is allowed + flags: 1, + pad0: [0, 0, 0, 0, 0], + asset_weight_init: loaded_bank.config.asset_weight_init, + asset_weight_maint: loaded_bank.config.asset_weight_maint, + }]; + + let res = test_f + .marginfi_group + .try_lending_pool_configure_bank_emode(&bank, emode_tag, &emode_entries) + .await; + assert!(res.is_ok()); + + // Load bank and check that the emode settings got applied + let loaded_bank: Bank = test_f.load_and_deserialize(&bank.key).await; + let timestamp = { + let mut ctx = test_f.context.borrow_mut(); + let clock: Clock = ctx.banks_client.get_sysvar().await?; + clock.unix_timestamp + }; + + assert_eq!(loaded_bank.emode.flags, EMODE_ON); + assert_eq!(loaded_bank.emode.emode_tag, emode_tag); + assert_eq!(loaded_bank.emode.timestamp, timestamp); + // Due to sorting by tag, the newly added entry is the last one + let last_entry_index = loaded_bank.emode.emode_config.entries.len() - 1; + assert_eq!( + loaded_bank.emode.emode_config.entries[last_entry_index], + emode_entries[0] + ); + // All other entries are still "inactive" + for i in 0..last_entry_index { + assert_eq!( + loaded_bank.emode.emode_config.entries[i].collateral_bank_emode_tag, + 0 + ); + } + + Ok(()) +} + +#[test_case(BankMint::Usdc)] +#[test_case(BankMint::PyUSD)] +#[test_case(BankMint::T22WithFee)] +#[test_case(BankMint::SolSwbPull)] +#[tokio::test] +async fn configure_bank_emode_invalid_args(bank_mint: BankMint) -> anyhow::Result<()> { + let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; + let bank = test_f.get_bank(&bank_mint); + + // Try to set an emode config with invalid weight params -> should fail + let emode_tag = 1u16; + let emode_entries = vec![EmodeEntry { + collateral_bank_emode_tag: emode_tag, + flags: 1, + pad0: [0, 0, 0, 0, 0], + asset_weight_init: I80F48!(1.0).into(), + asset_weight_maint: I80F48!(0.9).into(), + }]; + + let res = test_f + .marginfi_group + .try_lending_pool_configure_bank_emode(&bank, emode_tag, &emode_entries) + .await; + assert!(res.is_err()); + + // Try to set an emode config with duplicate entries -> should fail + let emode_tag = 2u16; + let emode_entries = vec![ + EmodeEntry { + collateral_bank_emode_tag: emode_tag, + flags: 1, + pad0: [0, 0, 0, 0, 0], + asset_weight_init: I80F48!(0.9).into(), + asset_weight_maint: I80F48!(1.0).into(), + }, + EmodeEntry { + collateral_bank_emode_tag: emode_tag, + flags: 0, + pad0: [0, 0, 0, 0, 0], + asset_weight_init: I80F48!(0.5).into(), + asset_weight_maint: I80F48!(0.9).into(), + }, + ]; + + let res = test_f + .marginfi_group + .try_lending_pool_configure_bank_emode(&bank, emode_tag, &emode_entries) + .await; + assert!(res.is_err()); + + Ok(()) +} diff --git a/programs/marginfi/tests/user_actions/borrow.rs b/programs/marginfi/tests/user_actions/borrow.rs index f8f4b8715..6b84b18ea 100644 --- a/programs/marginfi/tests/user_actions/borrow.rs +++ b/programs/marginfi/tests/user_actions/borrow.rs @@ -2,11 +2,15 @@ use anchor_spl::token_2022::spl_token_2022::extension::{ transfer_fee::TransferFeeConfig, BaseStateWithExtensions, }; use fixed::types::I80F48; +use fixed_macro::types::I80F48; use fixtures::{assert_custom_error, native, prelude::*, ui_to_native}; use marginfi::{ assert_eq_with_tolerance, prelude::*, - state::marginfi_group::{BankConfigOpt, BankVaultType}, + state::{ + emode::EmodeEntry, + marginfi_group::{Bank, BankConfigOpt, BankVaultType}, + }, }; use pretty_assertions::assert_eq; use solana_program_test::*; @@ -486,3 +490,166 @@ async fn isolated_borrows() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test] +async fn emode_borrows() -> anyhow::Result<()> { + let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; + + let usdc_bank = test_f.get_bank(&BankMint::Usdc); + let sol_bank = test_f.get_bank(&BankMint::Sol); + let sol_eq_bank = test_f.get_bank(&BankMint::SolEquivalent); + let loaded_sol_eq_bank: Bank = test_f.load_and_deserialize(&sol_eq_bank.key).await; + assert_eq!( + loaded_sol_eq_bank.config.asset_weight_init, + I80F48!(1.0).into() + ); + assert_eq!( + loaded_sol_eq_bank.config.asset_weight_maint, + I80F48!(1.0).into() + ); + + // Bring asset weights down to 0.4 for SOL EQ bank + let config_bank_opt = BankConfigOpt { + asset_weight_init: Some(I80F48!(0.4).into()), + asset_weight_maint: Some(I80F48!(0.4).into()), + ..BankConfigOpt::default() + }; + let res = sol_eq_bank + .update_config(config_bank_opt.clone(), None) + .await; + assert!(res.is_ok()); + + let loaded_sol_eq_bank: Bank = test_f.load_and_deserialize(&sol_eq_bank.key).await; + assert_eq!( + loaded_sol_eq_bank.config.asset_weight_init, + I80F48!(0.4).into() + ); + assert_eq!( + loaded_sol_eq_bank.config.asset_weight_maint, + I80F48!(0.4).into() + ); + + // Fund SOL lender + let lender_mfi_account_f = test_f.create_marginfi_account().await; + let lender_token_account_sol = test_f + .sol_equivalent_mint + .create_token_account_and_mint_to(1_000) + .await; + let res = lender_mfi_account_f + .try_bank_deposit(lender_token_account_sol.key, sol_eq_bank, 1_000, None) + .await; + assert!(res.is_ok()); + + let lender_token_account_sol = test_f + .sol_mint + .create_token_account_and_mint_to(1_000) + .await; + let res = lender_mfi_account_f + .try_bank_deposit(lender_token_account_sol.key, sol_bank, 1_000, None) + .await; + assert!(res.is_ok()); + + let lender_token_account_usdc = test_f + .usdc_mint + .create_token_account_and_mint_to(1_000) + .await; + let res = lender_mfi_account_f + .try_bank_deposit(lender_token_account_usdc.key, usdc_bank, 1_000, None) + .await; + assert!(res.is_ok()); + + // Fund SOL borrower + let borrower_mfi_account_f = test_f.create_marginfi_account().await; + + let borrower_token_account_f_sol = test_f + .sol_equivalent_mint + .create_token_account_and_mint_to(1_000) + .await; + let res = borrower_mfi_account_f + .try_bank_deposit(borrower_token_account_f_sol.key, sol_eq_bank, 1_000, None) + .await; + assert!(res.is_ok()); + + // Borrow SOL against SOL EQ + let borrower_token_account_f_sol = test_f.sol_mint.create_empty_token_account().await; + + // Check that we cannot borrow > ~400 SOL + let res = borrower_mfi_account_f + .try_bank_borrow(borrower_token_account_f_sol.key, sol_bank, 399) + .await; + assert!(res.is_ok()); + let res = borrower_mfi_account_f + .try_bank_borrow(borrower_token_account_f_sol.key, sol_bank, 2) + .await; + assert!(res.is_err()); + + // Configure emode for the banks so that SOL bank has a favourable rate for SOL_EQ bank + let sol_eq_emode_tag = 1u16; + let res = test_f + .marginfi_group + .try_lending_pool_configure_bank_emode(&sol_eq_bank, sol_eq_emode_tag, &[]) + .await; + assert!(res.is_ok()); + + let sol_emode_tag = 2u16; + let emode_entries = vec![EmodeEntry { + collateral_bank_emode_tag: sol_eq_emode_tag, + flags: 0, + pad0: [0, 0, 0, 0, 0], + asset_weight_init: I80F48!(1.0).into(), // up from 0.4 + asset_weight_maint: I80F48!(1.0).into(), // up from 0.4 + }]; + + let res = test_f + .marginfi_group + .try_lending_pool_configure_bank_emode(&sol_bank, sol_emode_tag, &emode_entries) + .await; + assert!(res.is_ok()); + + // Verify that we CAN now borrow up to ~1000 SOL (i.e. +600 to existing liability) + let res = borrower_mfi_account_f + .try_bank_borrow(borrower_token_account_f_sol.key, sol_bank, 600) + .await; + assert!(res.is_ok()); + let res = borrower_mfi_account_f + .try_bank_borrow(borrower_token_account_f_sol.key, sol_bank, 2) + .await; + assert!(res.is_err()); + + // Now check that we cannot borrow any other asset since it would turn off the emode and put us in a bad health + let borrower_token_account_f_usdc = test_f.usdc_mint.create_empty_token_account().await; + let res = borrower_mfi_account_f + .try_bank_borrow(borrower_token_account_f_usdc.key, usdc_bank, 2) + .await; + assert!(res.is_err()); + + // Repay part of the debt so that we can borrow some USDC (even though this would turn off the emode) + let res = borrower_mfi_account_f + .try_bank_repay(borrower_token_account_f_sol.key, sol_bank, 650, None) + .await; + assert!(res.is_ok()); + + let res = borrower_mfi_account_f + .try_bank_borrow(borrower_token_account_f_usdc.key, usdc_bank, 500) + .await; + assert!(res.is_ok()); + + // Check that we cannot re-borrow ~the same amount (- borrowed USDC) of SOL anymore. + let res = borrower_mfi_account_f + .try_bank_borrow(borrower_token_account_f_sol.key, sol_bank, 500) + .await; + assert!(res.is_err()); + + // Now fully repay the USDC debt and verify that the SOL borrow limits are again favourable (emode is ON) + let res = borrower_mfi_account_f + .try_bank_repay(borrower_token_account_f_usdc.key, usdc_bank, 0, Some(true)) + .await; + assert!(res.is_ok()); + + let res = borrower_mfi_account_f + .try_bank_borrow(borrower_token_account_f_sol.key, sol_bank, 650) + .await; + assert!(res.is_ok()); + + Ok(()) +} diff --git a/programs/marginfi/tests/user_actions/liquidate.rs b/programs/marginfi/tests/user_actions/liquidate.rs index 31dad5cf5..6203a9d44 100644 --- a/programs/marginfi/tests/user_actions/liquidate.rs +++ b/programs/marginfi/tests/user_actions/liquidate.rs @@ -6,7 +6,10 @@ use fixed_macro::types::I80F48; use fixtures::{assert_custom_error, assert_eq_noise, native, prelude::*}; use marginfi::{ prelude::*, - state::marginfi_group::{Bank, BankConfig, BankConfigOpt, BankVaultType}, + state::{ + emode::EmodeEntry, + marginfi_group::{Bank, BankConfig, BankConfigOpt, BankVaultType}, + }, }; use pretty_assertions::assert_eq; use solana_program_test::*; @@ -757,3 +760,311 @@ async fn marginfi_account_liquidation_failure_bank_not_liquidatable() -> anyhow: Ok(()) } + +#[test_case(100., 9.9, 1., BankMint::Usdc, BankMint::Sol)] +#[test_case(123., 122., 1.23, BankMint::SolEquivalent, BankMint::SolEqIsolated)] +#[test_case(1_000., 1900., 10., BankMint::Usdc, BankMint::T22WithFee)] +#[test_case(2_000., 99., 20., BankMint::T22WithFee, BankMint::SolEquivalent)] +#[test_case(2_000., 1_999., 20., BankMint::Usdc, BankMint::PyUSD)] +#[tokio::test] +async fn marginfi_account_liquidation_emode( + deposit_amount: f64, + borrow_amount: f64, + liquidate_amount: f64, + collateral_mint: BankMint, + debt_mint: BankMint, +) -> anyhow::Result<()> { + // ------------------------------------------------------------------------- + // Setup + // ------------------------------------------------------------------------- + + let mut test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; + + let emode_breaker_bank_mint = if collateral_mint == BankMint::Usdc { + BankMint::SolEquivalent + } else { + BankMint::Usdc + }; + + // LP + + { + let lp_deposit_amount = 2. * borrow_amount; + let lp_wallet_balance = get_max_deposit_amount_pre_fee(lp_deposit_amount); + let lp_mfi_account_f = test_f.create_marginfi_account().await; + let lp_collateral_token_account = test_f + .get_bank(&debt_mint) + .mint + .create_token_account_and_mint_to(lp_wallet_balance) + .await; + lp_mfi_account_f + .try_bank_deposit( + lp_collateral_token_account.key, + test_f.get_bank(&debt_mint), + lp_deposit_amount, + None, + ) + .await?; + let lp_deposit_amount = 10.0; // any small amount is enough + let lp_wallet_balance = get_max_deposit_amount_pre_fee(lp_deposit_amount); + let lp_collateral_token_account = test_f + .get_bank(&emode_breaker_bank_mint) + .mint + .create_token_account_and_mint_to(lp_wallet_balance) + .await; + lp_mfi_account_f + .try_bank_deposit( + lp_collateral_token_account.key, + test_f.get_bank(&emode_breaker_bank_mint), + lp_deposit_amount, + None, + ) + .await?; + } + + // Liquidatee + + let (liquidatee_mfi_account_f, borrow_amount_actual) = { + let liquidatee_mfi_account_f = test_f.create_marginfi_account().await; + let liquidatee_wallet_balance = get_max_deposit_amount_pre_fee(deposit_amount); + let liquidatee_collateral_token_account_f = test_f + .get_bank_mut(&collateral_mint) + .mint + .create_token_account_and_mint_to(liquidatee_wallet_balance) + .await; + let liquidatee_debt_token_account_f = test_f + .get_bank_mut(&debt_mint) + .mint + .create_empty_token_account() + .await; + liquidatee_mfi_account_f + .try_bank_deposit( + liquidatee_collateral_token_account_f.key, + test_f.get_bank(&collateral_mint), + deposit_amount, + None, + ) + .await?; + liquidatee_mfi_account_f + .try_bank_borrow( + liquidatee_debt_token_account_f.key, + test_f.get_bank(&debt_mint), + borrow_amount, + ) + .await?; + + let liquidatee_mfi_ma = liquidatee_mfi_account_f.load().await; + let debt_bank = test_f.get_bank(&debt_mint).load().await; + let borrow_amount_actual_native = debt_bank.get_liability_amount( + liquidatee_mfi_ma.lending_account.balances[1] + .liability_shares + .into(), + )?; + let borrow_amount_actual = borrow_amount_actual_native.to_num::() + / 10_f64.powf(debt_bank.mint_decimals as f64); + + (liquidatee_mfi_account_f, borrow_amount_actual) + }; + + // Liquidator + + let liquidator_mfi_account_f = { + let liquidator_mfi_account_f = test_f.create_marginfi_account().await; + let liquidator_wallet_balance = get_max_deposit_amount_pre_fee(borrow_amount_actual); + let liquidator_collateral_token_account_f = test_f + .get_bank_mut(&debt_mint) + .mint + .create_token_account_and_mint_to(liquidator_wallet_balance) + .await; + liquidator_mfi_account_f + .try_bank_deposit( + liquidator_collateral_token_account_f.key, + test_f.get_bank(&debt_mint), + borrow_amount_actual * 0.85, + None, + ) + .await?; + + liquidator_mfi_account_f + }; + + // ------------------------------------------------------------------------- + // Test + // ------------------------------------------------------------------------- + + // First decrease the default weights to make liquidatee unhealthy + { + let collateral_bank = test_f.get_bank(&collateral_mint); + + let config_bank_opt = BankConfigOpt { + asset_weight_init: Some(I80F48!(0.1).into()), + asset_weight_maint: Some(I80F48!(0.1).into()), + ..BankConfigOpt::default() + }; + let res = collateral_bank + .update_config(config_bank_opt.clone(), None) + .await; + assert!(res.is_ok()); + } + + // Emode is OFF -> liquidation will succeed + { + let collateral_bank_f = test_f.get_bank(&collateral_mint); + let debt_bank_f = test_f.get_bank(&debt_mint); + let res = liquidator_mfi_account_f + .try_liquidate( + &liquidatee_mfi_account_f, + collateral_bank_f, + liquidate_amount, + debt_bank_f, + ) + .await; + assert!(res.is_ok()); + } + + // Now increase the weights back but only in emode + let collateral_bank_emode_tag = 1u16; + { + let collateral_bank = test_f.get_bank(&collateral_mint); + let debt_bank = test_f.get_bank(&debt_mint); + + let res = test_f + .marginfi_group + .try_lending_pool_configure_bank_emode(&collateral_bank, collateral_bank_emode_tag, &[]) + .await; + assert!(res.is_ok()); + + let debt_bank_emode_tag = 2u16; + let emode_entries = vec![EmodeEntry { + collateral_bank_emode_tag, + flags: 0, + pad0: [0, 0, 0, 0, 0], + asset_weight_init: I80F48!(1.0).into(), // up from 0.1 + asset_weight_maint: I80F48!(1.0).into(), // up from 0.1 + }]; + + let res = test_f + .marginfi_group + .try_lending_pool_configure_bank_emode(&debt_bank, debt_bank_emode_tag, &emode_entries) + .await; + assert!(res.is_ok()); + } + + // The account is healthy when emode is ON -> liquidation will fail + { + let collateral_bank_f = test_f.get_bank(&collateral_mint); + let debt_bank_f = test_f.get_bank(&debt_mint); + let res = liquidator_mfi_account_f + .try_liquidate( + &liquidatee_mfi_account_f, + collateral_bank_f, + liquidate_amount * 0.1, // just to differ from the previous liquidation transaction + debt_bank_f, + ) + .await; + assert!(res.is_err()); + } + + // Decrease the emode weights drawing the liquidatee account liquidatable again + { + let debt_bank = test_f.get_bank(&debt_mint); + + let debt_bank_emode_tag = 2u16; + let emode_entries = vec![EmodeEntry { + collateral_bank_emode_tag, + flags: 0, + pad0: [0, 0, 0, 0, 0], + asset_weight_init: I80F48!(0.6).into(), // down from 1.0 + asset_weight_maint: I80F48!(0.6).into(), // down from 1.0 + }]; + + let res = test_f + .marginfi_group + .try_lending_pool_configure_bank_emode(&debt_bank, debt_bank_emode_tag, &emode_entries) + .await; + assert!(res.is_ok()); + } + + // The account is again unhealthy (emode is still ON) -> liquidation will suceed + { + let collateral_bank_f = test_f.get_bank(&collateral_mint); + let debt_bank_f = test_f.get_bank(&debt_mint); + let res = liquidator_mfi_account_f + .try_liquidate( + &liquidatee_mfi_account_f, + collateral_bank_f, + liquidate_amount * 2.0, // just to differ from the previous liquidation transaction + debt_bank_f, + ) + .await; + assert!(res.is_ok()); + } + + // Now we check the scenario where the liquidator tries to liquidate a valid amount of liquidatee's debt + // but fails due to rendering its own account in a bad health as a result of liquidation. This happens because + // liquidatee's collateral is still in emode and is weighted as 0.6 whereas liquidator's collateral is NOT + // in emode (see below) and is weighted by default - as 0.4. So even though the liquidator would actually gain + // some money, its health would become worse. + + // This borrowing of another asset disables emode for the liquidator + let liquidator_debt_token_account_f = { + let liquidator_debt_token_account_f = test_f + .get_bank_mut(&emode_breaker_bank_mint) + .mint + .create_empty_token_account() + .await; + let res = liquidator_mfi_account_f + .try_bank_borrow( + liquidator_debt_token_account_f.key, + test_f.get_bank(&emode_breaker_bank_mint), + 0.1, // any trivial amount will do + ) + .await; + assert!(res.is_ok()); + liquidator_debt_token_account_f + }; + + { + let collateral_bank_f = test_f.get_bank(&collateral_mint); + let debt_bank_f = test_f.get_bank(&debt_mint); + let res = liquidator_mfi_account_f + .try_liquidate( + &liquidatee_mfi_account_f, + collateral_bank_f, + liquidate_amount * 97.0, // try to liquidate as much as possible + debt_bank_f, + ) + .await; + assert!(res.is_err()); + } + + // Finally we enable emode for liquidator as well. Now that both participants are in emode, + // liquidation goes through and increases the health of both. + { + let res = liquidator_mfi_account_f + .try_bank_repay( + liquidator_debt_token_account_f.key, + test_f.get_bank(&emode_breaker_bank_mint), + 0.0, + Some(true), + ) + .await; + assert!(res.is_ok()); + } + + { + let collateral_bank_f = test_f.get_bank(&collateral_mint); + let debt_bank_f = test_f.get_bank(&debt_mint); + let res = liquidator_mfi_account_f + .try_liquidate( + &liquidatee_mfi_account_f, + collateral_bank_f, + liquidate_amount * 97.0, // liquidate as much as possible + debt_bank_f, + ) + .await; + assert!(res.is_ok()); + } + + Ok(()) +} diff --git a/test-utils/src/marginfi_group.rs b/test-utils/src/marginfi_group.rs index ab76fb5ed..564da0332 100644 --- a/test-utils/src/marginfi_group.rs +++ b/test-utils/src/marginfi_group.rs @@ -6,10 +6,12 @@ use anchor_lang::{prelude::*, solana_program::system_program, InstructionData}; use anchor_spl::associated_token::get_associated_token_address_with_program_id; use anyhow::Result; use bytemuck::bytes_of; +use fixed::types::I80F48; use marginfi::constants::{ FEE_STATE_SEED, INIT_BANK_ORIGINATION_FEE_DEFAULT, PROTOCOL_FEE_FIXED_DEFAULT, PROTOCOL_FEE_RATE_DEFAULT, }; +use marginfi::state::emode::{EmodeEntry, MAX_EMODE_ENTRIES}; use marginfi::state::fee_state::FeeState; use marginfi::state::marginfi_group::BankConfigCompact; use marginfi::state::price::OracleSetup; @@ -391,6 +393,74 @@ impl MarginfiGroupFixture { Ok(()) } + #[allow(clippy::result_large_err)] + pub fn pad_emode_entries( + entries: &[EmodeEntry], + ) -> Result<[EmodeEntry; MAX_EMODE_ENTRIES], BanksClientError> { + if entries.len() > MAX_EMODE_ENTRIES { + return Err(BanksClientError::ClientError( + "wrong number of entries (max: 10)", + )); + } + + let mut result = [EmodeEntry { + collateral_bank_emode_tag: 0, + flags: 0, + pad0: [0; 5], + asset_weight_init: I80F48::ZERO.into(), + asset_weight_maint: I80F48::ZERO.into(), + }; MAX_EMODE_ENTRIES]; + + result[..entries.len()].copy_from_slice(entries); + + Ok(result) + } + + pub fn make_lending_pool_configure_bank_emode_ix( + &self, + bank: &BankFixture, + emode_tag: u16, + entries: [EmodeEntry; MAX_EMODE_ENTRIES], + ) -> Instruction { + let accounts = marginfi::accounts::LendingPoolConfigureBankEmode { + bank: bank.key, + group: self.key, + emode_admin: self.ctx.borrow().payer.pubkey(), + } + .to_account_metas(Some(true)); + + Instruction { + program_id: marginfi::id(), + accounts, + data: marginfi::instruction::LendingPoolConfigureBankEmode { emode_tag, entries } + .data(), + } + } + + pub async fn try_lending_pool_configure_bank_emode( + &self, + bank: &BankFixture, + emode_tag: u16, + entries: &[EmodeEntry], + ) -> Result<(), BanksClientError> { + let padded_entries = Self::pad_emode_entries(entries)?; + let ix = self.make_lending_pool_configure_bank_emode_ix(bank, emode_tag, padded_entries); + let tx = Transaction::new_signed_with_payer( + &[ix], + Some(&self.ctx.borrow().payer.pubkey().clone()), + &[&self.ctx.borrow().payer], + self.ctx.borrow().last_blockhash, + ); + + self.ctx + .borrow_mut() + .banks_client + .process_transaction(tx) + .await?; + + Ok(()) + } + pub async fn try_accrue_interest(&self, bank: &BankFixture) -> Result<()> { let mut ctx = self.ctx.borrow_mut(); diff --git a/tests/e04_emodeLiquidation.spec.ts b/tests/e04_emodeLiquidation.spec.ts index 347c22e39..b1e1e902b 100644 --- a/tests/e04_emodeLiquidation.spec.ts +++ b/tests/e04_emodeLiquidation.spec.ts @@ -169,7 +169,7 @@ describe("Emode liquidation", () => { } }); - // Note: excluding emode, user 1 is unhealthy. Any liquidator that does not yet account for emode + // Note: excluding emode, user 0 is unhealthy. Any liquidator that does not yet account for emode // will try to do this repeatedly and fail. it("(liquidator) Tries to liquidate user 0 with emode in effect - can't liquidate", async () => { const liquidatee = users[0]; @@ -219,7 +219,7 @@ describe("Emode liquidation", () => { }); // Note: In production, reducing Emode weights is at least as risky as reducing regular weights, - // which is done rarely or never because it can trigger use liquidations. In rare instances where + // which is done rarely or never because it can trigger user liquidations. In rare instances where // this must be done outside for security concerns or assets in freefall, it should be done // carefully and slowly! it("(emode admin) Reduces LST A emode settings", async () => { diff --git a/tools/alerting/Cargo.toml b/tools/alerting/Cargo.toml index 447949035..da756bc19 100644 --- a/tools/alerting/Cargo.toml +++ b/tools/alerting/Cargo.toml @@ -18,7 +18,7 @@ marginfi = { path = "../../programs/marginfi", version = "0.1.0", features = [ ] } pagerduty-rs = { version = "*", features = ["sync"] } pyth-sdk-solana = { workspace = true } -pyth-solana-receiver-sdk = "0.3.1" +pyth-solana-receiver-sdk = "0.6.0" serde = "1.0.210" solana-account-decoder = { workspace = true } solana-client.workspace = true From 0a49436f682eac10ca94067a23f27d069c442583 Mon Sep 17 00:00:00 2001 From: Ilia Zyrin Date: Thu, 17 Apr 2025 14:53:33 +0200 Subject: [PATCH 25/38] attempt to fix CI --- Cargo.lock | 13 ++++++++----- Cargo.toml | 1 + clients/rust/marginfi-cli/Cargo.toml | 1 + programs/marginfi/Cargo.toml | 1 + test-utils/Cargo.toml | 1 + tools/alerting/Cargo.toml | 1 + 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16fc0b9cb..fa73d8f89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,6 +109,7 @@ dependencies = [ "pagerduty-rs", "pyth-sdk-solana", "pyth-solana-receiver-sdk", + "pythnet-sdk", "serde", "solana-account-decoder", "solana-client", @@ -3015,6 +3016,7 @@ dependencies = [ "pretty_assertions", "pyth-sdk-solana", "pyth-solana-receiver-sdk", + "pythnet-sdk", "rust_decimal", "serde", "serde_json", @@ -3058,6 +3060,7 @@ dependencies = [ "marginfi", "pyth-sdk-solana", "pyth-solana-receiver-sdk", + "pythnet-sdk", "rand 0.8.5", "serde", "serde_json", @@ -3916,9 +3919,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -3989,9 +3992,9 @@ dependencies = [ [[package]] name = "pythnet-sdk" -version = "2.1.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bbbc0456f9f27c9ad16b6c3bf1b2a7fea61eebf900f4d024a0468b9a84fe0c1" +checksum = "498d20fd330277697aaee92f341bdabdb4695b10e05f054157a18ad8b7746a17" dependencies = [ "anchor-lang 0.29.0", "bincode", @@ -4000,7 +4003,6 @@ dependencies = [ "byteorder", "fast-math", "hex", - "proc-macro2", "rustc_version", "serde", "sha3 0.10.8", @@ -7078,6 +7080,7 @@ dependencies = [ "pretty_assertions", "pyth-sdk-solana", "pyth-solana-receiver-sdk", + "pythnet-sdk", "serde", "serde_json", "solana-cli-output", diff --git a/Cargo.toml b/Cargo.toml index 9b4b6fadf..786a76fee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ anchor-client = { git = "https://github.com/mrgnlabs/anchor.git", rev = "fdcf299 pyth-sdk-solana = "=0.10.1" pyth-solana-receiver-sdk = "0.6.0" +pythnet-sdk = "2.3.1" switchboard-solana = "0.29.0" switchboard-on-demand = "0.1.14" borsh = "0.10.3" diff --git a/clients/rust/marginfi-cli/Cargo.toml b/clients/rust/marginfi-cli/Cargo.toml index 4c620b586..e0b15bfea 100644 --- a/clients/rust/marginfi-cli/Cargo.toml +++ b/clients/rust/marginfi-cli/Cargo.toml @@ -28,6 +28,7 @@ anchor-client = { workspace = true } anchor-spl = { workspace = true, features = ["token_2022"] } pyth-sdk-solana = { workspace = true } +pythnet-sdk = { workspace = true } switchboard-solana = { workspace = true } switchboard-on-demand = "0.1.14" borsh = "0.10.3" diff --git a/programs/marginfi/Cargo.toml b/programs/marginfi/Cargo.toml index cf7b99ac6..4d235251f 100644 --- a/programs/marginfi/Cargo.toml +++ b/programs/marginfi/Cargo.toml @@ -34,6 +34,7 @@ anchor-spl = { workspace = true } pyth-sdk-solana = { workspace = true } pyth-solana-receiver-sdk = { workspace = true } +pythnet-sdk = { workspace = true } switchboard-solana = { workspace = true } switchboard-on-demand = { workspace = true } borsh = "0.10.3" diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index d0486a3c1..9c1a17e81 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -24,6 +24,7 @@ anchor-spl = { workspace = true } pyth-sdk-solana = { workspace = true } pyth-solana-receiver-sdk = { workspace = true } +pythnet-sdk = { workspace = true } switchboard-solana = { workspace = true } switchboard-on-demand = { workspace = true } diff --git a/tools/alerting/Cargo.toml b/tools/alerting/Cargo.toml index da756bc19..826bb0564 100644 --- a/tools/alerting/Cargo.toml +++ b/tools/alerting/Cargo.toml @@ -19,6 +19,7 @@ marginfi = { path = "../../programs/marginfi", version = "0.1.0", features = [ pagerduty-rs = { version = "*", features = ["sync"] } pyth-sdk-solana = { workspace = true } pyth-solana-receiver-sdk = "0.6.0" +pythnet-sdk = { workspace = true } serde = "1.0.210" solana-account-decoder = { workspace = true } solana-client.workspace = true From f1405f53832d8ddb46429775669a98f65c563b04 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Thu, 17 Apr 2025 17:49:40 -0400 Subject: [PATCH 26/38] ABSOLUTE INSANITY: ITS A START --- .github/actions/setup-solana-cli/action.yaml | 2 +- .github/workflows/test.yaml | 6 +- Anchor.toml | 14 +- Cargo.lock | 4510 +++++++++-------- Cargo.toml | 52 +- package.json | 2 +- programs/brick/Cargo.toml | 2 +- .../liquidity-incentive-program/Cargo.toml | 8 +- programs/marginfi/Cargo.toml | 11 +- programs/marginfi/src/constants.rs | 2 +- .../instructions/marginfi_account/borrow.rs | 2 +- .../instructions/marginfi_account/deposit.rs | 4 +- .../marginfi_account/flashloan.rs | 16 +- .../marginfi_account/initialize.rs | 2 +- .../marginfi_account/liquidate.rs | 4 +- .../marginfi_account/pulse_health.rs | 2 +- .../instructions/marginfi_account/repay.rs | 2 +- .../instructions/marginfi_account/withdraw.rs | 2 +- programs/marginfi/src/state/marginfi_group.rs | 6 +- programs/marginfi/src/state/price.rs | 513 +- .../tests/admin_actions/bankruptcy.rs | 36 +- .../admin_actions/create_marginfi_group.rs | 2 +- .../tests/admin_actions/setup_bank.rs | 55 +- .../tests/admin_actions/withdraw_fees.rs | 8 +- programs/marginfi/tests/misc/regression.rs | 4 +- .../marginfi/tests/misc/token_extensions.rs | 390 +- .../marginfi/tests/user_actions/borrow.rs | 18 +- .../tests/user_actions/close_balance.rs | 2 +- .../marginfi/tests/user_actions/deposit.rs | 152 +- .../marginfi/tests/user_actions/flash_loan.rs | 2 +- .../marginfi/tests/user_actions/liquidate.rs | 134 +- programs/marginfi/tests/user_actions/mod.rs | 456 +- programs/marginfi/tests/user_actions/repay.rs | 19 +- .../marginfi/tests/user_actions/withdraw.rs | 22 +- programs/test_transfer_hook/Cargo.toml | 3 +- programs/test_transfer_hook/src/lib.rs | 4 +- rust-toolchain.toml | 2 +- test-utils/Cargo.toml | 25 +- test-utils/src/lib.rs | 7 +- test-utils/src/marginfi_account.rs | 154 +- test-utils/src/spl.rs | 220 +- test-utils/src/test.rs | 135 +- test-utils/src/utils.rs | 282 +- yarn.lock | 53 + 44 files changed, 3507 insertions(+), 3840 deletions(-) diff --git a/.github/actions/setup-solana-cli/action.yaml b/.github/actions/setup-solana-cli/action.yaml index 649a67f2c..8246543fd 100644 --- a/.github/actions/setup-solana-cli/action.yaml +++ b/.github/actions/setup-solana-cli/action.yaml @@ -11,7 +11,7 @@ runs: # ~/.cache/solana/ # ~/.local/share/solana/ # key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_CLI_VERSION }}-${{ env.RUST_TOOLCHAIN }} - - run: sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_CLI_VERSION }}/install)" + - run: sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_CLI_VERSION }}/install)" shell: bash # if: steps.cache-solana.outputs.cache-hit != 'true' - run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fa411c538..0c53f147c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,9 +14,9 @@ defaults: working-directory: . env: - RUST_TOOLCHAIN: 1.75.0 - SOLANA_CLI_VERSION: 1.18.11 - ANCHOR_CLI_VERSION: 0.30.1 + RUST_TOOLCHAIN: 1.79.0 + SOLANA_CLI_VERSION: 2.1.0 + ANCHOR_CLI_VERSION: 0.31.0 ANCHOR_SHA: e6d7dafe12da661a36ad1b4f3b5970e8986e5321 CARGO_TERM_COLOR: always diff --git a/Anchor.toml b/Anchor.toml index 75ae0d1ca..9335d9874 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -1,8 +1,16 @@ [toolchain] -anchor_version = "0.30.1" -solana_version = "1.18.17" +anchor_version = "0.31.0" +solana_version = "2.1.0" # Getting "thread 'main' panicked at cli/src/lib.rs:545:18:"? Check your toolchain matches the above. +[workspace] +members = ["programs/marginfi", "programs/mocks"] +# exclude = [ +# "programs/test_transfer_hook", +# "programs/liquidity-incentive-program", +# "programs/brick", +# ] + [features] resolution = true skip-lint = false @@ -14,7 +22,7 @@ mocks = "5XaaR94jBubdbrRrNW7DtRvZeWvLhSHkEGU3jHTEXV3C" spl_single_pool = "SVSPxpvHdN29nkVg9rPapPNDddN5DipNLRUFhyjFThE" # cloned from solana-labs repo (see below) [programs.mainnet] -liquidity_incentive_program = "LipsxuAkFkwa4RKNzn51wAsW7Dedzt1RNHMkTkDEZUW" +# liquidity_incentive_program = "LipsxuAkFkwa4RKNzn51wAsW7Dedzt1RNHMkTkDEZUW" marginfi = "MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA" [registry] diff --git a/Cargo.lock b/Cargo.lock index fa73d8f89..ad5715f2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,32 +27,38 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aead" -version = "0.4.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ + "crypto-common", "generic-array", ] [[package]] name = "aes" -version = "0.7.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", "cpufeatures", - "opaque-debug", ] [[package]] name = "aes-gcm-siv" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589c637f0e68c877bbd59a4599bbe849cac8e5f3e4b5a3ebae8f528cd218dcdc" +checksum = "ae0784134ba9375416d469ec31e7c5f9fa94405049cf08c5ce5b4698be673e0d" dependencies = [ "aead", "aes", @@ -63,6 +69,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "agave-transaction-view" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a249374d6349eeb31348a849666f3d47cacb18e0e05454fbd11a1fc69fae8e7e" +dependencies = [ + "solana-sdk", + "solana-svm-transaction", +] + [[package]] name = "ahash" version = "0.7.8" @@ -96,37 +112,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "alerting" -version = "0.1.0" -dependencies = [ - "anyhow", - "bytemuck", - "chrono", - "env_logger 0.11.5", - "log", - "marginfi", - "pagerduty-rs", - "pyth-sdk-solana", - "pyth-solana-receiver-sdk", - "pythnet-sdk", - "serde", - "solana-account-decoder", - "solana-client", - "solana-sdk", - "structopt", - "switchboard-on-demand", - "switchboard-solana", - "time", - "toml 0.8.19", -] - -[[package]] -name = "aliasable" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" - [[package]] name = "alloc-no-stdlib" version = "2.0.4" @@ -144,22 +129,11 @@ dependencies = [ [[package]] name = "anchor-attribute-access-control" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f619f1d04f53621925ba8a2e633ba5a6081f2ae14758cbb67f38fd823e0a3e" -dependencies = [ - "anchor-syn 0.29.0", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-access-control" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "37013051defd745a5437d6842bd404e5480e14ad4e4f0441dd9a81a4b9aea1d6" dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "proc-macro2", "quote", "syn 1.0.109", @@ -167,24 +141,12 @@ dependencies = [ [[package]] name = "anchor-attribute-account" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f2a3e1df4685f18d12a943a9f2a7456305401af21a07c9fe076ef9ecd6e400" -dependencies = [ - "anchor-syn 0.29.0", - "bs58 0.5.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-account" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "92db0f793e924e18462b3fac53c5759a8248649a8072788b5e88a4af714998c8" dependencies = [ - "anchor-syn 0.30.1", - "bs58 0.5.1", + "anchor-syn", + "bs58", "proc-macro2", "quote", "syn 1.0.109", @@ -192,64 +154,33 @@ dependencies = [ [[package]] name = "anchor-attribute-constant" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9423945cb55627f0b30903288e78baf6f62c6c8ab28fb344b6b25f1ffee3dca7" -dependencies = [ - "anchor-syn 0.29.0", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-constant" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "7a98126ebfc96d6248899caadc9ea7c2403420c4f5c994e541802bce9f423674" dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "quote", "syn 1.0.109", ] [[package]] name = "anchor-attribute-error" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ed12720033cc3c3bf3cfa293349c2275cd5ab99936e33dd4bf283aaad3e241" -dependencies = [ - "anchor-syn 0.29.0", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "f8a4dcb403f872fbcd0910fc39a3e05bb6c43a8399f915a1878e62eb680fbb23" dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "quote", "syn 1.0.109", ] [[package]] name = "anchor-attribute-event" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eef4dc0371eba2d8c8b54794b0b0eb786a234a559b77593d6f80825b6d2c77a2" -dependencies = [ - "anchor-syn 0.29.0", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "420d651b2703ccff86f6c4b7c394140cb85049787c078a5f8280506121d48065" dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "proc-macro2", "quote", "syn 1.0.109", @@ -257,24 +188,14 @@ dependencies = [ [[package]] name = "anchor-attribute-program" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b18c4f191331e078d4a6a080954d1576241c29c56638783322a18d308ab27e4f" -dependencies = [ - "anchor-syn 0.29.0", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "d258f3a9f47db7f4199888df0ee67e42b960a7acb8f5c336b585d4eb243b9665" dependencies = [ "anchor-lang-idl", - "anchor-syn 0.30.1", + "anchor-syn", "anyhow", - "bs58 0.5.1", + "bs58", "heck 0.3.3", "proc-macro2", "quote", @@ -282,65 +203,25 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "anchor-client" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" -dependencies = [ - "anchor-lang 0.30.1", - "anyhow", - "futures", - "regex", - "serde", - "solana-account-decoder", - "solana-client", - "solana-sdk", - "thiserror", - "tokio", - "url", -] - [[package]] name = "anchor-derive-accounts" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de10d6e9620d3bcea56c56151cad83c5992f50d5960b3a9bebc4a50390ddc3c" -dependencies = [ - "anchor-syn 0.29.0", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "097147501de51105d8dbdad9bd5a96a1b17ecbb2cee9f200d6167031372eab3b" dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "quote", "syn 1.0.109", ] [[package]] name = "anchor-derive-serde" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e2e5be518ec6053d90a2a7f26843dbee607583c779e6c8395951b9739bdfbe" -dependencies = [ - "anchor-syn 0.29.0", - "borsh-derive-internal 0.10.3", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-derive-serde" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "d5a24721da4ed67f0a1391cac27ea7e51c255cbd94cdcc6728a0aa56227628d0" dependencies = [ - "anchor-syn 0.30.1", - "borsh-derive-internal 0.10.3", + "anchor-syn", + "borsh-derive-internal", "proc-macro2", "quote", "syn 1.0.109", @@ -348,19 +229,9 @@ dependencies = [ [[package]] name = "anchor-derive-space" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecc31d19fa54840e74b7a979d44bcea49d70459de846088a1d71e87ba53c419" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-derive-space" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "f41986f84d238a2f7a807f3a98da5df0e97ebe23f29f7d67b8cdd4fd80bc1ba1" dependencies = [ "proc-macro2", "quote", @@ -369,58 +240,33 @@ dependencies = [ [[package]] name = "anchor-lang" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35da4785497388af0553586d55ebdc08054a8b1724720ef2749d313494f2b8ad" -dependencies = [ - "anchor-attribute-access-control 0.29.0", - "anchor-attribute-account 0.29.0", - "anchor-attribute-constant 0.29.0", - "anchor-attribute-error 0.29.0", - "anchor-attribute-event 0.29.0", - "anchor-attribute-program 0.29.0", - "anchor-derive-accounts 0.29.0", - "anchor-derive-serde 0.29.0", - "anchor-derive-space 0.29.0", - "arrayref", - "base64 0.13.1", - "bincode", - "borsh 0.10.3", - "bytemuck", - "getrandom 0.2.15", - "solana-program", - "thiserror", -] - -[[package]] -name = "anchor-lang" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" -dependencies = [ - "anchor-attribute-access-control 0.30.1", - "anchor-attribute-account 0.30.1", - "anchor-attribute-constant 0.30.1", - "anchor-attribute-error 0.30.1", - "anchor-attribute-event 0.30.1", - "anchor-attribute-program 0.30.1", - "anchor-derive-accounts 0.30.1", - "anchor-derive-serde 0.30.1", - "anchor-derive-space 0.30.1", +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eba81a0543fee1b7b610fe9ebedbae6a14e8d3e85a6a6dd48871d48a08880195" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-program", + "anchor-derive-accounts", + "anchor-derive-serde", + "anchor-derive-space", "anchor-lang-idl", - "arrayref", "base64 0.21.7", "bincode", "borsh 0.10.3", "bytemuck", - "getrandom 0.2.15", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "anchor-lang-idl" -version = "0.1.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e8599d21995f68e296265aa5ab0c3cef582fd58afec014d01bd0bce18a4418" dependencies = [ "anchor-lang-idl-spec", "anyhow", @@ -434,7 +280,8 @@ dependencies = [ [[package]] name = "anchor-lang-idl-spec" version = "0.1.0" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bdf143115440fe621bdac3a29a1f7472e09f6cd82b2aa569429a0c13f103838" dependencies = [ "anyhow", "serde", @@ -442,56 +289,27 @@ dependencies = [ [[package]] name = "anchor-spl" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c4fd6e43b2ca6220d2ef1641539e678bfc31b6cc393cf892b373b5997b6a39a" +checksum = "e9d989ebc64e6c1a9828d3a6f7b8e7a4d63cc8a4f667dcb191bd9067a3375c20" dependencies = [ - "anchor-lang 0.29.0", - "solana-program", - "spl-associated-token-account 2.3.0", - "spl-token 4.0.0", - "spl-token-2022 0.9.0", -] - -[[package]] -name = "anchor-spl" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" -dependencies = [ - "anchor-lang 0.30.1", - "spl-associated-token-account 3.0.2", - "spl-pod 0.2.2", - "spl-token 4.0.0", - "spl-token-2022 3.0.2", - "spl-token-group-interface 0.2.3", - "spl-token-metadata-interface 0.3.3", + "anchor-lang", + "spl-associated-token-account 6.0.0", + "spl-pod 0.5.0", + "spl-token 7.0.0", + "spl-token-2022 6.0.0", + "spl-token-group-interface 0.5.0", + "spl-token-metadata-interface 0.6.0", ] [[package]] name = "anchor-syn" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9101b84702fed2ea57bd22992f75065da5648017135b844283a2f6d74f27825" +checksum = "564685b759db12a2424d1b2688cfdf0fec26a023813bc461274754fb0e5d97b0" dependencies = [ "anyhow", - "bs58 0.5.1", - "heck 0.3.3", - "proc-macro2", - "quote", - "serde", - "serde_json", - "sha2 0.10.8", - "syn 1.0.109", - "thiserror", -] - -[[package]] -name = "anchor-syn" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" -dependencies = [ - "anyhow", - "bs58 0.5.1", + "bs58", "cargo_toml", "heck 0.3.3", "proc-macro2", @@ -500,7 +318,7 @@ dependencies = [ "serde_json", "sha2 0.10.8", "syn 1.0.109", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -527,60 +345,11 @@ dependencies = [ "winapi", ] -[[package]] -name = "anstream" -version = "0.6.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" - -[[package]] -name = "anstyle-parse" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "aquamarine" @@ -589,7 +358,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1da02abba9f9063d786eab1509833ebb2fac0f966862ca59439c76b9c566760" dependencies = [ "include_dir", - "itertools", + "itertools 0.10.5", "proc-macro-error", "proc-macro2", "quote", @@ -625,7 +394,7 @@ dependencies = [ "ark-std", "derivative", "hashbrown 0.13.2", - "itertools", + "itertools 0.10.5", "num-traits", "zeroize", ] @@ -642,7 +411,7 @@ dependencies = [ "ark-std", "derivative", "digest 0.10.7", - "itertools", + "itertools 0.10.5", "num-bigint 0.4.6", "num-traits", "paste", @@ -721,9 +490,9 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" @@ -749,7 +518,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror", + "thiserror 1.0.69", "time", ] @@ -789,7 +558,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] @@ -808,37 +577,25 @@ dependencies = [ ] [[package]] -name = "async-mutex" -version = "1.4.0" +name = "async-lock" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener", + "event-listener 5.4.0", + "event-listener-strategy", + "pin-project-lite", ] [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", -] - -[[package]] -name = "attohttpc" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcf00bc6d5abb29b5f97e3c61a90b6d3caa12f3faf897d4a3e3607c050a35a7" -dependencies = [ - "http", - "log", - "native-tls", - "serde", - "serde_json", - "url", + "syn 2.0.100", ] [[package]] @@ -858,32 +615,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" -[[package]] -name = "aws-creds" -version = "0.34.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3776743bb68d4ad02ba30ba8f64373f1be4e082fe47651767171ce75bb2f6cf5" -dependencies = [ - "attohttpc", - "dirs", - "log", - "quick-xml", - "rust-ini", - "serde", - "thiserror", - "time", - "url", -] - -[[package]] -name = "aws-region" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42fed2b9fca70f2908268d057a607f2a906f47edbf856ea8587de9038d264e22" -dependencies = [ - "thiserror", -] - [[package]] name = "az" version = "1.2.1" @@ -900,7 +631,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] @@ -924,10 +655,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] -name = "base64ct" -version = "1.6.0" +name = "base64" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bincode" @@ -976,9 +707,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +checksum = "389a099b34312839e16420d499a9cad9650541715937ffbdd40d36f49e77eeb3" dependencies = [ "arrayref", "arrayvec", @@ -994,7 +725,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "block-padding", "generic-array", ] @@ -1007,22 +737,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive 0.9.3", - "hashbrown 0.11.2", -] - [[package]] name = "borsh" version = "0.10.3" @@ -1043,27 +757,14 @@ dependencies = [ "cfg_aliases", ] -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal 0.9.3", - "borsh-schema-derive-internal 0.9.3", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "borsh-derive" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" dependencies = [ - "borsh-derive-internal 0.10.3", - "borsh-schema-derive-internal 0.10.3", + "borsh-derive-internal", + "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", "proc-macro2", "syn 1.0.109", @@ -1079,37 +780,15 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", "syn_derive", ] [[package]] name = "borsh-derive-internal" -version = "0.9.3" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" dependencies = [ "proc-macro2", "quote", @@ -1127,14 +806,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "brick" -version = "0.1.0" -dependencies = [ - "anchor-lang 0.30.1", - "solana-program", -] - [[package]] name = "brotli" version = "6.0.0" @@ -1156,12 +827,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - [[package]] name = "bs58" version = "0.5.1" @@ -1211,22 +876,22 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.19.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b" +checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1237,9 +902,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "bzip2" @@ -1253,12 +918,11 @@ dependencies = [ [[package]] name = "bzip2-sys" -version = "0.1.11+1.0.8" +version = "0.1.13+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" dependencies = [ "cc", - "libc", "pkg-config", ] @@ -1269,7 +933,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190baaad529bcfbde9e1a19022c42781bdb6ff9de25721abdb8fd98c0807730b" dependencies = [ "libc", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1284,15 +948,21 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.99" +version = "1.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" dependencies = [ "jobserver", "libc", - "once_cell", + "shlex", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-if" version = "1.0.0" @@ -1305,6 +975,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "cfg_eval" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45565fc9416b9896014f5732ac776f810ee53a66730c17e4020c3ec064a8f88f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "chrono" version = "0.4.38" @@ -1331,11 +1012,12 @@ dependencies = [ [[package]] name = "cipher" -version = "0.3.0" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "generic-array", + "crypto-common", + "inout", ] [[package]] @@ -1348,56 +1030,11 @@ dependencies = [ "atty", "bitflags 1.3.2", "strsim 0.8.0", - "textwrap 0.11.0", - "unicode-width", + "textwrap", + "unicode-width 0.1.14", "vec_map", ] -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_derive", - "clap_lex", - "indexmap 1.9.3", - "once_cell", - "strsim 0.10.0", - "termcolor", - "textwrap 0.16.1", -] - -[[package]] -name = "clap_derive" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" -dependencies = [ - "heck 0.4.1", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - -[[package]] -name = "colorchoice" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" - [[package]] name = "combine" version = "3.8.1" @@ -1411,6 +1048,16 @@ dependencies = [ "unreachable", ] +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -1422,15 +1069,15 @@ dependencies = [ [[package]] name = "console" -version = "0.15.8" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" dependencies = [ "encode_unicode", - "lazy_static", "libc", - "unicode-width", - "windows-sys 0.52.0", + "once_cell", + "unicode-width 0.2.0", + "windows-sys 0.59.0", ] [[package]] @@ -1453,17 +1100,11 @@ dependencies = [ "web-sys", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "core-foundation" @@ -1475,11 +1116,21 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" @@ -1510,9 +1161,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -1546,6 +1197,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] @@ -1561,27 +1213,55 @@ dependencies = [ [[package]] name = "ctr" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ "cipher", ] [[package]] name = "curve25519-dalek" -version = "3.2.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ "byteorder", "digest 0.9.0", "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "rand_core 0.6.4", + "rustc_version", "serde", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "darling" version = "0.20.9" @@ -1603,7 +1283,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1614,7 +1294,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1633,18 +1313,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - -[[package]] -name = "der" -version = "0.5.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" [[package]] name = "der-parser" @@ -1662,12 +1333,11 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.11" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -1740,15 +1410,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - [[package]] name = "dirs-next" version = "2.0.0" @@ -1759,17 +1420,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -1789,7 +1439,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1812,15 +1462,9 @@ checksum = "a6cbae11b3de8fce2a456e8ea3dada226b35fe791f0dc1d360c0941f0bb681f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] -[[package]] -name = "dlv-list" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" - [[package]] name = "downcast" version = "0.11.0" @@ -1854,7 +1498,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ - "curve25519-dalek", + "curve25519-dalek 3.2.0", "ed25519", "rand 0.7.3", "serde", @@ -1894,9 +1538,9 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "encode_unicode" -version = "0.3.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "encoding_rs" @@ -1924,7 +1568,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1937,7 +1581,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1949,17 +1593,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.58", -] - -[[package]] -name = "env_filter" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" -dependencies = [ - "log", - "regex", + "syn 2.0.100", ] [[package]] @@ -1975,19 +1609,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "env_logger" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" -dependencies = [ - "anstream", - "anstyle", - "env_filter", - "humantime", - "log", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -2006,12 +1627,12 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2020,6 +1641,27 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener 5.4.0", + "pin-project-lite", +] + [[package]] name = "fast-math" version = "0.1.1" @@ -2031,9 +1673,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "feature-probe" @@ -2041,18 +1683,39 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "filetime" -version = "0.2.23" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", - "windows-sys 0.52.0", + "libredox", + "windows-sys 0.59.0", +] + +[[package]] +name = "five8_const" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26dec3da8bc3ef08f2c04f61eab298c3ab334523e55f076354d6d6f613799a7b" +dependencies = [ + "five8_core", ] +[[package]] +name = "five8_core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2551bf44bc5f776c15044b9b94153a00198be06743e262afaaa61f11ac7523a5" + [[package]] name = "fixed" version = "1.27.0" @@ -2102,12 +1765,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.30" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.8", ] [[package]] @@ -2125,21 +1788,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -2151,9 +1799,9 @@ dependencies = [ [[package]] name = "fragile" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" +checksum = "28dd6caf6059519a65843af8fe2a3ae298b14b80179855aeb4adc2c1934ee619" [[package]] name = "funty" @@ -2163,9 +1811,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -2178,9 +1826,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -2188,15 +1836,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -2205,38 +1853,44 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -2297,6 +1951,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", + "wasm-bindgen", +] + [[package]] name = "gimli" version = "0.29.0" @@ -2304,14 +1972,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] -name = "goblin" -version = "0.5.4" +name = "governor" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7666983ed0dd8d21a6f6576ee00053ca0926fb281a5522577a4dbd0f1b54143" +checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" dependencies = [ - "log", - "plain", - "scroll", + "cfg-if", + "dashmap", + "futures", + "futures-timer", + "no-std-compat", + "nonzero_ext", + "parking_lot", + "portable-atomic", + "quanta", + "rand 0.8.5", + "smallvec", + "spinning_top", ] [[package]] @@ -2326,7 +2003,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.6.0", + "indexmap", "slab", "tokio", "tokio-util 0.7.11", @@ -2354,27 +2031,18 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash 0.7.8", ] [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.8", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ "ahash 0.8.11", ] @@ -2502,9 +2170,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f" [[package]] name = "hyper" @@ -2539,34 +2207,22 @@ dependencies = [ "futures-util", "http", "hyper", - "rustls", + "rustls 0.21.12", "tokio", "tokio-rustls", ] -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -2639,19 +2295,9 @@ dependencies = [ [[package]] name = "index_list" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb725b6505e51229de32027e0cfcd9db29da4d89156f9747b0a5195643fa3e1" - -[[package]] -name = "indexmap" -version = "1.9.3" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] +checksum = "fa38453685e5fe724fd23ff6c1a158c1e2ca21ce0c2718fa11e96e70e99fd4de" [[package]] name = "indexmap" @@ -2665,24 +2311,24 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.8" +version = "0.17.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" dependencies = [ "console", - "instant", "number_prefix", "portable-atomic", - "unicode-width", + "unicode-width 0.2.0", + "web-time", ] [[package]] -name = "instant" -version = "0.1.13" +name = "inout" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "cfg-if", + "generic-array", ] [[package]] @@ -2692,16 +2338,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] -name = "is_terminal_polyfill" -version = "1.70.1" +name = "itertools" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] [[package]] name = "itertools" -version = "0.10.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -2712,21 +2361,45 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine 4.6.7", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" dependencies = [ + "getrandom 0.3.2", "libc", ] [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -2754,15 +2427,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -2771,9 +2435,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "libredox" @@ -2783,6 +2447,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.6.0", "libc", + "redox_syscall", ] [[package]] @@ -2890,61 +2555,14 @@ dependencies = [ "ark-bn254", "ark-ff", "num-bigint 0.4.6", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "liquidity-incentive-program" -version = "0.1.0" -dependencies = [ - "anchor-lang 0.30.1", - "anchor-spl 0.30.1", - "anyhow", - "assert_matches", - "bincode", - "cfg-if", - "fixed", - "futures", - "marginfi", - "pretty_assertions", - "solana-logger", - "solana-program", - "solana-program-test", - "solana-sdk", - "test-utilities", -] - -[[package]] -name = "llama-snapshot-tool" -version = "0.1.0" -dependencies = [ - "anchor-client", - "anchor-spl 0.30.1", - "anyhow", - "bytemuck", - "clap 3.2.25", - "env_logger 0.9.3", - "fixed", - "fixed-macro", - "futures", - "lazy_static", - "log", - "marginfi", - "reqwest", - "rust-s3", - "serde", - "serde_json", - "solana-account-decoder", - "solana-client", - "solana-sdk", - "tokio", -] +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "lock_api" @@ -2965,30 +2583,20 @@ dependencies = [ "value-bag", ] -[[package]] -name = "lru" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" -dependencies = [ - "hashbrown 0.12.3", -] - [[package]] name = "lz4" -version = "1.25.0" +version = "1.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6eab492fe7f8651add23237ea56dbf11b3c4ff762ab83d40a47f11433421f91" +checksum = "a20b523e860d03443e98350ceaac5e71c6ba89aea7d960769ec3ce37f4de5af4" dependencies = [ - "libc", "lz4-sys", ] [[package]] name = "lz4-sys" -version = "1.9.5" +version = "1.11.1+lz4-1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9764018d143cc854c9f17f0b907de70f14393b1f502da6375dce70f00514eb3" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" dependencies = [ "cc", "libc", @@ -2998,9 +2606,8 @@ dependencies = [ name = "marginfi" version = "0.1.2" dependencies = [ - "anchor-lang 0.29.0", - "anchor-lang 0.30.1", - "anchor-spl 0.30.1", + "anchor-lang", + "anchor-spl", "anyhow", "assert_matches", "base64 0.21.7", @@ -3022,77 +2629,17 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-cli-output", - "solana-logger", - "solana-program", "solana-program-test", "solana-sdk", "solana-security-txt", - "spl-tlv-account-resolution 0.6.3", "spl-transfer-hook-interface 0.6.3", "static_assertions", "switchboard-on-demand", - "switchboard-solana", "test-case", "test-utilities", "type-layout", ] -[[package]] -name = "marginfi-v2-cli" -version = "0.1.0" -dependencies = [ - "anchor-client", - "anchor-spl 0.30.1", - "anyhow", - "bincode", - "borsh 0.10.3", - "bs58 0.4.0", - "bytemuck", - "chrono", - "clap 3.2.25", - "dirs", - "env_logger 0.9.3", - "fixed", - "fixed-macro", - "hex", - "liquidity-incentive-program", - "log", - "marginfi", - "pyth-sdk-solana", - "pyth-solana-receiver-sdk", - "pythnet-sdk", - "rand 0.8.5", - "serde", - "serde_json", - "shellexpand", - "solana-account-decoder", - "solana-address-lookup-table-program", - "solana-client", - "solana-sdk", - "spl-associated-token-account 2.3.0", - "spl-token 4.0.0", - "switchboard-on-demand", - "switchboard-solana", - "type-layout", -] - -[[package]] -name = "maybe-async" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.58", -] - -[[package]] -name = "md5" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" - [[package]] name = "memchr" version = "2.7.4" @@ -3117,15 +2664,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.1" @@ -3154,12 +2692,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] -name = "minidom" -version = "0.15.2" +name = "mime_guess" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f45614075738ce1b77a1768912a60c0227525971b03e09122a05b8a34a2a6278" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ - "rxml", + "mime", + "unicase", ] [[package]] @@ -3177,6 +2716,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +dependencies = [ + "adler2", +] + [[package]] name = "mio" version = "0.8.11" @@ -3219,8 +2767,8 @@ dependencies = [ name = "mocks" version = "0.1.0" dependencies = [ - "anchor-lang 0.30.1", - "anchor-spl 0.30.1", + "anchor-lang", + "anchor-spl", "bytemuck", "static_assertions", ] @@ -3247,34 +2795,23 @@ dependencies = [ ] [[package]] -name = "native-tls" -version = "0.2.12" +name = "nix" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "cfg_aliases", "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", + "memoffset 0.9.1", ] [[package]] -name = "nix" -version = "0.26.4" +name = "no-std-compat" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", - "pin-utils", -] +checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" [[package]] name = "nom" @@ -3286,6 +2823,12 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nonzero_ext" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -3385,7 +2928,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -3452,65 +2995,23 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive 0.5.11", -] - -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive 0.6.1", -] - -[[package]] -name = "num_enum" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" -dependencies = [ - "num_enum_derive 0.7.2", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 2.0.58", + "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -3539,9 +3040,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "opaque-debug" @@ -3550,118 +3051,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] -name = "openssl" -version = "0.10.64" +name = "openssl-probe" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] -name = "openssl-macros" -version = "0.1.1" +name = "opentelemetry" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.58", + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project", + "rand 0.8.5", + "thiserror 1.0.69", ] [[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "opentelemetry" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" -dependencies = [ - "async-trait", - "crossbeam-channel", - "futures-channel", - "futures-executor", - "futures-util", - "js-sys", - "lazy_static", - "percent-encoding", - "pin-project", - "rand 0.8.5", - "thiserror", -] - -[[package]] -name = "ordered-multimap" -version = "0.4.3" +name = "parking" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" -dependencies = [ - "dlv-list", - "hashbrown 0.12.3", -] - -[[package]] -name = "os_str_bytes" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" - -[[package]] -name = "ouroboros" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db" -dependencies = [ - "aliasable", - "ouroboros_macro", -] - -[[package]] -name = "ouroboros_macro" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" -dependencies = [ - "Inflector", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "pagerduty-rs" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd10bab2b6df910bbe6c4987d76aa4221235103d9a9c000cfabcee6a6abc8f7a" -dependencies = [ - "reqwest", - "serde", - "time", - "url", -] +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" @@ -3681,7 +3099,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.2", + "redox_syscall", "smallvec", "windows-targets 0.52.6", ] @@ -3736,22 +3154,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -3766,34 +3184,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs8" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" -dependencies = [ - "der", - "spki", - "zeroize", -] - [[package]] name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - -[[package]] -name = "plain" -version = "0.2.3" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "polyval" -version = "0.5.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", "cpufeatures", @@ -3803,9 +3204,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" [[package]] name = "powerfmt" @@ -3827,7 +3228,7 @@ checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", - "itertools", + "itertools 0.10.5", "normalize-line-endings", "predicates-core", "regex", @@ -3835,15 +3236,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" +checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" [[package]] name = "predicates-tree" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" dependencies = [ "predicates-core", "termtree", @@ -3874,16 +3275,6 @@ dependencies = [ "toml 0.5.11", ] -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - [[package]] name = "proc-macro-crate" version = "3.1.0" @@ -3919,9 +3310,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -3974,7 +3365,7 @@ dependencies = [ "pyth-sdk", "serde", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3983,7 +3374,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f07e92abfc18154532ed3dabaa7dac8e693b9925bfe28b2915bc8f8c1540ca0" dependencies = [ - "anchor-lang 0.29.0", + "anchor-lang", "bytemuck_derive", "hex", "pythnet-sdk", @@ -3996,7 +3387,7 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "498d20fd330277697aaee92f341bdabdb4695b10e05f054157a18ad8b7746a17" dependencies = [ - "anchor-lang 0.29.0", + "anchor-lang", "bincode", "borsh 0.10.3", "bytemuck", @@ -4005,10 +3396,10 @@ dependencies = [ "hex", "rustc_version", "serde", - "sha3 0.10.8", + "sha3", "slow_primes", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -4028,65 +3419,77 @@ checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] -name = "quick-xml" -version = "0.26.0" +name = "quanta" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd" +checksum = "3bd1fe6824cea6538803de3ff1bc0cf3949024db3d43c9643024bfb33a807c0e" dependencies = [ - "memchr", - "serde", + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid", + "wasi 0.11.0+wasi-snapshot-preview1", + "web-sys", + "winapi", ] [[package]] name = "quinn" -version = "0.10.2" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" +checksum = "c3bd15a6f2967aef83887dcb9fec0014580467e33720d073560cf015a5683012" dependencies = [ "bytes", + "cfg_aliases", "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash", - "rustls", - "thiserror", + "rustc-hash 2.1.1", + "rustls 0.23.26", + "socket2", + "thiserror 2.0.12", "tokio", "tracing", + "web-time", ] [[package]] name = "quinn-proto" -version = "0.10.6" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "141bf7dfde2fbc246bfd3fe12f2455aa24b0fbd9af535d8c86c7bd1381ff2b1a" +checksum = "b820744eb4dc9b57a3398183639c511b5a26d2ed702cedd3febaa1393caa22cc" dependencies = [ "bytes", - "rand 0.8.5", - "ring 0.16.20", - "rustc-hash", - "rustls", - "rustls-native-certs", + "getrandom 0.3.2", + "rand 0.9.1", + "ring", + "rustc-hash 2.1.1", + "rustls 0.23.26", + "rustls-pki-types", + "rustls-platform-verifier", "slab", - "thiserror", + "thiserror 2.0.12", "tinyvec", "tracing", + "web-time", ] [[package]] name = "quinn-udp" -version = "0.4.1" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" +checksum = "541d0f57c6ec747a90738a52741d3221f7960e8ac2f0ff4b1a63680e033b4ab5" dependencies = [ - "bytes", + "cfg_aliases", "libc", + "once_cell", "socket2", "tracing", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -4098,6 +3501,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + [[package]] name = "radium" version = "0.7.0" @@ -4128,6 +3537,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -4148,6 +3567,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + [[package]] name = "rand_core" version = "0.5.1" @@ -4166,6 +3595,15 @@ dependencies = [ "getrandom 0.2.15", ] +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.2", +] + [[package]] name = "rand_hc" version = "0.2.0" @@ -4184,6 +3622,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "raw-cpuid" +version = "11.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146" +dependencies = [ + "bitflags 2.6.0", +] + [[package]] name = "rayon" version = "1.10.0" @@ -4204,27 +3651,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "rcgen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" -dependencies = [ - "pem", - "ring 0.16.20", - "time", - "yasna", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.5.2" @@ -4236,20 +3662,20 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.15", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "regex" -version = "1.10.5" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -4259,9 +3685,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -4270,9 +3696,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rend" @@ -4300,16 +3726,15 @@ dependencies = [ "http-body", "hyper", "hyper-rustls", - "hyper-tls", "ipnet", "js-sys", "log", "mime", - "native-tls", + "mime_guess", "once_cell", "percent-encoding", "pin-project-lite", - "rustls", + "rustls 0.21.12", "rustls-pemfile", "serde", "serde_json", @@ -4317,32 +3742,30 @@ dependencies = [ "sync_wrapper", "system-configuration", "tokio", - "tokio-native-tls", "tokio-rustls", "tokio-util 0.7.11", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", - "wasm-streams", "web-sys", "webpki-roots 0.25.4", "winreg", ] [[package]] -name = "ring" -version = "0.16.20" +name = "reqwest-middleware" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "5a735987236a8e238bf0296c7e351b999c188ccc11477f311b82b55c93984216" dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", + "anyhow", + "async-trait", + "http", + "reqwest", + "serde", + "task-local-extensions", + "thiserror 1.0.69", ] [[package]] @@ -4355,8 +3778,8 @@ dependencies = [ "cfg-if", "getrandom 0.2.15", "libc", - "spin 0.9.8", - "untrusted 0.9.0", + "spin", + "untrusted", "windows-sys 0.52.0", ] @@ -4410,49 +3833,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "rust-ini" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" -dependencies = [ - "cfg-if", - "ordered-multimap", -] - -[[package]] -name = "rust-s3" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b2ac5ff6acfbe74226fa701b5ef793aaa054055c13ebb7060ad36942956e027" -dependencies = [ - "async-trait", - "aws-creds", - "aws-region", - "base64 0.13.1", - "bytes", - "cfg-if", - "futures", - "hex", - "hmac 0.12.1", - "http", - "log", - "maybe-async", - "md5", - "minidom", - "percent-encoding", - "quick-xml", - "reqwest", - "serde", - "serde_derive", - "sha2 0.10.8", - "thiserror", - "time", - "tokio", - "tokio-stream", - "url", -] - [[package]] name = "rust_decimal" version = "1.35.0" @@ -4481,6 +3861,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + [[package]] name = "rustc_version" version = "0.4.0" @@ -4501,15 +3887,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.34" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4519,19 +3905,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", - "ring 0.17.8", - "rustls-webpki", + "ring", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.23.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki 0.103.1", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pki-types", "schannel", "security-framework", ] @@ -4546,37 +3946,67 @@ dependencies = [ ] [[package]] -name = "rustls-webpki" -version = "0.101.7" +name = "rustls-pki-types" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "web-time", ] [[package]] -name = "rustversion" -version = "1.0.17" +name = "rustls-platform-verifier" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "4a5467026f437b4cb2a533865eaa73eb840019a0916f4b9ec563c6e617e086c9" +dependencies = [ + "core-foundation 0.10.0", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls 0.23.26", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki 0.103.1", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.59.0", +] [[package]] -name = "rxml" -version = "0.9.1" +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + +[[package]] +name = "rustls-webpki" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a98f186c7a2f3abbffb802984b7f1dfd65dac8be1aafdaabbca4137f53f0dff7" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "bytes", - "rxml_validation", - "smartstring", + "ring", + "untrusted", ] [[package]] -name = "rxml_validation" -version = "0.9.1" +name = "rustls-webpki" +version = "0.103.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a197350ece202f19a166d1ad6d9d6de145e1d2a8ef47db299abe164dbd7530" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" @@ -4595,11 +4025,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4623,7 +4053,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -4637,20 +4067,6 @@ name = "scroll" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" -dependencies = [ - "scroll_derive", -] - -[[package]] -name = "scroll_derive" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.58", -] [[package]] name = "sct" @@ -4658,8 +4074,8 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "ring", + "untrusted", ] [[package]] @@ -4670,12 +4086,12 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "security-framework" -version = "2.11.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -4683,9 +4099,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -4708,9 +4124,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] @@ -4726,13 +4142,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -4743,7 +4159,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -4757,12 +4173,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ - "indexmap 2.6.0", "itoa", + "memchr", "ryu", "serde", ] @@ -4790,24 +4206,25 @@ dependencies = [ [[package]] name = "serde_with" -version = "2.3.3" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ "serde", + "serde_derive", "serde_with_macros", ] [[package]] name = "serde_with_macros" -version = "2.3.3" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -4816,7 +4233,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.6.0", + "indexmap", "itoa", "ryu", "serde", @@ -4858,18 +4275,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug", -] - [[package]] name = "sha3" version = "0.10.8" @@ -4896,13 +4301,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" [[package]] -name = "shellexpand" -version = "2.1.2" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" -dependencies = [ - "dirs", -] +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" @@ -4965,17 +4367,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "smartstring" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" -dependencies = [ - "autocfg", - "static_assertions", - "version_check", -] - [[package]] name = "socket2" version = "0.5.7" @@ -4986,118 +4377,154 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "solana-account" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "730219420b206253977b8cc8fd7846ffe021ab2e2c718e70db420efbd2775547" +dependencies = [ + "bincode", + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-program", +] + [[package]] name = "solana-account-decoder" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4973213a11c2e1b924b36e0c6688682b5aa4623f8d4eeaa1204c32cee524e6d6" +checksum = "14e5b1c167335942b659d077552607f79b2eca3472e40eeed97a2c55838b84ef" dependencies = [ "Inflector", - "base64 0.21.7", + "base64 0.22.1", "bincode", - "bs58 0.4.0", + "bs58", "bv", "lazy_static", "serde", "serde_derive", "serde_json", + "solana-account-decoder-client-types", "solana-config-program", "solana-sdk", - "spl-token 4.0.0", - "spl-token-2022 1.0.0", - "spl-token-group-interface 0.1.0", - "spl-token-metadata-interface 0.2.0", - "thiserror", + "spl-token 6.0.0", + "spl-token-2022 4.0.0", + "spl-token-group-interface 0.3.0", + "spl-token-metadata-interface 0.4.0", + "thiserror 1.0.69", + "zstd", +] + +[[package]] +name = "solana-account-decoder-client-types" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee0750d2f106ecbee6d4508b6e2029e6946cb5f67288bf002b5a62f9f451c43" +dependencies = [ + "base64 0.22.1", + "bs58", + "serde", + "serde_derive", + "serde_json", + "solana-account", + "solana-pubkey", "zstd", ] +[[package]] +name = "solana-account-info" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6abe81cfc4a75f71a510c6856b03a7d8525e416af3c69d55daef62e6078b8d40" +dependencies = [ + "bincode", + "serde", + "solana-program-error", + "solana-program-memory", + "solana-pubkey", +] + [[package]] name = "solana-accounts-db" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c06263320e399af20d46c8cebea7a1d5dc1bc56f31f8dfaacf7119576c48a7" +checksum = "b9fecc332ad4edd98ed63e5a46d990ecaf6fe4abd2bf9795c15474a64534ced6" dependencies = [ - "arrayref", + "ahash 0.8.11", "bincode", "blake3", "bv", "bytemuck", - "byteorder", + "bytemuck_derive", "bzip2", "crossbeam-channel", "dashmap", - "flate2", - "fnv", - "im", "index_list", - "itertools", + "indexmap", + "itertools 0.12.1", "lazy_static", "log", "lz4", "memmap2", "modular-bitfield", - "num-derive 0.4.2", - "num-traits", "num_cpus", - "num_enum 0.7.2", - "ouroboros", - "percentage", - "qualifier_attr", + "num_enum", "rand 0.8.5", "rayon", - "regex", - "rustc_version", "seqlock", "serde", "serde_derive", "smallvec", "solana-bucket-map", - "solana-config-program", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-inline-spl", + "solana-lattice-hash", "solana-measure", "solana-metrics", "solana-nohash-hasher", - "solana-program-runtime", "solana-rayon-threadlimit", "solana-sdk", - "solana-stake-program", - "solana-system-program", - "solana-vote-program", + "solana-svm-transaction", "static_assertions", - "strum", - "strum_macros", "tar", "tempfile", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-address-lookup-table-program" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e57cb8f2e90361280b246f70bb7f5f86f4e4ff1ad5bbdfe18a81bea141f03a" +checksum = "2cf79a76f2878982b9781dfd0831d58ee15eb905be65406ccf7370c3ecd69c52" dependencies = [ "bincode", "bytemuck", "log", "num-derive 0.4.2", "num-traits", - "rustc_version", - "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-feature-set", + "solana-log-collector", "solana-program", "solana-program-runtime", "solana-sdk", - "thiserror", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-atomic-u64" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391b795afcdcad39ddc6c938d64b789d036cdfe00d9dc5ff83024cf2da9f066f" +dependencies = [ + "parking_lot", ] [[package]] name = "solana-banks-client" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c65a9540370523f3ade7190526309337cc50f1d742b3341dfa7357da3f59a56" +checksum = "2f857fb6590467d433f40eee507666ca496ec67907e50b7d530b6c04f6541875" dependencies = [ "borsh 1.5.1", "futures", @@ -5105,91 +4532,159 @@ dependencies = [ "solana-program", "solana-sdk", "tarpc", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-serde", ] [[package]] name = "solana-banks-interface" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b1dc20a7a71cf37bcbc2a3a5dfd73d7410a13850aa68d954a9c09e6a77e652" +checksum = "20052d231bb9ac3268dc61a713e3915d6c95fc942f9a5c15ca3a81a3fcd9cc12" dependencies = [ "serde", + "serde_derive", "solana-sdk", "tarpc", ] [[package]] name = "solana-banks-server" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d449d55d3c5c3fe4c9f0c9f790a9feabe294f8ff0b4c6b771a20b2313ad8974a" +checksum = "10db60e4bf077b870a7e75f8596bf3790d079b3762e9b4edc032475077007d0b" dependencies = [ "bincode", "crossbeam-channel", "futures", - "solana-accounts-db", "solana-banks-interface", "solana-client", + "solana-feature-set", "solana-runtime", "solana-sdk", "solana-send-transaction-service", + "solana-svm", "tarpc", "tokio", "tokio-serde", ] +[[package]] +name = "solana-bincode" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e85cb5961c356345a61378163fd9057011b35540f8bcdd8d8a09cb10117264f" +dependencies = [ + "bincode", + "serde", + "solana-instruction", +] + +[[package]] +name = "solana-bn254" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39c4030db26ad618f7e18fb5284df19fd52a68e092a1ca58db857108c4cc777" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "bytemuck", + "solana-program", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-borsh" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d526f3525ab22a3ada3f9a1d642664dafac00dc9208326b701a2045514eb04" +dependencies = [ + "borsh 0.10.3", + "borsh 1.5.1", +] + [[package]] name = "solana-bpf-loader-program" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1a55b8533f2dc716602e7c1b2bd555d5ac598ef6e80d28a517e6f31baf042e" +checksum = "142e0407f8428a1d2a33154d1d3d1c134ad257651ddff0811c17a6ee840def36" dependencies = [ "bincode", "byteorder", "libsecp256k1 0.6.0", "log", "scopeguard", + "solana-bn254", + "solana-compute-budget", + "solana-curve25519", + "solana-feature-set", + "solana-log-collector", "solana-measure", + "solana-poseidon", + "solana-program-memory", "solana-program-runtime", "solana-sdk", - "solana-zk-token-sdk", + "solana-timings", + "solana-type-overrides", "solana_rbpf", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-bucket-map" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda213af7ae26ce249120f211060d2a85d87fe367c6490ee19b70845cbd320fc" +checksum = "66eb348939fcfea6e40eed61bca06a1c631f8cb70f1801a5b14021bddefe93eb" dependencies = [ "bv", "bytemuck", + "bytemuck_derive", "log", "memmap2", "modular-bitfield", - "num_enum 0.7.2", + "num_enum", "rand 0.8.5", "solana-measure", "solana-sdk", "tempfile", ] +[[package]] +name = "solana-builtins-default-costs" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854270e266040355f5fd5b67c91855bc36cebf1d3f325eb54d8b1b0ca385f74b" +dependencies = [ + "ahash 0.8.11", + "lazy_static", + "log", + "solana-address-lookup-table-program", + "solana-bpf-loader-program", + "solana-compute-budget-program", + "solana-config-program", + "solana-loader-v4-program", + "solana-sdk", + "solana-stake-program", + "solana-system-program", + "solana-vote-program", +] + [[package]] name = "solana-clap-utils" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909f4553d0b31bb5b97533a6b64cc321a4eace9112d6efbabcf4408ea1b3f1db" +checksum = "1709e1b0aefc8062fca29a4fde8d35f39ee95586e77cc6360e9bfc50a094c44f" dependencies = [ "chrono", - "clap 2.34.0", + "clap", "rpassword", + "solana-derivation-path", "solana-remote-wallet", "solana-sdk", - "thiserror", + "thiserror 1.0.69", "tiny-bip39", "uriparse", "url", @@ -5197,9 +4692,9 @@ dependencies = [ [[package]] name = "solana-cli-config" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2242c4a0776cdaec1358d0ffc61b32131985a7b2210c491fa465d28c313eb880" +checksum = "384fda0ddf3099eab0f702b326663f499e84731e8584fd7d0c6d8bab03bead79" dependencies = [ "dirs-next", "lazy_static", @@ -5213,14 +4708,14 @@ dependencies = [ [[package]] name = "solana-cli-output" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bada4ba96ef2f351363ba64ce4f592bc584ac48bb7d9da4e41303416b0a21026" +checksum = "b82ae7fc5a012ad5bc4077a235ea5b26145fab50ca05b550e792a50bdd6d77a9" dependencies = [ "Inflector", - "base64 0.21.7", + "base64 0.22.1", "chrono", - "clap 2.34.0", + "clap", "console", "humantime", "indicatif", @@ -5235,28 +4730,27 @@ dependencies = [ "solana-sdk", "solana-transaction-status", "solana-vote-program", - "spl-memo", + "spl-memo 5.0.0", ] [[package]] name = "solana-client" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5cc431df6cc1dd964134fa4ec7df765d3af3fae9c2148f96a3c4fb500290633" +checksum = "1d9a40b8e9e11604e8c05e8b5fcdb89359235db47d1aae84dcba0fc98e95dd0c" dependencies = [ "async-trait", "bincode", "dashmap", "futures", "futures-util", - "indexmap 2.6.0", + "indexmap", "indicatif", "log", "quinn", "rayon", "solana-connection-cache", "solana-measure", - "solana-metrics", "solana-pubsub-client", "solana-quic-client", "solana-rpc-client", @@ -5267,15 +4761,35 @@ dependencies = [ "solana-thin-client", "solana-tpu-client", "solana-udp-client", - "thiserror", + "thiserror 1.0.69", "tokio", ] +[[package]] +name = "solana-clock" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7848171e53fa528efd41dd4b3ab919f47b851f8bb4a827d63ff95678f08737fc" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-macro", +] + +[[package]] +name = "solana-compute-budget" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebf2f023f471bd1195b7f420e13ffc2422592dd48e71104b4901300b49ac493e" +dependencies = [ + "solana-sdk", +] + [[package]] name = "solana-compute-budget-program" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eb36ef3c3a1f38515c1ae0d255c4d6e5e635a856ac2aa1cd5f892b3db58e857" +checksum = "73eddf023f02a56daa838818e30894b874368a741782457468eeefdfce2f7f53" dependencies = [ "solana-program-runtime", "solana-sdk", @@ -5283,189 +4797,361 @@ dependencies = [ [[package]] name = "solana-config-program" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e38b040d3a42e8f7d80c4a86bb0d49d7aed663b56b0fe0ae135d2d145fb7ae3a" +checksum = "a035a01970ebbf40a244b3b79af533329ac8d48d80b0b98e166e23e35aa88171" dependencies = [ "bincode", "chrono", "serde", "serde_derive", + "solana-log-collector", "solana-program-runtime", "solana-sdk", + "solana-short-vec", ] [[package]] name = "solana-connection-cache" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae02622c63943485f0af3d0896626eaf6478e734f0b6bc61c7cc5320963c6e75" +checksum = "5f45dd2a6d5d55ed951781486231d0d2ee9ff7047fdafaed01ee021e236319d0" dependencies = [ "async-trait", "bincode", "crossbeam-channel", "futures-util", - "indexmap 2.6.0", + "indexmap", "log", "rand 0.8.5", "rayon", - "rcgen", "solana-measure", "solana-metrics", "solana-sdk", - "thiserror", + "thiserror 1.0.69", "tokio", ] [[package]] name = "solana-cost-model" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "838532d8437d00958621d2589d6033e9c69ea95cd0936efa8964146e49dcff53" +checksum = "448128561bb950bce19cdbbdc1780955a52ef25f1984c9c13b35b4b9cdc548c4" dependencies = [ + "ahash 0.8.11", "lazy_static", "log", - "rustc_version", - "solana-address-lookup-table-program", - "solana-bpf-loader-program", - "solana-compute-budget-program", - "solana-config-program", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-loader-v4-program", + "solana-builtins-default-costs", + "solana-compute-budget", + "solana-feature-set", "solana-metrics", - "solana-program-runtime", + "solana-runtime-transaction", "solana-sdk", - "solana-stake-program", - "solana-system-program", + "solana-svm-transaction", "solana-vote-program", ] [[package]] -name = "solana-frozen-abi" -version = "1.18.17" +name = "solana-cpi" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4867f66e9527fa44451c861c1dc6d9b2a7c7a668d7c6a297cdefbe39f4395b33" +checksum = "25c536ad0ce25d84a64f48dedcb773e764827e0ef781eda41fa1fa35f5d64b38" dependencies = [ - "block-buffer 0.10.4", - "bs58 0.4.0", - "bv", - "either", - "generic-array", - "im", - "lazy_static", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_bytes", - "serde_derive", - "sha2 0.10.8", - "solana-frozen-abi-macro", - "subtle", - "thiserror", + "solana-account-info", + "solana-define-syscall", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-stable-layout", ] [[package]] -name = "solana-frozen-abi-macro" -version = "1.18.17" +name = "solana-curve25519" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168f24d97347b85f05192df58d6be3e3047a4aadc4001bc1b9e711a5ec878eea" +checksum = "f934d38b6f2a940fb1e1d8eaa17a14ffd3773b37be9fb29fa4bcec1bac5e4591" dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn 2.0.58", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "solana-program", + "thiserror 1.0.69", ] [[package]] -name = "solana-loader-v4-program" -version = "1.18.17" +name = "solana-decode-error" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c426482234b7c267a5e0dfa8198442e1ffad2ad6c521f6b810949bc2719215" +checksum = "c5a431f532d030098e81d120877f2dddbd3dd90bea5b259198a6aae4ff6456c3" dependencies = [ - "log", - "solana-measure", - "solana-program-runtime", - "solana-sdk", - "solana_rbpf", + "num-traits", ] [[package]] -name = "solana-logger" -version = "1.18.17" +name = "solana-define-syscall" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7062ae1de58e294d3bee5fd2c89efc155b7f7383ddce4cb88345dfafaaabc5bd" + +[[package]] +name = "solana-derivation-path" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0511082fc62f2d086520fff5aa1917c389d8c840930c08ad255ae05952c08a2" +checksum = "12080d9bf8eecd559c6f40b5aaf9e47f7f28f515218087f83f02e493b46d8388" dependencies = [ - "env_logger 0.9.3", - "lazy_static", - "log", + "derivation-path", + "qstring", + "uriparse", ] [[package]] -name = "solana-measure" -version = "1.18.17" +name = "solana-epoch-schedule" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55a3df105431d25f86f2a7da0cbbde5f54c1f0782ca59367ea4a8037bc6797" +checksum = "65c4cf7d7c266d353169cf4feeada5e4bba3a55f33715535fa1ef49080eac3e0" dependencies = [ - "log", - "solana-sdk", + "serde", + "serde_derive", + "solana-sdk-macro", ] [[package]] -name = "solana-metrics" -version = "1.18.17" +name = "solana-feature-set" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddec097ed7572804389195128dbd57958b427829153c6cd8ec3343c86fe3cd22" +checksum = "5cebf45992982065a0b01b4e109bf039b2ebf6394b21672382fd951516d4c9b0" dependencies = [ - "crossbeam-channel", - "gethostname", "lazy_static", - "log", - "reqwest", - "solana-sdk", - "thiserror", + "solana-clock", + "solana-epoch-schedule", + "solana-hash", + "solana-pubkey", + "solana-sha256-hasher", ] [[package]] -name = "solana-net-utils" -version = "1.18.17" +name = "solana-fee" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258fa7c29fb7605b8d2ed89aa0d43c640d14f4147ad1f5b3fdad19a1ac145ca5" +checksum = "833e9a34c8cb1271e360b240dce43065cc4419ad74fc7e807c4e30cf06ebca80" dependencies = [ - "bincode", - "clap 3.2.25", - "crossbeam-channel", - "log", - "nix", - "rand 0.8.5", - "serde", - "serde_derive", - "socket2", - "solana-logger", "solana-sdk", - "solana-version", - "tokio", - "url", + "solana-svm-transaction", ] [[package]] -name = "solana-nohash-hasher" -version = "0.2.1" +name = "solana-fee-calculator" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2befe056ece2eb5807298c2b569a35ee52f79df859bdd16a1f97869f8224a28" +dependencies = [ + "log", + "serde", + "serde_derive", +] + +[[package]] +name = "solana-hash" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1807bc4e9e1d25271514167d5a1e698ce5a330bce547a368242dd63b355b5faa" +dependencies = [ + "borsh 1.5.1", + "bs58", + "bytemuck", + "bytemuck_derive", + "js-sys", + "serde", + "serde_derive", + "solana-atomic-u64", + "solana-sanitize", + "wasm-bindgen", +] + +[[package]] +name = "solana-inflation" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a60b572cdf0ec8fcf5a53e5ba4e3e19814dd96c2b9c156d5828be68d0d2e7103" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "solana-inline-spl" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24c9c6590e4eaf91efa887b2689b2941fe4b324bccd9a95f77853168f3d9a88" +dependencies = [ + "bytemuck", + "solana-pubkey", +] + +[[package]] +name = "solana-instruction" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfef689e06e5c7cb6206d4dc61ac77733de4f72d754e0d531393206abc27dbe4" +dependencies = [ + "bincode", + "borsh 1.5.1", + "getrandom 0.2.15", + "js-sys", + "num-traits", + "serde", + "serde_derive", + "solana-define-syscall", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-last-restart-slot" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3186feae497bdfd2e77bfa56caed38b1cb1b0f389506666e3331f0b9ae799cb" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-macro", +] + +[[package]] +name = "solana-lattice-hash" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ec86f48a8694d55757922823823069a3652d2896f61f3ffc4b741646c166a62" +dependencies = [ + "base64 0.22.1", + "blake3", + "bs58", + "bytemuck", +] + +[[package]] +name = "solana-loader-v4-program" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94c6915a49e537925e934551dbce2db2357d555d257a311bbf5ba0810cb1017a" +dependencies = [ + "log", + "solana-bpf-loader-program", + "solana-compute-budget", + "solana-log-collector", + "solana-measure", + "solana-program-runtime", + "solana-sdk", + "solana-type-overrides", + "solana_rbpf", +] + +[[package]] +name = "solana-log-collector" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b529f5736a6c0794a885dac2e091138d3db6d924335906f117a62b58b0d3b5dc" +dependencies = [ + "log", +] + +[[package]] +name = "solana-logger" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "367c5431bad14b10fbb62614b48720b746672558dba3244167ff7d251890c355" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-measure" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b2047a2f588082b71080b060918f107c3330ae1505f759c3b2d74bae9d9c88" + +[[package]] +name = "solana-metrics" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6319c74238e8ed4f7159fd37c693a574ab8316d03b053103f9cc83dce13f1d5c" +dependencies = [ + "crossbeam-channel", + "gethostname", + "lazy_static", + "log", + "reqwest", + "solana-sdk", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-msg" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f7551f85064bc7299d56dbd7126258b084a2d78d0325b1579324f818b405123" +dependencies = [ + "solana-define-syscall", +] + +[[package]] +name = "solana-native-token" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0c4074f5fc67574dabd8f30fe6e51e290a812d88326b19b49c462058e23340" + +[[package]] +name = "solana-net-utils" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbac19474a4c4f91cb264c2fccead8a1a4f65384ce650b24360d9df5650e65bc" +dependencies = [ + "bincode", + "crossbeam-channel", + "log", + "nix", + "rand 0.8.5", + "serde", + "serde_derive", + "socket2", + "solana-sdk", + "tokio", + "url", +] + +[[package]] +name = "solana-nohash-hasher" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b8a731ed60e89177c8a7ab05fe0f1511cedd3e70e773f288f9de33a9cfdc21e" +[[package]] +name = "solana-packet" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dafc2d84e57dbfe32583fe915962bd2ca3af6be496628a871db3c3d697b38d7" +dependencies = [ + "bincode", + "bitflags 2.6.0", + "cfg_eval", + "serde", + "serde_derive", + "serde_with", +] + [[package]] name = "solana-perf" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca422edcf16a6e64003ca118575ea641f7b750f14a0ad28c71dd84f33dcb912a" +checksum = "e8299f1ba518f9888da8cafa861addc6ffdd639c689e3ce219ae08212c0dcd0e" dependencies = [ "ahash 0.8.11", "bincode", "bv", "caps", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "dlopen2", "fnv", "lazy_static", @@ -5474,47 +5160,59 @@ dependencies = [ "nix", "rand 0.8.5", "rayon", - "rustc_version", "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", "solana-metrics", "solana-rayon-threadlimit", "solana-sdk", + "solana-short-vec", "solana-vote-program", ] [[package]] -name = "solana-program" -version = "1.18.17" +name = "solana-poseidon" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc5a636dc75e5c25651e34f7a36afc9ae60d38166687c5b0375abb580ac81a2" +checksum = "f193a65f0db7fe5615c76c2814d6450a2e4cda61f786d5bf7a6b1ad0c179b947" dependencies = [ "ark-bn254", - "ark-ec", - "ark-ff", - "ark-serialize", - "base64 0.21.7", + "light-poseidon", + "solana-define-syscall", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-precompile-error" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a30ab58b9e37cde4e5577282670f30df71b97b6b06dbdb420e9b84e57b831227" +dependencies = [ + "num-traits", + "solana-decode-error", +] + +[[package]] +name = "solana-program" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9040decf2f295d35da22557eeab3768ab8dfca8aed9afe668663c8fa0e97d60e" +dependencies = [ + "base64 0.22.1", "bincode", "bitflags 2.6.0", "blake3", "borsh 0.10.3", - "borsh 0.9.3", "borsh 1.5.1", - "bs58 0.4.0", + "bs58", "bv", "bytemuck", - "cc", + "bytemuck_derive", "console_error_panic_hook", "console_log", - "curve25519-dalek", + "curve25519-dalek 4.1.3", + "five8_const", "getrandom 0.2.15", - "itertools", "js-sys", "lazy_static", - "libc", - "libsecp256k1 0.6.0", - "light-poseidon", "log", "memoffset 0.9.1", "num-bigint 0.4.6", @@ -5522,60 +5220,140 @@ dependencies = [ "num-traits", "parking_lot", "rand 0.8.5", - "rustc_version", - "rustversion", "serde", "serde_bytes", "serde_derive", - "serde_json", "sha2 0.10.8", - "sha3 0.10.8", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "sha3", + "solana-account-info", + "solana-atomic-u64", + "solana-bincode", + "solana-borsh", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-define-syscall", + "solana-epoch-schedule", + "solana-fee-calculator", + "solana-hash", + "solana-instruction", + "solana-last-restart-slot", + "solana-msg", + "solana-native-token", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sanitize", "solana-sdk-macro", - "thiserror", - "tiny-bip39", + "solana-secp256k1-recover", + "solana-serde-varint", + "solana-serialize-utils", + "solana-sha256-hasher", + "solana-short-vec", + "solana-slot-hashes", + "solana-slot-history", + "solana-stable-layout", + "solana-transaction-error", + "thiserror 1.0.69", "wasm-bindgen", - "zeroize", +] + +[[package]] +name = "solana-program-entrypoint" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eb90f3fa3e979b912451a404508f1f90bb6e5c1d7767625f622b20016fb9fde" +dependencies = [ + "solana-account-info", + "solana-msg", + "solana-program-error", + "solana-pubkey", +] + +[[package]] +name = "solana-program-error" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd089caeef26dd07bd12b7b67d45e92faddc2fc67a960f316df7ae4776a2f3d5" +dependencies = [ + "borsh 1.5.1", + "num-traits", + "serde", + "serde_derive", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-pubkey", +] + +[[package]] +name = "solana-program-memory" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed4bc044dc2b49c323aeff04aec03c908a052e278c2edf2f7616f32fc0f1bcd9" +dependencies = [ + "num-traits", + "solana-define-syscall", +] + +[[package]] +name = "solana-program-option" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3babbdffd81994c043fc9a61458ce87496218825d6e9a303de643c0a53089b9a" + +[[package]] +name = "solana-program-pack" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fb28439d23e1f505e59c7a14ed5012365ab7aa0f20dc7bda048e02ff231cf6" +dependencies = [ + "solana-program-error", ] [[package]] name = "solana-program-runtime" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf373c3da0387f47fee4c5ed2465a9628b9db026a62211a692a9285aa9251544" +checksum = "ba1de51df173401d50c0f4cf750f5070d7a4c82125a03c1aec9622dc041b0b54" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "bincode", - "eager", "enum-iterator", - "itertools", + "itertools 0.12.1", "libc", "log", "num-derive 0.4.2", "num-traits", "percentage", "rand 0.8.5", - "rustc_version", "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-compute-budget", + "solana-feature-set", + "solana-log-collector", "solana-measure", "solana-metrics", "solana-sdk", + "solana-timings", + "solana-type-overrides", + "solana-vote", "solana_rbpf", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-program-test" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9194b8744c5b135401ab4a2923a1072d3a67697bd50f7450a4ed5302f36a6999" +checksum = "974591eca853eafee8196a3445b81fd03ebd9b3e38a6dd7b6f22dc3414c32be6" dependencies = [ "assert_matches", "async-trait", - "base64 0.21.7", + "base64 0.22.1", "bincode", "chrono-humanize", "crossbeam-channel", @@ -5586,22 +5364,55 @@ dependencies = [ "solana-banks-interface", "solana-banks-server", "solana-bpf-loader-program", + "solana-compute-budget", + "solana-feature-set", + "solana-inline-spl", + "solana-instruction", + "solana-log-collector", "solana-logger", "solana-program-runtime", "solana-runtime", "solana-sdk", + "solana-svm", + "solana-timings", "solana-vote-program", "solana_rbpf", - "test-case", - "thiserror", + "thiserror 1.0.69", "tokio", ] +[[package]] +name = "solana-pubkey" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bea3215775fcedf200d47590c7e2ce9a3a46bc2b7d3f77d0eae9c6edf0a39aec" +dependencies = [ + "borsh 0.10.3", + "borsh 1.5.1", + "bs58", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "five8_const", + "getrandom 0.2.15", + "js-sys", + "num-traits", + "rand 0.8.5", + "serde", + "serde_derive", + "solana-atomic-u64", + "solana-decode-error", + "solana-define-syscall", + "solana-sanitize", + "solana-sha256-hasher", + "wasm-bindgen", +] + [[package]] name = "solana-pubsub-client" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b9abc76168d19927561db6a3685b98752bd0961b4ce4f8b7f85ee12238c017" +checksum = "9d28adf5ff89c19ef3cb24d0f484afa05852697881c2e4ef12aec190d61f76d8" dependencies = [ "crossbeam-channel", "futures-util", @@ -5614,7 +5425,7 @@ dependencies = [ "solana-account-decoder", "solana-rpc-client-api", "solana-sdk", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-stream", "tokio-tungstenite", @@ -5624,20 +5435,19 @@ dependencies = [ [[package]] name = "solana-quic-client" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7952c5306a0be5f5276448cd20246b31265bfa884f29a077a24303c6a16aeb34" +checksum = "259c6d420c0b7620557700f13fbbdb00afbb1b82274485c27ba30dd660ea921b" dependencies = [ - "async-mutex", + "async-lock", "async-trait", "futures", - "itertools", + "itertools 0.12.1", "lazy_static", "log", "quinn", "quinn-proto", - "rcgen", - "rustls", + "rustls 0.23.26", "solana-connection-cache", "solana-measure", "solana-metrics", @@ -5645,15 +5455,15 @@ dependencies = [ "solana-rpc-client-api", "solana-sdk", "solana-streamer", - "thiserror", + "thiserror 1.0.69", "tokio", ] [[package]] name = "solana-rayon-threadlimit" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4fa0cc66f8e73d769bca2ede3012ba2ef8ab67963e832808665369f2cf81743" +checksum = "4c69806ad1a7b0986f750134e13e55d83919631d81a2328a588615740e14ed0a" dependencies = [ "lazy_static", "num_cpus", @@ -5661,9 +5471,9 @@ dependencies = [ [[package]] name = "solana-remote-wallet" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "289803796d4ff7b4699504d3ab9e9d9c5205ea3892b2ebe397b377494dbd75d4" +checksum = "6f36cf8ad0090276b5e9c73512df889b84092761ed733a26781b164c9e95f544" dependencies = [ "console", "dialoguer", @@ -5673,32 +5483,45 @@ dependencies = [ "parking_lot", "qstring", "semver", + "solana-derivation-path", "solana-sdk", - "thiserror", + "thiserror 1.0.69", "uriparse", ] +[[package]] +name = "solana-rent" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aab3f4a270196c38d62c3bb3c7a2f07732af2c772b50da49c9b1e2c9d2ace286" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-macro", +] + [[package]] name = "solana-rpc-client" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb55a08018776a62ecff52139fbcdab1a7baa4e8f077202be58156e8dde4d5f" +checksum = "3b05822aceeb484074a72d82a1b289da9fc3383f9ba3f55ce4bfd003bf9d62e6" dependencies = [ "async-trait", - "base64 0.21.7", + "base64 0.22.1", "bincode", - "bs58 0.4.0", + "bs58", "indicatif", "log", "reqwest", + "reqwest-middleware", "semver", "serde", "serde_derive", "serde_json", - "solana-account-decoder", + "solana-account-decoder-client-types", "solana-rpc-client-api", "solana-sdk", - "solana-transaction-status", + "solana-transaction-status-client-types", "solana-version", "solana-vote-program", "tokio", @@ -5706,48 +5529,49 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a8403038f4d6ab65bc7e7afb3afe8d9824c592232553c5cef55cf3de36025d" +checksum = "cb9c6e64f01cfafef9b2d43d6adb02979bb22f579ec8ee88b77796259acce92e" dependencies = [ - "base64 0.21.7", - "bs58 0.4.0", + "anyhow", + "base64 0.22.1", + "bs58", "jsonrpc-core", "reqwest", + "reqwest-middleware", "semver", "serde", "serde_derive", "serde_json", - "solana-account-decoder", + "solana-account-decoder-client-types", + "solana-inline-spl", "solana-sdk", - "solana-transaction-status", + "solana-transaction-status-client-types", "solana-version", - "spl-token-2022 1.0.0", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-rpc-client-nonce-utils" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4caca735caf76d51c074c3bacbfe38094bf7f92cfbe7b5b13f3bc4946e64f889" +checksum = "7f0ab2d1ca3769c5058c689b438d35eb1cb7d2a32fc4b2b7c16fe72fa187927c" dependencies = [ - "clap 2.34.0", - "solana-clap-utils", "solana-rpc-client", "solana-sdk", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-runtime" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699943045665038bfa4e76dd2582b4c390f1aec6ab5edef36da43afe3469f1d" +checksum = "60f579df1ed24b2e7be5c99c2b97cb2a331823008129103b5b7753057ddf3cf7" dependencies = [ + "ahash 0.8.11", "aquamarine", "arrayref", - "base64 0.21.7", + "base64 0.22.1", "bincode", "blake3", "bv", @@ -5761,10 +5585,10 @@ dependencies = [ "fnv", "im", "index_list", - "itertools", + "itertools 0.12.1", "lazy_static", + "libc", "log", - "lru", "lz4", "memmap2", "mockall", @@ -5772,38 +5596,49 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_cpus", - "num_enum 0.7.2", - "ouroboros", + "num_enum", "percentage", "qualifier_attr", "rand 0.8.5", "rayon", "regex", - "rustc_version", "serde", "serde_derive", "serde_json", + "serde_with", "solana-accounts-db", "solana-address-lookup-table-program", "solana-bpf-loader-program", "solana-bucket-map", + "solana-compute-budget", "solana-compute-budget-program", "solana-config-program", "solana-cost-model", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-feature-set", + "solana-fee", + "solana-inline-spl", + "solana-lattice-hash", "solana-loader-v4-program", "solana-measure", "solana-metrics", "solana-perf", + "solana-program", "solana-program-runtime", "solana-rayon-threadlimit", + "solana-runtime-transaction", "solana-sdk", "solana-stake-program", + "solana-svm", + "solana-svm-rent-collector", + "solana-svm-transaction", "solana-system-program", + "solana-timings", + "solana-transaction-status", "solana-version", "solana-vote", "solana-vote-program", + "solana-zk-elgamal-proof-program", + "solana-zk-sdk", "solana-zk-token-proof-program", "solana-zk-token-sdk", "static_assertions", @@ -5812,32 +5647,52 @@ dependencies = [ "symlink", "tar", "tempfile", - "thiserror", + "thiserror 1.0.69", "zstd", ] +[[package]] +name = "solana-runtime-transaction" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01e1757d4473c7a2f462d2ce5f3cb5689145cfbde3a6b12161a49e497633ab85" +dependencies = [ + "agave-transaction-view", + "log", + "solana-builtins-default-costs", + "solana-compute-budget", + "solana-pubkey", + "solana-sdk", + "solana-svm-transaction", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-sanitize" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "203b90994371db8cade8e885f74ec9f68ee02a32b25d514594158b2551a4e5ed" + [[package]] name = "solana-sdk" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df43d3a1e1637397ab43cbc216a5a8f977ec8a3cc3f3ae8c3851c83a3255dbcf" +checksum = "524604d94185c189616296e5b7da1014cc96d1e446bd2b26f247f00708b9225a" dependencies = [ - "assert_matches", - "base64 0.21.7", "bincode", "bitflags 2.6.0", "borsh 1.5.1", - "bs58 0.4.0", + "bs58", "bytemuck", + "bytemuck_derive", "byteorder", "chrono", - "derivation-path", "digest 0.10.7", "ed25519-dalek", "ed25519-dalek-bip32", - "generic-array", + "getrandom 0.1.16", "hmac 0.12.1", - "itertools", + "itertools 0.12.1", "js-sys", "lazy_static", "libsecp256k1 0.6.0", @@ -5845,43 +5700,64 @@ dependencies = [ "memmap2", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.2", + "num_enum", "pbkdf2 0.11.0", - "qstring", - "qualifier_attr", "rand 0.7.3", "rand 0.8.5", - "rustc_version", - "rustversion", "serde", "serde_bytes", "serde_derive", "serde_json", "serde_with", "sha2 0.10.8", - "sha3 0.10.8", + "sha3", "siphasher", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", + "solana-account", + "solana-bn254", + "solana-decode-error", + "solana-derivation-path", + "solana-feature-set", + "solana-inflation", + "solana-instruction", + "solana-native-token", + "solana-packet", + "solana-precompile-error", "solana-program", + "solana-program-memory", + "solana-pubkey", + "solana-sanitize", "solana-sdk-macro", - "thiserror", - "uriparse", + "solana-secp256k1-recover", + "solana-serde-varint", + "solana-short-vec", + "solana-signature", + "solana-transaction-error", + "thiserror 1.0.69", "wasm-bindgen", ] [[package]] name = "solana-sdk-macro" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86c76414183a325038ff020b22c07d1e9d2da0703ddc0244acfed37ee2921d96" +checksum = "1bd2265b93dce9d3dcf9f395abf1a85b5e06e4da4aa60ca147620003ac3abc67" dependencies = [ - "bs58 0.4.0", + "bs58", "proc-macro2", "quote", - "rustversion", - "syn 2.0.58", + "syn 2.0.100", +] + +[[package]] +name = "solana-secp256k1-recover" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2eef5a00a75648273c3fb6e3d85b0c8c02fcc1e36c4271664dcc39b6b128d41" +dependencies = [ + "borsh 1.5.1", + "libsecp256k1 0.6.0", + "solana-define-syscall", + "thiserror 1.0.69", ] [[package]] @@ -5892,13 +5768,14 @@ checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" [[package]] name = "solana-send-transaction-service" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e056d865d22548bb7228121e118aa632486fc1a33a100961e5e98b5663371384" +checksum = "8dc6adaa31bdaab1e5f8932575e75160f4806553ab5e15e552c258dfe1d5594b" dependencies = [ "crossbeam-channel", "log", "solana-client", + "solana-connection-cache", "solana-measure", "solana-metrics", "solana-runtime", @@ -5906,73 +5783,217 @@ dependencies = [ "solana-tpu-client", ] +[[package]] +name = "solana-serde-varint" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aeb51d3c20e2a61db0ef72617f3b8c9207a342a867af454a95f17add9f6c262" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-serialize-utils" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cfb0b57c6a431fb15ff33053caadb6c36aed4e1ce74bea9adfc459a710b3626" +dependencies = [ + "solana-instruction", + "solana-pubkey", + "solana-sanitize", +] + +[[package]] +name = "solana-sha256-hasher" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd115f3a1136314b0183235080d29023530c3a0a5df60505fdb7ea620eff9fd6" +dependencies = [ + "sha2 0.10.8", + "solana-define-syscall", + "solana-hash", +] + +[[package]] +name = "solana-short-vec" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08e55330b694db1139dcdf2a1ea7781abe8bd994dec2ab29e36abfd06e4e9274" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad9784d110f195a3a4fe423479d18f05b01a1c380a1430644a3b3038fdbe2f0" +dependencies = [ + "bs58", + "ed25519-dalek", + "generic-array", + "rand 0.8.5", + "serde", + "serde_derive", + "solana-sanitize", +] + +[[package]] +name = "solana-slot-hashes" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17d216c0ebf00e95acaf2b1e227e6cc900a5ce50fb81fa0743272851e88a788d" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", +] + +[[package]] +name = "solana-slot-history" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88cbcdf767891c6a40116a5ef8f7241000f074ece4ba80c8f00b4f62705fc8a4" +dependencies = [ + "bv", + "serde", + "serde_derive", +] + +[[package]] +name = "solana-stable-layout" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a5305ca88fb5deb219cd88f04e24f3a131769417d7fcb11a8da1126a8f98d23" +dependencies = [ + "solana-instruction", + "solana-pubkey", +] + [[package]] name = "solana-stake-program" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5dd1bc07beb75da5df5e07301d3d0d6104872c9afade22b910af9061fb4bc15" +checksum = "c8bb1a59fdd929becddfaed9ec33a1ca4db853f45ae85e14e4f4054a875fc41d" dependencies = [ "bincode", "log", - "rustc_version", "solana-config-program", + "solana-feature-set", + "solana-log-collector", "solana-program-runtime", "solana-sdk", + "solana-type-overrides", "solana-vote-program", ] [[package]] name = "solana-streamer" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad1bdb955ec6d23a1dbf87e403ff3e610d68616275693125a893d7ed4b2d323" +checksum = "ff771524872781eca074e0ba221d72b07fa0800cc1a7ffa400a9eb3e125fb922" dependencies = [ "async-channel", "bytes", "crossbeam-channel", + "dashmap", + "futures", "futures-util", + "governor", "histogram", - "indexmap 2.6.0", - "itertools", + "indexmap", + "itertools 0.12.1", "libc", "log", "nix", "pem", "percentage", - "pkcs8", "quinn", "quinn-proto", "rand 0.8.5", - "rcgen", - "rustls", + "rustls 0.23.26", "smallvec", + "socket2", + "solana-measure", "solana-metrics", "solana-perf", "solana-sdk", - "thiserror", + "solana-transaction-metrics-tracker", + "thiserror 1.0.69", "tokio", + "tokio-util 0.7.11", "x509-parser", ] +[[package]] +name = "solana-svm" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f3b139a001effc93295b693437013f365785fab04dcf2fa679164af4206ec8" +dependencies = [ + "itertools 0.12.1", + "log", + "percentage", + "serde", + "serde_derive", + "solana-bpf-loader-program", + "solana-compute-budget", + "solana-feature-set", + "solana-fee", + "solana-loader-v4-program", + "solana-log-collector", + "solana-measure", + "solana-program-runtime", + "solana-runtime-transaction", + "solana-sdk", + "solana-svm-rent-collector", + "solana-svm-transaction", + "solana-system-program", + "solana-timings", + "solana-type-overrides", + "solana-vote", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-svm-rent-collector" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e7068d6cc69c730190c96b87b106afd42cde203cf56164106792778cd0aaeb" +dependencies = [ + "solana-sdk", +] + +[[package]] +name = "solana-svm-transaction" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a8533576cb7beca4a44b976ac27df9865bbf8c4cbca2ee8f4f3469cdd8175f" +dependencies = [ + "solana-sdk", +] + [[package]] name = "solana-system-program" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78733745268c96d5a29c09cde9f0a6c9d662abba43e661b75dd858da8e3d0b2e" +checksum = "242634cdc1eacaa83738cc100fdd583eb88f99cc2edcc900c8ebe57d77af51b1" dependencies = [ "bincode", "log", "serde", "serde_derive", + "solana-log-collector", "solana-program-runtime", "solana-sdk", + "solana-type-overrides", ] [[package]] name = "solana-thin-client" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc301310ba0755c449a8800136f67f8ad14419b366404629894cd10021495360" +checksum = "10314ae3e0889cf38140902862d2c2ea481895c82c19f51dc4457b7dfa3aa6d0" dependencies = [ "bincode", "log", @@ -5983,41 +6004,79 @@ dependencies = [ "solana-sdk", ] +[[package]] +name = "solana-timings" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a8e2f926d488c1e2a65cbc05544dcb68cfa88deb4d50f89db5bfbda7ff2419" +dependencies = [ + "eager", + "enum-iterator", + "solana-sdk", +] + [[package]] name = "solana-tpu-client" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb887bd5078ff015e103e9ee54a6713380590efa8ff1804b3a653f07188928c6" +checksum = "516cbed8800cd36fb3ecc9a65df1e76bf8251929aa32e9b10497e8d6612de605" dependencies = [ "async-trait", "bincode", "futures-util", - "indexmap 2.6.0", + "indexmap", "indicatif", "log", "rayon", "solana-connection-cache", "solana-measure", - "solana-metrics", "solana-pubsub-client", "solana-rpc-client", "solana-rpc-client-api", "solana-sdk", - "thiserror", + "thiserror 1.0.69", "tokio", ] +[[package]] +name = "solana-transaction-error" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37a4bea6d80b34fe6e785d19bf928fe103928d1f6c9935ec23bb6a9d4d7a33d2" +dependencies = [ + "serde", + "serde_derive", + "solana-instruction", + "solana-sanitize", +] + +[[package]] +name = "solana-transaction-metrics-tracker" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0b668c986a83e6b2eb8f130039045b54abc37ee821853250755386d26c1c668" +dependencies = [ + "base64 0.22.1", + "bincode", + "lazy_static", + "log", + "rand 0.8.5", + "solana-perf", + "solana-sdk", + "solana-short-vec", +] + [[package]] name = "solana-transaction-status" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a0cdfdf63192fb60de094fae8e81159e4e3e9aac9659fe3f9ef0e707023fb32" +checksum = "e3e8ed5bf2511c45b923de25482407c9a2eb56af73dba52c19db76df4dd35cba" dependencies = [ "Inflector", - "base64 0.21.7", + "base64 0.22.1", "bincode", - "borsh 0.10.3", - "bs58 0.4.0", + "borsh 1.5.1", + "bs58", "lazy_static", "log", "serde", @@ -6025,94 +6084,165 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-sdk", - "spl-associated-token-account 2.3.0", - "spl-memo", - "spl-token 4.0.0", - "spl-token-2022 1.0.0", - "thiserror", + "solana-transaction-status-client-types", + "spl-associated-token-account 4.0.0", + "spl-memo 5.0.0", + "spl-token 6.0.0", + "spl-token-2022 4.0.0", + "spl-token-group-interface 0.3.0", + "spl-token-metadata-interface 0.4.0", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-transaction-status-client-types" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb35fb678fec581e9bdf6350d2c7f5829951a6280038fc06949b1589a9605e1" +dependencies = [ + "base64 0.22.1", + "bincode", + "bs58", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder-client-types", + "solana-sdk", + "solana-signature", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-type-overrides" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2066f25d460d63801f91436c2640aaba4f2dc95aa18fe1e76f7f2c063e981d4e" +dependencies = [ + "lazy_static", + "rand 0.8.5", ] [[package]] name = "solana-udp-client" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea0d6d8d66e36371577f51c4d1d6192a66f1fa4efe7161a36d94677640dcadb" +checksum = "95ec0cbc2d5e3379fafb2c1493f2358f07c09e76e2081c44e3a8c36da12fbd40" dependencies = [ "async-trait", "solana-connection-cache", "solana-net-utils", "solana-sdk", "solana-streamer", - "thiserror", + "thiserror 1.0.69", "tokio", ] [[package]] name = "solana-version" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f4c2f531c22ce806b211118be8928a791425f97de4592371fb57b246ed33e34" -dependencies = [ - "log", - "rustc_version", +checksum = "7310708b642fb83c04f44934509f4f149ffd69d0cd4cf76d9645c991177d7ea0" +dependencies = [ "semver", "serde", "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-sdk", + "solana-feature-set", + "solana-sanitize", + "solana-serde-varint", ] [[package]] name = "solana-vote" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28ab95a5d19ff0464def1777adaae5a74e1edc9e6818103064c18fdc2643f6cb" +checksum = "5ab46788981765ee706094ca53ad8421aae0286a6b948e892fa7db88992a5373" dependencies = [ - "crossbeam-channel", - "itertools", + "itertools 0.12.1", "log", - "rustc_version", "serde", "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", "solana-sdk", - "solana-vote-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-vote-program" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d8a6486017e71a3714a8e1a635e17209135cc20535ba9808ccf106d80ff6e8b" +checksum = "637cadc921725d1804a451ea7d2dff83310a12b75e0b6c83a8bb67ebc02d10f1" dependencies = [ "bincode", "log", "num-derive 0.4.2", "num-traits", - "rustc_version", "serde", "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-feature-set", "solana-metrics", "solana-program", "solana-program-runtime", "solana-sdk", - "thiserror", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-zk-elgamal-proof-program" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47f5ac026a972c9cbc6bd0f72f692f85ff9ceec961fc4bcb1f2550e6387e962c" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-log-collector", + "solana-program-runtime", + "solana-sdk", + "solana-zk-sdk", +] + +[[package]] +name = "solana-zk-sdk" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18c2d96f65cb033f4dc16d3a1b085f8af0ea38012c514a8f65b9b6d75bc9339f" +dependencies = [ + "aes-gcm-siv", + "base64 0.22.1", + "bincode", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "itertools 0.12.1", + "js-sys", + "lazy_static", + "merlin", + "num-derive 0.4.2", + "num-traits", + "rand 0.8.5", + "serde", + "serde_derive", + "serde_json", + "sha3", + "solana-derivation-path", + "solana-program", + "solana-sdk", + "subtle", + "thiserror 1.0.69", + "wasm-bindgen", + "zeroize", ] [[package]] name = "solana-zk-token-proof-program" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e3dfb2deb449f7eb1dbd0c7e66dd95ec7b1303a5788673f9fbc9b5a5ea59f2" +checksum = "83029f0fac09633fc4463dd5a7d13959d1825dccf77889c6e617e2b1265fb2f1" dependencies = [ "bytemuck", "num-derive 0.4.2", "num-traits", + "solana-feature-set", + "solana-log-collector", "solana-program-runtime", "solana-sdk", "solana-zk-token-sdk", @@ -6120,58 +6250,54 @@ dependencies = [ [[package]] name = "solana-zk-token-sdk" -version = "1.18.17" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "513407f88394e437b4ff5aad892bc5bf51a655ae2401e6e63549734d3695c46f" +checksum = "ed293089d8eebd6b5c1b53ee4ad6817889fea254274ddb34cb01ad35a2f817cb" dependencies = [ "aes-gcm-siv", - "base64 0.21.7", + "base64 0.22.1", "bincode", "bytemuck", + "bytemuck_derive", "byteorder", - "curve25519-dalek", - "getrandom 0.1.16", - "itertools", + "curve25519-dalek 4.1.3", + "itertools 0.12.1", "lazy_static", "merlin", "num-derive 0.4.2", "num-traits", - "rand 0.7.3", + "rand 0.8.5", "serde", + "serde_derive", "serde_json", - "sha3 0.9.1", + "sha3", + "solana-curve25519", + "solana-derivation-path", "solana-program", "solana-sdk", "subtle", - "thiserror", + "thiserror 1.0.69", "zeroize", ] [[package]] name = "solana_rbpf" -version = "0.8.0" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d457cc2ba742c120492a64b7fa60e22c575e891f6b55039f4d736568fb112a3" +checksum = "1c1941b5ef0c3ce8f2ac5dd984d0fb1a97423c4ff2a02eec81e3913f02e2ac2b" dependencies = [ "byteorder", - "combine", - "goblin", + "combine 3.8.1", "hash32", "libc", "log", "rand 0.8.5", "rustc-demangle", "scroll", - "thiserror", + "thiserror 1.0.69", "winapi", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -6179,78 +6305,88 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] -name = "spki" -version = "0.5.4" +name = "spinning_top" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" dependencies = [ - "base64ct", - "der", + "lock_api", ] [[package]] name = "spl-associated-token-account" -version = "2.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "992d9c64c2564cc8f63a4b508bf3ebcdf2254b0429b13cd1d31adb6162432a5f" +checksum = "68034596cf4804880d265f834af1ff2f821ad5293e41fa0f8f59086c181fc38e" dependencies = [ "assert_matches", - "borsh 0.10.3", + "borsh 1.5.1", "num-derive 0.4.2", "num-traits", "solana-program", - "spl-token 4.0.0", - "spl-token-2022 1.0.0", - "thiserror", + "spl-token 6.0.0", + "spl-token-2022 4.0.0", + "thiserror 1.0.69", ] [[package]] name = "spl-associated-token-account" -version = "3.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2e688554bac5838217ffd1fab7845c573ff106b6336bf7d290db7c98d5a8efd" +checksum = "76fee7d65013667032d499adc3c895e286197a35a0d3a4643c80e7fd3e9969e3" dependencies = [ - "assert_matches", "borsh 1.5.1", "num-derive 0.4.2", "num-traits", "solana-program", - "spl-token 4.0.0", - "spl-token-2022 3.0.2", - "thiserror", + "spl-associated-token-account-client", + "spl-token 7.0.0", + "spl-token-2022 6.0.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-associated-token-account-client" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f8349dbcbe575f354f9a533a21f272f3eb3808a49e2fdc1c34393b88ba76cb" +dependencies = [ + "solana-instruction", + "solana-pubkey", ] [[package]] name = "spl-discriminator" -version = "0.1.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" +checksum = "34d1814406e98b08c5cd02c1126f83fd407ad084adce0b05fda5730677822eac" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator-derive 0.1.2", + "spl-discriminator-derive", ] [[package]] name = "spl-discriminator" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d1814406e98b08c5cd02c1126f83fd407ad084adce0b05fda5730677822eac" +checksum = "a38ea8b6dedb7065887f12d62ed62c1743aa70749e8558f963609793f6fb12bc" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator-derive 0.2.0", + "spl-discriminator-derive", ] [[package]] -name = "spl-discriminator-derive" -version = "0.1.2" +name = "spl-discriminator" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fd7858fc4ff8fb0e34090e41d7eb06a823e1057945c26d480bfc21d2338a93" +checksum = "a7398da23554a31660f17718164e31d31900956054f54f52d5ec1be51cb4f4b3" dependencies = [ - "quote", - "spl-discriminator-syn 0.1.2", - "syn 2.0.58", + "bytemuck", + "solana-program-error", + "solana-sha256-hasher", + "spl-discriminator-derive", ] [[package]] @@ -6260,82 +6396,103 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9e8418ea6269dcfb01c712f0444d2c75542c04448b480e87de59d2865edc750" dependencies = [ "quote", - "spl-discriminator-syn 0.2.0", - "syn 2.0.58", + "spl-discriminator-syn", + "syn 2.0.100", ] [[package]] name = "spl-discriminator-syn" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fea7be851bd98d10721782ea958097c03a0c2a07d8d4997041d0ece6319a63" +checksum = "8c1f05593b7ca9eac7caca309720f2eafb96355e037e6d373b909a80fe7b69b9" dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.58", - "thiserror", + "syn 2.0.100", + "thiserror 1.0.69", ] [[package]] -name = "spl-discriminator-syn" -version = "0.2.0" +name = "spl-elgamal-registry" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f05593b7ca9eac7caca309720f2eafb96355e037e6d373b909a80fe7b69b9" +checksum = "ce0f668975d2b0536e8a8fd60e56a05c467f06021dae037f1d0cfed0de2e231d" dependencies = [ - "proc-macro2", - "quote", - "sha2 0.10.8", - "syn 2.0.58", - "thiserror", + "bytemuck", + "solana-program", + "solana-zk-sdk", + "spl-pod 0.5.0", + "spl-token-confidential-transfer-proof-extraction", ] [[package]] name = "spl-memo" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f180b03318c3dbab3ef4e1e4d46d5211ae3c780940dd0a28695aba4b59a75a" +checksum = "a0dba2f2bb6419523405d21c301a32c9f9568354d4742552e7972af801f4bdb3" dependencies = [ "solana-program", ] +[[package]] +name = "spl-memo" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f09647c0974e33366efeb83b8e2daebb329f0420149e74d3a4bd2c08cf9f7cb" +dependencies = [ + "solana-account-info", + "solana-instruction", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-pubkey", +] + [[package]] name = "spl-pod" -version = "0.1.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2881dddfca792737c0706fa0175345ab282b1b0879c7d877bad129645737c079" +checksum = "046ce669f48cf2eca1ec518916d8725596bfb655beb1c74374cf71dc6cb773c9" dependencies = [ - "borsh 0.10.3", "bytemuck", "solana-program", "solana-zk-token-sdk", - "spl-program-error 0.3.0", + "spl-program-error 0.4.1", ] [[package]] name = "spl-pod" -version = "0.2.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046ce669f48cf2eca1ec518916d8725596bfb655beb1c74374cf71dc6cb773c9" +checksum = "c704c88fc457fa649ba3aabe195c79d885c3f26709efaddc453c8de352c90b87" dependencies = [ "borsh 1.5.1", "bytemuck", + "bytemuck_derive", "solana-program", "solana-zk-token-sdk", - "spl-program-error 0.4.1", + "spl-program-error 0.5.0", ] [[package]] -name = "spl-program-error" -version = "0.3.0" +name = "spl-pod" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "249e0318493b6bcf27ae9902600566c689b7dfba9f1bdff5893e92253374e78c" +checksum = "41a7d5950993e1ff2680bd989df298eeb169367fb2f9deeef1f132de6e4e8016" dependencies = [ + "borsh 1.5.1", + "bytemuck", + "bytemuck_derive", "num-derive 0.4.2", "num-traits", - "solana-program", - "spl-program-error-derive 0.3.2", - "thiserror", + "solana-decode-error", + "solana-msg", + "solana-program-error", + "solana-program-option", + "solana-pubkey", + "solana-zk-sdk", + "thiserror 1.0.69", ] [[package]] @@ -6347,20 +6504,34 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "solana-program", - "spl-program-error-derive 0.4.1", - "thiserror", + "spl-program-error-derive", + "thiserror 1.0.69", ] [[package]] -name = "spl-program-error-derive" -version = "0.3.2" +name = "spl-program-error" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1845dfe71fd68f70382232742e758557afe973ae19e6c06807b2c30f5d5cb474" +checksum = "d7b28bed65356558133751cc32b48a7a5ddfc59ac4e941314630bbed1ac10532" dependencies = [ - "proc-macro2", - "quote", - "sha2 0.10.8", - "syn 2.0.58", + "num-derive 0.4.2", + "num-traits", + "solana-program", + "spl-program-error-derive", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-program-error" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d39b5186f42b2b50168029d81e58e800b690877ef0b30580d107659250da1d1" +dependencies = [ + "num-derive 0.4.2", + "num-traits", + "solana-program", + "spl-program-error-derive", + "thiserror 1.0.69", ] [[package]] @@ -6372,277 +6543,383 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] name = "spl-tlv-account-resolution" -version = "0.4.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062e148d3eab7b165582757453632ffeef490c02c86a48bfdb4988f63eefb3b9" +checksum = "cace91ba08984a41556efe49cbf2edca4db2f577b649da7827d3621161784bf8" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-type-length-value 0.3.0", + "spl-discriminator 0.2.2", + "spl-pod 0.2.2", + "spl-program-error 0.4.1", + "spl-type-length-value 0.4.3", ] [[package]] name = "spl-tlv-account-resolution" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615d381f48ddd2bb3c57c7f7fb207591a2a05054639b18a62e785117dd7a8683" +checksum = "37a75a5f0fcc58126693ed78a17042e9dc53f07e357d6be91789f7d62aff61a4" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-type-length-value 0.3.0", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", + "spl-type-length-value 0.5.0", ] [[package]] name = "spl-tlv-account-resolution" -version = "0.6.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cace91ba08984a41556efe49cbf2edca4db2f577b649da7827d3621161784bf8" +checksum = "cd99ff1e9ed2ab86e3fd582850d47a739fec1be9f4661cba1782d3a0f26805f3" dependencies = [ "bytemuck", - "solana-program", - "spl-discriminator 0.2.2", - "spl-pod 0.2.2", - "spl-program-error 0.4.1", - "spl-type-length-value 0.4.3", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "spl-program-error 0.6.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", ] [[package]] name = "spl-token" -version = "3.5.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e85e168a785e82564160dcb87b2a8e04cee9bfd1f4d488c729d53d6a4bd300d" +checksum = "70a0f06ac7f23dc0984931b1fe309468f14ea58e32660439c1cef19456f5d0e3" dependencies = [ "arrayref", "bytemuck", - "num-derive 0.3.3", + "num-derive 0.4.2", "num-traits", - "num_enum 0.5.11", + "num_enum", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "spl-token" -version = "4.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08459ba1b8f7c1020b4582c4edf0f5c7511a5e099a7a97570c9698d4f2337060" +checksum = "ed320a6c934128d4f7e54fe00e16b8aeaecf215799d060ae14f93378da6dc834" dependencies = [ "arrayref", "bytemuck", - "num-derive 0.3.3", + "num-derive 0.4.2", "num-traits", - "num_enum 0.6.1", + "num_enum", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "spl-token-2022" -version = "0.9.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4abf34a65ba420584a0c35f3903f8d727d1f13ababbdc3f714c6b065a686e86" +checksum = "d9c10f3483e48679619c76598d4e4aebb955bc49b0a5cc63323afbf44135c9bf" dependencies = [ "arrayref", "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.2", + "num_enum", "solana-program", + "solana-security-txt", "solana-zk-token-sdk", - "spl-memo", - "spl-pod 0.1.0", - "spl-token 4.0.0", - "spl-token-metadata-interface 0.2.0", - "spl-transfer-hook-interface 0.3.0", - "spl-type-length-value 0.3.0", - "thiserror", + "spl-memo 5.0.0", + "spl-pod 0.3.1", + "spl-token 6.0.0", + "spl-token-group-interface 0.3.0", + "spl-token-metadata-interface 0.4.0", + "spl-transfer-hook-interface 0.7.0", + "spl-type-length-value 0.5.0", + "thiserror 1.0.69", ] [[package]] name = "spl-token-2022" -version = "1.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d697fac19fd74ff472dfcc13f0b442dd71403178ce1de7b5d16f83a33561c059" +checksum = "5b27f7405010ef816587c944536b0eafbcc35206ab6ba0f2ca79f1d28e488f4f" dependencies = [ "arrayref", "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.2", + "num_enum", "solana-program", "solana-security-txt", - "solana-zk-token-sdk", - "spl-memo", - "spl-pod 0.1.0", - "spl-token 4.0.0", - "spl-token-group-interface 0.1.0", - "spl-token-metadata-interface 0.2.0", - "spl-transfer-hook-interface 0.4.1", - "spl-type-length-value 0.3.0", - "thiserror", + "solana-zk-sdk", + "spl-elgamal-registry", + "spl-memo 6.0.0", + "spl-pod 0.5.0", + "spl-token 7.0.0", + "spl-token-confidential-transfer-ciphertext-arithmetic", + "spl-token-confidential-transfer-proof-extraction", + "spl-token-confidential-transfer-proof-generation 0.2.0", + "spl-token-group-interface 0.5.0", + "spl-token-metadata-interface 0.6.0", + "spl-transfer-hook-interface 0.9.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", ] [[package]] name = "spl-token-2022" -version = "3.0.2" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5412f99ae7ee6e0afde00defaa354e6228e47e30c0e3adf553e2e01e6abb584" +checksum = "9048b26b0df0290f929ff91317c83db28b3ef99af2b3493dd35baa146774924c" dependencies = [ "arrayref", "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.2", + "num_enum", "solana-program", "solana-security-txt", - "solana-zk-token-sdk", - "spl-memo", - "spl-pod 0.2.2", - "spl-token 4.0.0", - "spl-token-group-interface 0.2.3", - "spl-token-metadata-interface 0.3.3", - "spl-transfer-hook-interface 0.6.3", - "spl-type-length-value 0.4.3", - "thiserror", + "solana-zk-sdk", + "spl-elgamal-registry", + "spl-memo 6.0.0", + "spl-pod 0.5.0", + "spl-token 7.0.0", + "spl-token-confidential-transfer-ciphertext-arithmetic", + "spl-token-confidential-transfer-proof-extraction", + "spl-token-confidential-transfer-proof-generation 0.3.0", + "spl-token-group-interface 0.5.0", + "spl-token-metadata-interface 0.6.0", + "spl-transfer-hook-interface 0.9.0", + "spl-type-length-value 0.7.0", + "thiserror 2.0.12", +] + +[[package]] +name = "spl-token-confidential-transfer-ciphertext-arithmetic" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170378693c5516090f6d37ae9bad2b9b6125069be68d9acd4865bbe9fc8499fd" +dependencies = [ + "base64 0.22.1", + "bytemuck", + "solana-curve25519", + "solana-zk-sdk", ] [[package]] -name = "spl-token-group-interface" -version = "0.1.0" +name = "spl-token-confidential-transfer-proof-extraction" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b889509d49fa74a4a033ca5dae6c2307e9e918122d97e58562f5c4ffa795c75d" +checksum = "eff2d6a445a147c9d6dd77b8301b1e116c8299601794b558eafa409b342faf96" dependencies = [ "bytemuck", + "solana-curve25519", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", + "solana-zk-sdk", + "spl-pod 0.5.0", + "thiserror 2.0.12", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-generation" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8627184782eec1894de8ea26129c61303f1f0adeed65c20e0b10bc584f09356d" +dependencies = [ + "curve25519-dalek 4.1.3", + "solana-zk-sdk", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-generation" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e3597628b0d2fe94e7900fd17cdb4cfbb31ee35c66f82809d27d86e44b2848b" +dependencies = [ + "curve25519-dalek 4.1.3", + "solana-zk-sdk", + "thiserror 2.0.12", ] [[package]] name = "spl-token-group-interface" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d419b5cfa3ee8e0f2386fd7e02a33b3ec8a7db4a9c7064a2ea24849dc4a273b6" +checksum = "df8752b85a5ecc1d9f3a43bce3dd9a6a053673aacf5deb513d1cbb88d3534ffd" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator 0.2.2", - "spl-pod 0.2.2", - "spl-program-error 0.4.1", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", +] + +[[package]] +name = "spl-token-group-interface" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d595667ed72dbfed8c251708f406d7c2814a3fa6879893b323d56a10bedfc799" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "thiserror 1.0.69", ] [[package]] name = "spl-token-metadata-interface" -version = "0.2.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c16ce3ba6979645fb7627aa1e435576172dd63088dc7848cb09aa331fa1fe4f" +checksum = "c6c2318ddff97e006ed9b1291ebec0750a78547f870f62a69c56fe3b46a5d8fc" dependencies = [ - "borsh 0.10.3", + "borsh 1.5.1", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-type-length-value 0.3.0", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", + "spl-type-length-value 0.5.0", ] [[package]] name = "spl-token-metadata-interface" -version = "0.3.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30179c47e93625680dabb620c6e7931bd12d62af390f447bc7beb4a3a9b5feee" +checksum = "dfb9c89dbc877abd735f05547dcf9e6e12c00c11d6d74d8817506cab4c99fdbb" dependencies = [ "borsh 1.5.1", + "num-derive 0.4.2", + "num-traits", + "solana-borsh", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-transfer-hook-interface" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66a98359769cd988f7b35c02558daa56d496a7e3bd8626e61f90a7c757eedb9b" +dependencies = [ + "arrayref", + "bytemuck", "solana-program", "spl-discriminator 0.2.2", "spl-pod 0.2.2", "spl-program-error 0.4.1", + "spl-tlv-account-resolution 0.6.3", "spl-type-length-value 0.4.3", ] [[package]] name = "spl-transfer-hook-interface" -version = "0.3.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051d31803f873cabe71aec3c1b849f35248beae5d19a347d93a5c9cccc5d5a9b" +checksum = "a110f33d941275d9f868b96daaa993f1e73b6806cc8836e43075b4d3ad8338a7" dependencies = [ "arrayref", "bytemuck", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-tlv-account-resolution 0.4.0", - "spl-type-length-value 0.3.0", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", + "spl-tlv-account-resolution 0.7.0", + "spl-type-length-value 0.5.0", ] [[package]] name = "spl-transfer-hook-interface" -version = "0.4.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aabdb7c471566f6ddcee724beb8618449ea24b399e58d464d6b5bc7db550259" +checksum = "4aa7503d52107c33c88e845e1351565050362c2314036ddf19a36cd25137c043" dependencies = [ "arrayref", "bytemuck", - "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-tlv-account-resolution 0.5.1", - "spl-type-length-value 0.3.0", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "spl-program-error 0.6.0", + "spl-tlv-account-resolution 0.9.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", ] [[package]] -name = "spl-transfer-hook-interface" -version = "0.6.3" +name = "spl-type-length-value" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a98359769cd988f7b35c02558daa56d496a7e3bd8626e61f90a7c757eedb9b" +checksum = "422ce13429dbd41d2cee8a73931c05fda0b0c8ca156a8b0c19445642550bb61a" dependencies = [ - "arrayref", "bytemuck", "solana-program", "spl-discriminator 0.2.2", "spl-pod 0.2.2", "spl-program-error 0.4.1", - "spl-tlv-account-resolution 0.6.3", - "spl-type-length-value 0.4.3", ] [[package]] name = "spl-type-length-value" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a468e6f6371f9c69aae760186ea9f1a01c2908351b06a5e0026d21cfc4d7ecac" +checksum = "bdcd73ec187bc409464c60759232e309f83b52a18a9c5610bf281c9c6432918c" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", ] [[package]] name = "spl-type-length-value" -version = "0.4.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422ce13429dbd41d2cee8a73931c05fda0b0c8ca156a8b0c19445642550bb61a" +checksum = "ba70ef09b13af616a4c987797870122863cba03acc4284f226a4473b043923f9" dependencies = [ "bytemuck", - "solana-program", - "spl-discriminator 0.2.2", - "spl-pod 0.2.2", - "spl-program-error 0.4.1", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-msg", + "solana-program-error", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "thiserror 1.0.69", ] [[package]] @@ -6657,42 +6934,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap 2.34.0", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "strum" version = "0.24.1" @@ -6717,15 +6964,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "superslice" -version = "1.0.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sval" @@ -6817,14 +7058,14 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "sha3 0.10.8", + "sha3", ] [[package]] name = "switchboard-on-demand" -version = "0.1.14" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3852951c42f8876a443060b6882bda945f1621224236ead37959e80f5369cf81" +checksum = "2ee00734181d7fdb6a5c9c72374d5257ba3991185db7dd6c5512f500faf70527" dependencies = [ "arc-swap", "async-trait", @@ -6836,36 +7077,14 @@ dependencies = [ "lazy_static", "libsecp256k1 0.7.1", "log", - "num 0.4.3", + "once_cell", "rust_decimal", "serde", - "serde_json", "sha2 0.10.8", "solana-address-lookup-table-program", "solana-program", - "spl-associated-token-account 2.3.0", - "spl-token 3.5.0", - "switchboard-common", -] - -[[package]] -name = "switchboard-solana" -version = "0.29.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb0cb2cd26bcd72a11fae679d07207bca093c303c9cc72bcdc7866bb7bf8a6b" -dependencies = [ - "anchor-lang 0.29.0", - "anchor-spl 0.29.0", - "bytemuck", - "hex", - "kv-log-macro", - "lazy_static", - "libsecp256k1 0.7.1", - "log", - "rust_decimal", - "solana-address-lookup-table-program", - "solana-program", - "superslice", + "spl-associated-token-account 6.0.0", + "spl-token 7.0.0", "switchboard-common", ] @@ -6888,9 +7107,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -6906,7 +7125,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -6934,7 +7153,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -6956,9 +7175,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tar" -version = "0.4.41" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" dependencies = [ "filetime", "libc", @@ -6981,7 +7200,7 @@ dependencies = [ "serde", "static_assertions", "tarpc-plugins", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-serde", "tokio-util 0.6.10", @@ -7000,16 +7219,26 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "task-local-extensions" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba323866e5d033818e3240feeb9f7db2c4296674e4d9e16b97b7bf8f490434e8" +dependencies = [ + "pin-utils", +] + [[package]] name = "tempfile" -version = "3.10.1" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ - "cfg-if", "fastrand", + "getrandom 0.3.2", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -7023,9 +7252,9 @@ dependencies = [ [[package]] name = "termtree" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" +checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" [[package]] name = "test-case" @@ -7045,7 +7274,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -7056,7 +7285,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", "test-case-core", ] @@ -7064,9 +7293,8 @@ dependencies = [ name = "test-utilities" version = "0.1.0" dependencies = [ - "anchor-lang 0.29.0", - "anchor-lang 0.30.1", - "anchor-spl 0.30.1", + "anchor-lang", + "anchor-spl", "anyhow", "assert_matches", "bincode", @@ -7075,7 +7303,6 @@ dependencies = [ "fixed-macro", "futures", "lazy_static", - "liquidity-incentive-program", "marginfi", "pretty_assertions", "pyth-sdk-solana", @@ -7088,60 +7315,60 @@ dependencies = [ "solana-program", "solana-program-test", "solana-sdk", - "spl-discriminator 0.2.2", - "spl-tlv-account-resolution 0.6.3", - "spl-token-2022 3.0.2", + "spl-token-2022 7.0.0", "spl-transfer-hook-interface 0.6.3", "static_assertions", "switchboard-on-demand", - "switchboard-solana", - "test_transfer_hook", "type-layout", ] -[[package]] -name = "test_transfer_hook" -version = "0.1.0" -dependencies = [ - "solana-program", - "spl-tlv-account-resolution 0.6.3", - "spl-token-2022 3.0.2", - "spl-transfer-hook-interface 0.6.3", -] - [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width", + "unicode-width 0.1.14", ] [[package]] -name = "textwrap" -version = "0.16.1" +name = "thiserror" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] [[package]] name = "thiserror" -version = "1.0.61" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl 2.0.12", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ - "thiserror-impl", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -7156,9 +7383,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ "deranged", "itoa", @@ -7171,15 +7398,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" dependencies = [ "num-conv", "time-core", @@ -7196,9 +7423,9 @@ dependencies = [ "once_cell", "pbkdf2 0.4.0", "rand 0.7.3", - "rustc-hash", + "rustc-hash 1.1.0", "sha2 0.9.9", - "thiserror", + "thiserror 1.0.69", "unicode-normalization", "wasm-bindgen", "zeroize", @@ -7246,17 +7473,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", + "syn 2.0.100", ] [[package]] @@ -7265,7 +7482,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.12", "tokio", ] @@ -7287,9 +7504,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -7304,7 +7521,7 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "rustls", + "rustls 0.21.12", "tokio", "tokio-rustls", "tungstenite", @@ -7369,24 +7586,13 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.6.0", - "toml_datetime", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.6.0", + "indexmap", "toml_datetime", "winnow 0.5.40", ] @@ -7397,7 +7603,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.6.0", + "indexmap", "serde", "serde_spanned", "toml_datetime", @@ -7424,13 +7630,13 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -7458,9 +7664,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "sharded-slab", "thread_local", @@ -7486,9 +7692,9 @@ dependencies = [ "httparse", "log", "rand 0.8.5", - "rustls", + "rustls 0.21.12", "sha1", - "thiserror", + "thiserror 1.0.69", "url", "utf-8", "webpki-roots 0.24.0", @@ -7527,6 +7733,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "unicase" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" + [[package]] name = "unicode-bidi" version = "0.3.15" @@ -7556,23 +7768,29 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "universal-hash" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ - "generic-array", + "crypto-common", "subtle", ] @@ -7591,12 +7809,6 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -7630,12 +7842,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - [[package]] name = "uuid" version = "1.10.0" @@ -7644,9 +7850,9 @@ checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" [[package]] name = "valuable" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "value-bag" @@ -7684,12 +7890,6 @@ dependencies = [ "sval_serde", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "vec_map" version = "0.8.2" @@ -7739,28 +7939,38 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", "wasm-bindgen-shared", ] @@ -7778,9 +7988,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7788,53 +7998,62 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] -name = "wasm-streams" -version = "0.4.0" +name = "web-sys" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ - "futures-util", "js-sys", "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", ] [[package]] -name = "web-sys" -version = "0.3.69" +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "webpki-root-certs" +version = "0.26.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09aed61f5e8d2c18344b3faa33a4c837855fe56642757754775548fee21386c4" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "webpki-roots" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" dependencies = [ - "rustls-webpki", + "rustls-webpki 0.101.7", ] [[package]] @@ -7861,11 +8080,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -7876,11 +8095,70 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.52.0" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" dependencies = [ - "windows-targets 0.52.6", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-result" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", ] [[package]] @@ -7901,6 +8179,30 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -7932,6 +8234,12 @@ dependencies = [ "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -7944,6 +8252,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -7956,6 +8270,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -7974,6 +8294,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -7986,6 +8312,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -7998,6 +8330,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -8010,6 +8348,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -8050,6 +8394,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags 2.6.0", +] + [[package]] name = "wyz" version = "0.5.1" @@ -8073,18 +8426,17 @@ dependencies = [ "nom", "oid-registry", "rusticata-macros", - "thiserror", + "thiserror 1.0.69", "time", ] [[package]] name = "xattr" -version = "1.3.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +checksum = "0d65cbf2f12c15564212d48f4e3dfb87923d25d611f2aed18f4cb23f0413d89e" dependencies = [ "libc", - "linux-raw-sys", "rustix", ] @@ -8094,15 +8446,6 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" -[[package]] -name = "yasna" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" -dependencies = [ - "time", -] - [[package]] name = "zerocopy" version = "0.7.35" @@ -8120,14 +8463,14 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] name = "zeroize" -version = "1.3.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -8140,33 +8483,32 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" dependencies = [ - "libc", "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.12+zstd.1.5.6" +version = "2.0.15+zstd.1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a4e40c320c3cb459d9a9ff6de98cff88f4751ee9275d140e2be94a2b74e4c13" +checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 786a76fee..66e2cc266 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,38 +1,40 @@ [workspace] resolver = "2" -members = ["programs/*", "clients/rust/*", "tools/*"] +members = ["programs/marginfi", "programs/mocks"] +# exclude = [ +# "programs/test_transfer_hook", +# "programs/liquidity-incentive-program", +# "programs/brick", +# ] [workspace.dependencies] -solana-cli-output = "=1.18.17" -solana-client = "=1.18.17" -solana-sdk = "=1.18.17" -solana-logger = "=1.18.17" -solana-program = "=1.18.17" -solana-program-test = "=1.18.17" -solana-account-decoder = "=1.18.17" -solana-measure = "=1.18.17" -solana-metrics = "=1.18.17" -solana-transaction-status = "=1.18.17" -solana-address-lookup-table-program = "=1.18.17" -spl-token = "4.0.0" -spl-associated-token-account = "2.2.0" +solana-cli-output = "=2.1.0" +solana-client = "=2.1.0" +solana-sdk = "=2.1.0" +solana-logger = "=2.1.0" +solana-program = "=2.1.0" +solana-program-test = "=2.1.0" +solana-account-decoder = "=2.1.0" +# solana-measure = "=2.1.0" +# solana-metrics = "=2.1.0" +# solana-transaction-status = "=2.1.0" +# solana-address-lookup-table-program = "=2.1.0" +spl-token = "8.0.0" +# spl-associated-token-account = "2.2.0" spl-transfer-hook-interface = "0.6.3" -spl-tlv-account-resolution = "0.6.3" -spl-discriminator = "0.2.2" -spl-token-2022 = "3.0.2" +# spl-tlv-account-resolution = "0.6.3" +# spl-discriminator = "0.2.2" +spl-token-2022 = { version = "7.0.0", features = ["no-entrypoint"] } -anchor-lang = { git = "https://github.com/mrgnlabs/anchor.git", rev = "fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" } -anchor-lang-29 = { version = "0.29.0", package = "anchor-lang" } -anchor-spl = { git = "https://github.com/mrgnlabs/anchor.git", features = [ - "token_2022", -], rev = "fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" } -anchor-client = { git = "https://github.com/mrgnlabs/anchor.git", rev = "fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" } +anchor-lang = { version = "0.31.0" } +anchor-spl = { version = "0.31.0", features = ["token_2022"] } +anchor-client = { version = "0.31.0" } pyth-sdk-solana = "=0.10.1" pyth-solana-receiver-sdk = "0.6.0" pythnet-sdk = "2.3.1" -switchboard-solana = "0.29.0" -switchboard-on-demand = "0.1.14" +# switchboard-solana = "0.29.0" +switchboard-on-demand = "0.3.5" borsh = "0.10.3" [profile.release] diff --git a/package.json b/package.json index 8e5e0f561..6e13de129 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check" }, "dependencies": { - "@coral-xyz/anchor": "^0.30.1", + "@coral-xyz/anchor": "0.31.0", "@coral-xyz/spl-token": "^0.30.1", "@mrgnlabs/marginfi-client-v2": "^4.0.0", "@mrgnlabs/mrgn-common": "^1.8.0", diff --git a/programs/brick/Cargo.toml b/programs/brick/Cargo.toml index 1bca36c77..9fdec88a9 100644 --- a/programs/brick/Cargo.toml +++ b/programs/brick/Cargo.toml @@ -19,4 +19,4 @@ test = [] [dependencies] # Remove workspace = true if already defined in the root Cargo.toml anchor-lang = { workspace = true } -solana-program = { workspace = true } +# solana-program = { workspace = true } diff --git a/programs/liquidity-incentive-program/Cargo.toml b/programs/liquidity-incentive-program/Cargo.toml index a4eec9871..7dbe3e0e0 100644 --- a/programs/liquidity-incentive-program/Cargo.toml +++ b/programs/liquidity-incentive-program/Cargo.toml @@ -33,7 +33,7 @@ features = ["cpi"] [dev-dependencies] solana-logger = { workspace = true } -solana-program = { workspace = true } +# solana-program = { workspace = true } solana-program-test = { workspace = true } solana-sdk = { workspace = true } @@ -42,6 +42,6 @@ assert_matches = "1.5.0" bincode = "1.3.3" futures = "0.3.25" pretty_assertions = "1.2.1" -fixtures = { path = "../../test-utils", package = "test-utilities", features = [ - "lip", -] } +# fixtures = { path = "../../test-utils", package = "test-utilities", features = [ +# "lip", +# ] } diff --git a/programs/marginfi/Cargo.toml b/programs/marginfi/Cargo.toml index 4d235251f..4a6ddfa1a 100644 --- a/programs/marginfi/Cargo.toml +++ b/programs/marginfi/Cargo.toml @@ -24,22 +24,21 @@ debug = [] staging = [] [dependencies] -solana-program = { workspace = true } +# solana-program = { workspace = true } spl-transfer-hook-interface = { workspace = true } -spl-tlv-account-resolution = { workspace = true } +# spl-tlv-account-resolution = { workspace = true } anchor-lang = { workspace = true } -anchor-lang-29 = { workspace = true } anchor-spl = { workspace = true } pyth-sdk-solana = { workspace = true } pyth-solana-receiver-sdk = { workspace = true } pythnet-sdk = { workspace = true } -switchboard-solana = { workspace = true } +# switchboard-solana = { workspace = true } switchboard-on-demand = { workspace = true } borsh = "0.10.3" -bytemuck = "1.9.1" +bytemuck = "1.22.0" cfg-if = "1.0.0" enum_dispatch = "0.3.11" fixed = "1.12.0" @@ -53,7 +52,7 @@ solana-security-txt = "1.1.1" solana-account-decoder = { workspace = true } solana-cli-output = { workspace = true } solana-program-test = { workspace = true } -solana-logger = { workspace = true } +# solana-logger = { workspace = true } solana-sdk = { workspace = true } anyhow = "1.0.66" diff --git a/programs/marginfi/src/constants.rs b/programs/marginfi/src/constants.rs index dc8680717..4e66fb889 100644 --- a/programs/marginfi/src/constants.rs +++ b/programs/marginfi/src/constants.rs @@ -2,7 +2,7 @@ use anchor_lang::prelude::*; use fixed::types::I80F48; use fixed_macro::types::I80F48; use pyth_solana_receiver_sdk::price_update::VerificationLevel; -use solana_program::pubkey; +use anchor_lang::solana_program::pubkey; pub const LIQUIDITY_VAULT_AUTHORITY_SEED: &str = "liquidity_vault_auth"; pub const INSURANCE_VAULT_AUTHORITY_SEED: &str = "insurance_vault_auth"; diff --git a/programs/marginfi/src/instructions/marginfi_account/borrow.rs b/programs/marginfi/src/instructions/marginfi_account/borrow.rs index 9e8a7f609..83a6c1cc1 100644 --- a/programs/marginfi/src/instructions/marginfi_account/borrow.rs +++ b/programs/marginfi/src/instructions/marginfi_account/borrow.rs @@ -12,10 +12,10 @@ use crate::{ utils::{self, validate_asset_tags}, }; use anchor_lang::prelude::*; +use anchor_lang::solana_program::{clock::Clock, sysvar::Sysvar}; use anchor_spl::token_interface::{TokenAccount, TokenInterface}; use bytemuck::Zeroable; use fixed::types::I80F48; -use solana_program::{clock::Clock, sysvar::Sysvar}; /// 1. Accrue interest /// 2. Create the user's bank account for the asset borrowed if it does not exist yet diff --git a/programs/marginfi/src/instructions/marginfi_account/deposit.rs b/programs/marginfi/src/instructions/marginfi_account/deposit.rs index 7b1b86aab..2cde8fe38 100644 --- a/programs/marginfi/src/instructions/marginfi_account/deposit.rs +++ b/programs/marginfi/src/instructions/marginfi_account/deposit.rs @@ -12,8 +12,8 @@ use crate::{ use anchor_lang::prelude::*; use anchor_spl::token_interface::{TokenAccount, TokenInterface}; use fixed::types::I80F48; -use solana_program::clock::Clock; -use solana_program::sysvar::Sysvar; +use anchor_lang::solana_program::clock::Clock; +use anchor_lang::solana_program::sysvar::Sysvar; /// 1. Accrue interest /// 2. Create the user's bank account for the asset deposited if it does not exist yet diff --git a/programs/marginfi/src/instructions/marginfi_account/flashloan.rs b/programs/marginfi/src/instructions/marginfi_account/flashloan.rs index 2dd7ffe33..266152029 100644 --- a/programs/marginfi/src/instructions/marginfi_account/flashloan.rs +++ b/programs/marginfi/src/instructions/marginfi_account/flashloan.rs @@ -6,7 +6,7 @@ use crate::{ }, }; use anchor_lang::{prelude::*, Discriminator}; -use solana_program::{ +use anchor_lang::solana_program::{ instruction::{get_stack_height, TRANSACTION_LEVEL_STACK_HEIGHT}, sysvar::{self, instructions}, }; @@ -81,11 +81,15 @@ pub fn check_flashloan_can_start( // Will error if ix doesn't exist let unchecked_end_fl_ix = instructions::load_instruction_at_checked(end_fl_idx, sysvar_ixs)?; - check!( - unchecked_end_fl_ix.data[..8] - .eq(&crate::instruction::LendingAccountEndFlashloan::DISCRIMINATOR), - MarginfiError::IllegalFlashloan - ); + // TODO restore with 0.31.0 discrim syntax or hard coded value + if unchecked_end_fl_ix.data[..8] != [0; 8] { + panic!("put discrim check back"); + } + // check!( + // unchecked_end_fl_ix.data[..8] + // .eq(&crate::instruction::LendingAccountEndFlashloan::DISCRIMINATOR), + // MarginfiError::IllegalFlashloan + // ); check!( unchecked_end_fl_ix.program_id.eq(&crate::id()), diff --git a/programs/marginfi/src/instructions/marginfi_account/initialize.rs b/programs/marginfi/src/instructions/marginfi_account/initialize.rs index 4cabeb862..645c36f52 100644 --- a/programs/marginfi/src/instructions/marginfi_account/initialize.rs +++ b/programs/marginfi/src/instructions/marginfi_account/initialize.rs @@ -4,7 +4,7 @@ use crate::{ state::marginfi_account::MarginfiAccount, }; use anchor_lang::prelude::*; -use solana_program::sysvar::Sysvar; +use anchor_lang::solana_program::sysvar::Sysvar; pub fn initialize_account(ctx: Context) -> MarginfiResult { let MarginfiAccountInitialize { diff --git a/programs/marginfi/src/instructions/marginfi_account/liquidate.rs b/programs/marginfi/src/instructions/marginfi_account/liquidate.rs index 6f7ec482a..f38c57fdd 100644 --- a/programs/marginfi/src/instructions/marginfi_account/liquidate.rs +++ b/programs/marginfi/src/instructions/marginfi_account/liquidate.rs @@ -15,10 +15,10 @@ use crate::{ }; use crate::{check, debug, prelude::*, utils}; use anchor_lang::prelude::*; +use anchor_lang::solana_program::clock::Clock; +use anchor_lang::solana_program::sysvar::Sysvar; use anchor_spl::token_interface::{TokenAccount, TokenInterface}; use fixed::types::I80F48; -use solana_program::clock::Clock; -use solana_program::sysvar::Sysvar; /// Instruction liquidates a position owned by a margin account that is in a unhealthy state. /// The liquidator can purchase discounted collateral from the unhealthy account, in exchange for paying its debt. diff --git a/programs/marginfi/src/instructions/marginfi_account/pulse_health.rs b/programs/marginfi/src/instructions/marginfi_account/pulse_health.rs index b0b32d614..7d3ecc9da 100644 --- a/programs/marginfi/src/instructions/marginfi_account/pulse_health.rs +++ b/programs/marginfi/src/instructions/marginfi_account/pulse_health.rs @@ -1,6 +1,6 @@ use anchor_lang::prelude::*; use bytemuck::Zeroable; -use solana_program::{clock::Clock, sysvar::Sysvar}; +use anchor_lang::solana_program::{clock::Clock, sysvar::Sysvar}; use crate::{ state::{ diff --git a/programs/marginfi/src/instructions/marginfi_account/repay.rs b/programs/marginfi/src/instructions/marginfi_account/repay.rs index 32f3687a8..982b23491 100644 --- a/programs/marginfi/src/instructions/marginfi_account/repay.rs +++ b/programs/marginfi/src/instructions/marginfi_account/repay.rs @@ -11,7 +11,7 @@ use crate::{ use anchor_lang::prelude::*; use anchor_spl::token_interface::{TokenAccount, TokenInterface}; use fixed::types::I80F48; -use solana_program::{clock::Clock, sysvar::Sysvar}; +use anchor_lang::solana_program::{clock::Clock, sysvar::Sysvar}; /// 1. Accrue interest /// 2. Find the user's existing bank account for the asset repaid diff --git a/programs/marginfi/src/instructions/marginfi_account/withdraw.rs b/programs/marginfi/src/instructions/marginfi_account/withdraw.rs index 247354deb..69426cc64 100644 --- a/programs/marginfi/src/instructions/marginfi_account/withdraw.rs +++ b/programs/marginfi/src/instructions/marginfi_account/withdraw.rs @@ -14,7 +14,7 @@ use anchor_lang::prelude::*; use anchor_spl::token_interface::{TokenAccount, TokenInterface}; use bytemuck::Zeroable; use fixed::types::I80F48; -use solana_program::{clock::Clock, sysvar::Sysvar}; +use anchor_lang::solana_program::{clock::Clock, sysvar::Sysvar}; /// 1. Accrue interest /// 2. Find the user's existing bank account for the asset withdrawn diff --git a/programs/marginfi/src/state/marginfi_group.rs b/programs/marginfi/src/state/marginfi_group.rs index dac7fb764..82eb2a598 100644 --- a/programs/marginfi/src/state/marginfi_group.rs +++ b/programs/marginfi/src/state/marginfi_group.rs @@ -787,7 +787,7 @@ impl Bank { #[cfg(not(feature = "client"))] bank: Pubkey, ) -> MarginfiResult<()> { #[cfg(all(not(feature = "client"), feature = "debug"))] - solana_program::log::sol_log_compute_units(); + anchor_lang::solana_program::log::sol_log_compute_units(); let time_delta: u64 = (current_timestamp - self.last_update).try_into().unwrap(); if time_delta == 0 { @@ -871,7 +871,7 @@ impl Bank { #[cfg(not(feature = "client"))] { #[cfg(feature = "debug")] - solana_program::log::sol_log_compute_units(); + anchor_lang::solana_program::log::sol_log_compute_units(); emit!(LendingPoolBankAccrueInterestEvent { header: GroupEventHeader { @@ -1534,7 +1534,7 @@ impl BankConfig { #[inline] pub fn get_oracle_max_age(&self) -> u64 { match (self.oracle_max_age, self.oracle_setup) { - (0, OracleSetup::SwitchboardV2) => MAX_SWB_ORACLE_AGE, + (0, OracleSetup::SwbDeprecated) => MAX_SWB_ORACLE_AGE, (0, OracleSetup::PythLegacy | OracleSetup::PythPushOracle) => MAX_PYTH_ORACLE_AGE, (n, _) => n as u64, } diff --git a/programs/marginfi/src/state/price.rs b/programs/marginfi/src/state/price.rs index 99d3450a1..96a30f896 100644 --- a/programs/marginfi/src/state/price.rs +++ b/programs/marginfi/src/state/price.rs @@ -1,4 +1,5 @@ use anchor_lang::prelude::*; +use anchor_lang::solana_program::{borsh1::try_from_slice_unchecked, stake::state::StakeStateV2}; use anchor_spl::token::Mint; use bytemuck::{Pod, Zeroable}; use enum_dispatch::enum_dispatch; @@ -6,12 +7,8 @@ use fixed::types::I80F48; pub use pyth_sdk_solana; use pyth_sdk_solana::{state::SolanaPriceAccount, Price, PriceFeed}; use pyth_solana_receiver_sdk::price_update::{self, FeedId, PriceUpdateV2}; -use solana_program::{borsh1::try_from_slice_unchecked, stake::state::StakeStateV2}; use std::{cell::Ref, cmp::min}; use switchboard_on_demand::{CurrentResult, PullFeedAccountData, SPL_TOKEN_PROGRAM_ID}; -use switchboard_solana::{ - AggregatorAccountData, AggregatorResolutionMode, SwitchboardDecimal, SWITCHBOARD_PROGRAM_ID, -}; use crate::{ check, check_eq, @@ -33,7 +30,7 @@ use pyth_solana_receiver_sdk::PYTH_PUSH_ORACLE_ID; pub enum OracleSetup { None, PythLegacy, - SwitchboardV2, + SwbDeprecated, PythPushOracle, SwitchboardPull, StakedWithPythPush, @@ -46,7 +43,7 @@ impl OracleSetup { match value { 0 => Some(Self::None), 1 => Some(Self::PythLegacy), - 2 => Some(Self::SwitchboardV2), + 2 => Some(Self::SwbDeprecated), 3 => Some(Self::PythPushOracle), 4 => Some(Self::SwitchboardPull), 5 => Some(Self::StakedWithPythPush), @@ -88,6 +85,22 @@ pub enum OraclePriceFeedAdapter { SwitchboardPull(SwitchboardPullPriceFeed), } +#[cfg_attr(feature = "client", derive(Clone, Debug))] +pub struct SwitchboardV2PriceFeed { + _ema_price: Box, + _price: Box, +} + +impl PriceAdapter for SwitchboardV2PriceFeed { + fn get_price_of_type( + &self, + price_type: OraclePriceType, + bias: Option, + ) -> MarginfiResult { + panic!("swb v2 is deprecated"); + } +} + impl OraclePriceFeedAdapter { pub fn try_from_bank_config<'info>( bank_config: &BankConfig, @@ -127,20 +140,8 @@ impl OraclePriceFeedAdapter { PythLegacyPriceFeed::load_checked(account_info, clock.unix_timestamp, max_age)?, )) } - OracleSetup::SwitchboardV2 => { - check!(ais.len() == 1, MarginfiError::WrongNumberOfOracleAccounts); - if ais[0].key != &bank_config.oracle_keys[0] { - msg!( - "Expected oracle key: {:?}, got: {:?}", - bank_config.oracle_keys[0], - ais[0].key - ); - return Err(error!(MarginfiError::WrongOracleAccountKeys)); - } - - Ok(OraclePriceFeedAdapter::SwitchboardV2( - SwitchboardV2PriceFeed::load_checked(&ais[0], clock.unix_timestamp, max_age)?, - )) + OracleSetup::SwbDeprecated => { + panic!("swb v2 is deprecated"); } OracleSetup::PythPushOracle => { check!(ais.len() == 1, MarginfiError::WrongNumberOfOracleAccounts); @@ -330,23 +331,8 @@ impl OraclePriceFeedAdapter { Ok(()) } - OracleSetup::SwitchboardV2 => { - check!( - oracle_ais.len() == 1, - MarginfiError::WrongNumberOfOracleAccounts - ); - if oracle_ais[0].key != &bank_config.oracle_keys[0] { - msg!( - "Expected oracle key: {:?}, got: {:?}", - bank_config.oracle_keys[0], - oracle_ais[0].key - ); - return Err(error!(MarginfiError::WrongOracleAccountKeys)); - } - - SwitchboardV2PriceFeed::check_ais(&oracle_ais[0])?; - - Ok(()) + OracleSetup::SwbDeprecated => { + panic!("swb v2 is deprecated"); } OracleSetup::PythPushOracle => { check!( @@ -693,115 +679,6 @@ impl PriceAdapter for SwitchboardPullPriceFeed { } } -#[cfg_attr(feature = "client", derive(Clone, Debug))] -pub struct SwitchboardV2PriceFeed { - aggregator_account: Box, -} - -impl SwitchboardV2PriceFeed { - pub fn load_checked( - ai: &AccountInfo, - current_timestamp: i64, - max_age: u64, - ) -> MarginfiResult { - let ai_data = ai.data.borrow(); - - check!( - ai.owner.eq(&SWITCHBOARD_PROGRAM_ID), - MarginfiError::InternalLogicError - ); - - let aggregator_account = AggregatorAccountData::new_from_bytes(&ai_data) - .map_err(|_| MarginfiError::InternalLogicError)?; - - aggregator_account - .check_staleness(current_timestamp, max_age as i64) - .map_err(|_| MarginfiError::InternalLogicError)?; - - Ok(Self { - aggregator_account: Box::new(aggregator_account.into()), - }) - } - - fn check_ais(ai: &AccountInfo) -> MarginfiResult { - let ai_data = ai.data.borrow(); - - check!( - ai.owner.eq(&SWITCHBOARD_PROGRAM_ID), - MarginfiError::InternalLogicError - ); - - AggregatorAccountData::new_from_bytes(&ai_data) - .map_err(|_| MarginfiError::InternalLogicError)?; - - Ok(()) - } - - fn get_price(&self) -> MarginfiResult { - let sw_decimal = self - .aggregator_account - .get_result() - .map_err(|_| MarginfiError::InvalidPrice)?; - - Ok(switchboard_decimal_to_i80f48(sw_decimal) - .ok_or(MarginfiError::InvalidSwitchboardDecimalConversion)?) - } - - fn get_confidence_interval(&self) -> MarginfiResult { - let std_div = self.aggregator_account.latest_confirmed_round_std_deviation; - let std_div = switchboard_decimal_to_i80f48(std_div) - .ok_or(MarginfiError::InvalidSwitchboardDecimalConversion)?; - - let conf_interval = std_div - .checked_mul(STD_DEV_MULTIPLE) - .ok_or_else(math_error!())?; - - let price = self.get_price()?; - - let max_conf_interval = price - .checked_mul(MAX_CONF_INTERVAL) - .ok_or_else(math_error!())?; - - assert!( - max_conf_interval >= I80F48::ZERO, - "Negative max confidence interval" - ); - - assert!( - conf_interval >= I80F48::ZERO, - "Negative confidence interval" - ); - - Ok(min(conf_interval, max_conf_interval)) - } -} - -impl PriceAdapter for SwitchboardV2PriceFeed { - fn get_price_of_type( - &self, - _price_type: OraclePriceType, - bias: Option, - ) -> MarginfiResult { - let price = self.get_price()?; - - match bias { - Some(price_bias) => { - let confidence_interval = self.get_confidence_interval()?; - - match price_bias { - PriceBias::Low => Ok(price - .checked_sub(confidence_interval) - .ok_or_else(math_error!())?), - PriceBias::High => Ok(price - .checked_add(confidence_interval) - .ok_or_else(math_error!())?), - } - } - None => Ok(price), - } - } -} - pub fn load_price_update_v2_checked(ai: &AccountInfo) -> MarginfiResult { if live!() { check_eq!( @@ -823,7 +700,7 @@ pub fn load_price_update_v2_checked(ai: &AccountInfo) -> MarginfiResult::DISCRIMINATOR, + discriminator == ::DISCRIMINATOR, MarginfiError::PythPushInvalidAccount ); @@ -1074,58 +951,6 @@ impl From> for LitePullFeedAccountData { } } -/// A slimmed down version of the AggregatorAccountData struct copied from the switchboard-v2/src/aggregator.rs -#[cfg_attr(feature = "client", derive(Clone, Debug))] -struct LiteAggregatorAccountData { - /// Use sliding windoe or round based resolution - /// NOTE: This changes result propagation in latest_round_result - pub resolution_mode: AggregatorResolutionMode, - /// Latest confirmed update request result that has been accepted as valid. - pub latest_confirmed_round_result: SwitchboardDecimal, - pub latest_confirmed_round_num_success: u32, - pub latest_confirmed_round_std_deviation: SwitchboardDecimal, - /// Minimum number of oracle responses required before a round is validated. - pub min_oracle_results: u32, -} - -impl From<&AggregatorAccountData> for LiteAggregatorAccountData { - fn from(agg: &AggregatorAccountData) -> Self { - Self { - resolution_mode: agg.resolution_mode, - latest_confirmed_round_result: agg.latest_confirmed_round.result, - latest_confirmed_round_num_success: agg.latest_confirmed_round.num_success, - latest_confirmed_round_std_deviation: agg.latest_confirmed_round.std_deviation, - min_oracle_results: agg.min_oracle_results, - } - } -} - -impl LiteAggregatorAccountData { - /// If sufficient oracle responses, returns the latest on-chain result in SwitchboardDecimal format - /// - /// # Examples - /// - /// ```ignore - /// use switchboard_v2::AggregatorAccountData; - /// use std::convert::TryInto; - /// - /// let feed_result = AggregatorAccountData::new(feed_account_info)?.get_result()?; - /// let decimal: f64 = feed_result.try_into()?; - /// ``` - - pub fn get_result(&self) -> anchor_lang::Result { - if self.resolution_mode == AggregatorResolutionMode::ModeSlidingResolution { - return Ok(self.latest_confirmed_round_result); - } - let min_oracle_results = self.min_oracle_results; - let latest_confirmed_round_num_success = self.latest_confirmed_round_num_success; - if min_oracle_results > latest_confirmed_round_num_success { - return Err(MarginfiError::SwitchboardInvalidAccount.into()); - } - Ok(self.latest_confirmed_round_result) - } -} - #[inline(always)] fn pyth_price_components_to_i80f48(price: I80F48, exponent: i32) -> MarginfiResult { let scaling_factor = EXP_10_I80F48[exponent.unsigned_abs() as usize]; @@ -1153,70 +978,16 @@ fn load_pyth_price_feed(ai: &AccountInfo) -> MarginfiResult { Ok(price_feed) } -#[inline(always)] -fn switchboard_decimal_to_i80f48(decimal: SwitchboardDecimal) -> Option { - let decimal = fit_scale_switchboard_decimal(decimal, MAX_SCALE)?; - - I80F48::from_num(decimal.mantissa).checked_div(EXP_10_I80F48[decimal.scale as usize]) -} - -const MAX_SCALE: u32 = 20; - -/// Scale a SwitchboardDecimal down to a given scale. -/// Return original SwitchboardDecimal if it is already at or below the given scale. -/// -/// This may result in minimal loss of precision past the scale delta. -#[inline] -fn fit_scale_switchboard_decimal( - decimal: SwitchboardDecimal, - scale: u32, -) -> Option { - if decimal.scale <= scale { - return Some(decimal); - } - - let scale_diff = decimal.scale - scale; - let mantissa = decimal.mantissa.checked_div(EXP_10[scale_diff as usize])?; - - Some(SwitchboardDecimal { mantissa, scale }) -} - #[cfg(test)] mod tests { use fixed_macro::types::I80F48; use pretty_assertions::assert_eq; use rust_decimal::Decimal; + use switchboard_on_demand::Discriminator; use crate::utils::hex_to_bytes; use super::*; - #[test] - fn swb_decimal_test_18() { - let decimal = SwitchboardDecimal { - mantissa: 1000000000000000000, - scale: 18, - }; - let i80f48 = switchboard_decimal_to_i80f48(decimal).unwrap(); - assert_eq!(i80f48, I80F48::from_num(1)); - } - - #[test] - /// Testing the standard deviation of the switchboard oracle on the SOLUSD mainnet feed - fn swb_dec_test_28() { - let dec = SwitchboardDecimal { - mantissa: 13942937500000000000000000, - scale: 28, - }; - - { - let decimal: Decimal = dec.try_into().unwrap(); - println!("control check: {:?}", decimal); - } - - let i80f48 = switchboard_decimal_to_i80f48(dec).unwrap(); - - assert_eq!(i80f48, I80F48::from_num(0.00139429375)); - } #[test] fn pyth_conf_interval_cap() { @@ -1253,46 +1024,6 @@ mod tests { assert_eq!(low_conf_interval, I80F48!(2.12)); } - #[test] - fn switchboard_conf_interval_cap() { - // Define a price with a 10% confidence interval - // Initialize SwitchboardV2PriceFeed with high confidence price - let swb_adapter_high_confidence = SwitchboardV2PriceFeed { - aggregator_account: Box::new(LiteAggregatorAccountData { - resolution_mode: AggregatorResolutionMode::ModeSlidingResolution, - latest_confirmed_round_result: SwitchboardDecimal::from_f64(100.0), - latest_confirmed_round_num_success: 1, - latest_confirmed_round_std_deviation: SwitchboardDecimal::from_f64(10.0), - min_oracle_results: 1, - }), - }; - - let swb_adapter_low_confidence = SwitchboardV2PriceFeed { - aggregator_account: Box::new(LiteAggregatorAccountData { - resolution_mode: AggregatorResolutionMode::ModeSlidingResolution, - latest_confirmed_round_result: SwitchboardDecimal::from_f64(100.0), - latest_confirmed_round_num_success: 1, - latest_confirmed_round_std_deviation: SwitchboardDecimal::from_f64(1.0), - min_oracle_results: 1, - }), - }; - - // Test confidence interval - let high_conf_interval = swb_adapter_high_confidence - .get_confidence_interval() - .unwrap(); - // The confidence interval should be capped at 5% - assert_eq!(high_conf_interval, I80F48!(5.00000000000007)); - - let low_conf_interval = swb_adapter_low_confidence - .get_confidence_interval() - .unwrap(); - - // The confidence interval should be the calculated value (1.96%) - - assert_eq!(low_conf_interval, I80F48!(1.96)); - } - #[test] fn pyth_and_pyth_push_cmp() { fn get_prices( @@ -1472,91 +1203,117 @@ mod tests { ); } - use solana_sdk::account::Account; + use anchor_lang::solana_program::account_info::AccountInfo; use std::cell::RefCell; use std::rc::Rc; - /// Convert an account to info, useful if you only care about data for testing purposes. - pub fn account_to_account_info<'a>( - account: &'a mut Account, - key: &'a Pubkey, - ) -> AccountInfo<'a> { - AccountInfo { - key, - lamports: Rc::new(RefCell::new(&mut account.lamports)), - data: Rc::new(RefCell::new(&mut account.data[..])), - owner: &account.owner, - rent_epoch: account.rent_epoch, - is_signer: false, - is_writable: true, - executable: account.executable, - } - } - - pub fn create_switch_pull_oracle_account_from_bytes(data: Vec) -> Account { - Account { - lamports: 1_000_000, - data, - owner: SWITCHBOARD_PULL_ID, - executable: false, - rent_epoch: 361, - } - } - - #[test] - fn swb_pull_get_price() { - // From mainnet: https://solana.fm/address/BSzfJs4d1tAkSDqkepnfzEVcx2WtDVnwwXa2giy9PLeP - // Actual price $155.59404527 - // conf/Std_dev ~5% - let bytes = hex_to_bytes("c41b6cc40ad7db286f5e7566ac000a9530e56b1db49585772719aeaaeeadb4d9bd8c2357b88e9e782e53d81000000000000000000000000000985f538057856308000000000000005cba953f3f15356b17703e554d3983801916531d7976aa424ad64348ec50e4224650d81000000000000000000000000000a0d5a780cc7f580800000000000000a20b742cedab55efd1faf60aef2cb872a092d24dfba8a48c8b953a5e90ac7bbf874ed81000000000000000000000000000c04958360093580800000000000000e7ef024ea756f8beec2eaa40234070da356754a8eeb2ac6a17c32d17c3e99f8ddc50d81000000000000000000000000000bc8739b45d215b0800000000000000e3e5130902c3e9c27917789769f1ae05de15cf504658beafeed2c598a949b3b7bf53d810000000000000000000000000007cec168c94d667080000000000000020e270b743473d87eff321663e267ba1c9a151f7969cef8147f625e9a2af7287ea54d81000000000000000000000000000dc65eccc174d6f0800000000000000ab605484238ac93f225c65f24d7705bb74b00cdb576555c3995e196691a4de5f484ed8100000000000000000000000000088f28dc9271d59080000000000000015196392573dc9043242716f629d4c0fb93bc0cff7a1a10ede24281b0e98fb7d5454d810000000000000000000000000000441a10ca4a268080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000048ac38271f28ab1b12e49439bddf54871094e4832a56c7a8ec57bd18d357980086807068432f186a147cf0b13a30067d386204ea9d6c8b04743ac2ef010b07524c935636f2523f6aeeb6dc7b7dab0e86a13ff2c794f7895fc78851d69fdb593bdccdb36600000000000000000000000000e40b540200000001000000534f4c2f55534400000000000000000000000000000000000000000000000000000000019e9eb66600000000fca3d11000000000000000000000000000000000000000000000000000000000000000000000000000dc65eccc174d6f0800000000000000006c9225e039550300000000000000000070d3c6ecddf76b080000000000000000d8244bc073aa060000000000000000000441a10ca4a268080000000000000000dc65eccc174d6f08000000000000000200000000000000ea54d810000000005454d81000000000ea54d81000000000fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); - let mut acc = create_switch_pull_oracle_account_from_bytes(bytes); - let key = pubkey!("BSzfJs4d1tAkSDqkepnfzEVcx2WtDVnwwXa2giy9PLeP"); - let ai = account_to_account_info(&mut acc, &key); - let ai_check = SwitchboardPullPriceFeed::check_ais(&ai); - assert!(ai_check.is_ok()); - - let current_timestamp = 42; - let max_age = 100; - let feed: SwitchboardPullPriceFeed = - SwitchboardPullPriceFeed::load_checked(&ai, current_timestamp, max_age).unwrap(); - let price: I80F48 = feed.get_price().unwrap(); - let conf: I80F48 = feed.get_confidence_interval().unwrap(); - - //println!("price: {:?}, conf: {:?}", price, conf); - - let target_price: I80F48 = I80F48::from_num(155); // Target price is $155 - let price_tolerance: I80F48 = target_price * I80F48::from_num(0.01); - - let target_conf: I80F48 = target_price * I80F48::from_num(0.05); - let conf_tolerance: I80F48 = target_conf * I80F48::from_num(0.005); - - let min_price: I80F48 = target_price.checked_sub(price_tolerance).unwrap(); - let max_price: I80F48 = target_price.checked_add(price_tolerance).unwrap(); - assert!(price >= min_price && price <= max_price); - - let min_conf: I80F48 = target_conf.checked_sub(conf_tolerance).unwrap(); - let max_conf: I80F48 = target_conf.checked_add(conf_tolerance).unwrap(); - assert!(conf >= min_conf && conf <= max_conf); - - let price_bias_none: I80F48 = feed - .get_price_of_type(OraclePriceType::RealTime, None) - .unwrap(); - assert_eq!(price, price_bias_none); - - let price_bias_low: I80F48 = feed - .get_price_of_type(OraclePriceType::RealTime, Some(PriceBias::Low)) - .unwrap(); - let target_price_low: I80F48 = target_price.checked_sub(target_conf).unwrap(); - let min_price: I80F48 = target_price_low.checked_sub(price_tolerance).unwrap(); - let max_price: I80F48 = target_price_low.checked_add(price_tolerance).unwrap(); - assert!(price_bias_low >= min_price && price_bias_low <= max_price); - - let price_bias_high: I80F48 = feed - .get_price_of_type(OraclePriceType::RealTime, Some(PriceBias::High)) - .unwrap(); - let target_price_high: I80F48 = target_price.checked_add(target_conf).unwrap(); - let min_price: I80F48 = target_price_high.checked_sub(price_tolerance).unwrap(); - let max_price: I80F48 = target_price_high.checked_add(price_tolerance).unwrap(); - assert!(price_bias_high >= min_price && price_bias_high <= max_price); - } + // TODO restore + + // /// Convert an account to info, useful if you only care about data for testing purposes. + // pub fn account_to_account_info<'a>( + // account: &'a mut dyn Account, + // key: &'a Pubkey, + // ) -> AccountInfo<'a> { + // AccountInfo { + // key, + // lamports: Rc::new(RefCell::new(&mut account.lamports)), + // data: Rc::new(RefCell::new(&mut account.data[..])), + // owner: &account.owner, + // rent_epoch: account.rent_epoch, + // is_signer: false, + // is_writable: true, + // executable: account.executable, + // } + // } + + // pub fn create_switch_pull_oracle_account_from_bytes(data: Vec) -> dyn Account { + // Account { + // lamports: 1_000_000, + // data, + // owner: SWITCHBOARD_PULL_ID, + // executable: false, + // rent_epoch: 361, + // } + // } + + // #[test] + // fn swb_pull_get_price() { + // // From mainnet: https://solana.fm/address/BSzfJs4d1tAkSDqkepnfzEVcx2WtDVnwwXa2giy9PLeP + // // Actual price $155.59404527 + // // conf/Std_dev ~5% + // let bytes = hex_to_bytes("c41b6cc40ad7db286f5e7566ac000a9530e56b1db49585772719aeaaeeadb4d9bd8c2357b88e9e782e53d81000000000000000000000000000985f538057856308000000000000005cba953f3f15356b17703e554d3983801916531d7976aa424ad64348ec50e4224650d81000000000000000000000000000a0d5a780cc7f580800000000000000a20b742cedab55efd1faf60aef2cb872a092d24dfba8a48c8b953a5e90ac7bbf874ed81000000000000000000000000000c04958360093580800000000000000e7ef024ea756f8beec2eaa40234070da356754a8eeb2ac6a17c32d17c3e99f8ddc50d81000000000000000000000000000bc8739b45d215b0800000000000000e3e5130902c3e9c27917789769f1ae05de15cf504658beafeed2c598a949b3b7bf53d810000000000000000000000000007cec168c94d667080000000000000020e270b743473d87eff321663e267ba1c9a151f7969cef8147f625e9a2af7287ea54d81000000000000000000000000000dc65eccc174d6f0800000000000000ab605484238ac93f225c65f24d7705bb74b00cdb576555c3995e196691a4de5f484ed8100000000000000000000000000088f28dc9271d59080000000000000015196392573dc9043242716f629d4c0fb93bc0cff7a1a10ede24281b0e98fb7d5454d810000000000000000000000000000441a10ca4a268080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000048ac38271f28ab1b12e49439bddf54871094e4832a56c7a8ec57bd18d357980086807068432f186a147cf0b13a30067d386204ea9d6c8b04743ac2ef010b07524c935636f2523f6aeeb6dc7b7dab0e86a13ff2c794f7895fc78851d69fdb593bdccdb36600000000000000000000000000e40b540200000001000000534f4c2f55534400000000000000000000000000000000000000000000000000000000019e9eb66600000000fca3d11000000000000000000000000000000000000000000000000000000000000000000000000000dc65eccc174d6f0800000000000000006c9225e039550300000000000000000070d3c6ecddf76b080000000000000000d8244bc073aa060000000000000000000441a10ca4a268080000000000000000dc65eccc174d6f08000000000000000200000000000000ea54d810000000005454d81000000000ea54d81000000000fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + // let key = pubkey!("BSzfJs4d1tAkSDqkepnfzEVcx2WtDVnwwXa2giy9PLeP"); + // let mut data = bytes.clone(); + // println!("data: {:?}", data.len()); + + // let mut lamports = 1_000_000u64; + // let discrim = &PullFeedAccountData::DISCRIMINATOR; + // let mut fake_data: [u8; 3208] = [0; 3208]; + // fake_data[0..8].copy_from_slice(discrim); + + // let ai = AccountInfo { + // key: &key, + // lamports: Rc::new(RefCell::new(&mut lamports)), + // data: Rc::new(RefCell::new(&mut fake_data[..])), + // owner: &SWITCHBOARD_PULL_ID, + // rent_epoch: 361, + // is_signer: false, + // is_writable: true, + // executable: false, + // }; + + // let ai_data = ai.data.borrow(); + // println!("a"); + // let result = PullFeedAccountData::parse(ai_data) + // .map_err(|_| MarginfiError::SwitchboardInvalidAccount); + // println!("b"); + + // let ai_check = SwitchboardPullPriceFeed::check_ais(&ai); + // assert!(ai_check.is_ok()); + + // println!("b"); + // let current_timestamp = 42; + // let max_age = 100; + // let feed: SwitchboardPullPriceFeed = + // SwitchboardPullPriceFeed::load_checked(&ai, current_timestamp, max_age).unwrap(); + // let price: I80F48 = feed.get_price().unwrap(); + // let conf: I80F48 = feed.get_confidence_interval().unwrap(); + + // //println!("price: {:?}, conf: {:?}", price, conf); + + // let target_price: I80F48 = I80F48::from_num(155); // Target price is $155 + // let price_tolerance: I80F48 = target_price * I80F48::from_num(0.01); + + // let target_conf: I80F48 = target_price * I80F48::from_num(0.05); + // let conf_tolerance: I80F48 = target_conf * I80F48::from_num(0.005); + + // let min_price: I80F48 = target_price.checked_sub(price_tolerance).unwrap(); + // let max_price: I80F48 = target_price.checked_add(price_tolerance).unwrap(); + // assert!(price >= min_price && price <= max_price); + + // let min_conf: I80F48 = target_conf.checked_sub(conf_tolerance).unwrap(); + // let max_conf: I80F48 = target_conf.checked_add(conf_tolerance).unwrap(); + // assert!(conf >= min_conf && conf <= max_conf); + + // let price_bias_none: I80F48 = feed + // .get_price_of_type(OraclePriceType::RealTime, None) + // .unwrap(); + // assert_eq!(price, price_bias_none); + + // let price_bias_low: I80F48 = feed + // .get_price_of_type(OraclePriceType::RealTime, Some(PriceBias::Low)) + // .unwrap(); + // let target_price_low: I80F48 = target_price.checked_sub(target_conf).unwrap(); + // let min_price: I80F48 = target_price_low.checked_sub(price_tolerance).unwrap(); + // let max_price: I80F48 = target_price_low.checked_add(price_tolerance).unwrap(); + // assert!(price_bias_low >= min_price && price_bias_low <= max_price); + + // let price_bias_high: I80F48 = feed + // .get_price_of_type(OraclePriceType::RealTime, Some(PriceBias::High)) + // .unwrap(); + // let target_price_high: I80F48 = target_price.checked_add(target_conf).unwrap(); + // let min_price: I80F48 = target_price_high.checked_sub(price_tolerance).unwrap(); + // let max_price: I80F48 = target_price_high.checked_add(price_tolerance).unwrap(); + // assert!(price_bias_high >= min_price && price_bias_high <= max_price); + // } } diff --git a/programs/marginfi/tests/admin_actions/bankruptcy.rs b/programs/marginfi/tests/admin_actions/bankruptcy.rs index 4a8cc91b2..b3afb5b04 100644 --- a/programs/marginfi/tests/admin_actions/bankruptcy.rs +++ b/programs/marginfi/tests/admin_actions/bankruptcy.rs @@ -13,11 +13,9 @@ use solana_program_test::*; use test_case::test_case; #[test_case(BankMint::Usdc, BankMint::Sol)] -#[test_case(BankMint::UsdcSwb, BankMint::Sol)] #[test_case(BankMint::Sol, BankMint::Usdc)] -#[test_case(BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_failure_not_bankrupt( collateral_mint: BankMint, @@ -100,11 +98,9 @@ async fn marginfi_group_handle_bankruptcy_failure_not_bankrupt( } #[test_case(BankMint::Usdc, BankMint::Sol)] -#[test_case(BankMint::UsdcSwb, BankMint::Sol)] #[test_case(BankMint::Sol, BankMint::Usdc)] -#[test_case(BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_failure_no_debt( collateral_mint: BankMint, @@ -194,11 +190,9 @@ async fn marginfi_group_handle_bankruptcy_failure_no_debt( } #[test_case(BankMint::Usdc, BankMint::Sol)] -#[test_case(BankMint::UsdcSwb, BankMint::Sol)] #[test_case(BankMint::Sol, BankMint::Usdc)] -#[test_case(BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_success( collateral_mint: BankMint, @@ -286,11 +280,9 @@ async fn marginfi_group_handle_bankruptcy_success( } #[test_case(10_000., BankMint::Usdc, BankMint::Sol)] -#[test_case(10_000., BankMint::UsdcSwb, BankMint::Sol)] #[test_case(10_000., BankMint::Sol, BankMint::Usdc)] -#[test_case(10_000., BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(10_000., BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(10_000., BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(10_000., BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(10_000., BankMint::T22WithFee, BankMint::Sol)] #[test_case(10_000., BankMint::Usdc, BankMint::SolSwbOrigFee)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_group_handle_bankruptcy_success_fully_insured( @@ -552,11 +544,9 @@ async fn marginfi_group_handle_bankruptcy_success_fully_insured( } #[test_case(10_000., 5000., BankMint::Usdc, BankMint::Sol)] -#[test_case(10_000., 5000., BankMint::UsdcSwb, BankMint::Sol)] #[test_case(10_000., 5000., BankMint::Sol, BankMint::Usdc)] -#[test_case(10_000., 5000., BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(10_000., 5000., BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(10_000., 5000., BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(10_000., 5000., BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(10_000., 5000., BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_success_partially_insured( borrow_amount: f64, @@ -730,11 +720,9 @@ async fn marginfi_group_handle_bankruptcy_success_partially_insured( } #[test_case(10_000., BankMint::Usdc, BankMint::Sol)] -#[test_case(10_000., BankMint::UsdcSwb, BankMint::Sol)] #[test_case(10_000., BankMint::Sol, BankMint::Usdc)] -#[test_case(10_000., BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(10_000., BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(10_000., BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(10_000., BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(10_000., BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_success_not_insured( borrow_amount: f64, diff --git a/programs/marginfi/tests/admin_actions/create_marginfi_group.rs b/programs/marginfi/tests/admin_actions/create_marginfi_group.rs index 13db1b55b..a2aad1d7a 100644 --- a/programs/marginfi/tests/admin_actions/create_marginfi_group.rs +++ b/programs/marginfi/tests/admin_actions/create_marginfi_group.rs @@ -1,8 +1,8 @@ +use anchor_lang::solana_program::{instruction::Instruction, system_program}; use anchor_lang::{InstructionData, ToAccountMetas}; use fixtures::prelude::*; use marginfi::{constants::FEE_STATE_SEED, prelude::MarginfiGroup}; use pretty_assertions::assert_eq; -use solana_program::{instruction::Instruction, system_program}; use solana_program_test::*; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer, transaction::Transaction}; diff --git a/programs/marginfi/tests/admin_actions/setup_bank.rs b/programs/marginfi/tests/admin_actions/setup_bank.rs index b3d9ee0c8..4e7a08bd0 100644 --- a/programs/marginfi/tests/admin_actions/setup_bank.rs +++ b/programs/marginfi/tests/admin_actions/setup_bank.rs @@ -13,8 +13,7 @@ use marginfi::{ }; use pretty_assertions::assert_eq; use solana_program_test::*; -use solana_sdk::pubkey::Pubkey; -use switchboard_solana::Clock; +use solana_sdk::{clock::Clock, pubkey::Pubkey}; use test_case::test_case; #[tokio::test] @@ -30,14 +29,8 @@ async fn add_bank_success() -> anyhow::Result<()> { *DEFAULT_USDC_TEST_BANK_CONFIG, ), ( - MintFixture::new_token_22( - test_f.context.clone(), - None, - None, - &[SupportedExtension::TransferFee], - ) - .await, - *DEFAULT_T22_WITH_FEE_TEST_BANK_CONFIG, + MintFixture::new(test_f.context.clone(), None, None).await, + *DEFAULT_SOL_TEST_BANK_CONFIG, ), ( MintFixture::new_from_file(&test_f.context.clone(), "src/fixtures/pyUSD.json"), @@ -163,14 +156,8 @@ async fn add_bank_with_seed_success() -> anyhow::Result<()> { *DEFAULT_USDC_TEST_BANK_CONFIG, ), ( - MintFixture::new_token_22( - test_f.context.clone(), - None, - None, - &[SupportedExtension::TransferFee], - ) - .await, - *DEFAULT_T22_WITH_FEE_TEST_BANK_CONFIG, + MintFixture::new(test_f.context.clone(), None, None).await, + *DEFAULT_SOL_TEST_BANK_CONFIG, ), ( MintFixture::new_from_file(&test_f.context.clone(), "src/fixtures/pyUSD.json"), @@ -310,8 +297,8 @@ async fn marginfi_group_add_bank_failure_inexistent_pyth_feed() -> anyhow::Resul } #[test_case(BankMint::Usdc)] -#[test_case(BankMint::PyUSD)] -#[test_case(BankMint::T22WithFee)] +// t22 #[test_case(BankMint::PyUSD)] +// t22 #[test_case(BankMint::T22WithFee)] #[test_case(BankMint::SolSwbPull)] #[tokio::test] async fn configure_bank_success(bank_mint: BankMint) -> anyhow::Result<()> { @@ -447,14 +434,8 @@ async fn add_too_many_arena_banks() -> anyhow::Result<()> { *DEFAULT_USDC_TEST_BANK_CONFIG, ), ( - MintFixture::new_token_22( - test_f.context.clone(), - None, - None, - &[SupportedExtension::TransferFee], - ) - .await, - *DEFAULT_T22_WITH_FEE_TEST_BANK_CONFIG, + MintFixture::new(test_f.context.clone(), None, None).await, + *DEFAULT_SOL_TEST_BANK_CONFIG, ), ]; @@ -502,14 +483,8 @@ async fn config_group_as_arena_too_many_banks() -> anyhow::Result<()> { *DEFAULT_USDC_TEST_BANK_CONFIG, ), ( - MintFixture::new_token_22( - test_f.context.clone(), - None, - None, - &[SupportedExtension::TransferFee], - ) - .await, - *DEFAULT_T22_WITH_FEE_TEST_BANK_CONFIG, + MintFixture::new(test_f.context.clone(), None, None).await, + *DEFAULT_SOL_TEST_BANK_CONFIG, ), ( MintFixture::new_from_file(&test_f.context.clone(), "src/fixtures/pyUSD.json"), @@ -538,8 +513,8 @@ async fn config_group_as_arena_too_many_banks() -> anyhow::Result<()> { } #[test_case(BankMint::Usdc)] -#[test_case(BankMint::PyUSD)] -#[test_case(BankMint::T22WithFee)] +// t22 #[test_case(BankMint::PyUSD)] +// t22 #[test_case(BankMint::T22WithFee)] #[test_case(BankMint::SolSwbPull)] #[tokio::test] async fn configure_bank_emode_success(bank_mint: BankMint) -> anyhow::Result<()> { @@ -619,8 +594,8 @@ async fn configure_bank_emode_success(bank_mint: BankMint) -> anyhow::Result<()> } #[test_case(BankMint::Usdc)] -#[test_case(BankMint::PyUSD)] -#[test_case(BankMint::T22WithFee)] +// t22 #[test_case(BankMint::PyUSD)] +// t22 #[test_case(BankMint::T22WithFee)] #[test_case(BankMint::SolSwbPull)] #[tokio::test] async fn configure_bank_emode_invalid_args(bank_mint: BankMint) -> anyhow::Result<()> { diff --git a/programs/marginfi/tests/admin_actions/withdraw_fees.rs b/programs/marginfi/tests/admin_actions/withdraw_fees.rs index 403d8e815..f128468fa 100644 --- a/programs/marginfi/tests/admin_actions/withdraw_fees.rs +++ b/programs/marginfi/tests/admin_actions/withdraw_fees.rs @@ -12,8 +12,8 @@ use test_case::test_case; #[test_case(BankMint::Usdc)] #[test_case(BankMint::Sol)] -#[test_case(BankMint::PyUSD)] -#[test_case(BankMint::T22WithFee)] +// t22 #[test_case(BankMint::PyUSD)] +// t22 #[test_case(BankMint::T22WithFee)] #[tokio::test] async fn marginfi_group_withdraw_fees_and_insurance_fund_as_admin_success( bank_mint: BankMint, @@ -81,8 +81,8 @@ async fn marginfi_group_withdraw_fees_and_insurance_fund_as_admin_success( #[test_case(BankMint::Usdc)] #[test_case(BankMint::Sol)] -#[test_case(BankMint::PyUSD)] -#[test_case(BankMint::T22WithFee)] +// t22 #[test_case(BankMint::PyUSD)] +// t22 #[test_case(BankMint::T22WithFee)] #[tokio::test] async fn marginfi_group_withdraw_fees_and_insurance_fund_as_non_admin_failure( bank_mint: BankMint, diff --git a/programs/marginfi/tests/misc/regression.rs b/programs/marginfi/tests/misc/regression.rs index 92661f5be..99cc015d2 100644 --- a/programs/marginfi/tests/misc/regression.rs +++ b/programs/marginfi/tests/misc/regression.rs @@ -1,5 +1,6 @@ use std::{fs::File, io::Read, path::PathBuf, str::FromStr}; +use anchor_lang::solana_program::pubkey; use anchor_lang::AccountDeserialize; use anyhow::bail; use base64::{prelude::BASE64_STANDARD, Engine}; @@ -16,9 +17,8 @@ use marginfi::{ }; use solana_account_decoder::UiAccountData; use solana_cli_output::CliAccount; -use solana_program::pubkey; use solana_program_test::tokio; -use switchboard_solana::Pubkey; +use solana_sdk::pubkey::Pubkey; #[tokio::test] async fn account_field_values_reg() -> anyhow::Result<()> { diff --git a/programs/marginfi/tests/misc/token_extensions.rs b/programs/marginfi/tests/misc/token_extensions.rs index 33487f339..8f54cc109 100644 --- a/programs/marginfi/tests/misc/token_extensions.rs +++ b/programs/marginfi/tests/misc/token_extensions.rs @@ -1,195 +1,195 @@ -use anchor_spl::token_2022::spl_token_2022::extension::{ - transfer_fee::TransferFeeConfig, BaseStateWithExtensions, -}; -use fixed::types::I80F48; -use fixed_macro::types::I80F48; -use fixtures::{ - assert_eq_noise, native, - spl::SupportedExtension, - test::{BankMint, TestBankSetting, TestFixture, TestSettings, DEFAULT_SOL_TEST_BANK_CONFIG}, - ui_to_native, -}; -use marginfi::state::marginfi_group::{Bank, BankConfig, BankConfigOpt, BankVaultType}; -use solana_program_test::tokio; -use test_case::test_case; - -#[test_case(vec![])] -#[test_case(vec![SupportedExtension::TransferFee])] -#[test_case(vec![SupportedExtension::TransferHook])] -#[test_case(vec![SupportedExtension::PermanentDelegate])] -#[test_case(vec![SupportedExtension::InterestBearing])] -#[test_case(vec![SupportedExtension::MintCloseAuthority])] -#[test_case(vec![SupportedExtension::PermanentDelegate, SupportedExtension::InterestBearing])] -#[test_case(vec![SupportedExtension::MintCloseAuthority, SupportedExtension::InterestBearing])] -#[test_case(vec![SupportedExtension::PermanentDelegate,SupportedExtension::MintCloseAuthority])] -#[test_case(vec![SupportedExtension::InterestBearing, SupportedExtension::MintCloseAuthority])] -#[test_case(vec![SupportedExtension::PermanentDelegate, SupportedExtension::InterestBearing, SupportedExtension::MintCloseAuthority])] -#[tokio::test] -async fn marginfi_account_liquidation_success_with_extension( - extensions: Vec, -) -> anyhow::Result<()> { - let test_f = TestFixture::new_with_t22_extension( - Some(TestSettings { - banks: vec![ - TestBankSetting { - mint: BankMint::Usdc, - ..TestBankSetting::default() - }, - TestBankSetting { - mint: BankMint::UsdcT22, - ..TestBankSetting::default() - }, - TestBankSetting { - mint: BankMint::PyUSD, - ..TestBankSetting::default() - }, - TestBankSetting { - mint: BankMint::Sol, - config: Some(BankConfig { - asset_weight_init: I80F48!(1).into(), - asset_weight_maint: I80F48!(1).into(), - ..*DEFAULT_SOL_TEST_BANK_CONFIG - }), - }, - ], - protocol_fees: false, - }), - &extensions, - ) - .await; - - let usdc_t22_bank_f = test_f.get_bank(&BankMint::UsdcT22); - let sol_bank_f = test_f.get_bank(&BankMint::Sol); - - let lender_mfi_account_f = test_f.create_marginfi_account().await; - let lender_token_account_usdc_t22 = test_f - .usdc_t22_mint - .create_token_account_and_mint_to(2_500) - .await; - lender_mfi_account_f - .try_bank_deposit( - lender_token_account_usdc_t22.key, - usdc_t22_bank_f, - 2_000, - None, - ) - .await - .unwrap(); - - let borrower_mfi_account_f = test_f.create_marginfi_account().await; - let borrower_token_account_sol = test_f.sol_mint.create_token_account_and_mint_to(100).await; - let borrower_token_account_usdc_t22 = test_f.usdc_t22_mint.create_empty_token_account().await; - - // Borrower deposits 100 SOL worth of $1000 - borrower_mfi_account_f - .try_bank_deposit(borrower_token_account_sol.key, sol_bank_f, 100, None) - .await?; - - // Borrower borrows $999 - // u32 is fine for this test.. not in production. Needed for Into - let usdc_t22_mint_state = usdc_t22_bank_f.mint.load_state().await; - let transfer_fee_offset: u32 = usdc_t22_mint_state - .get_extension::() - .map(|config| { - config - .calculate_inverse_epoch_fee(0, native!(900, "USDC")) - .unwrap_or(0) as u32 - }) - .unwrap_or(0); - - borrower_mfi_account_f - .try_bank_borrow(borrower_token_account_usdc_t22.key, usdc_t22_bank_f, 900) - .await - .unwrap(); - assert_eq!( - borrower_token_account_usdc_t22.balance().await, - native!(900, "USDC") - ); - - // Synthetically bring down the borrower account health by reducing the asset weights of the SOL bank - sol_bank_f - .update_config( - BankConfigOpt { - asset_weight_init: Some(I80F48!(0.25).into()), - asset_weight_maint: Some(I80F48!(0.5).into()), - ..Default::default() - }, - None, - ) - .await?; - - lender_mfi_account_f - .try_liquidate(&borrower_mfi_account_f, sol_bank_f, 1, usdc_t22_bank_f) - .await - .unwrap(); - - // Checks - let sol_bank: Bank = sol_bank_f.load().await; - let usdc_t22_bank: Bank = usdc_t22_bank_f.load().await; - - let depositor_ma = lender_mfi_account_f.load().await; - let borrower_ma = borrower_mfi_account_f.load().await; - - // Depositors should have 1 SOL - assert_eq!( - sol_bank - .get_asset_amount(depositor_ma.lending_account.balances[1].asset_shares.into()) - .unwrap(), - I80F48::from(native!(1, "SOL")) - ); - - // Depositors should have 1990.25 USDC - assert_eq_noise!( - usdc_t22_bank - .get_asset_amount(depositor_ma.lending_account.balances[0].asset_shares.into()) - .unwrap(), - I80F48::from(native!(1990.25, "USDC", f64)), - native!(0.00001, "USDC", f64) - ); - - // Borrower should have 99 SOL - assert_eq!( - sol_bank - .get_asset_amount(borrower_ma.lending_account.balances[0].asset_shares.into()) - .unwrap(), - I80F48::from(native!(99, "SOL")) - ); - - // Borrower should have 890.50 USDC - assert_eq_noise!( - usdc_t22_bank - .get_liability_amount( - borrower_ma.lending_account.balances[1] - .liability_shares - .into() - ) - .unwrap(), - I80F48::from(native!( - 890.50 + transfer_fee_offset as f64 / 1e6, - "USDC", - f64 - )), - native!(0.00001, "USDC", f64) - ); - - // Check insurance fund fee - let insurance_fund_usdc = usdc_t22_bank_f - .get_vault_token_account(BankVaultType::Insurance) - .await; - - let fee = usdc_t22_mint_state - .get_extension::() - .map(|config| { - config - .calculate_epoch_fee(0, ui_to_native!(0.25, 6)) - .unwrap_or(0) as u32 - }) - .unwrap_or(0); - assert_eq_noise!( - insurance_fund_usdc.balance().await as i64, - native!(0.25 - fee as f64 / 1e6, "USDC", f64) as i64, - 1 - ); - - Ok(()) -} +// use anchor_spl::token_2022::spl_token_2022::extension::{ +// transfer_fee::TransferFeeConfig, BaseStateWithExtensions, +// }; +// use fixed::types::I80F48; +// use fixed_macro::types::I80F48; +// use fixtures::{ +// assert_eq_noise, native, +// spl::SupportedExtension, +// test::{BankMint, TestBankSetting, TestFixture, TestSettings, DEFAULT_SOL_TEST_BANK_CONFIG}, +// ui_to_native, +// }; +// use marginfi::state::marginfi_group::{Bank, BankConfig, BankConfigOpt, BankVaultType}; +// use solana_program_test::tokio; +// use test_case::test_case; + +// #[test_case(vec![])] +// #[test_case(vec![SupportedExtension::TransferFee])] +// #[test_case(vec![SupportedExtension::TransferHook])] +// #[test_case(vec![SupportedExtension::PermanentDelegate])] +// #[test_case(vec![SupportedExtension::InterestBearing])] +// #[test_case(vec![SupportedExtension::MintCloseAuthority])] +// #[test_case(vec![SupportedExtension::PermanentDelegate, SupportedExtension::InterestBearing])] +// #[test_case(vec![SupportedExtension::MintCloseAuthority, SupportedExtension::InterestBearing])] +// #[test_case(vec![SupportedExtension::PermanentDelegate,SupportedExtension::MintCloseAuthority])] +// #[test_case(vec![SupportedExtension::InterestBearing, SupportedExtension::MintCloseAuthority])] +// #[test_case(vec![SupportedExtension::PermanentDelegate, SupportedExtension::InterestBearing, SupportedExtension::MintCloseAuthority])] +// #[tokio::test] +// async fn marginfi_account_liquidation_success_with_extension( +// extensions: Vec, +// ) -> anyhow::Result<()> { +// let test_f = TestFixture::new_with_t22_extension( +// Some(TestSettings { +// banks: vec![ +// TestBankSetting { +// mint: BankMint::Usdc, +// ..TestBankSetting::default() +// }, +// TestBankSetting { +// mint: BankMint::UsdcT22, +// ..TestBankSetting::default() +// }, +// TestBankSetting { +// mint: BankMint::PyUSD, +// ..TestBankSetting::default() +// }, +// TestBankSetting { +// mint: BankMint::Sol, +// config: Some(BankConfig { +// asset_weight_init: I80F48!(1).into(), +// asset_weight_maint: I80F48!(1).into(), +// ..*DEFAULT_SOL_TEST_BANK_CONFIG +// }), +// }, +// ], +// protocol_fees: false, +// }), +// &extensions, +// ) +// .await; + +// let usdc_t22_bank_f = test_f.get_bank(&BankMint::UsdcT22); +// let sol_bank_f = test_f.get_bank(&BankMint::Sol); + +// let lender_mfi_account_f = test_f.create_marginfi_account().await; +// let lender_token_account_usdc_t22 = test_f +// .usdc_t22_mint +// .create_token_account_and_mint_to(2_500) +// .await; +// lender_mfi_account_f +// .try_bank_deposit( +// lender_token_account_usdc_t22.key, +// usdc_t22_bank_f, +// 2_000, +// None, +// ) +// .await +// .unwrap(); + +// let borrower_mfi_account_f = test_f.create_marginfi_account().await; +// let borrower_token_account_sol = test_f.sol_mint.create_token_account_and_mint_to(100).await; +// let borrower_token_account_usdc_t22 = test_f.usdc_t22_mint.create_empty_token_account().await; + +// // Borrower deposits 100 SOL worth of $1000 +// borrower_mfi_account_f +// .try_bank_deposit(borrower_token_account_sol.key, sol_bank_f, 100, None) +// .await?; + +// // Borrower borrows $999 +// // u32 is fine for this test.. not in production. Needed for Into +// let usdc_t22_mint_state = usdc_t22_bank_f.mint.load_state().await; +// let transfer_fee_offset: u32 = usdc_t22_mint_state +// .get_extension::() +// .map(|config| { +// config +// .calculate_inverse_epoch_fee(0, native!(900, "USDC")) +// .unwrap_or(0) as u32 +// }) +// .unwrap_or(0); + +// borrower_mfi_account_f +// .try_bank_borrow(borrower_token_account_usdc_t22.key, usdc_t22_bank_f, 900) +// .await +// .unwrap(); +// assert_eq!( +// borrower_token_account_usdc_t22.balance().await, +// native!(900, "USDC") +// ); + +// // Synthetically bring down the borrower account health by reducing the asset weights of the SOL bank +// sol_bank_f +// .update_config( +// BankConfigOpt { +// asset_weight_init: Some(I80F48!(0.25).into()), +// asset_weight_maint: Some(I80F48!(0.5).into()), +// ..Default::default() +// }, +// None, +// ) +// .await?; + +// lender_mfi_account_f +// .try_liquidate(&borrower_mfi_account_f, sol_bank_f, 1, usdc_t22_bank_f) +// .await +// .unwrap(); + +// // Checks +// let sol_bank: Bank = sol_bank_f.load().await; +// let usdc_t22_bank: Bank = usdc_t22_bank_f.load().await; + +// let depositor_ma = lender_mfi_account_f.load().await; +// let borrower_ma = borrower_mfi_account_f.load().await; + +// // Depositors should have 1 SOL +// assert_eq!( +// sol_bank +// .get_asset_amount(depositor_ma.lending_account.balances[1].asset_shares.into()) +// .unwrap(), +// I80F48::from(native!(1, "SOL")) +// ); + +// // Depositors should have 1990.25 USDC +// assert_eq_noise!( +// usdc_t22_bank +// .get_asset_amount(depositor_ma.lending_account.balances[0].asset_shares.into()) +// .unwrap(), +// I80F48::from(native!(1990.25, "USDC", f64)), +// native!(0.00001, "USDC", f64) +// ); + +// // Borrower should have 99 SOL +// assert_eq!( +// sol_bank +// .get_asset_amount(borrower_ma.lending_account.balances[0].asset_shares.into()) +// .unwrap(), +// I80F48::from(native!(99, "SOL")) +// ); + +// // Borrower should have 890.50 USDC +// assert_eq_noise!( +// usdc_t22_bank +// .get_liability_amount( +// borrower_ma.lending_account.balances[1] +// .liability_shares +// .into() +// ) +// .unwrap(), +// I80F48::from(native!( +// 890.50 + transfer_fee_offset as f64 / 1e6, +// "USDC", +// f64 +// )), +// native!(0.00001, "USDC", f64) +// ); + +// // Check insurance fund fee +// let insurance_fund_usdc = usdc_t22_bank_f +// .get_vault_token_account(BankVaultType::Insurance) +// .await; + +// let fee = usdc_t22_mint_state +// .get_extension::() +// .map(|config| { +// config +// .calculate_epoch_fee(0, ui_to_native!(0.25, 6)) +// .unwrap_or(0) as u32 +// }) +// .unwrap_or(0); +// assert_eq_noise!( +// insurance_fund_usdc.balance().await as i64, +// native!(0.25 - fee as f64 / 1e6, "USDC", f64) as i64, +// 1 +// ); + +// Ok(()) +// } diff --git a/programs/marginfi/tests/user_actions/borrow.rs b/programs/marginfi/tests/user_actions/borrow.rs index 6b84b18ea..13f098bfd 100644 --- a/programs/marginfi/tests/user_actions/borrow.rs +++ b/programs/marginfi/tests/user_actions/borrow.rs @@ -18,11 +18,9 @@ use test_case::test_case; #[test_case(100., 9., BankMint::Usdc, BankMint::Sol)] #[test_case(123456.0, 12345.599999999, BankMint::Usdc, BankMint::Sol)] -#[test_case(123456.0, 10000., BankMint::UsdcSwb, BankMint::Sol)] #[test_case(1.0, 5.0, BankMint::Sol, BankMint::Usdc)] -#[test_case(128932.0, 9834.0, BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(240., 0.092, BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(36., 1.7, BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(240., 0.092, BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(36., 1.7, BankMint::T22WithFee, BankMint::Sol)] #[test_case(200., 1.1, BankMint::Usdc, BankMint::SolSwbOrigFee)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_account_borrow_success( @@ -212,11 +210,9 @@ async fn marginfi_account_borrow_success( #[test_case(100., 9., 10.000000001, BankMint::Usdc, BankMint::Sol)] #[test_case(123_456., 12_345.6, 12_345.9, BankMint::Usdc, BankMint::Sol)] -#[test_case(123_456., 10_000., 15_000., BankMint::UsdcSwb, BankMint::Sol)] #[test_case(1., 5., 11.98224, BankMint::Sol, BankMint::Usdc)] -#[test_case(128_932., 10_000., 15_000.0, BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(240., 0.092, 500., BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(36., 1.7, 1.9, BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(240., 0.092, 500., BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(36., 1.7, 1.9, BankMint::T22WithFee, BankMint::Sol)] #[test_case(1., 100., 155.1, BankMint::SolSwbPull, BankMint::Usdc)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_account_borrow_failure_not_enough_collateral( @@ -304,11 +300,9 @@ async fn marginfi_account_borrow_failure_not_enough_collateral( #[test_case(505., 500., 505.0000000001, BankMint::Usdc, BankMint::Sol)] #[test_case(12_345.6, 12_345.5, 12_345.9, BankMint::Usdc, BankMint::Sol)] -#[test_case(11_000., 10_000., 15_000., BankMint::UsdcSwb, BankMint::Sol)] #[test_case(0.91, 0.1, 0.98, BankMint::Sol, BankMint::Usdc)] -#[test_case(11_000., 10_000., 15_000., BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(505., 0.092, 500., BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(1.8, 1.7, 1.9, BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(505., 0.092, 500., BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(1.8, 1.7, 1.9, BankMint::T22WithFee, BankMint::Sol)] #[test_case(1.5, 1.4, 1.6, BankMint::SolSwbPull, BankMint::Usdc)] #[tokio::test] async fn marginfi_account_borrow_failure_borrow_limit( diff --git a/programs/marginfi/tests/user_actions/close_balance.rs b/programs/marginfi/tests/user_actions/close_balance.rs index 9415d0d1c..29648e367 100644 --- a/programs/marginfi/tests/user_actions/close_balance.rs +++ b/programs/marginfi/tests/user_actions/close_balance.rs @@ -4,7 +4,7 @@ use fixtures::{ }; use marginfi::errors::MarginfiError; use solana_program_test::tokio; -use switchboard_solana::Clock; +use solana_sdk::clock::Clock; #[tokio::test] async fn lending_account_close_balance() -> anyhow::Result<()> { diff --git a/programs/marginfi/tests/user_actions/deposit.rs b/programs/marginfi/tests/user_actions/deposit.rs index c754004eb..52532292c 100644 --- a/programs/marginfi/tests/user_actions/deposit.rs +++ b/programs/marginfi/tests/user_actions/deposit.rs @@ -12,15 +12,13 @@ use solana_sdk::{instruction::Instruction, signer::Signer}; use test_case::test_case; #[test_case(0.0, BankMint::Usdc)] -#[test_case(0.05, BankMint::UsdcSwb)] #[test_case(1_000.0, BankMint::Usdc)] #[test_case(0.05, BankMint::Sol)] -#[test_case(15_002.0, BankMint::SolSwb)] -#[test_case(0.05, BankMint::PyUSD)] -#[test_case(15_002.0, BankMint::PyUSD)] -#[test_case(0.0, BankMint::T22WithFee)] -#[test_case(0.05, BankMint::T22WithFee)] -#[test_case(15_002.0, BankMint::T22WithFee)] +// t22 #[test_case(0.05, BankMint::PyUSD)] +// t22 #[test_case(15_002.0, BankMint::PyUSD)] +// t22 #[test_case(0.0, BankMint::T22WithFee)] +// t22 #[test_case(0.05, BankMint::T22WithFee)] +// t22 #[test_case(15_002.0, BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_deposit_success( deposit_amount: f64, @@ -102,12 +100,10 @@ async fn marginfi_account_deposit_success( } #[test_case(1_000., 456., 2345., BankMint::Usdc)] -#[test_case(1_000., 456., 2345., BankMint::UsdcSwb)] #[test_case(1_000., 456., 2345., BankMint::Sol)] -#[test_case(1_000., 456., 2345., BankMint::SolSwb)] -#[test_case(1_000., 456., 2345., BankMint::PyUSD)] -#[test_case(1_000., 456., 2345., BankMint::T22WithFee)] -#[test_case(1_000., 999.999999, 1000., BankMint::T22WithFee)] +// t22 #[test_case(1_000., 456., 2345., BankMint::PyUSD)] +// t22 #[test_case(1_000., 456., 2345., BankMint::T22WithFee)] +// t22 #[test_case(1_000., 999.999999, 1000., BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_deposit_failure_capacity_exceeded( deposit_cap: f64, @@ -158,75 +154,75 @@ async fn marginfi_account_deposit_failure_capacity_exceeded( Ok(()) } -#[tokio::test] -async fn marginfi_account_deposit_failure_wrong_token_program() -> anyhow::Result<()> { - // ------------------------------------------------------------------------- - // Setup - // ------------------------------------------------------------------------- - - let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; - - // User - - let deposit_amount = 1_000.; - let bank_mint = BankMint::T22WithFee; - - let user_mfi_account_f = test_f.create_marginfi_account().await; - let user_wallet_balance = get_max_deposit_amount_pre_fee(deposit_amount); - let bank_f = test_f.get_bank(&bank_mint); - let user_token_account = bank_f - .mint - .create_token_account_and_mint_to(user_wallet_balance) - .await; - - // ------------------------------------------------------------------------- - // Test - // ------------------------------------------------------------------------- - - let marginfi_account = user_mfi_account_f.load().await; - - let accounts = marginfi::accounts::LendingAccountDeposit { - group: marginfi_account.group, - marginfi_account: user_mfi_account_f.key, - authority: test_f.context.borrow().payer.pubkey(), - bank: bank_f.key, - signer_token_account: user_token_account.key, - liquidity_vault: bank_f.get_vault(BankVaultType::Liquidity).0, - token_program: spl_token::ID, - } - .to_account_metas(Some(true)); - - let deposit_ix = Instruction { - program_id: marginfi::id(), - accounts, - data: marginfi::instruction::LendingAccountDeposit { - amount: native!(deposit_amount, bank_f.mint.mint.decimals, f64), - deposit_up_to_limit: None, - } - .data(), - }; - - let tx = { - let ctx = test_f.context.borrow(); - Transaction::new_signed_with_payer( - &[deposit_ix], - Some(&ctx.payer.pubkey().clone()), - &[&ctx.payer], - ctx.last_blockhash, - ) - }; - - let mut ctx = test_f.context.borrow_mut(); - let res = ctx.banks_client.process_transaction(tx).await; - assert!(res.is_err()); - - Ok(()) -} +// #[tokio::test] +// async fn marginfi_account_deposit_failure_wrong_token_program() -> anyhow::Result<()> { +// // ------------------------------------------------------------------------- +// // Setup +// // ------------------------------------------------------------------------- + +// let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; + +// // User + +// let deposit_amount = 1_000.; +// let bank_mint = BankMint::T22WithFee; + +// let user_mfi_account_f = test_f.create_marginfi_account().await; +// let user_wallet_balance = get_max_deposit_amount_pre_fee(deposit_amount); +// let bank_f = test_f.get_bank(&bank_mint); +// let user_token_account = bank_f +// .mint +// .create_token_account_and_mint_to(user_wallet_balance) +// .await; + +// // ------------------------------------------------------------------------- +// // Test +// // ------------------------------------------------------------------------- + +// let marginfi_account = user_mfi_account_f.load().await; + +// let accounts = marginfi::accounts::LendingAccountDeposit { +// group: marginfi_account.group, +// marginfi_account: user_mfi_account_f.key, +// authority: test_f.context.borrow().payer.pubkey(), +// bank: bank_f.key, +// signer_token_account: user_token_account.key, +// liquidity_vault: bank_f.get_vault(BankVaultType::Liquidity).0, +// token_program: spl_token::ID, +// } +// .to_account_metas(Some(true)); + +// let deposit_ix = Instruction { +// program_id: marginfi::id(), +// accounts, +// data: marginfi::instruction::LendingAccountDeposit { +// amount: native!(deposit_amount, bank_f.mint.mint.decimals, f64), +// deposit_up_to_limit: None, +// } +// .data(), +// }; + +// let tx = { +// let ctx = test_f.context.borrow(); +// Transaction::new_signed_with_payer( +// &[deposit_ix], +// Some(&ctx.payer.pubkey().clone()), +// &[&ctx.payer], +// ctx.last_blockhash, +// ) +// }; + +// let mut ctx = test_f.context.borrow_mut(); +// let res = ctx.banks_client.process_transaction(tx).await; +// assert!(res.is_err()); + +// Ok(()) +// } #[test_case(1_000., 500., 800., 500., BankMint::Usdc)] #[test_case(1_000., 500., 800., 500., BankMint::Sol)] -#[test_case(1_000., 500., 800., 500., BankMint::PyUSD)] -#[test_case(1_000., 500., 800., 500., BankMint::T22WithFee)] +// t22 #[test_case(1_000., 500., 800., 500., BankMint::PyUSD)] +// t22 #[test_case(1_000., 500., 800., 500., BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_deposit_up_to_limit_success( deposit_cap: f64, diff --git a/programs/marginfi/tests/user_actions/flash_loan.rs b/programs/marginfi/tests/user_actions/flash_loan.rs index 6d9f49b46..512790da7 100644 --- a/programs/marginfi/tests/user_actions/flash_loan.rs +++ b/programs/marginfi/tests/user_actions/flash_loan.rs @@ -1,8 +1,8 @@ +use anchor_lang::solana_program::{instruction::Instruction, pubkey::Pubkey}; use anchor_lang::{InstructionData, ToAccountMetas}; use fixtures::{assert_custom_error, prelude::*}; use marginfi::prelude::*; use pretty_assertions::assert_eq; -use solana_program::{instruction::Instruction, pubkey::Pubkey}; use solana_program_test::*; use solana_sdk::{ compute_budget::ComputeBudgetInstruction, signer::Signer, transaction::Transaction, diff --git a/programs/marginfi/tests/user_actions/liquidate.rs b/programs/marginfi/tests/user_actions/liquidate.rs index 6203a9d44..8a3666842 100644 --- a/programs/marginfi/tests/user_actions/liquidate.rs +++ b/programs/marginfi/tests/user_actions/liquidate.rs @@ -17,9 +17,9 @@ use test_case::test_case; #[test_case(100., 9.9, 1., BankMint::Usdc, BankMint::Sol)] #[test_case(123., 122., 10., BankMint::SolEquivalent, BankMint::SolEqIsolated)] -#[test_case(1_000., 999., 10., BankMint::Usdc, BankMint::T22WithFee)] -#[test_case(2_000., 99., 1_000., BankMint::T22WithFee, BankMint::SolEquivalent)] -#[test_case(2_000., 1_999., 2_000., BankMint::Usdc, BankMint::PyUSD)] +// t22 #[test_case(1_000., 999., 10., BankMint::Usdc, BankMint::T22WithFee)] +// t22 #[test_case(2_000., 99., 1_000., BankMint::T22WithFee, BankMint::SolEquivalent)] +// t22 #[test_case(2_000., 1_999., 2_000., BankMint::Usdc, BankMint::PyUSD)] #[tokio::test] async fn marginfi_account_liquidation_success( deposit_amount: f64, @@ -396,128 +396,6 @@ async fn marginfi_account_liquidation_success_many_balances() -> anyhow::Result< Ok(()) } -#[tokio::test] -async fn marginfi_account_liquidation_success_swb() -> anyhow::Result<()> { - let test_f = TestFixture::new(Some(TestSettings { - banks: vec![ - TestBankSetting { - mint: BankMint::Usdc, - ..TestBankSetting::default() - }, - TestBankSetting { - mint: BankMint::Sol, - config: Some(BankConfig { - asset_weight_init: I80F48!(1).into(), - asset_weight_maint: I80F48!(1).into(), - ..*DEFAULT_SOL_TEST_SW_BANK_CONFIG - }), - }, - ], - protocol_fees: false, - })) - .await; - - let usdc_bank_f = test_f.get_bank(&BankMint::Usdc); - let sol_bank_f = test_f.get_bank(&BankMint::Sol); - - let lender_mfi_account_f = test_f.create_marginfi_account().await; - let lender_token_account_usdc = test_f - .usdc_mint - .create_token_account_and_mint_to(2_000) - .await; - lender_mfi_account_f - .try_bank_deposit(lender_token_account_usdc.key, usdc_bank_f, 2_000, None) - .await?; - - let borrower_mfi_account_f = test_f.create_marginfi_account().await; - let borrower_token_account_sol = test_f.sol_mint.create_token_account_and_mint_to(100).await; - let borrower_token_account_usdc = test_f.usdc_mint.create_empty_token_account().await; - - // Borrower deposits 100 SOL worth of $1000 - borrower_mfi_account_f - .try_bank_deposit(borrower_token_account_sol.key, sol_bank_f, 100, None) - .await?; - - // Borrower borrows $999 - borrower_mfi_account_f - .try_bank_borrow(borrower_token_account_usdc.key, usdc_bank_f, 999) - .await?; - - // Synthetically bring down the borrower account health by reducing the asset weights of the SOL bank - sol_bank_f - .update_config( - BankConfigOpt { - asset_weight_init: Some(I80F48!(0.25).into()), - asset_weight_maint: Some(I80F48!(0.5).into()), - ..Default::default() - }, - None, - ) - .await?; - - lender_mfi_account_f - .try_liquidate(&borrower_mfi_account_f, sol_bank_f, 1, usdc_bank_f) - .await?; - - // Checks - let sol_bank: Bank = sol_bank_f.load().await; - let usdc_bank: Bank = usdc_bank_f.load().await; - - let depositor_ma = lender_mfi_account_f.load().await; - let borrower_ma = borrower_mfi_account_f.load().await; - - // Depositors should have 1 SOL - assert_eq!( - sol_bank - .get_asset_amount(depositor_ma.lending_account.balances[1].asset_shares.into()) - .unwrap(), - I80F48::from(native!(1, "SOL")) - ); - - // Depositors should have 1990.25 USDC - assert_eq_noise!( - usdc_bank - .get_asset_amount(depositor_ma.lending_account.balances[0].asset_shares.into()) - .unwrap(), - I80F48::from(native!(1990.25, "USDC", f64)), - native!(0.01, "USDC", f64) - ); - - // Borrower should have 99 SOL - assert_eq!( - sol_bank - .get_asset_amount(borrower_ma.lending_account.balances[0].asset_shares.into()) - .unwrap(), - I80F48::from(native!(99, "SOL")) - ); - - // Borrower should have 989.50 USDC - assert_eq_noise!( - usdc_bank - .get_liability_amount( - borrower_ma.lending_account.balances[1] - .liability_shares - .into() - ) - .unwrap(), - I80F48::from(native!(989.50, "USDC", f64)), - native!(0.01, "USDC", f64) - ); - - // Check insurance fund fee - let insurance_fund_usdc = usdc_bank_f - .get_vault_token_account(BankVaultType::Insurance) - .await; - - assert_eq_noise!( - insurance_fund_usdc.balance().await as i64, - native!(0.25, "USDC", f64) as i64, - native!(0.001, "USDC", f64) as i64 - ); - - Ok(()) -} - #[tokio::test] async fn marginfi_account_liquidation_failure_liquidatee_not_unhealthy() -> anyhow::Result<()> { let test_f = TestFixture::new(Some(TestSettings { @@ -763,9 +641,9 @@ async fn marginfi_account_liquidation_failure_bank_not_liquidatable() -> anyhow: #[test_case(100., 9.9, 1., BankMint::Usdc, BankMint::Sol)] #[test_case(123., 122., 1.23, BankMint::SolEquivalent, BankMint::SolEqIsolated)] -#[test_case(1_000., 1900., 10., BankMint::Usdc, BankMint::T22WithFee)] -#[test_case(2_000., 99., 20., BankMint::T22WithFee, BankMint::SolEquivalent)] -#[test_case(2_000., 1_999., 20., BankMint::Usdc, BankMint::PyUSD)] +// t22 #[test_case(1_000., 1900., 10., BankMint::Usdc, BankMint::T22WithFee)] +// t22 #[test_case(2_000., 99., 20., BankMint::T22WithFee, BankMint::SolEquivalent)] +// t22 #[test_case(2_000., 1_999., 20., BankMint::Usdc, BankMint::PyUSD)] #[tokio::test] async fn marginfi_account_liquidation_emode( deposit_amount: f64, diff --git a/programs/marginfi/tests/user_actions/mod.rs b/programs/marginfi/tests/user_actions/mod.rs index df996f0ea..1e981b8dc 100644 --- a/programs/marginfi/tests/user_actions/mod.rs +++ b/programs/marginfi/tests/user_actions/mod.rs @@ -161,182 +161,182 @@ async fn marginfi_account_correct_balance_selection_after_closing_position() -> Ok(()) } -#[tokio::test] -async fn emissions_test() -> anyhow::Result<()> { - let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; - - let usdc_bank = test_f.get_bank(&BankMint::Usdc); - let sol_bank = test_f.get_bank(&BankMint::Sol); - - // Setup emissions (Deposit for USDC, Borrow for SOL) - - let funding_account = test_f.usdc_mint.create_token_account_and_mint_to(100).await; - - usdc_bank - .try_setup_emissions( - EMISSIONS_FLAG_LENDING_ACTIVE, - 1_000_000, - native!(50, "USDC"), - usdc_bank.mint.key, - funding_account.key, - usdc_bank.get_token_program(), - ) - .await?; - - // SOL Emissions are not in SOL Bank mint - let sol_emissions_mint = - MintFixture::new_token_22(test_f.context.clone(), None, Some(6), &[]).await; - - let funding_account = sol_emissions_mint - .create_token_account_and_mint_to(200) - .await; - - sol_bank - .try_setup_emissions( - EMISSIONS_FLAG_BORROW_ACTIVE, - 1_000_000, - native!(100, 6), - sol_emissions_mint.key, - funding_account.key, - sol_emissions_mint.token_program, - ) - .await?; - - let sol_emissions_mint_2 = - MintFixture::new_token_22(test_f.context.clone(), None, Some(6), &[]).await; - - let funding_account = sol_emissions_mint_2 - .create_token_account_and_mint_to(200) - .await; - - let res = sol_bank - .try_setup_emissions( - EMISSIONS_FLAG_BORROW_ACTIVE, - 1_000_000, - native!(50, 6), - sol_emissions_mint_2.key, - funding_account.key, - sol_emissions_mint_2.token_program, - ) - .await; - - assert_custom_error!(res.unwrap_err(), MarginfiError::EmissionsAlreadySetup); - - // Fund SOL bank - let sol_lender_account = test_f.create_marginfi_account().await; - let sol_lender_token_account = test_f.sol_mint.create_token_account_and_mint_to(100).await; - - sol_lender_account - .try_bank_deposit(sol_lender_token_account.key, sol_bank, 100, None) - .await?; - - // Create account and setup positions - test_f.set_time(MIN_EMISSIONS_START_TIME as i64); - test_f - .set_pyth_oracle_timestamp(PYTH_USDC_FEED, MIN_EMISSIONS_START_TIME as i64) - .await; - test_f - .set_pyth_oracle_timestamp(PYTH_SOL_FEED, MIN_EMISSIONS_START_TIME as i64) - .await; - - let mfi_account_f = test_f.create_marginfi_account().await; - let lender_token_account_usdc = test_f.usdc_mint.create_token_account_and_mint_to(50).await; - - mfi_account_f - .try_bank_deposit(lender_token_account_usdc.key, usdc_bank, 50, None) - .await?; - - let sol_account = test_f.sol_mint.create_empty_token_account().await; - - mfi_account_f - .try_bank_borrow(sol_account.key, sol_bank, 2) - .await?; - - // Advance for half a year and claim half emissions - test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; - - let lender_token_account_usdc = test_f.usdc_mint.create_empty_token_account().await; +// #[tokio::test] +// async fn emissions_test() -> anyhow::Result<()> { +// let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; + +// let usdc_bank = test_f.get_bank(&BankMint::Usdc); +// let sol_bank = test_f.get_bank(&BankMint::Sol); + +// // Setup emissions (Deposit for USDC, Borrow for SOL) + +// let funding_account = test_f.usdc_mint.create_token_account_and_mint_to(100).await; + +// usdc_bank +// .try_setup_emissions( +// EMISSIONS_FLAG_LENDING_ACTIVE, +// 1_000_000, +// native!(50, "USDC"), +// usdc_bank.mint.key, +// funding_account.key, +// usdc_bank.get_token_program(), +// ) +// .await?; + +// // SOL Emissions are not in SOL Bank mint +// let sol_emissions_mint = +// MintFixture::new_token_22(test_f.context.clone(), None, Some(6), &[]).await; + +// let funding_account = sol_emissions_mint +// .create_token_account_and_mint_to(200) +// .await; + +// sol_bank +// .try_setup_emissions( +// EMISSIONS_FLAG_BORROW_ACTIVE, +// 1_000_000, +// native!(100, 6), +// sol_emissions_mint.key, +// funding_account.key, +// sol_emissions_mint.token_program, +// ) +// .await?; + +// let sol_emissions_mint_2 = +// MintFixture::new_token_22(test_f.context.clone(), None, Some(6), &[]).await; + +// let funding_account = sol_emissions_mint_2 +// .create_token_account_and_mint_to(200) +// .await; + +// let res = sol_bank +// .try_setup_emissions( +// EMISSIONS_FLAG_BORROW_ACTIVE, +// 1_000_000, +// native!(50, 6), +// sol_emissions_mint_2.key, +// funding_account.key, +// sol_emissions_mint_2.token_program, +// ) +// .await; + +// assert_custom_error!(res.unwrap_err(), MarginfiError::EmissionsAlreadySetup); + +// // Fund SOL bank +// let sol_lender_account = test_f.create_marginfi_account().await; +// let sol_lender_token_account = test_f.sol_mint.create_token_account_and_mint_to(100).await; + +// sol_lender_account +// .try_bank_deposit(sol_lender_token_account.key, sol_bank, 100, None) +// .await?; + +// // Create account and setup positions +// test_f.set_time(MIN_EMISSIONS_START_TIME as i64); +// test_f +// .set_pyth_oracle_timestamp(PYTH_USDC_FEED, MIN_EMISSIONS_START_TIME as i64) +// .await; +// test_f +// .set_pyth_oracle_timestamp(PYTH_SOL_FEED, MIN_EMISSIONS_START_TIME as i64) +// .await; + +// let mfi_account_f = test_f.create_marginfi_account().await; +// let lender_token_account_usdc = test_f.usdc_mint.create_token_account_and_mint_to(50).await; + +// mfi_account_f +// .try_bank_deposit(lender_token_account_usdc.key, usdc_bank, 50, None) +// .await?; + +// let sol_account = test_f.sol_mint.create_empty_token_account().await; + +// mfi_account_f +// .try_bank_borrow(sol_account.key, sol_bank, 2) +// .await?; + +// // Advance for half a year and claim half emissions +// test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; + +// let lender_token_account_usdc = test_f.usdc_mint.create_empty_token_account().await; + +// mfi_account_f +// .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) +// .await?; + +// let sol_emissions_ta = sol_emissions_mint.create_empty_token_account().await; + +// mfi_account_f +// .try_withdraw_emissions(sol_bank, &sol_emissions_ta) +// .await?; + +// assert_eq_with_tolerance!( +// lender_token_account_usdc.balance().await as i64, +// native!(25, "USDC") as i64, +// native!(1, "USDC") as i64 +// ); + +// assert_eq_with_tolerance!( +// sol_emissions_ta.balance().await as i64, +// native!(1, 6) as i64, +// native!(0.1, 6, f64) as i64 +// ); + +// // Advance for another half a year and claim the rest +// test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; + +// mfi_account_f +// .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) +// .await?; + +// assert_eq_with_tolerance!( +// lender_token_account_usdc.balance().await as i64, +// native!(50, "USDC") as i64, +// native!(1, "USDC") as i64 +// ); + +// mfi_account_f +// .try_withdraw_emissions(sol_bank, &sol_emissions_ta) +// .await?; + +// assert_eq_with_tolerance!( +// sol_emissions_ta.balance().await as i64, +// native!(2, 6) as i64, +// native!(0.1, 6, f64) as i64 +// ); - mfi_account_f - .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) - .await?; - - let sol_emissions_ta = sol_emissions_mint.create_empty_token_account().await; - - mfi_account_f - .try_withdraw_emissions(sol_bank, &sol_emissions_ta) - .await?; - - assert_eq_with_tolerance!( - lender_token_account_usdc.balance().await as i64, - native!(25, "USDC") as i64, - native!(1, "USDC") as i64 - ); - - assert_eq_with_tolerance!( - sol_emissions_ta.balance().await as i64, - native!(1, 6) as i64, - native!(0.1, 6, f64) as i64 - ); - - // Advance for another half a year and claim the rest - test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; - - mfi_account_f - .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) - .await?; - - assert_eq_with_tolerance!( - lender_token_account_usdc.balance().await as i64, - native!(50, "USDC") as i64, - native!(1, "USDC") as i64 - ); +// // Advance a year, and no more USDC emissions can be claimed (drained), SOL emissions can be claimed - mfi_account_f - .try_withdraw_emissions(sol_bank, &sol_emissions_ta) - .await?; +// test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; + +// mfi_account_f +// .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) +// .await?; + +// mfi_account_f +// .try_withdraw_emissions(sol_bank, &sol_emissions_ta) +// .await?; - assert_eq_with_tolerance!( - sol_emissions_ta.balance().await as i64, - native!(2, 6) as i64, - native!(0.1, 6, f64) as i64 - ); +// assert_eq_with_tolerance!( +// lender_token_account_usdc.balance().await as i64, +// native!(50, "USDC") as i64, +// native!(1, "USDC") as i64 +// ); - // Advance a year, and no more USDC emissions can be claimed (drained), SOL emissions can be claimed +// assert_eq_with_tolerance!( +// sol_emissions_ta.balance().await as i64, +// native!(3, 6) as i64, +// native!(0.1, 6, f64) as i64 +// ); - test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; +// // SOL lendeing account can't claim emissions, bc SOL is borrow only emissions +// let sol_lender_emissions = sol_emissions_mint.create_empty_token_account().await; - mfi_account_f - .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) - .await?; +// sol_lender_account +// .try_withdraw_emissions(sol_bank, &sol_lender_emissions) +// .await?; - mfi_account_f - .try_withdraw_emissions(sol_bank, &sol_emissions_ta) - .await?; +// assert_eq!(sol_lender_emissions.balance().await as i64, 0); - assert_eq_with_tolerance!( - lender_token_account_usdc.balance().await as i64, - native!(50, "USDC") as i64, - native!(1, "USDC") as i64 - ); - - assert_eq_with_tolerance!( - sol_emissions_ta.balance().await as i64, - native!(3, 6) as i64, - native!(0.1, 6, f64) as i64 - ); - - // SOL lendeing account can't claim emissions, bc SOL is borrow only emissions - let sol_lender_emissions = sol_emissions_mint.create_empty_token_account().await; - - sol_lender_account - .try_withdraw_emissions(sol_bank, &sol_lender_emissions) - .await?; - - assert_eq!(sol_lender_emissions.balance().await as i64, 0); - - Ok(()) -} +// Ok(()) +// } #[tokio::test] async fn emissions_test_2() -> anyhow::Result<()> { @@ -391,86 +391,86 @@ async fn emissions_test_2() -> anyhow::Result<()> { Ok(()) } -#[tokio::test] -async fn emissions_setup_t22_with_fee() -> anyhow::Result<()> { - let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; +// #[tokio::test] +// async fn emissions_setup_t22_with_fee() -> anyhow::Result<()> { +// let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; - let collateral_mint = BankMint::T22WithFee; - let bank_f = test_f.get_bank(&collateral_mint); +// let collateral_mint = BankMint::T22WithFee; +// let bank_f = test_f.get_bank(&collateral_mint); - let funding_account = bank_f.mint.create_token_account_and_mint_to(100).await; +// let funding_account = bank_f.mint.create_token_account_and_mint_to(100).await; - let emissions_vault = get_emissions_token_account_address(bank_f.key, bank_f.mint.key).0; +// let emissions_vault = get_emissions_token_account_address(bank_f.key, bank_f.mint.key).0; - let pre_vault_balance = 0; +// let pre_vault_balance = 0; - bank_f - .try_setup_emissions( - EMISSIONS_FLAG_LENDING_ACTIVE, - 1_000_000, - native!(50, bank_f.mint.mint.decimals), - bank_f.mint.key, - funding_account.key, - bank_f.get_token_program(), - ) - .await?; +// bank_f +// .try_setup_emissions( +// EMISSIONS_FLAG_LENDING_ACTIVE, +// 1_000_000, +// native!(50, bank_f.mint.mint.decimals), +// bank_f.mint.key, +// funding_account.key, +// bank_f.get_token_program(), +// ) +// .await?; - let post_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) - .await - .balance() - .await; +// let post_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) +// .await +// .balance() +// .await; - let bank = bank_f.load().await; +// let bank = bank_f.load().await; - assert_eq!(bank.flags, EMISSIONS_FLAG_LENDING_ACTIVE); +// assert_eq!(bank.flags, EMISSIONS_FLAG_LENDING_ACTIVE); - assert_eq!(bank.emissions_rate, 1_000_000); +// assert_eq!(bank.emissions_rate, 1_000_000); - assert_eq!( - I80F48::from(bank.emissions_remaining), - I80F48::from_num(native!(50, bank_f.mint.mint.decimals)) - ); +// assert_eq!( +// I80F48::from(bank.emissions_remaining), +// I80F48::from_num(native!(50, bank_f.mint.mint.decimals)) +// ); - let expected_vault_balance_delta = native!(50, bank_f.mint.mint.decimals) as u64; - let actual_vault_balance_delta = post_vault_balance - pre_vault_balance; - assert_eq!(expected_vault_balance_delta, actual_vault_balance_delta); +// let expected_vault_balance_delta = native!(50, bank_f.mint.mint.decimals) as u64; +// let actual_vault_balance_delta = post_vault_balance - pre_vault_balance; +// assert_eq!(expected_vault_balance_delta, actual_vault_balance_delta); - let pre_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) - .await - .balance() - .await; +// let pre_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) +// .await +// .balance() +// .await; - bank_f - .try_update_emissions( - Some(EMISSIONS_FLAG_BORROW_ACTIVE), - Some(500_000), - Some((native!(25, bank_f.mint.mint.decimals), funding_account.key)), - bank_f.get_token_program(), - ) - .await?; +// bank_f +// .try_update_emissions( +// Some(EMISSIONS_FLAG_BORROW_ACTIVE), +// Some(500_000), +// Some((native!(25, bank_f.mint.mint.decimals), funding_account.key)), +// bank_f.get_token_program(), +// ) +// .await?; - let post_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) - .await - .balance() - .await; +// let post_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) +// .await +// .balance() +// .await; - let bank_data = bank_f.load().await; +// let bank_data = bank_f.load().await; - assert_eq!(bank_data.flags, EMISSIONS_FLAG_BORROW_ACTIVE); +// assert_eq!(bank_data.flags, EMISSIONS_FLAG_BORROW_ACTIVE); - assert_eq!(bank_data.emissions_rate, 500_000); +// assert_eq!(bank_data.emissions_rate, 500_000); - assert_eq!( - I80F48::from(bank_data.emissions_remaining), - I80F48::from_num(native!(75, bank_f.mint.mint.decimals)) - ); +// assert_eq!( +// I80F48::from(bank_data.emissions_remaining), +// I80F48::from_num(native!(75, bank_f.mint.mint.decimals)) +// ); - let expected_vault_balance_delta = native!(25, bank_f.mint.mint.decimals) as u64; - let actual_vault_balance_delta = post_vault_balance - pre_vault_balance; - assert_eq!(expected_vault_balance_delta, actual_vault_balance_delta); +// let expected_vault_balance_delta = native!(25, bank_f.mint.mint.decimals) as u64; +// let actual_vault_balance_delta = post_vault_balance - pre_vault_balance; +// assert_eq!(expected_vault_balance_delta, actual_vault_balance_delta); - Ok(()) -} +// Ok(()) +// } #[tokio::test] async fn account_flags() -> anyhow::Result<()> { diff --git a/programs/marginfi/tests/user_actions/repay.rs b/programs/marginfi/tests/user_actions/repay.rs index b7bad9b89..2e843f82d 100644 --- a/programs/marginfi/tests/user_actions/repay.rs +++ b/programs/marginfi/tests/user_actions/repay.rs @@ -11,11 +11,9 @@ use test_case::test_case; #[test_case(100., 9., BankMint::Usdc, BankMint::Sol)] #[test_case(123456., 12345.599999999, BankMint::Usdc, BankMint::Sol)] -#[test_case(123456., 10000., BankMint::UsdcSwb, BankMint::Sol)] #[test_case(1., 1., BankMint::Sol, BankMint::Usdc)] -#[test_case(128932., 9834., BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(240., 0.092, BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(36., 20., BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(240., 0.092, BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(36., 20., BankMint::T22WithFee, BankMint::Sol)] #[test_case(200., 1.1, BankMint::Usdc, BankMint::SolSwbOrigFee)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_account_repay_success( @@ -140,11 +138,9 @@ async fn marginfi_account_repay_success( #[test_case(100., BankMint::Usdc, BankMint::Sol)] #[test_case(123456., BankMint::Usdc, BankMint::Sol)] -#[test_case(123456., BankMint::UsdcSwb, BankMint::Sol)] #[test_case(1., BankMint::Sol, BankMint::Usdc)] -#[test_case(128932., BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(240., BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(36., BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(240., BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(36., BankMint::T22WithFee, BankMint::Sol)] #[test_case(200., BankMint::Usdc, BankMint::SolSwbOrigFee)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_account_repay_all_success( @@ -297,11 +293,10 @@ async fn marginfi_account_repay_all_success( #[test_case(100., 110., BankMint::Usdc, BankMint::Sol)] #[test_case(123456., 123457., BankMint::Usdc, BankMint::Sol)] -#[test_case(3000., 10000., BankMint::UsdcSwb, BankMint::Sol)] #[test_case(1., 1.000002, BankMint::Sol, BankMint::Usdc)] -#[test_case(9834., 234749., BankMint::PyUSD, BankMint::SolSwb)] -#[test_case(0.092, 240., BankMint::PyUSD, BankMint::T22WithFee)] -#[test_case(1.7, 36., BankMint::T22WithFee, BankMint::Sol)] +// t22 #[test_case(9834., 234749., BankMint::PyUSD, BankMint::SolSwb)] +// t22 #[test_case(0.092, 240., BankMint::PyUSD, BankMint::T22WithFee)] +// t22 #[test_case(1.7, 36., BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_account_repay_failure_repaying_too_much( borrow_amount: f64, diff --git a/programs/marginfi/tests/user_actions/withdraw.rs b/programs/marginfi/tests/user_actions/withdraw.rs index d181dbce4..3cfa24115 100644 --- a/programs/marginfi/tests/user_actions/withdraw.rs +++ b/programs/marginfi/tests/user_actions/withdraw.rs @@ -9,11 +9,9 @@ use solana_program_test::*; use test_case::test_case; #[test_case(0.03, 0.012, BankMint::Usdc)] -#[test_case(100.0, 100.0, BankMint::UsdcSwb)] -#[test_case(100.0, 100.0, BankMint::SolSwb)] -#[test_case(128932.0, 9834.0, BankMint::PyUSD)] -#[test_case(0.1, 0.092, BankMint::T22WithFee)] -#[test_case(100.0, 92.0, BankMint::T22WithFee)] +// t22 #[test_case(128932.0, 9834.0, BankMint::PyUSD)] +// t22 #[test_case(0.1, 0.092, BankMint::T22WithFee)] +// t22 #[test_case(100.0, 92.0, BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_withdraw_success( deposit_amount: f64, @@ -175,9 +173,9 @@ async fn marginfi_account_withdraw_success( #[test_case(0.03, BankMint::Usdc)] #[test_case(100.0, BankMint::Usdc)] #[test_case(100.0, BankMint::Sol)] -#[test_case(128932.0, BankMint::PyUSD)] -#[test_case(0.1, BankMint::T22WithFee)] -#[test_case(100.0, BankMint::T22WithFee)] +// t22 #[test_case(128932.0, BankMint::PyUSD)] +// t22 #[test_case(0.1, BankMint::T22WithFee)] +// t22 #[test_case(100.0, BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_withdraw_all_success( deposit_amount: f64, @@ -274,12 +272,10 @@ async fn marginfi_account_withdraw_all_success( } #[test_case(0.03, 0.030001, BankMint::Usdc)] -#[test_case(100., 101., BankMint::UsdcSwb)] #[test_case(100., 102., BankMint::Sol)] -#[test_case(100., 102., BankMint::SolSwb)] -#[test_case(109247394., 109247394.000001, BankMint::PyUSD)] -#[test_case(16., 16., BankMint::T22WithFee)] -#[test_case(100., 98., BankMint::T22WithFee)] +// t22 #[test_case(109247394., 109247394.000001, BankMint::PyUSD)] +// t22 #[test_case(16., 16., BankMint::T22WithFee)] +// t22 #[test_case(100., 98., BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_withdraw_failure_withdrawing_too_much( deposit_amount: f64, diff --git a/programs/test_transfer_hook/Cargo.toml b/programs/test_transfer_hook/Cargo.toml index b23f23a7d..0e8a34ddc 100644 --- a/programs/test_transfer_hook/Cargo.toml +++ b/programs/test_transfer_hook/Cargo.toml @@ -11,7 +11,8 @@ no-entrypoint = [] crate-type = ["cdylib", "lib"] [dependencies] -solana-program = { workspace = true } +# solana-program = { workspace = true } +anchor-lang = { workspace = true } spl-token-2022 = { workspace = true, features = ["no-entrypoint"] } spl-transfer-hook-interface = { workspace = true } spl-tlv-account-resolution = { workspace = true } diff --git a/programs/test_transfer_hook/src/lib.rs b/programs/test_transfer_hook/src/lib.rs index ddda3069f..3e0aa0de6 100644 --- a/programs/test_transfer_hook/src/lib.rs +++ b/programs/test_transfer_hook/src/lib.rs @@ -1,6 +1,6 @@ //! Program state processor use { - solana_program::{ + anchor_lang::solana_program::{ account_info::{next_account_info, AccountInfo}, entrypoint::ProgramResult, msg, @@ -28,7 +28,7 @@ use { pub static TEST_HOOK_ID: Pubkey = pubkey!("TRANSFERHKTRANSFERHKTRANSFERHKTRANSFERHKTRA"); #[cfg(not(feature = "no-entrypoint"))] -solana_program::entrypoint!(process); +anchor_lang::solana_program::entrypoint!(process); #[allow(unused)] fn check_token_account_is_transferring(account_info: &AccountInfo) -> Result<(), ProgramError> { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7897a24d1..628740b12 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.75.0" +channel = "1.79.0" diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 9c1a17e81..646e312b4 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -5,7 +5,7 @@ publish = false edition = "2021" [features] -lip = ["liquidity-incentive-program"] +# lip = ["liquidity-incentive-program"] [dependencies] solana-cli-output = { workspace = true } @@ -13,19 +13,18 @@ solana-program = { workspace = true } solana-logger = { workspace = true } solana-program-test = { workspace = true } solana-sdk = { workspace = true } -spl-token-2022 = { workspace = true } spl-transfer-hook-interface = { workspace = true } -spl-tlv-account-resolution = { workspace = true } -spl-discriminator = { workspace = true } +# spl-tlv-account-resolution = { workspace = true } +# spl-discriminator = { workspace = true } +spl-token-2022 = { workspace = true } anchor-lang = { workspace = true } -anchor-lang-29 = { workspace = true } anchor-spl = { workspace = true } pyth-sdk-solana = { workspace = true } pyth-solana-receiver-sdk = { workspace = true } pythnet-sdk = { workspace = true } -switchboard-solana = { workspace = true } +# switchboard-solana = { workspace = true } switchboard-on-demand = { workspace = true } bytemuck = "1.9.1" @@ -46,11 +45,11 @@ serde_json = "1.0.115" path = "../programs/marginfi" features = ["test-bpf"] -[dependencies.transfer_hook] -path = "../programs/test_transfer_hook" -package = "test_transfer_hook" -features = ["no-entrypoint"] +# [dependencies.transfer_hook] +# path = "../programs/test_transfer_hook" +# package = "test_transfer_hook" +# features = ["no-entrypoint"] -[dependencies.liquidity-incentive-program] -path = "../programs/liquidity-incentive-program" -optional = true +# [dependencies.liquidity-incentive-program] +# path = "../programs/liquidity-incentive-program" +# optional = true diff --git a/test-utils/src/lib.rs b/test-utils/src/lib.rs index 6bca22317..d20528dfa 100644 --- a/test-utils/src/lib.rs +++ b/test-utils/src/lib.rs @@ -1,6 +1,6 @@ pub mod bank; -#[cfg(feature = "lip")] -pub mod lip; +// #[cfg(feature = "lip")] +// pub mod lip; pub mod marginfi_account; pub mod marginfi_group; pub mod prelude; @@ -8,4 +8,5 @@ pub mod spl; pub mod test; // pub mod transfer_hook; pub mod utils; -pub use transfer_hook; + +// pub use transfer_hook; diff --git a/test-utils/src/marginfi_account.rs b/test-utils/src/marginfi_account.rs index 66d48b2bc..5a96710b6 100644 --- a/test-utils/src/marginfi_account.rs +++ b/test-utils/src/marginfi_account.rs @@ -107,35 +107,35 @@ impl MarginfiAccountFixture { .make_bank_deposit_ix(funding_account, bank, ui_amount, deposit_up_to_limit) .await; - // If t22 with transfer hook, add remaining accounts - let fetch_account_data_fn = |key| async move { - Ok(self - .ctx - .borrow_mut() - .banks_client - .get_account(key) - .await - .map(|acc| acc.map(|a| a.data))?) - }; - let payer = self.ctx.borrow_mut().payer.pubkey(); - if bank.mint.token_program == spl_token_2022::ID { - // TODO: do that only if hook exists - println!( - "[TODO] Adding extra account metas for execute for mint {:?}", - bank.mint.key - ); - let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( - &mut ix, - &super::transfer_hook::TEST_HOOK_ID, - &funding_account, - &bank.mint.key, - &bank.get_vault(BankVaultType::Liquidity).0, - &payer, - ui_to_native!(ui_amount.into(), bank.mint.mint.decimals), - fetch_account_data_fn, - ) - .await; - } + // // If t22 with transfer hook, add remaining accounts + // let fetch_account_data_fn = |key| async move { + // Ok(self + // .ctx + // .borrow_mut() + // .banks_client + // .get_account(key) + // .await + // .map(|acc| acc.map(|a| a.data))?) + // }; + // let payer = self.ctx.borrow_mut().payer.pubkey(); + // if bank.mint.token_program == spl_token_2022::ID { + // // TODO: do that only if hook exists + // println!( + // "[TODO] Adding extra account metas for execute for mint {:?}", + // bank.mint.key + // ); + // let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( + // &mut ix, + // &super::transfer_hook::TEST_HOOK_ID, + // &funding_account, + // &bank.mint.key, + // &bank.get_vault(BankVaultType::Liquidity).0, + // &payer, + // ui_to_native!(ui_amount.into(), bank.mint.mint.decimals), + // fetch_account_data_fn, + // ) + // .await; + // } let mut ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( @@ -283,30 +283,30 @@ impl MarginfiAccountFixture { .make_bank_borrow_ix(destination_account, bank, ui_amount) .await; - if bank.mint.token_program == spl_token_2022::ID { - let fetch_account_data_fn = |key| async move { - Ok(self - .ctx - .borrow_mut() - .banks_client - .get_account(key) - .await - .map(|acc| acc.map(|a| a.data))?) - }; - - let payer = self.ctx.borrow().payer.pubkey(); - let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( - &mut ix, - &super::transfer_hook::TEST_HOOK_ID, - &bank.get_vault(BankVaultType::Liquidity).0, - &bank.mint.key, - &destination_account, - &payer, - ui_to_native!(ui_amount.into(), bank.mint.mint.decimals), - fetch_account_data_fn, - ) - .await; - } + // if bank.mint.token_program == spl_token_2022::ID { + // let fetch_account_data_fn = |key| async move { + // Ok(self + // .ctx + // .borrow_mut() + // .banks_client + // .get_account(key) + // .await + // .map(|acc| acc.map(|a| a.data))?) + // }; + + // let payer = self.ctx.borrow().payer.pubkey(); + // let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( + // &mut ix, + // &super::transfer_hook::TEST_HOOK_ID, + // &bank.get_vault(BankVaultType::Liquidity).0, + // &bank.mint.key, + // &destination_account, + // &payer, + // ui_to_native!(ui_amount.into(), bank.mint.mint.decimals), + // fetch_account_data_fn, + // ) + // .await; + // } let compute_budget_ix = ComputeBudgetInstruction::set_compute_unit_limit(1_400_000); let nonce_ix = ComputeBudgetInstruction::set_compute_unit_price(nonce); @@ -476,30 +476,30 @@ impl MarginfiAccountFixture { .data(), }; - if liab_bank_fixture.mint.token_program == spl_token_2022::ID { - let payer = self.ctx.borrow().payer.pubkey(); - let fetch_account_data_fn = |key| async move { - Ok(self - .ctx - .borrow_mut() - .banks_client - .get_account(key) - .await - .map(|acc| acc.map(|a| a.data))?) - }; - - let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( - &mut ix, - &super::transfer_hook::TEST_HOOK_ID, - &liab_bank_fixture.mint.key, - &liab_bank_fixture.mint.key, - &liab_bank_fixture.mint.key, - &payer, - 0, - fetch_account_data_fn, - ) - .await; - } + // if liab_bank_fixture.mint.token_program == spl_token_2022::ID { + // let payer = self.ctx.borrow().payer.pubkey(); + // let fetch_account_data_fn = |key| async move { + // Ok(self + // .ctx + // .borrow_mut() + // .banks_client + // .get_account(key) + // .await + // .map(|acc| acc.map(|a| a.data))?) + // }; + + // let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( + // &mut ix, + // &super::transfer_hook::TEST_HOOK_ID, + // &liab_bank_fixture.mint.key, + // &liab_bank_fixture.mint.key, + // &liab_bank_fixture.mint.key, + // &payer, + // 0, + // fetch_account_data_fn, + // ) + // .await; + // } ix.accounts.extend_from_slice( &self diff --git a/test-utils/src/spl.rs b/test-utils/src/spl.rs index 01346e0a0..ba04c4204 100644 --- a/test-utils/src/spl.rs +++ b/test-utils/src/spl.rs @@ -1,4 +1,4 @@ -use crate::{transfer_hook::TEST_HOOK_ID, ui_to_native}; +use crate::ui_to_native; use anchor_lang::prelude::*; use anchor_spl::{ associated_token::{ @@ -101,103 +101,103 @@ impl MintFixture { } } - pub async fn new_token_22( - ctx: Rc>, - mint_keypair: Option, - mint_decimals: Option, - extensions: &[SupportedExtension], - ) -> MintFixture { - let ctx_ref = Rc::clone(&ctx); - let keypair = mint_keypair.unwrap_or_else(Keypair::new); - let program = token_2022::ID; - let mint = { - let mut ctx = ctx.borrow_mut(); - - let rent = ctx.banks_client.get_rent().await.unwrap(); - - let extension_types = SupportedExtension::types(extensions.iter()); - let len = ExtensionType::try_calculate_account_len::( - &extension_types, - ) - .unwrap(); - let init_account_ix = create_account( - &ctx.payer.pubkey(), - &keypair.pubkey(), - rent.minimum_balance(len), - len as u64, - &program, - ); - let init_mint_ix = spl_token_2022::instruction::initialize_mint( - &program, - &keypair.pubkey(), - &ctx.payer.pubkey(), - None, - mint_decimals.unwrap_or(6), - ) - .unwrap(); - - let mut ixs = vec![init_account_ix]; - ixs.extend( - extensions - .iter() - .map(|e| e.instruction(&keypair.pubkey(), &ctx.payer.pubkey())), - ); - ixs.push(init_mint_ix); - let extra_metas_address = get_extra_account_metas_address( - &keypair.pubkey(), - &super::transfer_hook::TEST_HOOK_ID, - ); - if extensions.contains(&SupportedExtension::TransferHook) { - ixs.push(system_instruction::transfer( - &ctx.payer.pubkey(), - &extra_metas_address, - 10 * LAMPORTS_PER_SOL, - )); - ixs.push(initialize_extra_account_meta_list( - &super::transfer_hook::TEST_HOOK_ID, - &extra_metas_address, - &keypair.pubkey(), - &ctx.payer.pubkey(), - &[], - )) - } - - let tx = Transaction::new_signed_with_payer( - &ixs, - Some(&ctx.payer.pubkey()), - &[&ctx.payer, &keypair], - ctx.last_blockhash, - ); - - ctx.banks_client.process_transaction(tx).await.unwrap(); - - if extensions.contains(&SupportedExtension::TransferHook) { - ctx.banks_client - .get_account(extra_metas_address) - .await - .unwrap() - .unwrap(); - } - - let mint_account = ctx - .banks_client - .get_account(keypair.pubkey()) - .await - .unwrap() - .unwrap(); - - StateWithExtensionsOwned::::unpack(mint_account.data) - .unwrap() - .base - }; - - MintFixture { - ctx: ctx_ref, - key: keypair.pubkey(), - mint, - token_program: token_2022::ID, - } - } + // pub async fn new_token_22( + // ctx: Rc>, + // mint_keypair: Option, + // mint_decimals: Option, + // extensions: &[SupportedExtension], + // ) -> MintFixture { + // let ctx_ref = Rc::clone(&ctx); + // let keypair = mint_keypair.unwrap_or_else(Keypair::new); + // let program = token_2022::ID; + // let mint = { + // let mut ctx = ctx.borrow_mut(); + + // let rent = ctx.banks_client.get_rent().await.unwrap(); + + // let extension_types = SupportedExtension::types(extensions.iter()); + // let len = ExtensionType::try_calculate_account_len::( + // &extension_types, + // ) + // .unwrap(); + // let init_account_ix = create_account( + // &ctx.payer.pubkey(), + // &keypair.pubkey(), + // rent.minimum_balance(len), + // len as u64, + // &program, + // ); + // let init_mint_ix = spl_token_2022::instruction::initialize_mint( + // &program, + // &keypair.pubkey(), + // &ctx.payer.pubkey(), + // None, + // mint_decimals.unwrap_or(6), + // ) + // .unwrap(); + + // let mut ixs = vec![init_account_ix]; + // ixs.extend( + // extensions + // .iter() + // .map(|e| e.instruction(&keypair.pubkey(), &ctx.payer.pubkey())), + // ); + // ixs.push(init_mint_ix); + // let extra_metas_address = get_extra_account_metas_address( + // &keypair.pubkey(), + // &super::transfer_hook::TEST_HOOK_ID, + // ); + // if extensions.contains(&SupportedExtension::TransferHook) { + // ixs.push(system_instruction::transfer( + // &ctx.payer.pubkey(), + // &extra_metas_address, + // 10 * LAMPORTS_PER_SOL, + // )); + // ixs.push(initialize_extra_account_meta_list( + // &super::transfer_hook::TEST_HOOK_ID, + // &extra_metas_address, + // &keypair.pubkey(), + // &ctx.payer.pubkey(), + // &[], + // )) + // } + + // let tx = Transaction::new_signed_with_payer( + // &ixs, + // Some(&ctx.payer.pubkey()), + // &[&ctx.payer, &keypair], + // ctx.last_blockhash, + // ); + + // ctx.banks_client.process_transaction(tx).await.unwrap(); + + // if extensions.contains(&SupportedExtension::TransferHook) { + // ctx.banks_client + // .get_account(extra_metas_address) + // .await + // .unwrap() + // .unwrap(); + // } + + // let mint_account = ctx + // .banks_client + // .get_account(keypair.pubkey()) + // .await + // .unwrap() + // .unwrap(); + + // StateWithExtensionsOwned::::unpack(mint_account.data) + // .unwrap() + // .base + // }; + + // MintFixture { + // ctx: ctx_ref, + // key: keypair.pubkey(), + // mint, + // token_program: token_2022::ID, + // } + // } pub fn new_from_file( ctx: &Rc>, @@ -643,7 +643,7 @@ pub enum SupportedExtension { MintCloseAuthority, InterestBearing, PermanentDelegate, - TransferHook, + // TransferHook, TransferFee, } @@ -675,15 +675,15 @@ impl SupportedExtension { ) .unwrap() } - Self::TransferHook => { - spl_token_2022::extension::transfer_hook::instruction::initialize( - &token_2022::ID, - mint, - Some(*key), - Some(TEST_HOOK_ID), - ) - .unwrap() - } + // Self::TransferHook => { + // spl_token_2022::extension::transfer_hook::instruction::initialize( + // &token_2022::ID, + // mint, + // Some(*key), + // Some(TEST_HOOK_ID), + // ) + // .unwrap() + // } Self::TransferFee => { spl_token_2022::extension::transfer_fee::instruction::initialize_transfer_fee_config( &token_2022::ID, @@ -703,7 +703,7 @@ impl SupportedExtension { SupportedExtension::MintCloseAuthority => pod_get_packed_len::(), SupportedExtension::InterestBearing => pod_get_packed_len::(), SupportedExtension::PermanentDelegate => pod_get_packed_len::(), - SupportedExtension::TransferHook => pod_get_packed_len::(), + // SupportedExtension::TransferHook => pod_get_packed_len::(), SupportedExtension::TransferFee => pod_get_packed_len::(), }) .sum() @@ -714,7 +714,7 @@ impl SupportedExtension { SupportedExtension::MintCloseAuthority => ExtensionType::MintCloseAuthority, SupportedExtension::InterestBearing => ExtensionType::InterestBearingConfig, SupportedExtension::PermanentDelegate => ExtensionType::PermanentDelegate, - SupportedExtension::TransferHook => ExtensionType::TransferHook, + // SupportedExtension::TransferHook => ExtensionType::TransferHook, SupportedExtension::TransferFee => ExtensionType::TransferFeeConfig, }) .collect() diff --git a/test-utils/src/test.rs b/test-utils/src/test.rs index ce4b1f79b..ac87dede3 100644 --- a/test-utils/src/test.rs +++ b/test-utils/src/test.rs @@ -1,6 +1,11 @@ use super::marginfi_account::MarginfiAccountFixture; use crate::{ - bank::BankFixture, marginfi_group::*, native, spl::*, transfer_hook::TEST_HOOK_ID, utils::*, + bank::BankFixture, + marginfi_group::*, + native, + spl::*, + utils::*, + // transfer_hook::TEST_HOOK_ID, }; use anchor_lang::prelude::*; @@ -37,18 +42,10 @@ impl TestSettings { mint: BankMint::Usdc, ..TestBankSetting::default() }, - TestBankSetting { - mint: BankMint::UsdcSwb, - ..TestBankSetting::default() - }, TestBankSetting { mint: BankMint::Sol, ..TestBankSetting::default() }, - TestBankSetting { - mint: BankMint::SolSwb, - ..TestBankSetting::default() - }, TestBankSetting { mint: BankMint::SolSwbPull, ..TestBankSetting::default() @@ -61,14 +58,14 @@ impl TestSettings { mint: BankMint::SolEquivalent, ..TestBankSetting::default() }, - TestBankSetting { - mint: BankMint::PyUSD, - ..TestBankSetting::default() - }, - TestBankSetting { - mint: BankMint::T22WithFee, - ..TestBankSetting::default() - }, + // TestBankSetting { + // mint: BankMint::PyUSD, + // ..TestBankSetting::default() + // }, + // TestBankSetting { + // mint: BankMint::T22WithFee, + // ..TestBankSetting::default() + // }, TestBankSetting { mint: BankMint::SolEqIsolated, ..TestBankSetting::default() @@ -81,23 +78,6 @@ impl TestSettings { } } - /// All banks with the same config, but USDC and SOL are using switchboard price oracls - pub fn all_banks_swb_payer_not_admin() -> Self { - Self { - banks: vec![ - TestBankSetting { - mint: BankMint::Usdc, - config: Some(*DEFAULT_USDC_TEST_SW_BANK_CONFIG), - }, - TestBankSetting { - mint: BankMint::Sol, - config: Some(*DEFAULT_SOL_TEST_SW_BANK_CONFIG), - }, - ], - protocol_fees: false, - } - } - pub fn all_banks_one_isolated() -> Self { Self { banks: vec![ @@ -181,9 +161,7 @@ pub struct TestBankSetting { #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] pub enum BankMint { Usdc, - UsdcSwb, Sol, - SolSwb, SolSwbPull, SolSwbOrigFee, SolEquivalent, @@ -196,9 +174,9 @@ pub enum BankMint { SolEquivalent7, SolEquivalent8, SolEquivalent9, - UsdcT22, - T22WithFee, - PyUSD, + // UsdcT22, + // T22WithFee, + // PyUSD, SolEqIsolated, } @@ -216,8 +194,8 @@ pub struct TestFixture { pub sol_mint: MintFixture, pub sol_equivalent_mint: MintFixture, pub mnde_mint: MintFixture, - pub usdc_t22_mint: MintFixture, - pub pyusd_mint: MintFixture, + // pub usdc_t22_mint: MintFixture, + // pub pyusd_mint: MintFixture, } pub const PYTH_USDC_FEED: Pubkey = pubkey!("PythUsdcPrice111111111111111111111111111111"); @@ -346,20 +324,6 @@ lazy_static! { oracle_keys: create_oracle_key_array(PYTH_MNDE_FEED), ..*DEFAULT_TEST_BANK_CONFIG }; - pub static ref DEFAULT_USDC_TEST_SW_BANK_CONFIG: BankConfig = BankConfig { - oracle_setup: OracleSetup::SwitchboardV2, - deposit_limit: native!(1_000_000_000, "USDC"), - borrow_limit: native!(1_000_000_000, "USDC"), - oracle_keys: create_oracle_key_array(SWITCHBOARD_USDC_FEED), - ..*DEFAULT_TEST_BANK_CONFIG - }; - pub static ref DEFAULT_SOL_TEST_SW_BANK_CONFIG: BankConfig = BankConfig { - oracle_setup: OracleSetup::SwitchboardV2, - deposit_limit: native!(1_000_000, "SOL"), - borrow_limit: native!(1_000_000, "SOL"), - oracle_keys: create_oracle_key_array(SWITCHBOARD_SOL_FEED), - ..*DEFAULT_TEST_BANK_CONFIG - }; pub static ref DEFAULT_SOL_TEST_PYTH_PUSH_FULLV_BANK_CONFIG: BankConfig = BankConfig { oracle_setup: OracleSetup::PythPushOracle, deposit_limit: native!(1_000_000, "SOL"), @@ -452,7 +416,7 @@ impl TestFixture { program.prefer_bpf(true); program.add_program("marginfi", marginfi::ID, None); - program.add_program("test_transfer_hook", TEST_HOOK_ID, None); + // program.add_program("test_transfer_hook", TEST_HOOK_ID, None); #[cfg(feature = "lip")] program.add_program( "liquidity_incentive_program", @@ -524,14 +488,6 @@ impl TestFixture { ), // create_pyth_price_account(mnde_keypair.pubkey(), 10.0, MNDE_MINT_DECIMALS.into(), None), ); - program.add_account( - SWITCHBOARD_USDC_FEED, - create_switchboard_price_feed(1, USDC_MINT_DECIMALS.into()), - ); - program.add_account( - SWITCHBOARD_SOL_FEED, - create_switchboard_price_feed(10, SOL_MINT_DECIMALS.into()), - ); program.add_account( PYTH_PUSH_SOL_FULLV_FEED, create_pyth_push_oracle_account( @@ -616,21 +572,21 @@ impl TestFixture { Some(MNDE_MINT_DECIMALS), ) .await; - let usdc_t22_mint_f = MintFixture::new_token_22( - Rc::clone(&context), - Some(usdc_t22_keypair), - Some(USDC_MINT_DECIMALS), - extensions, - ) - .await; - let pyusd_mint_f = MintFixture::new_from_file(&context, "src/fixtures/pyUSD.json"); - let t22_with_fee_mint_f = MintFixture::new_token_22( - Rc::clone(&context), - Some(t22_with_fee_keypair), - Some(T22_WITH_FEE_MINT_DECIMALS), - &[SupportedExtension::TransferFee], - ) - .await; + // let usdc_t22_mint_f = MintFixture::new_token_22( + // Rc::clone(&context), + // Some(usdc_t22_keypair), + // Some(USDC_MINT_DECIMALS), + // extensions, + // ) + // .await; + // let pyusd_mint_f = MintFixture::new_from_file(&context, "src/fixtures/pyUSD.json"); + // let t22_with_fee_mint_f = MintFixture::new_token_22( + // Rc::clone(&context), + // Some(t22_with_fee_keypair), + // Some(T22_WITH_FEE_MINT_DECIMALS), + // &[SupportedExtension::TransferFee], + // ) + // .await; let tester_group = MarginfiGroupFixture::new(Rc::clone(&context)).await; @@ -643,9 +599,7 @@ impl TestFixture { for bank in test_settings.banks.iter() { let (bank_mint, default_config) = match bank.mint { BankMint::Usdc => (&usdc_mint_f, *DEFAULT_USDC_TEST_BANK_CONFIG), - BankMint::UsdcSwb => (&usdc_mint_f, *DEFAULT_USDC_TEST_SW_BANK_CONFIG), BankMint::Sol => (&sol_mint_f, *DEFAULT_SOL_TEST_BANK_CONFIG), - BankMint::SolSwb => (&sol_mint_f, *DEFAULT_SOL_TEST_SW_BANK_CONFIG), BankMint::SolSwbPull => { (&sol_mint_f, *DEFAULT_SB_PULL_SOL_TEST_REAL_BANK_CONFIG) } @@ -693,11 +647,11 @@ impl TestFixture { &sol_equivalent_mint_f, *DEFAULT_SOL_EQUIVALENT_TEST_BANK_CONFIG, ), - BankMint::T22WithFee => { - (&t22_with_fee_mint_f, *DEFAULT_T22_WITH_FEE_TEST_BANK_CONFIG) - } - BankMint::UsdcT22 => (&usdc_t22_mint_f, *DEFAULT_USDC_TEST_BANK_CONFIG), - BankMint::PyUSD => (&pyusd_mint_f, *DEFAULT_PYUSD_TEST_BANK_CONFIG), + // BankMint::T22WithFee => { + // (&t22_with_fee_mint_f, *DEFAULT_T22_WITH_FEE_TEST_BANK_CONFIG) + // } + // BankMint::UsdcT22 => (&usdc_t22_mint_f, *DEFAULT_USDC_TEST_BANK_CONFIG), + // BankMint::PyUSD => (&pyusd_mint_f, *DEFAULT_PYUSD_TEST_BANK_CONFIG), BankMint::SolEqIsolated => { (&sol_equivalent_mint_f, *DEFAULT_SOL_EQ_ISO_TEST_BANK_CONFIG) } @@ -721,8 +675,8 @@ impl TestFixture { sol_mint: sol_mint_f, sol_equivalent_mint: sol_equivalent_mint_f, mnde_mint: mnde_mint_f, - usdc_t22_mint: usdc_t22_mint_f, - pyusd_mint: pyusd_mint_f, + // usdc_t22_mint: usdc_t22_mint_f, + // pyusd_mint: pyusd_mint_f, } } @@ -895,12 +849,11 @@ impl TestFixture { pub fn get_mint_price(mint: BankMint) -> f64 { match mint { // For the T22 with fee variant, it's 50 cents - BankMint::T22WithFee => 0.5, + // BankMint::T22WithFee => 0.5, // For USDC-based and PYUSD mints, the price is roughly 1.0. - BankMint::Usdc | BankMint::UsdcSwb | BankMint::UsdcT22 | BankMint::PyUSD => 1.0, + BankMint::Usdc /* | BankMint::UsdcT22 | BankMint::PyUSD */ => 1.0, // For SOL and its equivalents, use the SOL price (here, roughly 10.0). BankMint::Sol - | BankMint::SolSwb | BankMint::SolSwbPull | BankMint::SolSwbOrigFee | BankMint::SolEquivalent diff --git a/test-utils/src/utils.rs b/test-utils/src/utils.rs index 55fe248ff..42c814cf7 100644 --- a/test-utils/src/utils.rs +++ b/test-utils/src/utils.rs @@ -1,5 +1,5 @@ use anchor_lang::prelude::*; -use anchor_lang_29::Discriminator; +use anchor_lang::Discriminator; use anchor_spl::token_2022::spl_token_2022::extension::transfer_fee::MAX_FEE_BASIS_POINTS; use marginfi::constants::PYTH_ID; use marginfi::constants::SWITCHBOARD_PULL_ID; @@ -9,15 +9,10 @@ use pyth_sdk_solana::state::{ use pyth_solana_receiver_sdk::price_update::FeedId; use pyth_solana_receiver_sdk::price_update::PriceUpdateV2; use pyth_solana_receiver_sdk::price_update::VerificationLevel; -use solana_program::{instruction::Instruction, pubkey}; +use anchor_lang::solana_program::instruction::Instruction; use solana_program_test::*; use solana_sdk::{account::Account, signature::Keypair}; -use std::mem::size_of; use std::{cell::RefCell, rc::Rc}; -use switchboard_solana::{ - AggregatorAccountData, AggregatorResolutionMode, AggregatorRound, SwitchboardDecimal, - SWITCHBOARD_PROGRAM_ID, -}; pub const MS_PER_SLOT: u64 = 400; pub const RUST_LOG_DEFAULT: &str = "solana_rbpf::vm=info,\ @@ -159,275 +154,6 @@ pub fn create_switch_pull_oracle_account_from_bytes(data: Vec) -> Account { } } -pub fn create_switchboard_price_feed(ui_price: i64, mint_decimals: i32) -> Account { - let native_price = ui_price * 10_i64.pow(mint_decimals as u32); - let aggregator_account = switchboard_solana::AggregatorAccountData { - name: [0; 32], - metadata: [0; 128], - _reserved1: [0; 32], - queue_pubkey: Pubkey::default(), - oracle_request_batch_size: 4, - min_oracle_results: 2, - min_job_results: 1, - min_update_delay_seconds: 6, - start_after: 0, - variance_threshold: SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - force_report_period: 0, - expiration: 0, - consecutive_failure_count: 0, - next_allowed_update_time: 1682220588, - is_locked: false, - crank_pubkey: Pubkey::default(), - latest_confirmed_round: AggregatorRound { - num_success: 4, - num_error: 0, - is_closed: true, - round_open_slot: 189963416, - round_open_timestamp: 1682220573, - result: SwitchboardDecimal { - mantissa: native_price as i128, - scale: mint_decimals as u32, - }, - std_deviation: SwitchboardDecimal { - mantissa: 13942937500000000000000000, - scale: 28, - }, - min_response: SwitchboardDecimal { - mantissa: 2175243675, - scale: 8, - }, - max_response: SwitchboardDecimal { - mantissa: 21763, - scale: 3, - }, - oracle_pubkeys_data: [Pubkey::default(); 16], - medians_data: [ - SwitchboardDecimal { - mantissa: 21757, - scale: 3, - }, - SwitchboardDecimal { - mantissa: 21757, - scale: 3, - }, - SwitchboardDecimal { - mantissa: 21757, - scale: 3, - }, - SwitchboardDecimal { - mantissa: 217597885875, - scale: 10, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - ], - current_payout: [12500, 12500, 0, 12500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - medians_fulfilled: [ - true, true, true, true, false, false, false, false, false, false, false, false, - false, false, false, false, - ], - errors_fulfilled: [ - false, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, - ], - }, - current_round: AggregatorRound { - num_success: 0, - num_error: 0, - is_closed: false, - round_open_slot: 189963432, - round_open_timestamp: 1682220581, - result: SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - std_deviation: SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - min_response: SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - max_response: SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - oracle_pubkeys_data: [Pubkey::default(); 16], - medians_data: [ - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - SwitchboardDecimal { - mantissa: 0, - scale: 0, - }, - ], - current_payout: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - medians_fulfilled: [ - false, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, - ], - errors_fulfilled: [ - false, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, - ], - }, - job_pubkeys_data: [Pubkey::default(); 16], - job_hashes: [switchboard_solana::Hash::default(); 16], - job_pubkeys_size: 5, - jobs_checksum: [ - 119, 207, 222, 177, 160, 127, 254, 198, 132, 153, 111, 54, 202, 89, 87, 81, 75, 152, - 67, 132, 249, 111, 216, 90, 132, 22, 198, 45, 67, 233, 50, 225, - ], - authority: pubkey!("GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR"), - history_buffer: pubkey!("E3cqnoFvTeKKNsGmC8YitpMjo2E39hwfoyt2Aiem7dCb"), - previous_confirmed_round_result: SwitchboardDecimal { - mantissa: 21757, - scale: 3, - }, - previous_confirmed_round_slot: 189963416, - disable_crank: false, - job_weights: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - creation_timestamp: 0, - resolution_mode: AggregatorResolutionMode::ModeRoundResolution, - _ebuf: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, - 0, - //0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - ..Default::default() // base_priority_fee: todo!(), - // priority_fee_bump: todo!(), - // priority_fee_bump_period: todo!(), - // max_priority_fee_multiplier: todo!(), - // parent_function: todo!(), - }; - - let desc_bytes = - ::DISCRIMINATOR; - let mut data = vec![0u8; 8 + size_of::()]; - data[..8].copy_from_slice(&desc_bytes); - data[8..].copy_from_slice(bytemuck::bytes_of(&aggregator_account)); - - Account { - lamports: 10000, - data, - owner: SWITCHBOARD_PROGRAM_ID, - executable: false, - rent_epoch: 0, - } -} - #[macro_export] macro_rules! assert_custom_error { ($error:expr, $matcher:expr) => { @@ -435,7 +161,7 @@ macro_rules! assert_custom_error { solana_program_test::BanksClientError::TransactionError( solana_sdk::transaction::TransactionError::InstructionError( _, - solana_program::instruction::InstructionError::Custom(n), + anchor_lang::solana_program::instruction::InstructionError::Custom(n), ), ) => { assert_eq!(n, anchor_lang::error::ERROR_CODE_OFFSET + $matcher as u32) @@ -452,7 +178,7 @@ macro_rules! assert_anchor_error { solana_program_test::BanksClientError::TransactionError( solana_sdk::transaction::TransactionError::InstructionError( _, - solana_program::instruction::InstructionError::Custom(n), + anchor_lang::solana_program::instruction::InstructionError::Custom(n), ), ) => { assert_eq!(n, $matcher as u32) diff --git a/yarn.lock b/yarn.lock index f4362e60c..439bc3e92 100644 --- a/yarn.lock +++ b/yarn.lock @@ -42,6 +42,30 @@ resolved "https://registry.yarnpkg.com/@coral-xyz/anchor-errors/-/anchor-errors-0.30.1.tgz#bdfd3a353131345244546876eb4afc0e125bec30" integrity sha512-9Mkradf5yS5xiLWrl9WrpjqOrAV+/W2RQHDlbnAZBivoGpOs1ECjoDCkVk4aRG8ZdiFiB8zQEVlxf+8fKkmSfQ== +"@coral-xyz/anchor-errors@^0.31.0": + version "0.31.0" + resolved "https://registry.yarnpkg.com/@coral-xyz/anchor-errors/-/anchor-errors-0.31.0.tgz#dfc7329fca152b598842f68175efe5000825b51b" + integrity sha512-SUERksFSQ+4F11hkROIwHq4mcoSMXJxwVWLoklefi4dU679zVWFVcTq6O7otvjY8wlUaRXeE+iYcQWZTw2ll6w== + +"@coral-xyz/anchor@0.31.0": + version "0.31.0" + resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.31.0.tgz#76b84541e6fdfbd6c661584cdc418453a6416f12" + integrity sha512-Yb1NwP1s4cWhAw7wL7vOLHSWWw3cD5D9pRCVSeJpdqPaI+w7sfRLScnVJL6ViYMZynB7nAG/5HcUPKUnY0L9rw== + dependencies: + "@coral-xyz/anchor-errors" "^0.31.0" + "@coral-xyz/borsh" "^0.31.0" + "@noble/hashes" "^1.3.1" + "@solana/web3.js" "^1.69.0" + bn.js "^5.1.2" + bs58 "^4.0.1" + buffer-layout "^1.2.2" + camelcase "^6.3.0" + cross-fetch "^3.1.5" + eventemitter3 "^4.0.7" + pako "^2.0.3" + superstruct "^0.15.4" + toml "^3.0.0" + "@coral-xyz/anchor@=0.30.1", "@coral-xyz/anchor@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d" @@ -99,6 +123,14 @@ bn.js "^5.1.2" buffer-layout "^1.2.0" +"@coral-xyz/borsh@^0.31.0": + version "0.31.0" + resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.31.0.tgz#eb77239b75f3ea9e771b1ee0821712caf664cb32" + integrity sha512-DwdQ5fuj+rGQCTKRnxnW1W2lvcpBaFc9m9M1TcGGlm+bwCcggmDgbLKLgF+LjIrKnc7Nd+bCACx5RA9YTK2I4Q== + dependencies: + bn.js "^5.1.2" + buffer-layout "^1.2.0" + "@coral-xyz/spl-token@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@coral-xyz/spl-token/-/spl-token-0.30.1.tgz#05223b2416fe46452777d3217a99cbe3fa2ff98b" @@ -582,6 +614,27 @@ rpc-websockets "^9.0.2" superstruct "^2.0.2" +"@solana/web3.js@^1.69.0": + version "1.98.0" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.98.0.tgz#21ecfe8198c10831df6f0cfde7f68370d0405917" + integrity sha512-nz3Q5OeyGFpFCR+erX2f6JPt3sKhzhYcSycBCSPkWjzSVDh/Rr1FqTVMRe58FKO16/ivTUcuJjeS5MyBvpkbzA== + dependencies: + "@babel/runtime" "^7.25.0" + "@noble/curves" "^1.4.2" + "@noble/hashes" "^1.4.0" + "@solana/buffer-layout" "^4.0.1" + agentkeepalive "^4.5.0" + bigint-buffer "^1.1.5" + bn.js "^5.2.1" + borsh "^0.7.0" + bs58 "^4.0.1" + buffer "6.0.3" + fast-stable-stringify "^1.0.0" + jayson "^4.1.1" + node-fetch "^2.7.0" + rpc-websockets "^9.0.2" + superstruct "^2.0.2" + "@solana/web3.js@~1.77.3": version "1.77.4" resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.77.4.tgz#aad8c44a02ced319493308ef765a2b36a9e9fa8c" From 61f30c8d8a50a81449d5d2f1b3ac12c6305fb1c7 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Fri, 18 Apr 2025 18:20:19 -0400 Subject: [PATCH 27/38] Probably fixed swb alignment issues, life is pain. --- .../marginfi_account/flashloan.rs | 16 +- programs/marginfi/src/state/price.rs | 230 +++++++++--------- programs/marginfi/tests/user_actions/repay.rs | 3 + 3 files changed, 122 insertions(+), 127 deletions(-) diff --git a/programs/marginfi/src/instructions/marginfi_account/flashloan.rs b/programs/marginfi/src/instructions/marginfi_account/flashloan.rs index 266152029..48085f850 100644 --- a/programs/marginfi/src/instructions/marginfi_account/flashloan.rs +++ b/programs/marginfi/src/instructions/marginfi_account/flashloan.rs @@ -5,11 +5,11 @@ use crate::{ MarginfiAccount, RiskEngine, ACCOUNT_DISABLED, ACCOUNT_IN_FLASHLOAN, }, }; -use anchor_lang::{prelude::*, Discriminator}; use anchor_lang::solana_program::{ instruction::{get_stack_height, TRANSACTION_LEVEL_STACK_HEIGHT}, sysvar::{self, instructions}, }; +use anchor_lang::{prelude::*, Discriminator}; pub fn lending_account_start_flashloan( ctx: Context, @@ -81,15 +81,13 @@ pub fn check_flashloan_can_start( // Will error if ix doesn't exist let unchecked_end_fl_ix = instructions::load_instruction_at_checked(end_fl_idx, sysvar_ixs)?; - // TODO restore with 0.31.0 discrim syntax or hard coded value - if unchecked_end_fl_ix.data[..8] != [0; 8] { - panic!("put discrim check back"); + let discrim = &unchecked_end_fl_ix.data[..8]; + // TODO figure out anchor's fancy new discrim syntax to avoid hard coding this. + const FLASHLOAN_DISCRIM: [u8; 8] = [105, 124, 201, 106, 153, 2, 8, 156]; + if discrim != FLASHLOAN_DISCRIM { + msg!("discrim: {:?}, expected: {:?}", discrim, FLASHLOAN_DISCRIM); + return err!(MarginfiError::IllegalFlashloan); } - // check!( - // unchecked_end_fl_ix.data[..8] - // .eq(&crate::instruction::LendingAccountEndFlashloan::DISCRIMINATOR), - // MarginfiError::IllegalFlashloan - // ); check!( unchecked_end_fl_ix.program_id.eq(&crate::id()), diff --git a/programs/marginfi/src/state/price.rs b/programs/marginfi/src/state/price.rs index 96a30f896..45577a562 100644 --- a/programs/marginfi/src/state/price.rs +++ b/programs/marginfi/src/state/price.rs @@ -7,8 +7,11 @@ use fixed::types::I80F48; pub use pyth_sdk_solana; use pyth_sdk_solana::{state::SolanaPriceAccount, Price, PriceFeed}; use pyth_solana_receiver_sdk::price_update::{self, FeedId, PriceUpdateV2}; +use std::mem; use std::{cell::Ref, cmp::min}; -use switchboard_on_demand::{CurrentResult, PullFeedAccountData, SPL_TOKEN_PROGRAM_ID}; +use switchboard_on_demand::{ + CurrentResult, Discriminator, PullFeedAccountData, SPL_TOKEN_PROGRAM_ID, +}; use crate::{ check, check_eq, @@ -94,8 +97,8 @@ pub struct SwitchboardV2PriceFeed { impl PriceAdapter for SwitchboardV2PriceFeed { fn get_price_of_type( &self, - price_type: OraclePriceType, - bias: Option, + _price_type: OraclePriceType, + _bias: Option, ) -> MarginfiResult { panic!("swb v2 is deprecated"); } @@ -577,14 +580,17 @@ impl SwitchboardPullPriceFeed { max_age: u64, ) -> MarginfiResult { let ai_data = ai.data.borrow(); + let _vec = ai_data.to_vec(); check!( ai.owner.eq(&SWITCHBOARD_PULL_ID), MarginfiError::SwitchboardWrongAccountOwner ); - let feed = PullFeedAccountData::parse(ai_data) - .map_err(|_| MarginfiError::SwitchboardInvalidAccount)?; + let feed = &parse_swb_ignore_alignment(ai_data)?; + // TODO restore when swb fixes alignment issue in crate. + // let feed = PullFeedAccountData::parse(ai_data) + // .map_err(|_| MarginfiError::SwitchboardInvalidAccount)?; // Check staleness let last_updated = feed.last_update_timestamp; @@ -605,8 +611,10 @@ impl SwitchboardPullPriceFeed { MarginfiError::SwitchboardWrongAccountOwner ); - PullFeedAccountData::parse(ai_data) - .map_err(|_| MarginfiError::SwitchboardInvalidAccount)?; + let _feed = parse_swb_ignore_alignment(ai_data)?; + // TODO restore when swb fixes alignment issue in crate. + // PullFeedAccountData::parse(ai_data) + // .map_err(|_| MarginfiError::SwitchboardInvalidAccount)?; Ok(()) } @@ -679,6 +687,35 @@ impl PriceAdapter for SwitchboardPullPriceFeed { } } +// TODO remove when swb fixes the alignment issue in their crate +// (TargetAlignmentGreaterAndInputNotAligned) when bytemuck::from_bytes executes on any local system +// (including bpf next-test) where the struct is "properly" aligned 16 +/// The same as PullFeedAccountData::parse but completely ignores input alignment. +pub fn parse_swb_ignore_alignment<'info>( + data: Ref<'info, &mut [u8]>, +) -> MarginfiResult { + if data.len() < 8 { + return err!(MarginfiError::SwitchboardInvalidAccount); + } + + let mut disc_bytes = [0u8; 8]; + disc_bytes.copy_from_slice(&data[..8]); + if disc_bytes != PullFeedAccountData::DISCRIMINATOR { + return err!(MarginfiError::SwitchboardInvalidAccount); + } + + let mut data_bytes = [0u8; 3200]; + data_bytes.copy_from_slice(&data[8..]); + + let feed_maybe = bytemuck::try_pod_read_unaligned::(&data_bytes); + let feed = if feed_maybe.is_ok() { + feed_maybe.unwrap() + } else { + return err!(MarginfiError::SwitchboardInvalidAccount); + }; + Ok(feed) +} + pub fn load_price_update_v2_checked(ai: &AccountInfo) -> MarginfiResult { if live!() { check_eq!( @@ -982,8 +1019,6 @@ fn load_pyth_price_feed(ai: &AccountInfo) -> MarginfiResult { mod tests { use fixed_macro::types::I80F48; use pretty_assertions::assert_eq; - use rust_decimal::Decimal; - use switchboard_on_demand::Discriminator; use crate::utils::hex_to_bytes; @@ -1207,113 +1242,72 @@ mod tests { use std::cell::RefCell; use std::rc::Rc; - // TODO restore - - // /// Convert an account to info, useful if you only care about data for testing purposes. - // pub fn account_to_account_info<'a>( - // account: &'a mut dyn Account, - // key: &'a Pubkey, - // ) -> AccountInfo<'a> { - // AccountInfo { - // key, - // lamports: Rc::new(RefCell::new(&mut account.lamports)), - // data: Rc::new(RefCell::new(&mut account.data[..])), - // owner: &account.owner, - // rent_epoch: account.rent_epoch, - // is_signer: false, - // is_writable: true, - // executable: account.executable, - // } - // } - - // pub fn create_switch_pull_oracle_account_from_bytes(data: Vec) -> dyn Account { - // Account { - // lamports: 1_000_000, - // data, - // owner: SWITCHBOARD_PULL_ID, - // executable: false, - // rent_epoch: 361, - // } - // } - - // #[test] - // fn swb_pull_get_price() { - // // From mainnet: https://solana.fm/address/BSzfJs4d1tAkSDqkepnfzEVcx2WtDVnwwXa2giy9PLeP - // // Actual price $155.59404527 - // // conf/Std_dev ~5% - // let bytes = hex_to_bytes("c41b6cc40ad7db286f5e7566ac000a9530e56b1db49585772719aeaaeeadb4d9bd8c2357b88e9e782e53d81000000000000000000000000000985f538057856308000000000000005cba953f3f15356b17703e554d3983801916531d7976aa424ad64348ec50e4224650d81000000000000000000000000000a0d5a780cc7f580800000000000000a20b742cedab55efd1faf60aef2cb872a092d24dfba8a48c8b953a5e90ac7bbf874ed81000000000000000000000000000c04958360093580800000000000000e7ef024ea756f8beec2eaa40234070da356754a8eeb2ac6a17c32d17c3e99f8ddc50d81000000000000000000000000000bc8739b45d215b0800000000000000e3e5130902c3e9c27917789769f1ae05de15cf504658beafeed2c598a949b3b7bf53d810000000000000000000000000007cec168c94d667080000000000000020e270b743473d87eff321663e267ba1c9a151f7969cef8147f625e9a2af7287ea54d81000000000000000000000000000dc65eccc174d6f0800000000000000ab605484238ac93f225c65f24d7705bb74b00cdb576555c3995e196691a4de5f484ed8100000000000000000000000000088f28dc9271d59080000000000000015196392573dc9043242716f629d4c0fb93bc0cff7a1a10ede24281b0e98fb7d5454d810000000000000000000000000000441a10ca4a268080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000048ac38271f28ab1b12e49439bddf54871094e4832a56c7a8ec57bd18d357980086807068432f186a147cf0b13a30067d386204ea9d6c8b04743ac2ef010b07524c935636f2523f6aeeb6dc7b7dab0e86a13ff2c794f7895fc78851d69fdb593bdccdb36600000000000000000000000000e40b540200000001000000534f4c2f55534400000000000000000000000000000000000000000000000000000000019e9eb66600000000fca3d11000000000000000000000000000000000000000000000000000000000000000000000000000dc65eccc174d6f0800000000000000006c9225e039550300000000000000000070d3c6ecddf76b080000000000000000d8244bc073aa060000000000000000000441a10ca4a268080000000000000000dc65eccc174d6f08000000000000000200000000000000ea54d810000000005454d81000000000ea54d81000000000fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); - // let key = pubkey!("BSzfJs4d1tAkSDqkepnfzEVcx2WtDVnwwXa2giy9PLeP"); - // let mut data = bytes.clone(); - // println!("data: {:?}", data.len()); - - // let mut lamports = 1_000_000u64; - // let discrim = &PullFeedAccountData::DISCRIMINATOR; - // let mut fake_data: [u8; 3208] = [0; 3208]; - // fake_data[0..8].copy_from_slice(discrim); - - // let ai = AccountInfo { - // key: &key, - // lamports: Rc::new(RefCell::new(&mut lamports)), - // data: Rc::new(RefCell::new(&mut fake_data[..])), - // owner: &SWITCHBOARD_PULL_ID, - // rent_epoch: 361, - // is_signer: false, - // is_writable: true, - // executable: false, - // }; - - // let ai_data = ai.data.borrow(); - // println!("a"); - // let result = PullFeedAccountData::parse(ai_data) - // .map_err(|_| MarginfiError::SwitchboardInvalidAccount); - // println!("b"); - - // let ai_check = SwitchboardPullPriceFeed::check_ais(&ai); - // assert!(ai_check.is_ok()); - - // println!("b"); - // let current_timestamp = 42; - // let max_age = 100; - // let feed: SwitchboardPullPriceFeed = - // SwitchboardPullPriceFeed::load_checked(&ai, current_timestamp, max_age).unwrap(); - // let price: I80F48 = feed.get_price().unwrap(); - // let conf: I80F48 = feed.get_confidence_interval().unwrap(); - - // //println!("price: {:?}, conf: {:?}", price, conf); - - // let target_price: I80F48 = I80F48::from_num(155); // Target price is $155 - // let price_tolerance: I80F48 = target_price * I80F48::from_num(0.01); - - // let target_conf: I80F48 = target_price * I80F48::from_num(0.05); - // let conf_tolerance: I80F48 = target_conf * I80F48::from_num(0.005); - - // let min_price: I80F48 = target_price.checked_sub(price_tolerance).unwrap(); - // let max_price: I80F48 = target_price.checked_add(price_tolerance).unwrap(); - // assert!(price >= min_price && price <= max_price); - - // let min_conf: I80F48 = target_conf.checked_sub(conf_tolerance).unwrap(); - // let max_conf: I80F48 = target_conf.checked_add(conf_tolerance).unwrap(); - // assert!(conf >= min_conf && conf <= max_conf); - - // let price_bias_none: I80F48 = feed - // .get_price_of_type(OraclePriceType::RealTime, None) - // .unwrap(); - // assert_eq!(price, price_bias_none); - - // let price_bias_low: I80F48 = feed - // .get_price_of_type(OraclePriceType::RealTime, Some(PriceBias::Low)) - // .unwrap(); - // let target_price_low: I80F48 = target_price.checked_sub(target_conf).unwrap(); - // let min_price: I80F48 = target_price_low.checked_sub(price_tolerance).unwrap(); - // let max_price: I80F48 = target_price_low.checked_add(price_tolerance).unwrap(); - // assert!(price_bias_low >= min_price && price_bias_low <= max_price); - - // let price_bias_high: I80F48 = feed - // .get_price_of_type(OraclePriceType::RealTime, Some(PriceBias::High)) - // .unwrap(); - // let target_price_high: I80F48 = target_price.checked_add(target_conf).unwrap(); - // let min_price: I80F48 = target_price_high.checked_sub(price_tolerance).unwrap(); - // let max_price: I80F48 = target_price_high.checked_add(price_tolerance).unwrap(); - // assert!(price_bias_high >= min_price && price_bias_high <= max_price); - // } + #[test] + fn swb_pull_get_price() { + // From mainnet: https://solana.fm/address/BSzfJs4d1tAkSDqkepnfzEVcx2WtDVnwwXa2giy9PLeP + // Actual price $155.59404527 + // conf/Std_dev ~5% + let bytes = hex_to_bytes("c41b6cc40ad7db286f5e7566ac000a9530e56b1db49585772719aeaaeeadb4d9bd8c2357b88e9e782e53d81000000000000000000000000000985f538057856308000000000000005cba953f3f15356b17703e554d3983801916531d7976aa424ad64348ec50e4224650d81000000000000000000000000000a0d5a780cc7f580800000000000000a20b742cedab55efd1faf60aef2cb872a092d24dfba8a48c8b953a5e90ac7bbf874ed81000000000000000000000000000c04958360093580800000000000000e7ef024ea756f8beec2eaa40234070da356754a8eeb2ac6a17c32d17c3e99f8ddc50d81000000000000000000000000000bc8739b45d215b0800000000000000e3e5130902c3e9c27917789769f1ae05de15cf504658beafeed2c598a949b3b7bf53d810000000000000000000000000007cec168c94d667080000000000000020e270b743473d87eff321663e267ba1c9a151f7969cef8147f625e9a2af7287ea54d81000000000000000000000000000dc65eccc174d6f0800000000000000ab605484238ac93f225c65f24d7705bb74b00cdb576555c3995e196691a4de5f484ed8100000000000000000000000000088f28dc9271d59080000000000000015196392573dc9043242716f629d4c0fb93bc0cff7a1a10ede24281b0e98fb7d5454d810000000000000000000000000000441a10ca4a268080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000048ac38271f28ab1b12e49439bddf54871094e4832a56c7a8ec57bd18d357980086807068432f186a147cf0b13a30067d386204ea9d6c8b04743ac2ef010b07524c935636f2523f6aeeb6dc7b7dab0e86a13ff2c794f7895fc78851d69fdb593bdccdb36600000000000000000000000000e40b540200000001000000534f4c2f55534400000000000000000000000000000000000000000000000000000000019e9eb66600000000fca3d11000000000000000000000000000000000000000000000000000000000000000000000000000dc65eccc174d6f0800000000000000006c9225e039550300000000000000000070d3c6ecddf76b080000000000000000d8244bc073aa060000000000000000000441a10ca4a268080000000000000000dc65eccc174d6f08000000000000000200000000000000ea54d810000000005454d81000000000ea54d81000000000fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + let key = pubkey!("BSzfJs4d1tAkSDqkepnfzEVcx2WtDVnwwXa2giy9PLeP"); + let mut lamports = 1_000_000u64; + let mut data = bytes.clone(); + + let ai = AccountInfo { + key: &key, + lamports: Rc::new(RefCell::new(&mut lamports)), + data: Rc::new(RefCell::new(&mut data[..])), + owner: &SWITCHBOARD_PULL_ID, + rent_epoch: 361, + is_signer: false, + is_writable: true, + executable: false, + }; + + let ai_check = SwitchboardPullPriceFeed::check_ais(&ai); + assert!(ai_check.is_ok()); + + let current_timestamp = 42; + let max_age = 100; + let feed: SwitchboardPullPriceFeed = + SwitchboardPullPriceFeed::load_checked(&ai, current_timestamp, max_age).unwrap(); + let price: I80F48 = feed.get_price().unwrap(); + let conf: I80F48 = feed.get_confidence_interval().unwrap(); + + //println!("price: {:?}, conf: {:?}", price, conf); + + let target_price: I80F48 = I80F48::from_num(155); // Target price is $155 + let price_tolerance: I80F48 = target_price * I80F48::from_num(0.01); + + let target_conf: I80F48 = target_price * I80F48::from_num(0.05); + let conf_tolerance: I80F48 = target_conf * I80F48::from_num(0.005); + + let min_price: I80F48 = target_price.checked_sub(price_tolerance).unwrap(); + let max_price: I80F48 = target_price.checked_add(price_tolerance).unwrap(); + assert!(price >= min_price && price <= max_price); + + let min_conf: I80F48 = target_conf.checked_sub(conf_tolerance).unwrap(); + let max_conf: I80F48 = target_conf.checked_add(conf_tolerance).unwrap(); + assert!(conf >= min_conf && conf <= max_conf); + + let price_bias_none: I80F48 = feed + .get_price_of_type(OraclePriceType::RealTime, None) + .unwrap(); + assert_eq!(price, price_bias_none); + + let price_bias_low: I80F48 = feed + .get_price_of_type(OraclePriceType::RealTime, Some(PriceBias::Low)) + .unwrap(); + let target_price_low: I80F48 = target_price.checked_sub(target_conf).unwrap(); + let min_price: I80F48 = target_price_low.checked_sub(price_tolerance).unwrap(); + let max_price: I80F48 = target_price_low.checked_add(price_tolerance).unwrap(); + assert!(price_bias_low >= min_price && price_bias_low <= max_price); + + let price_bias_high: I80F48 = feed + .get_price_of_type(OraclePriceType::RealTime, Some(PriceBias::High)) + .unwrap(); + let target_price_high: I80F48 = target_price.checked_add(target_conf).unwrap(); + let min_price: I80F48 = target_price_high.checked_sub(price_tolerance).unwrap(); + let max_price: I80F48 = target_price_high.checked_add(price_tolerance).unwrap(); + assert!(price_bias_high >= min_price && price_bias_high <= max_price); + } } diff --git a/programs/marginfi/tests/user_actions/repay.rs b/programs/marginfi/tests/user_actions/repay.rs index 2e843f82d..6b86aebc6 100644 --- a/programs/marginfi/tests/user_actions/repay.rs +++ b/programs/marginfi/tests/user_actions/repay.rs @@ -54,16 +54,19 @@ async fn marginfi_account_repay_success( .get_sufficient_collateral_for_outflow(borrow_amount, &collateral_mint, &debt_mint) .await; let user_wallet_balance = get_max_deposit_amount_pre_fee(sufficient_collateral_amount); + let user_collateral_token_account_f = test_f .get_bank_mut(&collateral_mint) .mint .create_token_account_and_mint_to(user_wallet_balance) .await; + let user_debt_token_account_f = test_f .get_bank_mut(&debt_mint) .mint .create_empty_token_account() .await; + user_mfi_account_f .try_bank_deposit( user_collateral_token_account_f.key, From c9e69ce6978e874fca75e6ec64147086551c7329 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Sat, 19 Apr 2025 04:07:16 -0400 Subject: [PATCH 28/38] Swb stack overflow fix, compiler settings optimization to make tests run at SuPeR SpEeD --- Anchor.toml | 2 +- Cargo.lock | 935 ++++++++++-------- Cargo.toml | 60 +- programs/marginfi/Cargo.toml | 18 +- programs/marginfi/src/state/price.rs | 24 +- .../tests/misc/collateral_value_cap.rs | 8 +- programs/mocks/Cargo.toml | 4 +- scripts/build-program-verifiable.sh | 6 + test-utils/Cargo.toml | 23 +- test-utils/src/lib.rs | 2 +- test-utils/src/marginfi_account.rs | 57 +- test-utils/src/spl.rs | 24 +- test-utils/src/utils.rs | 33 +- 13 files changed, 714 insertions(+), 482 deletions(-) diff --git a/Anchor.toml b/Anchor.toml index 9335d9874..81c8453f3 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -4,7 +4,7 @@ solana_version = "2.1.0" # Getting "thread 'main' panicked at cli/src/lib.rs:545:18:"? Check your toolchain matches the above. [workspace] -members = ["programs/marginfi", "programs/mocks"] +members = ["programs/marginfi", "programs/mocks", "programs/test_transfer_hook"] # exclude = [ # "programs/test_transfer_hook", # "programs/liquidity-incentive-program", diff --git a/Cargo.lock b/Cargo.lock index ad5715f2e..5a3c0305f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,19 +14,13 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "adler2" version = "2.0.0" @@ -100,7 +94,7 @@ dependencies = [ "getrandom 0.2.15", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -256,7 +250,7 @@ dependencies = [ "anchor-lang-idl", "base64 0.21.7", "bincode", - "borsh 0.10.3", + "borsh 0.10.4", "bytemuck", "solana-program", "thiserror 1.0.69", @@ -496,9 +490,9 @@ checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "ascii" @@ -531,7 +525,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -564,9 +558,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.11" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd066d0b4ef8ecb03a55319dc13aa6910616d0f44008a045bb1835af830abff5" +checksum = "59a194f9d963d8099596278594b3107448656ba73831c9d8c783e613ce86da64" dependencies = [ "brotli", "flate2", @@ -611,9 +605,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "az" @@ -623,17 +617,17 @@ checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -677,9 +671,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" dependencies = [ "serde", ] @@ -739,29 +733,29 @@ dependencies = [ [[package]] name = "borsh" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" +checksum = "115e54d64eb62cdebad391c19efc9dce4981c690c85a33a12199d99bb9546fee" dependencies = [ - "borsh-derive 0.10.3", + "borsh-derive 0.10.4", "hashbrown 0.13.2", ] [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" dependencies = [ - "borsh-derive 1.5.1", + "borsh-derive 1.5.7", "cfg_aliases", ] [[package]] name = "borsh-derive" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" +checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", @@ -772,23 +766,22 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" dependencies = [ "once_cell", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", - "syn_derive", ] [[package]] name = "borsh-derive-internal" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" +checksum = "65d6ba50644c98714aa2a70d13d7df3cd75cd2b523a2b452bf010443800976b3" dependencies = [ "proc-macro2", "quote", @@ -797,9 +790,9 @@ dependencies = [ [[package]] name = "borsh-schema-derive-internal" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" +checksum = "276691d96f063427be83e6692b86148e488ebba9f48f77788724ca027ba3b6d4" dependencies = [ "proc-macro2", "quote", @@ -808,9 +801,9 @@ dependencies = [ [[package]] name = "brotli" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" +checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -819,9 +812,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "4.0.1" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +checksum = "a334ef7c9e23abf0ce748e8cd309037da93e606ad52eb372e4ce327a0dcfbdfd" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -838,9 +831,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bv" @@ -943,7 +936,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be" dependencies = [ "serde", - "toml 0.8.19", + "toml 0.8.20", ] [[package]] @@ -988,9 +981,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", @@ -998,7 +991,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -1134,9 +1127,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] @@ -1152,9 +1145,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" dependencies = [ "crossbeam-utils", ] @@ -1180,15 +1173,15 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "crypto-common" @@ -1264,9 +1257,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.9" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ "darling_core", "darling_macro", @@ -1274,9 +1267,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.9" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", @@ -1288,9 +1281,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.9" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", @@ -1473,9 +1466,9 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dyn-clone" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" +checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" [[package]] name = "eager" @@ -1532,9 +1525,9 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "encode_unicode" @@ -1544,9 +1537,9 @@ checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -1611,15 +1604,15 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "erased-serde" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d" +checksum = "e004d887f51fcb9fef17317a2f3525c887d8aa3f4f50fed920816a688284a5b7" dependencies = [ "serde", "typeid", @@ -1718,9 +1711,9 @@ checksum = "2551bf44bc5f776c15044b9b94153a00198be06743e262afaaa61f11ac7523a5" [[package]] name = "fixed" -version = "1.27.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc715d38bea7b5bf487fcd79bcf8c209f0b58014f3018a7a19c2b855f472048" +checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" dependencies = [ "az", "bytemuck", @@ -1770,7 +1763,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" dependencies = [ "crc32fast", - "miniz_oxide 0.8.8", + "miniz_oxide", ] [[package]] @@ -1967,9 +1960,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "governor" @@ -2006,7 +1999,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.14", "tracing", ] @@ -2055,9 +2048,9 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -2158,9 +2151,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -2176,9 +2169,9 @@ checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f" [[package]] name = "hyper" -version = "0.14.29" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ "bytes", "futures-channel", @@ -2236,6 +2229,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -2244,12 +2355,23 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -2301,12 +2423,12 @@ checksum = "fa38453685e5fe724fd23ff6c1a158c1e2ca21ce0c2718fa11e96e70e99fd4de" [[package]] name = "indexmap" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.2", ] [[package]] @@ -2333,9 +2455,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "itertools" @@ -2357,9 +2479,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jni" @@ -2445,7 +2567,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "libc", "redox_syscall", ] @@ -2471,12 +2593,12 @@ dependencies = [ [[package]] name = "libsecp256k1" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +checksum = "e79019718125edc905a079a70cfa5f3820bc76139fc91d6f9abc27ea2a887139" dependencies = [ "arrayref", - "base64 0.13.1", + "base64 0.22.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core 0.3.0", @@ -2564,6 +2686,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "lock_api" version = "0.4.12" @@ -2576,9 +2704,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" dependencies = [ "value-bag", ] @@ -2612,7 +2740,7 @@ dependencies = [ "assert_matches", "base64 0.21.7", "bincode", - "borsh 0.10.3", + "borsh 1.5.7", "bytemuck", "cfg-if", "enum_dispatch", @@ -2632,7 +2760,7 @@ dependencies = [ "solana-program-test", "solana-sdk", "solana-security-txt", - "spl-transfer-hook-interface 0.6.3", + "spl-transfer-hook-interface 0.9.0", "static_assertions", "switchboard-on-demand", "test-case", @@ -2707,15 +2835,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.8.8" @@ -2727,13 +2846,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.11" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2800,7 +2919,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "cfg-if", "cfg_aliases", "libc", @@ -3008,7 +3127,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -3022,9 +3141,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.36.1" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] @@ -3174,9 +3293,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -3216,9 +3335,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] [[package]] name = "predicates" @@ -3258,9 +3380,9 @@ checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" [[package]] name = "pretty_assertions" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" dependencies = [ "diff", "yansi", @@ -3277,11 +3399,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ - "toml_edit 0.21.1", + "toml_edit", ] [[package]] @@ -3343,8 +3465,8 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7aeef4d5f0a9c98ff5af2ddd84a8b89919c512188305b497a9eb9afa97a949" dependencies = [ - "borsh 0.10.3", - "borsh-derive 0.10.3", + "borsh 0.10.4", + "borsh-derive 0.10.4", "getrandom 0.2.15", "hex", "schemars", @@ -3353,12 +3475,12 @@ dependencies = [ [[package]] name = "pyth-sdk-solana" -version = "0.10.1" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f913de6eb29d8def199af3beaee645e84c5281327d58777eff3fdd9f1d37105" +checksum = "5a1875ce0bee6b18af4a9700ae8e514f1dd093c29aa3400e2a40e96421adcdb5" dependencies = [ - "borsh 0.10.3", - "borsh-derive 0.10.3", + "borsh 0.10.4", + "borsh-derive 0.10.4", "bytemuck", "num-derive 0.3.3", "num-traits", @@ -3389,7 +3511,7 @@ checksum = "498d20fd330277697aaee92f341bdabdb4695b10e05f054157a18ad8b7746a17" dependencies = [ "anchor-lang", "bincode", - "borsh 0.10.3", + "borsh 0.10.4", "bytemuck", "byteorder", "fast-math", @@ -3494,9 +3616,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -3628,7 +3750,7 @@ version = "11.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -3653,11 +3775,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.2" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +checksum = "d2f103c6d277498fbceb16e84d317e2a400f160f46904d5f5410848c829511a3" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -3743,7 +3865,7 @@ dependencies = [ "system-configuration", "tokio", "tokio-rustls", - "tokio-util 0.7.11", + "tokio-util 0.7.14", "tower-service", "url", "wasm-bindgen", @@ -3770,24 +3892,23 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.8" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", "getrandom 0.2.15", "libc", - "spin", "untrusted", "windows-sys 0.52.0", ] [[package]] name = "rkyv" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" dependencies = [ "bitvec", "bytecheck", @@ -3803,9 +3924,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ "proc-macro2", "quote", @@ -3835,12 +3956,12 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.35.0" +version = "1.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a" +checksum = "faa7de2ba56ac291bd90c6b9bece784a52ae1411f9506544b3eae36dd2356d50" dependencies = [ "arrayvec", - "borsh 1.5.1", + "borsh 1.5.7", "bytes", "num-traits", "rand 0.8.5", @@ -3869,9 +3990,9 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] @@ -3891,7 +4012,7 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "errno", "libc", "linux-raw-sys", @@ -4004,15 +4125,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "same-file" @@ -4034,9 +4155,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" dependencies = [ "dyn-clone", "schemars_derive", @@ -4046,9 +4167,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" dependencies = [ "proc-macro2", "quote", @@ -4090,7 +4211,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "core-foundation 0.10.0", "core-foundation-sys", "libc", @@ -4109,9 +4230,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "seqlock" @@ -4133,9 +4254,9 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.15" +version = "0.11.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" +checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96" dependencies = [ "serde", ] @@ -4323,9 +4444,9 @@ checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" [[package]] name = "simdutf8" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "siphasher" @@ -4363,15 +4484,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.2" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" dependencies = [ "libc", "windows-sys 0.52.0", @@ -4526,7 +4647,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f857fb6590467d433f40eee507666ca496ec67907e50b7d530b6c04f6541875" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "futures", "solana-banks-interface", "solana-program", @@ -4602,8 +4723,8 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5d526f3525ab22a3ada3f9a1d642664dafac00dc9208326b701a2045514eb04" dependencies = [ - "borsh 0.10.3", - "borsh 1.5.1", + "borsh 0.10.4", + "borsh 1.5.7", ] [[package]] @@ -4956,7 +5077,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1807bc4e9e1d25271514167d5a1e698ce5a330bce547a368242dd63b355b5faa" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "bs58", "bytemuck", "bytemuck_derive", @@ -4995,7 +5116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfef689e06e5c7cb6206d4dc61ac77733de4f72d754e0d531393206abc27dbe4" dependencies = [ "bincode", - "borsh 1.5.1", + "borsh 1.5.7", "getrandom 0.2.15", "js-sys", "num-traits", @@ -5134,7 +5255,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dafc2d84e57dbfe32583fe915962bd2ca3af6be496628a871db3c3d697b38d7" dependencies = [ "bincode", - "bitflags 2.6.0", + "bitflags 2.9.0", "cfg_eval", "serde", "serde_derive", @@ -5198,10 +5319,10 @@ checksum = "9040decf2f295d35da22557eeab3768ab8dfca8aed9afe668663c8fa0e97d60e" dependencies = [ "base64 0.22.1", "bincode", - "bitflags 2.6.0", + "bitflags 2.9.0", "blake3", - "borsh 0.10.3", - "borsh 1.5.1", + "borsh 0.10.4", + "borsh 1.5.7", "bs58", "bv", "bytemuck", @@ -5280,7 +5401,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd089caeef26dd07bd12b7b67d45e92faddc2fc67a960f316df7ae4776a2f3d5" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "num-traits", "serde", "serde_derive", @@ -5387,8 +5508,8 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bea3215775fcedf200d47590c7e2ce9a3a46bc2b7d3f77d0eae9c6edf0a39aec" dependencies = [ - "borsh 0.10.3", - "borsh 1.5.1", + "borsh 0.10.4", + "borsh 1.5.7", "bs58", "bytemuck", "bytemuck_derive", @@ -5680,8 +5801,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524604d94185c189616296e5b7da1014cc96d1e446bd2b26f247f00708b9225a" dependencies = [ "bincode", - "bitflags 2.6.0", - "borsh 1.5.1", + "bitflags 2.9.0", + "borsh 1.5.7", "bs58", "bytemuck", "bytemuck_derive", @@ -5754,7 +5875,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2eef5a00a75648273c3fb6e3d85b0c8c02fcc1e36c4271664dcc39b6b128d41" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "libsecp256k1 0.6.0", "solana-define-syscall", "thiserror 1.0.69", @@ -5921,7 +6042,7 @@ dependencies = [ "solana-transaction-metrics-tracker", "thiserror 1.0.69", "tokio", - "tokio-util 0.7.11", + "tokio-util 0.7.14", "x509-parser", ] @@ -6075,7 +6196,7 @@ dependencies = [ "Inflector", "base64 0.22.1", "bincode", - "borsh 1.5.1", + "borsh 1.5.7", "bs58", "lazy_static", "log", @@ -6298,12 +6419,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - [[package]] name = "spinning_top" version = "0.3.0" @@ -6320,7 +6435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68034596cf4804880d265f834af1ff2f821ad5293e41fa0f8f59086c181fc38e" dependencies = [ "assert_matches", - "borsh 1.5.1", + "borsh 1.5.7", "num-derive 0.4.2", "num-traits", "solana-program", @@ -6335,7 +6450,7 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76fee7d65013667032d499adc3c895e286197a35a0d3a4643c80e7fd3e9969e3" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "num-derive 0.4.2", "num-traits", "solana-program", @@ -6355,17 +6470,6 @@ dependencies = [ "solana-pubkey", ] -[[package]] -name = "spl-discriminator" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d1814406e98b08c5cd02c1126f83fd407ad084adce0b05fda5730677822eac" -dependencies = [ - "bytemuck", - "solana-program", - "spl-discriminator-derive", -] - [[package]] name = "spl-discriminator" version = "0.3.0" @@ -6449,25 +6553,13 @@ dependencies = [ "solana-pubkey", ] -[[package]] -name = "spl-pod" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046ce669f48cf2eca1ec518916d8725596bfb655beb1c74374cf71dc6cb773c9" -dependencies = [ - "bytemuck", - "solana-program", - "solana-zk-token-sdk", - "spl-program-error 0.4.1", -] - [[package]] name = "spl-pod" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c704c88fc457fa649ba3aabe195c79d885c3f26709efaddc453c8de352c90b87" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "bytemuck", "bytemuck_derive", "solana-program", @@ -6481,7 +6573,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41a7d5950993e1ff2680bd989df298eeb169367fb2f9deeef1f132de6e4e8016" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "bytemuck", "bytemuck_derive", "num-derive 0.4.2", @@ -6495,19 +6587,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "spl-program-error" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49065093ea91f57b9b2bd81493ff705e2ad4e64507a07dbc02b085778e02770e" -dependencies = [ - "num-derive 0.4.2", - "num-traits", - "solana-program", - "spl-program-error-derive", - "thiserror 1.0.69", -] - [[package]] name = "spl-program-error" version = "0.5.0" @@ -6546,20 +6625,6 @@ dependencies = [ "syn 2.0.100", ] -[[package]] -name = "spl-tlv-account-resolution" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cace91ba08984a41556efe49cbf2edca4db2f577b649da7827d3621161784bf8" -dependencies = [ - "bytemuck", - "solana-program", - "spl-discriminator 0.2.2", - "spl-pod 0.2.2", - "spl-program-error 0.4.1", - "spl-type-length-value 0.4.3", -] - [[package]] name = "spl-tlv-account-resolution" version = "0.7.0" @@ -6792,7 +6857,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6c2318ddff97e006ed9b1291ebec0750a78547f870f62a69c56fe3b46a5d8fc" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "solana-program", "spl-discriminator 0.3.0", "spl-pod 0.3.1", @@ -6806,7 +6871,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfb9c89dbc877abd735f05547dcf9e6e12c00c11d6d74d8817506cab4c99fdbb" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "num-derive 0.4.2", "num-traits", "solana-borsh", @@ -6821,22 +6886,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "spl-transfer-hook-interface" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a98359769cd988f7b35c02558daa56d496a7e3bd8626e61f90a7c757eedb9b" -dependencies = [ - "arrayref", - "bytemuck", - "solana-program", - "spl-discriminator 0.2.2", - "spl-pod 0.2.2", - "spl-program-error 0.4.1", - "spl-tlv-account-resolution 0.6.3", - "spl-type-length-value 0.4.3", -] - [[package]] name = "spl-transfer-hook-interface" version = "0.7.0" @@ -6878,19 +6927,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "spl-type-length-value" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422ce13429dbd41d2cee8a73931c05fda0b0c8ca156a8b0c19445642550bb61a" -dependencies = [ - "bytemuck", - "solana-program", - "spl-discriminator 0.2.2", - "spl-pod 0.2.2", - "spl-program-error 0.4.1", -] - [[package]] name = "spl-type-length-value" version = "0.5.0" @@ -6922,6 +6958,12 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -6970,15 +7012,15 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sval" -version = "2.13.0" +version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53eb957fbc79a55306d5d25d87daf3627bc3800681491cda0709eef36c748bfe" +checksum = "7cc9739f56c5d0c44a5ed45473ec868af02eb896af8c05f616673a31e1d1bb09" [[package]] name = "sval_buffer" -version = "2.13.0" +version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e860aef60e9cbf37888d4953a13445abf523c534640d1f6174d310917c410d" +checksum = "f39b07436a8c271b34dad5070c634d1d3d76d6776e938ee97b4a66a5e8003d0b" dependencies = [ "sval", "sval_ref", @@ -6986,18 +7028,18 @@ dependencies = [ [[package]] name = "sval_dynamic" -version = "2.13.0" +version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea3f2b07929a1127d204ed7cb3905049381708245727680e9139dac317ed556f" +checksum = "ffcb072d857431bf885580dacecf05ed987bac931230736739a79051dbf3499b" dependencies = [ "sval", ] [[package]] name = "sval_fmt" -version = "2.13.0" +version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4e188677497de274a1367c4bda15bd2296de4070d91729aac8f0a09c1abf64d" +checksum = "3f214f427ad94a553e5ca5514c95c6be84667cbc5568cce957f03f3477d03d5c" dependencies = [ "itoa", "ryu", @@ -7006,9 +7048,9 @@ dependencies = [ [[package]] name = "sval_json" -version = "2.13.0" +version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f456c07dae652744781f2245d5e3b78e6a9ebad70790ac11eb15dbdbce5282" +checksum = "389ed34b32e638dec9a99c8ac92d0aa1220d40041026b625474c2b6a4d6f4feb" dependencies = [ "itoa", "ryu", @@ -7017,9 +7059,9 @@ dependencies = [ [[package]] name = "sval_nested" -version = "2.13.0" +version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "886feb24709f0476baaebbf9ac10671a50163caa7e439d7a7beb7f6d81d0a6fb" +checksum = "14bae8fcb2f24fee2c42c1f19037707f7c9a29a0cda936d2188d48a961c4bb2a" dependencies = [ "sval", "sval_buffer", @@ -7028,18 +7070,18 @@ dependencies = [ [[package]] name = "sval_ref" -version = "2.13.0" +version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2e7fc517d778f44f8cb64140afa36010999565528d48985f55e64d45f369ce" +checksum = "2a4eaea3821d3046dcba81d4b8489421da42961889902342691fb7eab491d79e" dependencies = [ "sval", ] [[package]] name = "sval_serde" -version = "2.13.0" +version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79bf66549a997ff35cd2114a27ac4b0c2843280f2cfa84b240d169ecaa0add46" +checksum = "172dd4aa8cb3b45c8ac8f3b4111d644cd26938b0643ede8f93070812b87fb339" dependencies = [ "serde", "sval", @@ -7071,11 +7113,11 @@ dependencies = [ "async-trait", "base64 0.21.7", "bincode", - "borsh 0.10.3", + "borsh 0.10.4", "bytemuck", "futures", "lazy_static", - "libsecp256k1 0.7.1", + "libsecp256k1 0.7.2", "log", "once_cell", "rust_decimal", @@ -7116,18 +7158,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.100", -] - [[package]] name = "sync_wrapper" version = "0.1.2" @@ -7146,6 +7176,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -7316,12 +7357,23 @@ dependencies = [ "solana-program-test", "solana-sdk", "spl-token-2022 7.0.0", - "spl-transfer-hook-interface 0.6.3", + "spl-transfer-hook-interface 0.9.0", "static_assertions", "switchboard-on-demand", + "test_transfer_hook", "type-layout", ] +[[package]] +name = "test_transfer_hook" +version = "0.1.0" +dependencies = [ + "anchor-lang", + "spl-tlv-account-resolution 0.9.0", + "spl-token-2022 7.0.0", + "spl-transfer-hook-interface 0.9.0", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -7431,11 +7483,21 @@ dependencies = [ "zeroize", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" dependencies = [ "tinyvec_macros", ] @@ -7448,28 +7510,27 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.44.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", @@ -7545,9 +7606,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" dependencies = [ "bytes", "futures-core", @@ -7567,14 +7628,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.22", + "toml_edit", ] [[package]] @@ -7588,39 +7649,28 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.20", + "winnow", ] [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -7641,9 +7691,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -7723,15 +7773,15 @@ dependencies = [ [[package]] name = "typeid" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "059d83cc991e7a42fc37bd50941885db0888e34209f8cfd9aab07ddec03bc9cf" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "unicase" @@ -7739,32 +7789,26 @@ version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" @@ -7827,9 +7871,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -7842,11 +7886,23 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" -version = "1.10.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" [[package]] name = "valuable" @@ -7856,9 +7912,9 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "value-bag" -version = "1.9.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101" +checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5" dependencies = [ "value-bag-serde1", "value-bag-sval2", @@ -7866,9 +7922,9 @@ dependencies = [ [[package]] name = "value-bag-serde1" -version = "1.9.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccacf50c5cb077a9abb723c5bcb5e0754c1a433f1e1de89edc328e2760b6328b" +checksum = "35540706617d373b118d550d41f5dfe0b78a0c195dc13c6815e92e2638432306" dependencies = [ "erased-serde", "serde", @@ -7877,9 +7933,9 @@ dependencies = [ [[package]] name = "value-bag-sval2" -version = "1.9.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1785bae486022dfb9703915d42287dcb284c1ee37bd1080eeba78cc04721285b" +checksum = "6fe7e140a2658cc16f7ee7a86e413e803fc8f9b5127adc8755c19f9fefa63a52" dependencies = [ "sval", "sval_buffer", @@ -7898,9 +7954,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "void" @@ -7976,12 +8032,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] @@ -8020,9 +8077,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -8368,18 +8425,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "0.6.20" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "63d3fcd9bba44b03821e7d699eeee959f3126dcc4aa8e4ae18ec617c2a5cea10" dependencies = [ "memchr", ] @@ -8400,9 +8448,21 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -8442,9 +8502,33 @@ dependencies = [ [[package]] name = "yansi" -version = "0.5.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", + "synstructure 0.13.1", +] [[package]] name = "zerocopy" @@ -8452,7 +8536,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", ] [[package]] @@ -8466,6 +8559,38 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", + "synstructure 0.13.1", +] + [[package]] name = "zeroize" version = "1.8.1" @@ -8486,6 +8611,28 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "zstd" version = "0.13.3" diff --git a/Cargo.toml b/Cargo.toml index 66e2cc266..a225f9cea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,12 @@ [workspace] resolver = "2" -members = ["programs/marginfi", "programs/mocks"] +members = [ + "programs/marginfi", + "test-utils", + "programs/mocks", + "programs/test_transfer_hook", +] # exclude = [ -# "programs/test_transfer_hook", # "programs/liquidity-incentive-program", # "programs/brick", # ] @@ -21,8 +25,8 @@ solana-account-decoder = "=2.1.0" # solana-address-lookup-table-program = "=2.1.0" spl-token = "8.0.0" # spl-associated-token-account = "2.2.0" -spl-transfer-hook-interface = "0.6.3" -# spl-tlv-account-resolution = "0.6.3" +spl-transfer-hook-interface = "0.9.0" +spl-tlv-account-resolution = "0.9.0" # spl-discriminator = "0.2.2" spl-token-2022 = { version = "7.0.0", features = ["no-entrypoint"] } @@ -30,19 +34,45 @@ anchor-lang = { version = "0.31.0" } anchor-spl = { version = "0.31.0", features = ["token_2022"] } anchor-client = { version = "0.31.0" } -pyth-sdk-solana = "=0.10.1" +fixtures = { path = "test-utils", package = "test-utilities" } +marginfi = { path = "programs/marginfi", package = "marginfi" } +transfer_hook = { path = "programs/test_transfer_hook", package = "test_transfer_hook" } + +pyth-sdk-solana = "=0.10.4" pyth-solana-receiver-sdk = "0.6.0" pythnet-sdk = "2.3.1" -# switchboard-solana = "0.29.0" switchboard-on-demand = "0.3.5" -borsh = "0.10.3" + +borsh = "1.5.7" +bytemuck = "1.22.0" +# Note: 1.29.0 and later require Rust 1.83+ which solana does not ship with (yet) +fixed = "=1.28.0" +fixed-macro = "1.2.0" +lazy_static = "1.4.0" +type-layout = "0.2.0" +static_assertions = "1.1.0" [profile.release] -overflow-checks = true -lto = "fat" -codegen-units = 1 - -[profile.release.build-override] -opt-level = 3 -incremental = false -codegen-units = 1 +overflow-checks = false +lto = "off" +codegen-units = 8 + +## Build options for release (build-program-verifiable should use these through env settings) +# [profile.release] +# overflow-checks = true +# lto = "fat" +# codegen-units = 1 + +# [profile.release.build-override] +# opt-level = 3 +# incremental = false +# codegen-units = 1 + + +## Notes for usable lockfile generation in Solana land +# Patch a version of half compatabile with fixed and Rust <=1.79: +# cargo update -p half --precise 2.4.1 +# +# Patch zerofrom and litemap: +# cargo update -p zerofrom --precise 0.1.5 +# cargo update -p litemap --precise 0.7.4 diff --git a/programs/marginfi/Cargo.toml b/programs/marginfi/Cargo.toml index 4a6ddfa1a..352630cd6 100644 --- a/programs/marginfi/Cargo.toml +++ b/programs/marginfi/Cargo.toml @@ -36,16 +36,16 @@ pyth-solana-receiver-sdk = { workspace = true } pythnet-sdk = { workspace = true } # switchboard-solana = { workspace = true } switchboard-on-demand = { workspace = true } -borsh = "0.10.3" -bytemuck = "1.22.0" +borsh = { workspace = true } +bytemuck = { workspace = true } +fixed = { workspace = true } +fixed-macro = { workspace = true } +lazy_static = { workspace = true } +type-layout = { workspace = true } +static_assertions = { workspace = true } cfg-if = "1.0.0" -enum_dispatch = "0.3.11" -fixed = "1.12.0" -fixed-macro = "1.2.0" -lazy_static = "1.4.0" -static_assertions = "1.1.0" -type-layout = "0.2.0" +enum_dispatch = "0.3.13" solana-security-txt = "1.1.1" [dev-dependencies] @@ -54,12 +54,12 @@ solana-cli-output = { workspace = true } solana-program-test = { workspace = true } # solana-logger = { workspace = true } solana-sdk = { workspace = true } +fixtures = { workspace = true, package = "test-utilities" } anyhow = "1.0.66" assert_matches = "1.5.0" base64 = "0.21.0" bincode = "1.3.3" -fixtures = { path = "../../test-utils", package = "test-utilities" } futures = "0.3.25" pretty_assertions = "1.2.1" rust_decimal = "*" diff --git a/programs/marginfi/src/state/price.rs b/programs/marginfi/src/state/price.rs index 45577a562..e4b1ee354 100644 --- a/programs/marginfi/src/state/price.rs +++ b/programs/marginfi/src/state/price.rs @@ -587,7 +587,8 @@ impl SwitchboardPullPriceFeed { MarginfiError::SwitchboardWrongAccountOwner ); - let feed = &parse_swb_ignore_alignment(ai_data)?; + let feed = parse_swb_ignore_alignment(ai_data)?; + let lite_feed = Box::new(LitePullFeedAccountData::from(&*feed)); // TODO restore when swb fixes alignment issue in crate. // let feed = PullFeedAccountData::parse(ai_data) // .map_err(|_| MarginfiError::SwitchboardInvalidAccount)?; @@ -598,9 +599,7 @@ impl SwitchboardPullPriceFeed { return err!(MarginfiError::SwitchboardStalePrice); } - Ok(Self { - feed: Box::new(feed.into()), - }) + Ok(Self { feed: lite_feed }) } fn check_ais(ai: &AccountInfo) -> MarginfiResult { @@ -693,7 +692,7 @@ impl PriceAdapter for SwitchboardPullPriceFeed { /// The same as PullFeedAccountData::parse but completely ignores input alignment. pub fn parse_swb_ignore_alignment<'info>( data: Ref<'info, &mut [u8]>, -) -> MarginfiResult { +) -> MarginfiResult> { if data.len() < 8 { return err!(MarginfiError::SwitchboardInvalidAccount); } @@ -704,16 +703,13 @@ pub fn parse_swb_ignore_alignment<'info>( return err!(MarginfiError::SwitchboardInvalidAccount); } - let mut data_bytes = [0u8; 3200]; - data_bytes.copy_from_slice(&data[8..]); + let mut heap_bytes: Box<[u8; 3200]> = Box::new([0u8; 3200]); + heap_bytes.copy_from_slice(&data[8..3208]); - let feed_maybe = bytemuck::try_pod_read_unaligned::(&data_bytes); - let feed = if feed_maybe.is_ok() { - feed_maybe.unwrap() - } else { - return err!(MarginfiError::SwitchboardInvalidAccount); - }; - Ok(feed) + // 3) parse the POD unaligned + let pod = bytemuck::try_pod_read_unaligned::(&*heap_bytes) + .map_err(|_| MarginfiError::SwitchboardInvalidAccount)?; + Ok(Box::new(pod)) } pub fn load_price_update_v2_checked(ai: &AccountInfo) -> MarginfiResult { diff --git a/programs/marginfi/tests/misc/collateral_value_cap.rs b/programs/marginfi/tests/misc/collateral_value_cap.rs index 3305792f2..66a37e20f 100644 --- a/programs/marginfi/tests/misc/collateral_value_cap.rs +++ b/programs/marginfi/tests/misc/collateral_value_cap.rs @@ -42,7 +42,7 @@ async fn marginfi_group_init_limit_0() -> anyhow::Result<()> { .await?; usdc_depositor - .try_bank_deposit(usdc_token_account.key, usdc_bank, 100, None) + .try_bank_deposit(usdc_token_account.key, usdc_bank, 100.01, None) .await?; // Borrowing 10 SOL should fail bc of init limit @@ -60,7 +60,7 @@ async fn marginfi_group_init_limit_0() -> anyhow::Result<()> { // Borrowing 10 SOL should succeed now let res = usdc_depositor - .try_bank_borrow(depositor_sol_account.key, sol_bank, 10) + .try_bank_borrow(depositor_sol_account.key, sol_bank, 9.999) .await; usdc_bank @@ -80,12 +80,12 @@ async fn marginfi_group_init_limit_0() -> anyhow::Result<()> { .await?; usdc_depositor - .try_bank_deposit(usdc_token_account.key, usdc_bank, 100, None) + .try_bank_deposit(usdc_token_account.key, usdc_bank, 100.02, None) .await?; // Borrowing 10 SOL should succeed now let res = usdc_depositor - .try_bank_borrow(depositor_sol_account.key, sol_bank, 10) + .try_bank_borrow(depositor_sol_account.key, sol_bank, 9.9999) .await; assert!(res.is_ok()); diff --git a/programs/mocks/Cargo.toml b/programs/mocks/Cargo.toml index e1a5ff097..4ef81b960 100644 --- a/programs/mocks/Cargo.toml +++ b/programs/mocks/Cargo.toml @@ -27,5 +27,5 @@ staging = [] anchor-lang = { workspace = true } anchor-spl = { workspace = true } -bytemuck = { version = "1.9.1", features = ["derive"] } -static_assertions = "1.1.0" \ No newline at end of file +bytemuck = { workspace = true, features = ["derive"] } +static_assertions = { workspace = true } diff --git a/scripts/build-program-verifiable.sh b/scripts/build-program-verifiable.sh index 25d86c12d..8c3ac568a 100755 --- a/scripts/build-program-verifiable.sh +++ b/scripts/build-program-verifiable.sh @@ -27,6 +27,12 @@ else exit 1 fi +export CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS=true +export CARGO_PROFILE_RELEASE_LTO=fat +export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 +export CARGO_PROFILE_RELEASE_OPT_LEVEL=3 +export CARGO_PROFILE_RELEASE_INCREMENTAL=false + cmd="sudo $verify_bin build --library-name $program_lib_name -- $features" echo "Running: $cmd" eval "$cmd" diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 646e312b4..bdf97bdcc 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -27,12 +27,12 @@ pythnet-sdk = { workspace = true } # switchboard-solana = { workspace = true } switchboard-on-demand = { workspace = true } -bytemuck = "1.9.1" -fixed = "1.12.0" -fixed-macro = "1.2.0" -lazy_static = "1.4.0" -static_assertions = "1.1.0" -type-layout = "0.2.0" +bytemuck = { workspace = true } +fixed = { workspace = true } +fixed-macro = { workspace = true } +lazy_static = { workspace = true } +type-layout = { workspace = true } +static_assertions = { workspace = true } anyhow = "1.0.66" assert_matches = "1.5.0" bincode = "1.3.3" @@ -41,14 +41,11 @@ pretty_assertions = "1.2.1" serde = { version = "1.0.197", features = ["derive"] } serde_json = "1.0.115" -[dependencies.marginfi] -path = "../programs/marginfi" -features = ["test-bpf"] +marginfi = { workspace = true, features = ["test-bpf"] } +transfer_hook = { workspace = true, package = "test_transfer_hook", features = [ + "no-entrypoint", +] } -# [dependencies.transfer_hook] -# path = "../programs/test_transfer_hook" -# package = "test_transfer_hook" -# features = ["no-entrypoint"] # [dependencies.liquidity-incentive-program] # path = "../programs/liquidity-incentive-program" diff --git a/test-utils/src/lib.rs b/test-utils/src/lib.rs index d20528dfa..6dc28c1f0 100644 --- a/test-utils/src/lib.rs +++ b/test-utils/src/lib.rs @@ -9,4 +9,4 @@ pub mod test; // pub mod transfer_hook; pub mod utils; -// pub use transfer_hook; +pub use transfer_hook; diff --git a/test-utils/src/marginfi_account.rs b/test-utils/src/marginfi_account.rs index 5a96710b6..75ecfd4a0 100644 --- a/test-utils/src/marginfi_account.rs +++ b/test-utils/src/marginfi_account.rs @@ -9,8 +9,8 @@ use marginfi::state::{ use solana_program::{instruction::Instruction, sysvar}; use solana_program_test::{BanksClientError, ProgramTestContext}; use solana_sdk::{ - compute_budget::ComputeBudgetInstruction, signature::Keypair, signer::Signer, - transaction::Transaction, + commitment_config::CommitmentLevel, compute_budget::ComputeBudgetInstruction, + signature::Keypair, signer::Signer, transaction::Transaction, }; use std::{cell::RefCell, mem, rc::Rc}; @@ -52,7 +52,10 @@ impl MarginfiAccountFixture { &[&ctx.payer, &account_key], ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await.unwrap(); + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await + .unwrap(); } MarginfiAccountFixture { @@ -145,7 +148,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await?; + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await?; Ok(()) } @@ -216,7 +221,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await?; + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await?; Ok(()) } @@ -319,7 +326,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await?; + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await?; Ok(()) } @@ -377,7 +386,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await?; + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await?; Ok(()) } @@ -408,7 +419,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await?; + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await?; Ok(()) } @@ -526,7 +539,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await } pub async fn try_withdraw_emissions( @@ -560,7 +575,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await } /// Set a flag on the account @@ -586,7 +603,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await } /// Unset a flag on the account @@ -612,7 +631,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await } pub async fn make_lending_account_start_flashloan_ix(&self, end_index: u64) -> Instruction { @@ -679,7 +700,9 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await } pub async fn load_observation_account_metas( @@ -816,7 +839,9 @@ impl MarginfiAccountFixture { .build_transfer_authority_tx(new_authority, signer_keypair) .await; let mut ctx = self.ctx.borrow_mut(); - ctx.banks_client.process_transaction(tx).await + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await } /// Use the client to get the transfer ix authority transaction @@ -852,6 +877,8 @@ impl MarginfiAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await } } diff --git a/test-utils/src/spl.rs b/test-utils/src/spl.rs index ba04c4204..249364eba 100644 --- a/test-utils/src/spl.rs +++ b/test-utils/src/spl.rs @@ -24,6 +24,7 @@ use solana_cli_output::CliAccount; use solana_program_test::ProgramTestContext; use solana_sdk::{ account::{AccountSharedData, ReadableAccount, WritableAccount}, + commitment_config::CommitmentLevel, instruction::Instruction, native_token::LAMPORTS_PER_SOL, program_pack::{Pack, Sealed}, @@ -81,7 +82,10 @@ impl MintFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await.unwrap(); + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await + .unwrap(); let mint_account = ctx .banks_client @@ -169,7 +173,7 @@ impl MintFixture { // ctx.last_blockhash, // ); - // ctx.banks_client.process_transaction(tx).await.unwrap(); + // ctx.banks_client.process_transaction_with_preflight_and_commitment(tx).await.unwrap(); // if extensions.contains(&SupportedExtension::TransferHook) { // ctx.banks_client @@ -277,7 +281,7 @@ impl MintFixture { self.ctx .borrow_mut() .banks_client - .process_transaction(tx) + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) .await .unwrap(); @@ -328,7 +332,10 @@ impl MintFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await.unwrap(); + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await + .unwrap(); token_account_f } @@ -446,7 +453,10 @@ impl TokenAccountFixture { ctx.last_blockhash, ); - ctx.banks_client.process_transaction(tx).await.unwrap(); + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await + .unwrap(); keypair.pubkey() } @@ -486,7 +496,7 @@ impl TokenAccountFixture { ctx.borrow_mut() .banks_client - .process_transaction(tx) + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) .await .unwrap(); } @@ -536,7 +546,7 @@ impl TokenAccountFixture { ctx.borrow_mut() .banks_client - .process_transaction(tx) + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) .await .unwrap(); } diff --git a/test-utils/src/utils.rs b/test-utils/src/utils.rs index 42c814cf7..370d50d7b 100644 --- a/test-utils/src/utils.rs +++ b/test-utils/src/utils.rs @@ -1,4 +1,5 @@ use anchor_lang::prelude::*; +use anchor_lang::solana_program::instruction::Instruction; use anchor_lang::Discriminator; use anchor_spl::token_2022::spl_token_2022::extension::transfer_fee::MAX_FEE_BASIS_POINTS; use marginfi::constants::PYTH_ID; @@ -9,7 +10,6 @@ use pyth_sdk_solana::state::{ use pyth_solana_receiver_sdk::price_update::FeedId; use pyth_solana_receiver_sdk::price_update::PriceUpdateV2; use pyth_solana_receiver_sdk::price_update::VerificationLevel; -use anchor_lang::solana_program::instruction::Instruction; use solana_program_test::*; use solana_sdk::{account::Account, signature::Keypair}; use std::{cell::RefCell, rc::Rc}; @@ -158,15 +158,25 @@ pub fn create_switch_pull_oracle_account_from_bytes(data: Vec) -> Account { macro_rules! assert_custom_error { ($error:expr, $matcher:expr) => { match $error { + // direct transaction error solana_program_test::BanksClientError::TransactionError( solana_sdk::transaction::TransactionError::InstructionError( _, anchor_lang::solana_program::instruction::InstructionError::Custom(n), ), - ) => { - assert_eq!(n, anchor_lang::error::ERROR_CODE_OFFSET + $matcher as u32) + ) + // simulation (preflight) error + | solana_program_test::BanksClientError::SimulationError { + err: solana_sdk::transaction::TransactionError::InstructionError( + _, + anchor_lang::solana_program::instruction::InstructionError::Custom(n), + ), + .. + } => { + let expected = anchor_lang::error::ERROR_CODE_OFFSET + $matcher as u32; + assert_eq!(n, expected); } - _ => assert!(false), + other => panic!("expected custom error, got {:?}", other), } }; } @@ -175,15 +185,24 @@ macro_rules! assert_custom_error { macro_rules! assert_anchor_error { ($error:expr, $matcher:expr) => { match $error { + // direct transaction error solana_program_test::BanksClientError::TransactionError( solana_sdk::transaction::TransactionError::InstructionError( _, anchor_lang::solana_program::instruction::InstructionError::Custom(n), ), - ) => { - assert_eq!(n, $matcher as u32) + ) + // simulation (preflight) failure + | solana_program_test::BanksClientError::SimulationError { + err: solana_sdk::transaction::TransactionError::InstructionError( + _, + anchor_lang::solana_program::instruction::InstructionError::Custom(n), + ), + .. + } => { + assert_eq!(n, $matcher as u32); } - _ => assert!(false), + other => panic!("expected anchor error {:?}, got {:?}", $matcher, other), } }; } From ab31920f29d936d725c92977968ca304a14d8baa Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Sat, 19 Apr 2025 04:10:33 -0400 Subject: [PATCH 29/38] minor doc update --- programs/marginfi/src/state/price.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/programs/marginfi/src/state/price.rs b/programs/marginfi/src/state/price.rs index e4b1ee354..243d0afbf 100644 --- a/programs/marginfi/src/state/price.rs +++ b/programs/marginfi/src/state/price.rs @@ -703,13 +703,12 @@ pub fn parse_swb_ignore_alignment<'info>( return err!(MarginfiError::SwitchboardInvalidAccount); } - let mut heap_bytes: Box<[u8; 3200]> = Box::new([0u8; 3200]); - heap_bytes.copy_from_slice(&data[8..3208]); + let mut data_bytes: Box<[u8; 3200]> = Box::new([0u8; 3200]); + data_bytes.copy_from_slice(&data[8..3208]); - // 3) parse the POD unaligned - let pod = bytemuck::try_pod_read_unaligned::(&*heap_bytes) + let feed = bytemuck::try_pod_read_unaligned::(&*data_bytes) .map_err(|_| MarginfiError::SwitchboardInvalidAccount)?; - Ok(Box::new(pod)) + Ok(Box::new(feed)) } pub fn load_price_update_v2_checked(ai: &AccountInfo) -> MarginfiResult { From 57ee50603796cec95cdff4abce9583ea22461b39 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Tue, 22 Apr 2025 15:02:01 -0400 Subject: [PATCH 30/38] Anchor tests now working as intended --- .github/workflows/test.yaml | 7 +- Cargo.lock | 4 +- Cargo.toml | 3 + package.json | 12 +- programs/marginfi/src/state/marginfi_group.rs | 2 +- programs/marginfi/src/state/price.rs | 37 +- tests/04_configureBank.spec.ts | 4 +- tests/utils/user-instructions.ts | 8 +- tsconfig.json | 5 + yarn.lock | 460 +++++++++++------- 10 files changed, 316 insertions(+), 226 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0c53f147c..e5410e121 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -129,9 +129,7 @@ jobs: - uses: ./.github/actions/setup-common/ - uses: ./.github/actions/setup-anchor-cli/ - - - uses: ./.github/actions/build-workspace/ - + - name: Install Node.js dependencies run: yarn install @@ -141,6 +139,9 @@ jobs: - name: Build mocks program run: anchor build -p mocks + - name: Build transfer hook program + run: anchor build -p test_transfer_hook --no-idl + # Handles extraneous (os error 2) that appears during testing in some versions of solana. See: # https://solana.stackexchange.com/questions/1648/error-no-such-file-or-directory-os-error-2-error-from-anchor-test - name: Run Anchor tests diff --git a/Cargo.lock b/Cargo.lock index 5a3c0305f..bde134acc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3432,9 +3432,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] diff --git a/Cargo.toml b/Cargo.toml index a225f9cea..aa4f30b19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,3 +76,6 @@ codegen-units = 8 # Patch zerofrom and litemap: # cargo update -p zerofrom --precise 0.1.5 # cargo update -p litemap --precise 0.7.4 + +## To fix the Anchor idl generation bug: +# cargo update -p proc-macro2 --precise 1.0.94 \ No newline at end of file diff --git a/package.json b/package.json index 6e13de129..91e8ee0df 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,12 @@ }, "dependencies": { "@coral-xyz/anchor": "0.31.0", - "@coral-xyz/spl-token": "^0.30.1", - "@mrgnlabs/marginfi-client-v2": "^4.0.0", - "@mrgnlabs/mrgn-common": "^1.8.0", + "@coral-xyz/spl-token": "^0.31.1", + "@mrgnlabs/marginfi-client-v2": "^6.0.1", + "@mrgnlabs/mrgn-common": "^2.0.2", "@solana/spl-single-pool-classic": "^1.0.2", "@solana/spl-token": "^0.4.8", - "@solana/web3.js": "^1.95.2", + "@solana/web3.js": "^1.98.0", "bignumber.js": "^9.1.2", "mocha": "^10.2.0", "ts-mocha": "^10.0.0" @@ -19,11 +19,11 @@ "@types/bn.js": "^5.1.0", "@types/chai": "^4.3.0", "@types/mocha": "^10.0.10", - "anchor-bankrun": "^0.4.0", + "anchor-bankrun": "^0.5.0", "big.js": "^6.2.1", "chai": "^4.3.4", "prettier": "^2.6.2", - "solana-bankrun": "^0.3.0", + "solana-bankrun": "^0.4.0", "ts-node": "^10.9.1", "typescript": "^5.7.3" } diff --git a/programs/marginfi/src/state/marginfi_group.rs b/programs/marginfi/src/state/marginfi_group.rs index 82eb2a598..bd71d6284 100644 --- a/programs/marginfi/src/state/marginfi_group.rs +++ b/programs/marginfi/src/state/marginfi_group.rs @@ -1534,7 +1534,7 @@ impl BankConfig { #[inline] pub fn get_oracle_max_age(&self) -> u64 { match (self.oracle_max_age, self.oracle_setup) { - (0, OracleSetup::SwbDeprecated) => MAX_SWB_ORACLE_AGE, + (0, OracleSetup::SwitchboardV2) => MAX_SWB_ORACLE_AGE, (0, OracleSetup::PythLegacy | OracleSetup::PythPushOracle) => MAX_PYTH_ORACLE_AGE, (n, _) => n as u64, } diff --git a/programs/marginfi/src/state/price.rs b/programs/marginfi/src/state/price.rs index 243d0afbf..45d913cdc 100644 --- a/programs/marginfi/src/state/price.rs +++ b/programs/marginfi/src/state/price.rs @@ -1,3 +1,14 @@ +use super::marginfi_group::BankConfig; +use crate::{ + check, check_eq, + constants::{ + CONF_INTERVAL_MULTIPLE, EXP_10_I80F48, MAX_CONF_INTERVAL, MIN_PYTH_PUSH_VERIFICATION_LEVEL, + NATIVE_STAKE_ID, PYTH_ID, SPL_SINGLE_POOL_ID, STD_DEV_MULTIPLE, SWITCHBOARD_PULL_ID, + }, + debug, live, math_error, + prelude::*, +}; +use anchor_lang::prelude::borsh; use anchor_lang::prelude::*; use anchor_lang::solana_program::{borsh1::try_from_slice_unchecked, stake::state::StakeStateV2}; use anchor_spl::token::Mint; @@ -7,33 +18,18 @@ use fixed::types::I80F48; pub use pyth_sdk_solana; use pyth_sdk_solana::{state::SolanaPriceAccount, Price, PriceFeed}; use pyth_solana_receiver_sdk::price_update::{self, FeedId, PriceUpdateV2}; -use std::mem; +use pyth_solana_receiver_sdk::PYTH_PUSH_ORACLE_ID; use std::{cell::Ref, cmp::min}; use switchboard_on_demand::{ CurrentResult, Discriminator, PullFeedAccountData, SPL_TOKEN_PROGRAM_ID, }; -use crate::{ - check, check_eq, - constants::{ - CONF_INTERVAL_MULTIPLE, EXP_10, EXP_10_I80F48, MAX_CONF_INTERVAL, - MIN_PYTH_PUSH_VERIFICATION_LEVEL, NATIVE_STAKE_ID, PYTH_ID, SPL_SINGLE_POOL_ID, - STD_DEV_MULTIPLE, SWITCHBOARD_PULL_ID, - }, - debug, live, math_error, - prelude::*, -}; - -use super::marginfi_group::BankConfig; -use anchor_lang::prelude::borsh; -use pyth_solana_receiver_sdk::PYTH_PUSH_ORACLE_ID; - #[repr(u8)] #[derive(Copy, Clone, Debug, AnchorSerialize, AnchorDeserialize, PartialEq, Eq)] pub enum OracleSetup { None, PythLegacy, - SwbDeprecated, + SwitchboardV2, PythPushOracle, SwitchboardPull, StakedWithPythPush, @@ -46,7 +42,7 @@ impl OracleSetup { match value { 0 => Some(Self::None), 1 => Some(Self::PythLegacy), - 2 => Some(Self::SwbDeprecated), + 2 => Some(Self::SwitchboardV2), 3 => Some(Self::PythPushOracle), 4 => Some(Self::SwitchboardPull), 5 => Some(Self::StakedWithPythPush), @@ -143,7 +139,7 @@ impl OraclePriceFeedAdapter { PythLegacyPriceFeed::load_checked(account_info, clock.unix_timestamp, max_age)?, )) } - OracleSetup::SwbDeprecated => { + OracleSetup::SwitchboardV2 => { panic!("swb v2 is deprecated"); } OracleSetup::PythPushOracle => { @@ -334,7 +330,7 @@ impl OraclePriceFeedAdapter { Ok(()) } - OracleSetup::SwbDeprecated => { + OracleSetup::SwitchboardV2 => { panic!("swb v2 is deprecated"); } OracleSetup::PythPushOracle => { @@ -1015,6 +1011,7 @@ mod tests { use fixed_macro::types::I80F48; use pretty_assertions::assert_eq; + use crate::constants::EXP_10; use crate::utils::hex_to_bytes; use super::*; diff --git a/tests/04_configureBank.spec.ts b/tests/04_configureBank.spec.ts index a9673d9cb..1aa40411a 100644 --- a/tests/04_configureBank.spec.ts +++ b/tests/04_configureBank.spec.ts @@ -150,12 +150,12 @@ describe("Lending pool configure bank", () => { new Transaction().add( await configureBankOracle(groupAdmin.mrgnProgram, { bank: bankKey, - type: 2, + type: 3, oracle: oracles.tokenAOracle.publicKey, }) ) ); - }, "InternalLogicError"); + }, "PythPushInvalidAccount"); await expectFailedTxWithMessage(async () => { await groupAdmin.mrgnProgram.provider.sendAndConfirm!( diff --git a/tests/utils/user-instructions.ts b/tests/utils/user-instructions.ts index 7e19cd9eb..17b6d9d12 100644 --- a/tests/utils/user-instructions.ts +++ b/tests/utils/user-instructions.ts @@ -361,8 +361,8 @@ export const liquidateIx = ( ) => { const oracleMeta: AccountMeta[] = args.remaining.map((pubkey) => { if (!(pubkey instanceof PublicKey)) { - console.error("Invalid remaining key:", pubkey); - throw new Error("remaining contains invalid keys"); + console.warn("Invalid remaining key:", pubkey); + // throw new Error("remaining contains invalid keys"); } return { pubkey, isSigner: false, isWritable: false }; @@ -403,8 +403,8 @@ export const healthPulse = ( ) => { const oracleMeta: AccountMeta[] = args.remaining.map((pubkey) => { if (!(pubkey instanceof PublicKey)) { - console.error("Invalid remaining key:", pubkey); - throw new Error("remaining contains invalid keys"); + console.warn("Invalid remaining key:", pubkey); + // throw new Error("remaining contains invalid keys"); } return { pubkey, isSigner: false, isWritable: false }; diff --git a/tsconfig.json b/tsconfig.json index 7c4018468..17668ee17 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,5 +7,10 @@ "target": "ES2022", "esModuleInterop": true, "sourceMap": true, + + "baseUrl": ".", + "paths": { + "@solana/web3.js": ["node_modules/@solana/web3.js"] + } } } diff --git a/yarn.lock b/yarn.lock index 439bc3e92..4d808ca96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,40 +2,24 @@ # yarn lockfile v1 -"@babel/runtime@^7.12.5", "@babel/runtime@^7.25.0": +"@babel/runtime@^7.10.5", "@babel/runtime@^7.12.5": + version "7.27.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.27.0.tgz#fbee7cf97c709518ecc1f590984481d5460d4762" + integrity sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw== + dependencies: + regenerator-runtime "^0.14.0" + +"@babel/runtime@^7.25.0": version "7.26.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.0.tgz#8600c2f595f277c60815256418b85356a65173c1" integrity sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw== dependencies: regenerator-runtime "^0.14.0" -"@brokerloop/ttlcache@^3.2.3": - version "3.2.3" - resolved "https://registry.yarnpkg.com/@brokerloop/ttlcache/-/ttlcache-3.2.3.tgz#bc3c79bb381f7b43f83745eb96e86673f75d3d11" - integrity sha512-kZWoyJGBYTv1cL5oHBYEixlJysJBf2RVnub3gbclD+dwaW9aKubbHzbZ9q1q6bONosxaOqMsoBorOrZKzBDiqg== - dependencies: - "@soncodi/signal" "~2.0.7" - -"@coral-xyz/anchor-30@npm:@coral-xyz/anchor@0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d" - integrity sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ== - dependencies: - "@coral-xyz/anchor-errors" "^0.30.1" - "@coral-xyz/borsh" "^0.30.1" - "@noble/hashes" "^1.3.1" - "@solana/web3.js" "^1.68.0" - bn.js "^5.1.2" - bs58 "^4.0.1" - buffer-layout "^1.2.2" - camelcase "^6.3.0" - cross-fetch "^3.1.5" - crypto-hash "^1.3.0" - eventemitter3 "^4.0.7" - pako "^2.0.3" - snake-case "^3.0.4" - superstruct "^0.15.4" - toml "^3.0.0" +"@common.js/quick-lru@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@common.js/quick-lru/-/quick-lru-7.0.0.tgz#1885393f1aa3f570bfacbdfa41a366da8c4fe025" + integrity sha512-DO3vApnH1vLizdWRSqzhg+S956vptHhtO+vw6PP6StJGDtaAGyfKSSPPGYWguJZu/Jlti6l6m6jB8NrKEQexLg== "@coral-xyz/anchor-errors@^0.30.1": version "0.30.1" @@ -47,6 +31,11 @@ resolved "https://registry.yarnpkg.com/@coral-xyz/anchor-errors/-/anchor-errors-0.31.0.tgz#dfc7329fca152b598842f68175efe5000825b51b" integrity sha512-SUERksFSQ+4F11hkROIwHq4mcoSMXJxwVWLoklefi4dU679zVWFVcTq6O7otvjY8wlUaRXeE+iYcQWZTw2ll6w== +"@coral-xyz/anchor-errors@^0.31.1": + version "0.31.1" + resolved "https://registry.yarnpkg.com/@coral-xyz/anchor-errors/-/anchor-errors-0.31.1.tgz#d635cbac2533973ae6bfb5d3ba1de89ce5aece2d" + integrity sha512-NhNEku4F3zzUSBtrYz84FzYWm48+9OvmT1Hhnwr6GnPQry2dsEqH/ti/7ASjjpoFTWRnPXrjAIT1qM6Isop+LQ== + "@coral-xyz/anchor@0.31.0": version "0.31.0" resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.31.0.tgz#76b84541e6fdfbd6c661584cdc418453a6416f12" @@ -66,24 +55,22 @@ superstruct "^0.15.4" toml "^3.0.0" -"@coral-xyz/anchor@=0.30.1", "@coral-xyz/anchor@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d" - integrity sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ== +"@coral-xyz/anchor@=0.31.1": + version "0.31.1" + resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.31.1.tgz#0fdeebf45a3cb2e47e8ebbb815ca98542152962c" + integrity sha512-QUqpoEK+gi2S6nlYc2atgT2r41TT3caWr/cPUEL8n8Md9437trZ68STknq897b82p5mW0XrTBNOzRbmIRJtfsA== dependencies: - "@coral-xyz/anchor-errors" "^0.30.1" - "@coral-xyz/borsh" "^0.30.1" + "@coral-xyz/anchor-errors" "^0.31.1" + "@coral-xyz/borsh" "^0.31.1" "@noble/hashes" "^1.3.1" - "@solana/web3.js" "^1.68.0" + "@solana/web3.js" "^1.69.0" bn.js "^5.1.2" bs58 "^4.0.1" buffer-layout "^1.2.2" camelcase "^6.3.0" cross-fetch "^3.1.5" - crypto-hash "^1.3.0" eventemitter3 "^4.0.7" pako "^2.0.3" - snake-case "^3.0.4" superstruct "^0.15.4" toml "^3.0.0" @@ -107,6 +94,27 @@ superstruct "^0.15.4" toml "^3.0.0" +"@coral-xyz/anchor@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d" + integrity sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ== + dependencies: + "@coral-xyz/anchor-errors" "^0.30.1" + "@coral-xyz/borsh" "^0.30.1" + "@noble/hashes" "^1.3.1" + "@solana/web3.js" "^1.68.0" + bn.js "^5.1.2" + bs58 "^4.0.1" + buffer-layout "^1.2.2" + camelcase "^6.3.0" + cross-fetch "^3.1.5" + crypto-hash "^1.3.0" + eventemitter3 "^4.0.7" + pako "^2.0.3" + snake-case "^3.0.4" + superstruct "^0.15.4" + toml "^3.0.0" + "@coral-xyz/borsh@^0.29.0": version "0.29.0" resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.29.0.tgz#79f7045df2ef66da8006d47f5399c7190363e71f" @@ -131,12 +139,20 @@ bn.js "^5.1.2" buffer-layout "^1.2.0" -"@coral-xyz/spl-token@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@coral-xyz/spl-token/-/spl-token-0.30.1.tgz#05223b2416fe46452777d3217a99cbe3fa2ff98b" - integrity sha512-3YGSkGergnfjr4FyWAiZxPdZbI+cIrGl407W/L541WtKUlNWykKgQlIpXvBctGeZ3s5QpiCr8KBY1Z8dblwCmQ== +"@coral-xyz/borsh@^0.31.1": + version "0.31.1" + resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.31.1.tgz#5328e1e0921b75d7f4a62dd3f61885a938bc7241" + integrity sha512-9N8AU9F0ubriKfNE3g1WF0/4dtlGXoBN/hd1PvbNBamBNwRgHxH4P+o3Zt7rSEloW1HUs6LfZEchlx9fW7POYw== dependencies: - "@coral-xyz/anchor" "=0.30.1" + bn.js "^5.1.2" + buffer-layout "^1.2.0" + +"@coral-xyz/spl-token@^0.31.1": + version "0.31.1" + resolved "https://registry.yarnpkg.com/@coral-xyz/spl-token/-/spl-token-0.31.1.tgz#d8f51dc45884e22a46ce721ebaab08aa7e690bb0" + integrity sha512-DqDbXNH87YtBvDXMd+FDK+K/EOZ8F83JU/VPt42KwoT8i56YBXwinffUfbefkV8j3/kSHCD6TTR+2B9F0IddxA== + dependencies: + "@coral-xyz/anchor" "=0.31.1" "@native-to-anchor/buffer-layout" "=0.1.0" "@cspotcode/source-map-support@^0.8.0": @@ -229,29 +245,33 @@ "@metaplex-foundation/umi-serializers-encodings" "^0.8.9" "@metaplex-foundation/umi-serializers-numbers" "^0.8.9" -"@mrgnlabs/marginfi-client-v2@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@mrgnlabs/marginfi-client-v2/-/marginfi-client-v2-4.0.0.tgz#50676767dc9a06b5ffaccb25f3dc8f7a24b6f52d" - integrity sha512-GnXdGdPgU54w517iDXfKoti1i8jrVyOwhxPKS2Lpqac3QH4NL3b4sSbz+pCBDmjk60gveHzu3IAIGscUpbo1yQ== +"@mrgnlabs/marginfi-client-v2@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/@mrgnlabs/marginfi-client-v2/-/marginfi-client-v2-6.0.1.tgz#740bb83635d7f3adb6764d37c17f9e36777a2750" + integrity sha512-I4IdrS+fAIhkcgqXmRfwsuZDRgzSipy1Ok8L8Wm3NGgw6JFvTje6qYJ2rNKdZOpZaTDl2q+kZc/GD5EhJkQrLA== dependencies: "@coral-xyz/anchor" "^0.30.1" - "@mrgnlabs/mrgn-common" "*" + "@coral-xyz/borsh" "^0.30.1" + "@mrgnlabs/mrgn-common" "2.0.2" "@pythnetwork/pyth-solana-receiver" "^0.8.0" + "@solana/spl-token" "^0.1.8" "@solana/wallet-adapter-base" "^0.9.23" "@solana/web3.js" "^1.93.2" - "@switchboard-xyz/on-demand" "^1.2.36" + "@switchboard-xyz/on-demand" "^1.2.54" bignumber.js "^9.1.2" borsh "^2.0.0" bs58 "^6.0.0" + crypto-hash "^3.1.0" decimal.js "^10.4.3" superstruct "^1.0.4" -"@mrgnlabs/mrgn-common@*", "@mrgnlabs/mrgn-common@^1.8.0": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@mrgnlabs/mrgn-common/-/mrgn-common-1.8.0.tgz#76df1104b3a6b04054c56c297b4dc6a27236d8fe" - integrity sha512-6VQ/2Ob8alyI1jsY3RETsWJ5W/myEp+h2yu1mFI/yzKHLffQMlt50FWPSDmCe2TBmkBioW48HOl+PqQf3+Wfbg== +"@mrgnlabs/mrgn-common@2.0.2", "@mrgnlabs/mrgn-common@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@mrgnlabs/mrgn-common/-/mrgn-common-2.0.2.tgz#4b96de41a7c8bd14e7e8c756793717e4cbbae8ef" + integrity sha512-PypRjfnLPN4HPLz6VOyq7FpcbZPvG1CsZzBX7YMTBBiIZElt8NVk9cMZvTjZS7FzjgBdli0l8L60gt1ZdV2jvg== dependencies: "@coral-xyz/anchor" "^0.30.1" + "@solana/buffer-layout" "4.0.1" "@solana/buffer-layout-utils" "^0.2.0" "@solana/wallet-adapter-base" "^0.9.23" "@solana/web3.js" "^1.93.2" @@ -269,7 +289,14 @@ "@solana/buffer-layout" "=4.0.0" "@solana/buffer-layout-utils" "=0.2.0" -"@noble/curves@^1.0.0", "@noble/curves@^1.4.2": +"@noble/curves@^1.0.0": + version "1.8.2" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.8.2.tgz#8f24c037795e22b90ae29e222a856294c1d9ffc7" + integrity sha512-vnI7V6lFNe0tLAuJMu+2sX+FcL14TaCWy1qiczg1VwRmPrpQCdq5ESXQMqUc2tluRNf6irBXrWbl1mGN8uaU/g== + dependencies: + "@noble/hashes" "1.7.2" + +"@noble/curves@^1.4.2": version "1.7.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.7.0.tgz#0512360622439256df892f21d25b388f52505e45" integrity sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw== @@ -286,7 +313,17 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.6.0.tgz#d4bfb516ad6e7b5111c216a5cc7075f4cf19e6c5" integrity sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ== -"@noble/hashes@^1.3.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.4.0": +"@noble/hashes@1.7.2": + version "1.7.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.7.2.tgz#d53c65a21658fb02f3303e7ee3ba89d6754c64b4" + integrity sha512-biZ0NUSxyjLLqo6KxEJ1b+C2NAx0wtDoFvCaXHGgUkeHzf3Xc1xKumFKREuT7f7DARNZ/slvYUwFG6B0f2b6hQ== + +"@noble/hashes@^1.3.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.8.0.tgz#cee43d801fcef9644b11b8194857695acd5f815a" + integrity sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A== + +"@noble/hashes@^1.3.1", "@noble/hashes@^1.4.0": version "1.6.1" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.6.1.tgz#df6e5943edcea504bac61395926d6fd67869a0d5" integrity sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w== @@ -395,6 +432,13 @@ bigint-buffer "^1.1.5" bignumber.js "^9.0.1" +"@solana/buffer-layout@4.0.1", "@solana/buffer-layout@^4.0.0", "@solana/buffer-layout@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz#b996235eaec15b1e0b5092a8ed6028df77fa6c15" + integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA== + dependencies: + buffer "~6.0.3" + "@solana/buffer-layout@=4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-4.0.0.tgz#75b1b11adc487234821c81dfae3119b73a5fd734" @@ -402,13 +446,6 @@ dependencies: buffer "~6.0.3" -"@solana/buffer-layout@^4.0.0", "@solana/buffer-layout@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz#b996235eaec15b1e0b5092a8ed6028df77fa6c15" - integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA== - dependencies: - buffer "~6.0.3" - "@solana/codecs-core@2.0.0-rc.1": version "2.0.0-rc.1" resolved "https://registry.yarnpkg.com/@solana/codecs-core/-/codecs-core-2.0.0-rc.1.tgz#1a2d76b9c7b9e7b7aeb3bd78be81c2ba21e3ce22" @@ -416,6 +453,13 @@ dependencies: "@solana/errors" "2.0.0-rc.1" +"@solana/codecs-core@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@solana/codecs-core/-/codecs-core-2.1.0.tgz#79ac28fbcde4a09d88f4360777ceeb30ec14e3f1" + integrity sha512-SR7pKtmJBg2mhmkel2NeHA1pz06QeQXdMv8WJoIR9m8F/hw80K/612uaYbwTt2nkK0jg/Qn/rNSd7EcJ4SBGjw== + dependencies: + "@solana/errors" "2.1.0" + "@solana/codecs-data-structures@2.0.0-rc.1": version "2.0.0-rc.1" resolved "https://registry.yarnpkg.com/@solana/codecs-data-structures/-/codecs-data-structures-2.0.0-rc.1.tgz#d47b2363d99fb3d643f5677c97d64a812982b888" @@ -433,6 +477,14 @@ "@solana/codecs-core" "2.0.0-rc.1" "@solana/errors" "2.0.0-rc.1" +"@solana/codecs-numbers@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@solana/codecs-numbers/-/codecs-numbers-2.1.0.tgz#f6a1a9009ace56238d8d9478dd5d375b09c6342a" + integrity sha512-XMu4yw5iCgQnMKsxSWPPOrGgtaohmupN3eyAtYv3K3C/MJEc5V90h74k5B1GUCiHvcrdUDO9RclNjD9lgbjFag== + dependencies: + "@solana/codecs-core" "2.1.0" + "@solana/errors" "2.1.0" + "@solana/codecs-strings@2.0.0-rc.1": version "2.0.0-rc.1" resolved "https://registry.yarnpkg.com/@solana/codecs-strings/-/codecs-strings-2.0.0-rc.1.tgz#e1d9167075b8c5b0b60849f8add69c0f24307018" @@ -461,6 +513,14 @@ chalk "^5.3.0" commander "^12.1.0" +"@solana/errors@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@solana/errors/-/errors-2.1.0.tgz#1a139965fcb8bec610cc1c6194d53d169f4b5852" + integrity sha512-l+GxAv0Ar4d3c3PlZdA9G++wFYZREEbbRyAFP8+n8HSg0vudCuzogh/13io6hYuUhG/9Ve8ARZNamhV7UScKNw== + dependencies: + chalk "^5.3.0" + commander "^13.1.0" + "@solana/functional@2.0.0-experimental.21e994f": version "2.0.0-experimental.21e994f" resolved "https://registry.yarnpkg.com/@solana/functional/-/functional-2.0.0-experimental.21e994f.tgz#e7ebdc8fcb14a0a2bc7d0f7df8667d171f54a10b" @@ -523,22 +583,24 @@ dependencies: "@solana/codecs" "2.0.0-rc.1" -"@solana/spl-token-metadata@^0.1.2", "@solana/spl-token-metadata@^0.1.6": +"@solana/spl-token-metadata@^0.1.6": version "0.1.6" resolved "https://registry.yarnpkg.com/@solana/spl-token-metadata/-/spl-token-metadata-0.1.6.tgz#d240947aed6e7318d637238022a7b0981b32ae80" integrity sha512-7sMt1rsm/zQOQcUWllQX9mD2O6KhSAtY1hFR2hfFwgqfFWzSY9E9GDvFVNYUI1F0iQKcm6HmePU9QbKRXTEBiA== dependencies: "@solana/codecs" "2.0.0-rc.1" -"@solana/spl-token@^0.3.4": - version "0.3.11" - resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.3.11.tgz#cdc10f9472b29b39c8983c92592cadd06627fb9a" - integrity sha512-bvohO3rIMSVL24Pb+I4EYTJ6cL82eFpInEXD/I8K8upOGjpqHsKUoAempR/RnUlI1qSFNyFlWJfu6MNUgfbCQQ== +"@solana/spl-token@^0.1.8": + version "0.1.8" + resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.1.8.tgz#f06e746341ef8d04165e21fc7f555492a2a0faa6" + integrity sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ== dependencies: - "@solana/buffer-layout" "^4.0.0" - "@solana/buffer-layout-utils" "^0.2.0" - "@solana/spl-token-metadata" "^0.1.2" - buffer "^6.0.3" + "@babel/runtime" "^7.10.5" + "@solana/web3.js" "^1.21.0" + bn.js "^5.1.0" + buffer "6.0.3" + buffer-layout "^1.2.0" + dotenv "10.0.0" "@solana/spl-token@^0.4.8": version "0.4.9" @@ -593,7 +655,28 @@ "@solana/transactions" "2.0.0-experimental.21e994f" fast-stable-stringify "^1.0.0" -"@solana/web3.js@^1.32.0", "@solana/web3.js@^1.68.0", "@solana/web3.js@^1.90.0", "@solana/web3.js@^1.91.6", "@solana/web3.js@^1.93.2", "@solana/web3.js@^1.95.2", "@solana/web3.js@^1.95.3", "@solana/web3.js@^1.95.8": +"@solana/web3.js@^1.21.0", "@solana/web3.js@^1.69.0", "@solana/web3.js@^1.90.0", "@solana/web3.js@^1.93.2", "@solana/web3.js@^1.98.0": + version "1.98.0" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.98.0.tgz#21ecfe8198c10831df6f0cfde7f68370d0405917" + integrity sha512-nz3Q5OeyGFpFCR+erX2f6JPt3sKhzhYcSycBCSPkWjzSVDh/Rr1FqTVMRe58FKO16/ivTUcuJjeS5MyBvpkbzA== + dependencies: + "@babel/runtime" "^7.25.0" + "@noble/curves" "^1.4.2" + "@noble/hashes" "^1.4.0" + "@solana/buffer-layout" "^4.0.1" + agentkeepalive "^4.5.0" + bigint-buffer "^1.1.5" + bn.js "^5.2.1" + borsh "^0.7.0" + bs58 "^4.0.1" + buffer "6.0.3" + fast-stable-stringify "^1.0.0" + jayson "^4.1.1" + node-fetch "^2.7.0" + rpc-websockets "^9.0.2" + superstruct "^2.0.2" + +"@solana/web3.js@^1.32.0", "@solana/web3.js@^1.91.6": version "1.95.8" resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.95.8.tgz#2d49abda23f7a79a3cc499ab6680f7be11786ee1" integrity sha512-sBHzNh7dHMrmNS5xPD1d0Xa2QffW/RXaxu/OysRXBfwTp+LYqGGmMtCYYwrHPrN5rjAmJCsQRNAwv4FM0t3B6g== @@ -614,17 +697,17 @@ rpc-websockets "^9.0.2" superstruct "^2.0.2" -"@solana/web3.js@^1.69.0": - version "1.98.0" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.98.0.tgz#21ecfe8198c10831df6f0cfde7f68370d0405917" - integrity sha512-nz3Q5OeyGFpFCR+erX2f6JPt3sKhzhYcSycBCSPkWjzSVDh/Rr1FqTVMRe58FKO16/ivTUcuJjeS5MyBvpkbzA== +"@solana/web3.js@^1.68.0": + version "1.98.1" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.98.1.tgz#9237a5dcded21b323672aa503a0db1c3d18ff841" + integrity sha512-gRAq1YPbfSDAbmho4kY7P/8iLIjMWXAzBJdP9iENFR+dFQSBSueHzjK/ou8fxhqHP9j+J4Msl4p/oDemFcIjlg== dependencies: "@babel/runtime" "^7.25.0" "@noble/curves" "^1.4.2" "@noble/hashes" "^1.4.0" "@solana/buffer-layout" "^4.0.1" + "@solana/codecs-numbers" "^2.1.0" agentkeepalive "^4.5.0" - bigint-buffer "^1.1.5" bn.js "^5.2.1" borsh "^0.7.0" bs58 "^4.0.1" @@ -656,27 +739,6 @@ rpc-websockets "^7.5.1" superstruct "^0.14.2" -"@solworks/soltoolkit-sdk@^0.0.37": - version "0.0.37" - resolved "https://registry.yarnpkg.com/@solworks/soltoolkit-sdk/-/soltoolkit-sdk-0.0.37.tgz#53800f0e43c56962194b130e02c713d8d7fb6a7c" - integrity sha512-3+mNv9ymup0LTOmZRhIWvqGmf9Col1TKuZ2I9dqrnbSveOBnjCgNDUkfge4qJ2FcWNZdVEvHzUd3UkV902INAg== - dependencies: - "@solana/buffer-layout" "^4.0.0" - "@solana/spl-token" "^0.3.4" - "@solana/web3.js" "^1.95.3" - "@types/bn.js" "^5.1.0" - "@types/node" "^18.7.13" - "@types/node-fetch" "^2.6.2" - bn.js "^5.2.1" - bs58 "^5.0.0" - decimal.js "^10.4.0" - typescript "^4.8.2" - -"@soncodi/signal@~2.0.7": - version "2.0.7" - resolved "https://registry.yarnpkg.com/@soncodi/signal/-/signal-2.0.7.tgz#0a2c361b02dbfdbcf4e66b78e5f711e0a13d6e83" - integrity sha512-zA2oZluZmVvgZEDjF243KWD1S2J+1SH1MVynI0O1KRgDt1lU8nqk7AK3oQfW/WpwT51L5waGSU0xKF/9BTP5Cw== - "@swc/helpers@^0.5.11": version "0.5.15" resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.15.tgz#79efab344c5819ecf83a43f3f9f811fc84b516d7" @@ -684,38 +746,34 @@ dependencies: tslib "^2.8.0" -"@switchboard-xyz/common@^2.5.7": - version "2.5.7" - resolved "https://registry.yarnpkg.com/@switchboard-xyz/common/-/common-2.5.7.tgz#8b781a882318d7e2e661bab3bc3695575c3da20e" - integrity sha512-xUThQ2Zuf+2/nO1J459DC3BrQn1OxytbrU84mxuGZKw4APhtm7hKKCaIdQ1uzdASj9v3NRZ+/KIPeMaQfk+ZZA== +"@switchboard-xyz/common@^3.0.1": + version "3.0.14" + resolved "https://registry.yarnpkg.com/@switchboard-xyz/common/-/common-3.0.14.tgz#5b363995bd0fefa22198286992dbe54f3e544b08" + integrity sha512-LpxzEywO0DjPYIgPzQYkf32C7agwW4YRsPN6BcIvYrw0iJdDMtPZ3SQfIGHLSlD1fwvn2KLUYuGaKegeq4aBTw== dependencies: - "@solana/web3.js" "^1.95.8" - axios "^1.7.8" + "@solana/web3.js" "^1.98.0" + axios "^1.8.3" big.js "^6.2.2" bn.js "^5.2.1" bs58 "^6.0.0" - cron-validator "^1.3.1" + buffer "^6.0.3" decimal.js "^10.4.3" js-sha256 "^0.11.0" - lodash "^4.17.21" protobufjs "^7.4.0" yaml "^2.6.1" -"@switchboard-xyz/on-demand@^1.2.36": - version "1.2.54" - resolved "https://registry.yarnpkg.com/@switchboard-xyz/on-demand/-/on-demand-1.2.54.tgz#ddf88d8bbc9525c2a447505f6ef22323da34db28" - integrity sha512-R7f0LmtV/XEbWhPVTKCWFIzGnbBgu8caP9eOlUapgcR+07oChU2SIyFtoG/bjNbAwKgx8TNVOxEk5RaZe5EyiA== +"@switchboard-xyz/on-demand@^1.2.54": + version "1.2.67" + resolved "https://registry.yarnpkg.com/@switchboard-xyz/on-demand/-/on-demand-1.2.67.tgz#7975154521218d559af8595f61617ebb0a036107" + integrity sha512-rtGA+9tQHb/xQnUFgVzyaOs2uKgnwP7OqYQLEOjTDdNTEEgU8OTR72ujluOEYB9LMByb7h9SRuOR353vxYQhYA== dependencies: - "@brokerloop/ttlcache" "^3.2.3" - "@coral-xyz/anchor-30" "npm:@coral-xyz/anchor@0.30.1" - "@solana/web3.js" "^1.95.8" - "@solworks/soltoolkit-sdk" "^0.0.37" - "@switchboard-xyz/common" "^2.5.7" + "@common.js/quick-lru" "^7.0.0" + "@coral-xyz/anchor" "^0.30.1" + "@switchboard-xyz/common" "^3.0.1" axios "^1.7.8" - big.js "^6.2.2" bs58 "^6.0.0" + buffer "^6.0.3" js-yaml "^4.1.0" - protobufjs "^7.4.0" "@tsconfig/node10@^1.0.7": version "1.0.11" @@ -766,14 +824,6 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.10.tgz#91f62905e8d23cbd66225312f239454a23bebfa0" integrity sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q== -"@types/node-fetch@^2.6.2": - version "2.6.12" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.12.tgz#8ab5c3ef8330f13100a7479e2cd56d3386830a03" - integrity sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA== - dependencies: - "@types/node" "*" - form-data "^4.0.0" - "@types/node@*", "@types/node@>=13.7.0": version "22.10.2" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.10.2.tgz#a485426e6d1fdafc7b0d4c7b24e2c78182ddabb9" @@ -786,13 +836,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== -"@types/node@^18.7.13": - version "18.19.68" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.68.tgz#f4f10d9927a7eaf3568c46a6d739cc0967ccb701" - integrity sha512-QGtpFH1vB99ZmTa63K4/FU8twThj4fuVSBkGddTp7uIL/cuoLWIUSL2RcOaigBhfR+hg5pgGkBnkoOxrTVBMKw== - dependencies: - undici-types "~5.26.4" - "@types/uuid@^8.3.4": version "8.3.4" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc" @@ -844,17 +887,24 @@ acorn@^8.11.0, acorn@^8.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== -agentkeepalive@^4.2.1, agentkeepalive@^4.3.0, agentkeepalive@^4.5.0: +agentkeepalive@^4.2.1: + version "4.6.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.6.0.tgz#35f73e94b3f40bf65f105219c623ad19c136ea6a" + integrity sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ== + dependencies: + humanize-ms "^1.2.1" + +agentkeepalive@^4.3.0, agentkeepalive@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== dependencies: humanize-ms "^1.2.1" -anchor-bankrun@^0.4.0: - version "0.4.1" - resolved "https://registry.yarnpkg.com/anchor-bankrun/-/anchor-bankrun-0.4.1.tgz#6fbbf824673f5fcdf353b1f1003d561c14a67c79" - integrity sha512-ryCT84tw+lP4AqRpBsZJbt/KTRoVVKufkxFGd77gnx9iHkbwA5G/9cALk/eqLQm4xeUWTrJSJdEVyg2e74iP9A== +anchor-bankrun@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/anchor-bankrun/-/anchor-bankrun-0.5.0.tgz#62b5905f6f0ed3799d4a37e6be045887c13d4f33" + integrity sha512-cNTRv7pN9dy+kiyJ3UlNVTg9hAXhY2HtNVNXJbP/2BkS9nOdLV0qKWhgW8UR9Go0gYuEOLKuPzrGL4HFAZPsVw== ansi-colors@^4.1.3: version "4.1.3" @@ -915,6 +965,15 @@ axios@^1.7.8: form-data "^4.0.0" proxy-from-env "^1.1.0" +axios@^1.8.3: + version "1.8.4" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.8.4.tgz#78990bb4bc63d2cae072952d374835950a82f447" + integrity sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -971,7 +1030,7 @@ bindings@^1.3.0: dependencies: file-uri-to-path "1.0.0" -bn.js@^5.0.0, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: +bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== @@ -1150,6 +1209,11 @@ commander@^12.1.0: resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== +commander@^13.1.0: + version "13.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-13.1.0.tgz#776167db68c78f38dcce1f9b8d7b8b9a488abf46" + integrity sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw== + commander@^2.20.3: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -1160,11 +1224,6 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -cron-validator@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/cron-validator/-/cron-validator-1.3.1.tgz#8f2fe430f92140df77f91178ae31fc1e3a48a20e" - integrity sha512-C1HsxuPCY/5opR55G5/WNzyEGDWFVG+6GLrA+fW/sCTcP6A6NTjUP2AK7B8n2PyFs90kDG2qzwm8LMheADku6A== - cross-fetch@^3.1.5: version "3.1.8" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" @@ -1177,6 +1236,11 @@ crypto-hash@^1.3.0: resolved "https://registry.yarnpkg.com/crypto-hash/-/crypto-hash-1.3.0.tgz#b402cb08f4529e9f4f09346c3e275942f845e247" integrity sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg== +crypto-hash@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/crypto-hash/-/crypto-hash-3.1.0.tgz#8be4497e1feee8e75dfc545aa5348fb11ae167c5" + integrity sha512-HR8JlZ+Dn54Lc5gGWZJxJitWbOCUzWb9/AlyONGecBnYZ+n/ONvt0gQnEzDNpJMYeRrYO7KogQ4qwyTPKnWKEw== + debug@^4.3.5: version "4.4.0" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" @@ -1189,7 +1253,7 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== -decimal.js@^10.4.0, decimal.js@^10.4.3: +decimal.js@^10.4.3: version "10.4.3" resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== @@ -1234,6 +1298,11 @@ dot-case@^3.0.4: no-case "^3.0.4" tslib "^2.0.3" +dotenv@10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" + integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== + dotenv@^16.0.3: version "16.4.7" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.7.tgz#0e20c5b82950140aa99be360a8a5f52335f53c26" @@ -1442,7 +1511,7 @@ isomorphic-ws@^4.0.1: resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== -jayson@^4.0.0, jayson@^4.1.0, jayson@^4.1.1: +jayson@^4.0.0, jayson@^4.1.1: version "4.1.3" resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.1.3.tgz#db9be2e4287d9fef4fc05b5fe367abe792c2eee8" integrity sha512-LtXh5aYZodBZ9Fc3j6f2w+MTNcnxteMOrb+QgIouguGOulWi0lieEkOUg+HkjjFs0DGoWDds6bi4E9hpNFLulQ== @@ -1460,6 +1529,24 @@ jayson@^4.0.0, jayson@^4.1.0, jayson@^4.1.1: uuid "^8.3.2" ws "^7.5.10" +jayson@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.2.0.tgz#b71762393fa40bc9637eaf734ca6f40d3b8c0c93" + integrity sha512-VfJ9t1YLwacIubLhONk0KFeosUBwstRWQ0IRT1KDjEjnVnSOVHC3uwugyV7L0c7R9lpVyrUGT2XWiBA1UTtpyg== + dependencies: + "@types/connect" "^3.4.33" + "@types/node" "^12.12.54" + "@types/ws" "^7.4.4" + commander "^2.20.3" + delay "^5.0.0" + es6-promisify "^5.0.0" + eyes "^0.1.8" + isomorphic-ws "^4.0.1" + json-stringify-safe "^5.0.1" + stream-json "^1.9.1" + uuid "^8.3.2" + ws "^7.5.10" + jito-ts@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/jito-ts/-/jito-ts-3.0.1.tgz#24126389896e042c26d303c4e802064b249ed27e" @@ -1515,11 +1602,6 @@ lodash.camelcase@^4.3.0: resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA== -lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" @@ -1785,44 +1867,44 @@ snake-case@^3.0.4: dot-case "^3.0.4" tslib "^2.0.3" -solana-bankrun-darwin-arm64@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-arm64/-/solana-bankrun-darwin-arm64-0.3.1.tgz#65ab6cd2e74eef260c38251f4c53721cf5b9030f" - integrity sha512-9LWtH/3/WR9fs8Ve/srdo41mpSqVHmRqDoo69Dv1Cupi+o1zMU6HiEPUHEvH2Tn/6TDbPEDf18MYNfReLUqE6A== +solana-bankrun-darwin-arm64@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-arm64/-/solana-bankrun-darwin-arm64-0.4.0.tgz#eb0f3dfffb1675f6329a1e026b12d09222b33986" + integrity sha512-6dz78Teoz7ez/3lpRLDjktYLJb79FcmJk2me4/YaB8WiO6W43OdExU4h+d2FyuAryO2DgBPXaBoBNY/8J1HJmw== -solana-bankrun-darwin-universal@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-universal/-/solana-bankrun-darwin-universal-0.3.1.tgz#bf691457cf046e8739c021ca11e48de5b4fefd45" - integrity sha512-muGHpVYWT7xCd8ZxEjs/bmsbMp8XBqroYGbE4lQPMDUuLvsJEIrjGqs3MbxEFr71sa58VpyvgywWd5ifI7sGIg== +solana-bankrun-darwin-universal@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-universal/-/solana-bankrun-darwin-universal-0.4.0.tgz#0ac13ec7637b334b1030e6f51abecc50a254b5de" + integrity sha512-zSSw/Jx3KNU42pPMmrEWABd0nOwGJfsj7nm9chVZ3ae7WQg3Uty0hHAkn5NSDCj3OOiN0py9Dr1l9vmRJpOOxg== -solana-bankrun-darwin-x64@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-x64/-/solana-bankrun-darwin-x64-0.3.1.tgz#c6f30c0a6bc3e1621ed90ce7562f26e93bf5303f" - integrity sha512-oCaxfHyt7RC3ZMldrh5AbKfy4EH3YRMl8h6fSlMZpxvjQx7nK7PxlRwMeflMnVdkKKp7U8WIDak1lilIPd3/lg== +solana-bankrun-darwin-x64@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-x64/-/solana-bankrun-darwin-x64-0.4.0.tgz#f863c5a668858b7c44be51376bd05fb077c11c99" + integrity sha512-LWjs5fsgHFtyr7YdJR6r0Ho5zrtzI6CY4wvwPXr8H2m3b4pZe6RLIZjQtabCav4cguc14G0K8yQB2PTMuGub8w== -solana-bankrun-linux-x64-gnu@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-linux-x64-gnu/-/solana-bankrun-linux-x64-gnu-0.3.1.tgz#78b522f1a581955a48f43a8fb560709c11301cfd" - integrity sha512-PfRFhr7igGFNt2Ecfdzh3li9eFPB3Xhmk0Eib17EFIB62YgNUg3ItRnQQFaf0spazFjjJLnglY1TRKTuYlgSVA== +solana-bankrun-linux-x64-gnu@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/solana-bankrun-linux-x64-gnu/-/solana-bankrun-linux-x64-gnu-0.4.0.tgz#30fd7edaf3ff6585468138d3bed6eaed37878d9e" + integrity sha512-SrlVrb82UIxt21Zr/XZFHVV/h9zd2/nP25PMpLJVLD7Pgl2yhkhfi82xj3OjxoQqWe+zkBJ+uszA0EEKr67yNw== -solana-bankrun-linux-x64-musl@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-linux-x64-musl/-/solana-bankrun-linux-x64-musl-0.3.1.tgz#1a044a132138a0084e82406ec7bf4939f06bed68" - integrity sha512-6r8i0NuXg3CGURql8ISMIUqhE7Hx/O7MlIworK4oN08jYrP0CXdLeB/hywNn7Z8d1NXrox/NpYUgvRm2yIzAsQ== +solana-bankrun-linux-x64-musl@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/solana-bankrun-linux-x64-musl/-/solana-bankrun-linux-x64-musl-0.4.0.tgz#3c870218140b1307dc44b51d2282697c99f2e1e4" + integrity sha512-Nv328ZanmURdYfcLL+jwB1oMzX4ZzK57NwIcuJjGlf0XSNLq96EoaO5buEiUTo4Ls7MqqMyLbClHcrPE7/aKyA== -solana-bankrun@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun/-/solana-bankrun-0.3.1.tgz#13665ab7c1c15ec2b3354aae56980d0ded514998" - integrity sha512-inRwON7fBU5lPC36HdEqPeDg15FXJYcf77+o0iz9amvkUMJepcwnRwEfTNyMVpVYdgjTOBW5vg+596/3fi1kGA== +solana-bankrun@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/solana-bankrun/-/solana-bankrun-0.4.0.tgz#a48a7a74ce6c56be4ec7e200336026f65e90b8dc" + integrity sha512-NMmXUipPBkt8NgnyNO3SCnPERP6xT/AMNMBooljGA3+rG6NN8lmXJsKeLqQTiFsDeWD74U++QM/DgcueSWvrIg== dependencies: "@solana/web3.js" "^1.68.0" bs58 "^4.0.1" optionalDependencies: - solana-bankrun-darwin-arm64 "0.3.1" - solana-bankrun-darwin-universal "0.3.1" - solana-bankrun-darwin-x64 "0.3.1" - solana-bankrun-linux-x64-gnu "0.3.1" - solana-bankrun-linux-x64-musl "0.3.1" + solana-bankrun-darwin-arm64 "0.4.0" + solana-bankrun-darwin-universal "0.4.0" + solana-bankrun-darwin-x64 "0.4.0" + solana-bankrun-linux-x64-gnu "0.4.0" + solana-bankrun-linux-x64-musl "0.4.0" source-map-support@^0.5.6: version "0.5.21" @@ -1837,6 +1919,18 @@ source-map@^0.6.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +stream-chain@^2.2.5: + version "2.2.5" + resolved "https://registry.yarnpkg.com/stream-chain/-/stream-chain-2.2.5.tgz#b30967e8f14ee033c5b9a19bbe8a2cba90ba0d09" + integrity sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA== + +stream-json@^1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/stream-json/-/stream-json-1.9.1.tgz#e3fec03e984a503718946c170db7d74556c2a187" + integrity sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw== + dependencies: + stream-chain "^2.2.5" + string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -1986,21 +2080,11 @@ type-detect@^4.0.0, type-detect@^4.1.0: resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.1.0.tgz#deb2453e8f08dcae7ae98c626b13dddb0155906c" integrity sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw== -typescript@^4.8.2: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== - typescript@^5.7.3: version "5.7.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - undici-types@~6.20.0: version "6.20.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433" From 5bfd5f219590c0e4ced4000ef63d9e497e0c4eef Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Tue, 22 Apr 2025 16:07:02 -0400 Subject: [PATCH 31/38] Now with anchor 0.31.1 proc macro fix enabled --- Anchor.toml | 4 +- Cargo.lock | 586 ++++++++++-------- Cargo.toml | 34 +- .../marginfi_account/flashloan.rs | 2 +- rust-toolchain.toml | 2 +- 5 files changed, 364 insertions(+), 264 deletions(-) diff --git a/Anchor.toml b/Anchor.toml index 81c8453f3..56b2dd9fc 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -1,6 +1,6 @@ [toolchain] -anchor_version = "0.31.0" -solana_version = "2.1.0" +anchor_version = "0.31.1" +solana_version = "2.1.20" # Getting "thread 'main' panicked at cli/src/lib.rs:545:18:"? Check your toolchain matches the above. [workspace] diff --git a/Cargo.lock b/Cargo.lock index bde134acc..7b801ee1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Inflector" @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "agave-transaction-view" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a249374d6349eeb31348a849666f3d47cacb18e0e05454fbd11a1fc69fae8e7e" +checksum = "383582a0ebe68832ed6a2d6460768a3f54fd61d23cd733c439aa65c6609b550b" dependencies = [ "solana-sdk", "solana-svm-transaction", @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "anchor-attribute-access-control" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37013051defd745a5437d6842bd404e5480e14ad4e4f0441dd9a81a4b9aea1d6" +checksum = "3f70fd141a4d18adf11253026b32504f885447048c7494faf5fa83b01af9c0cf" dependencies = [ "anchor-syn", "proc-macro2", @@ -135,9 +135,9 @@ dependencies = [ [[package]] name = "anchor-attribute-account" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92db0f793e924e18462b3fac53c5759a8248649a8072788b5e88a4af714998c8" +checksum = "715a261c57c7679581e06f07a74fa2af874ac30f86bd8ea07cca4a7e5388a064" dependencies = [ "anchor-syn", "bs58", @@ -148,9 +148,9 @@ dependencies = [ [[package]] name = "anchor-attribute-constant" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a98126ebfc96d6248899caadc9ea7c2403420c4f5c994e541802bce9f423674" +checksum = "730d6df8ae120321c5c25e0779e61789e4b70dc8297102248902022f286102e4" dependencies = [ "anchor-syn", "quote", @@ -159,9 +159,9 @@ dependencies = [ [[package]] name = "anchor-attribute-error" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8a4dcb403f872fbcd0910fc39a3e05bb6c43a8399f915a1878e62eb680fbb23" +checksum = "27e6e449cc3a37b2880b74dcafb8e5a17b954c0e58e376432d7adc646fb333ef" dependencies = [ "anchor-syn", "quote", @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "anchor-attribute-event" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420d651b2703ccff86f6c4b7c394140cb85049787c078a5f8280506121d48065" +checksum = "d7710e4c54adf485affcd9be9adec5ef8846d9c71d7f31e16ba86ff9fc1dd49f" dependencies = [ "anchor-syn", "proc-macro2", @@ -182,9 +182,9 @@ dependencies = [ [[package]] name = "anchor-attribute-program" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d258f3a9f47db7f4199888df0ee67e42b960a7acb8f5c336b585d4eb243b9665" +checksum = "05ecfd49b2aeadeb32f35262230db402abed76ce87e27562b34f61318b2ec83c" dependencies = [ "anchor-lang-idl", "anchor-syn", @@ -199,9 +199,9 @@ dependencies = [ [[package]] name = "anchor-derive-accounts" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "097147501de51105d8dbdad9bd5a96a1b17ecbb2cee9f200d6167031372eab3b" +checksum = "be89d160793a88495af462a7010b3978e48e30a630c91de47ce2c1d3cb7a6149" dependencies = [ "anchor-syn", "quote", @@ -210,9 +210,9 @@ dependencies = [ [[package]] name = "anchor-derive-serde" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5a24721da4ed67f0a1391cac27ea7e51c255cbd94cdcc6728a0aa56227628d0" +checksum = "abc6ee78acb7bfe0c2dd2abc677aaa4789c0281a0c0ef01dbf6fe85e0fd9e6e4" dependencies = [ "anchor-syn", "borsh-derive-internal", @@ -223,9 +223,9 @@ dependencies = [ [[package]] name = "anchor-derive-space" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41986f84d238a2f7a807f3a98da5df0e97ebe23f29f7d67b8cdd4fd80bc1ba1" +checksum = "134a01c0703f6fd355a0e472c033f6f3e41fac1ef6e370b20c50f4c8d022cea7" dependencies = [ "proc-macro2", "quote", @@ -234,9 +234,9 @@ dependencies = [ [[package]] name = "anchor-lang" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba81a0543fee1b7b610fe9ebedbae6a14e8d3e85a6a6dd48871d48a08880195" +checksum = "e6bab117055905e930f762c196e08f861f8dfe7241b92cee46677a3b15561a0a" dependencies = [ "anchor-attribute-access-control", "anchor-attribute-account", @@ -283,9 +283,9 @@ dependencies = [ [[package]] name = "anchor-spl" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9d989ebc64e6c1a9828d3a6f7b8e7a4d63cc8a4f667dcb191bd9067a3375c20" +checksum = "3c08cb5d762c0694f74bd02c9a5b04ea53cefc496e2c27b3234acffca5cd076b" dependencies = [ "anchor-lang", "spl-associated-token-account 6.0.0", @@ -298,9 +298,9 @@ dependencies = [ [[package]] name = "anchor-syn" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "564685b759db12a2424d1b2688cfdf0fec26a023813bc461274754fb0e5d97b0" +checksum = "5dc7a6d90cc643df0ed2744862cdf180587d1e5d28936538c18fc8908489ed67" dependencies = [ "anyhow", "bs58", @@ -1781,6 +1781,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -3169,12 +3184,60 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "openssl" +version = "0.10.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" +dependencies = [ + "bitflags 2.9.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +[[package]] +name = "openssl-src" +version = "300.5.0+3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8ce546f549326b0e6052b649198487d91320875da901e7bd11a06d1ee3f9c2f" +dependencies = [ + "cc", +] + +[[package]] +name = "openssl-sys" +version = "0.9.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07" +dependencies = [ + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] + [[package]] name = "opentelemetry" version = "0.17.0" @@ -3432,9 +3495,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -4500,9 +4563,9 @@ dependencies = [ [[package]] name = "solana-account" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "730219420b206253977b8cc8fd7846ffe021ab2e2c718e70db420efbd2775547" +checksum = "dc8a1697bdaf669a3786ceb8751d888463747f30a10d08fb3d3399c8e8861301" dependencies = [ "bincode", "serde", @@ -4514,9 +4577,9 @@ dependencies = [ [[package]] name = "solana-account-decoder" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e5b1c167335942b659d077552607f79b2eca3472e40eeed97a2c55838b84ef" +checksum = "e8b612a2db04fc53399d3c655f29750311307e5e24f3e02c38a6a47646556974" dependencies = [ "Inflector", "base64 0.22.1", @@ -4540,9 +4603,9 @@ dependencies = [ [[package]] name = "solana-account-decoder-client-types" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee0750d2f106ecbee6d4508b6e2029e6946cb5f67288bf002b5a62f9f451c43" +checksum = "f2249bcb1a569a9b62ace2088d45f63923667c700a4c80c58ce95dd5c00de93c" dependencies = [ "base64 0.22.1", "bs58", @@ -4556,9 +4619,9 @@ dependencies = [ [[package]] name = "solana-account-info" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6abe81cfc4a75f71a510c6856b03a7d8525e416af3c69d55daef62e6078b8d40" +checksum = "0208a6ce6349850842b0a226114af298e1b9237998484c2b467fe513c84f66f4" dependencies = [ "bincode", "serde", @@ -4569,9 +4632,9 @@ dependencies = [ [[package]] name = "solana-accounts-db" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fecc332ad4edd98ed63e5a46d990ecaf6fe4abd2bf9795c15474a64534ced6" +checksum = "74d7fca29e8ad794b181a34cdb3bd6f3469c3bd2c2e3f37315482fe0868f84b8" dependencies = [ "ahash 0.8.11", "bincode", @@ -4615,9 +4678,9 @@ dependencies = [ [[package]] name = "solana-address-lookup-table-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cf79a76f2878982b9781dfd0831d58ee15eb905be65406ccf7370c3ecd69c52" +checksum = "405ca5ea0bd3172ea38359b4377f8aaf5ff5d925a99864fec57c26de840d99e6" dependencies = [ "bincode", "bytemuck", @@ -4634,18 +4697,18 @@ dependencies = [ [[package]] name = "solana-atomic-u64" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391b795afcdcad39ddc6c938d64b789d036cdfe00d9dc5ff83024cf2da9f066f" +checksum = "6cffca840b9aef9e35051b5addc6f8bf179594346dea8a05cb527e84c758b225" dependencies = [ "parking_lot", ] [[package]] name = "solana-banks-client" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f857fb6590467d433f40eee507666ca496ec67907e50b7d530b6c04f6541875" +checksum = "db12f1f869941527d9a985fe01ed82e55312af9b9dfed795ccd41fbdb7eb835d" dependencies = [ "borsh 1.5.7", "futures", @@ -4660,9 +4723,9 @@ dependencies = [ [[package]] name = "solana-banks-interface" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20052d231bb9ac3268dc61a713e3915d6c95fc942f9a5c15ca3a81a3fcd9cc12" +checksum = "5bc09d1f1c1be091ee929a9a582f9d13c4a65f19a72ae9d0aa2478d431ddc17a" dependencies = [ "serde", "serde_derive", @@ -4672,9 +4735,9 @@ dependencies = [ [[package]] name = "solana-banks-server" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10db60e4bf077b870a7e75f8596bf3790d079b3762e9b4edc032475077007d0b" +checksum = "4921c2b6c0a952dd35025ccda66706fc0b1c1025160750de5634918892e8c7f9" dependencies = [ "bincode", "crossbeam-channel", @@ -4693,9 +4756,9 @@ dependencies = [ [[package]] name = "solana-bincode" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e85cb5961c356345a61378163fd9057011b35540f8bcdd8d8a09cb10117264f" +checksum = "ec16f955b9fcc2021b1f8eb347d22f8f3431552107b4561958a0d5d3ae8e9dec" dependencies = [ "bincode", "serde", @@ -4704,9 +4767,9 @@ dependencies = [ [[package]] name = "solana-bn254" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39c4030db26ad618f7e18fb5284df19fd52a68e092a1ca58db857108c4cc777" +checksum = "0d7ccd91311c95c71b7dfa9b0118e5f663005d9aa044029e2909db5241d3d55c" dependencies = [ "ark-bn254", "ark-ec", @@ -4719,9 +4782,9 @@ dependencies = [ [[package]] name = "solana-borsh" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d526f3525ab22a3ada3f9a1d642664dafac00dc9208326b701a2045514eb04" +checksum = "344fee9277ae2c36c8560ba4478b474fa1689c73e086fedb7a5265a926e8c63a" dependencies = [ "borsh 0.10.4", "borsh 1.5.7", @@ -4729,9 +4792,9 @@ dependencies = [ [[package]] name = "solana-bpf-loader-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142e0407f8428a1d2a33154d1d3d1c134ad257651ddff0811c17a6ee840def36" +checksum = "c139606662646889222bc1499f12bd4287de7a13a6ab3ed0f582208e41cf67be" dependencies = [ "bincode", "byteorder", @@ -4756,9 +4819,9 @@ dependencies = [ [[package]] name = "solana-bucket-map" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66eb348939fcfea6e40eed61bca06a1c631f8cb70f1801a5b14021bddefe93eb" +checksum = "071f4066a875d79e596903f0db2ea760d64fafa8077286e29abd36d3f4c8e5e3" dependencies = [ "bv", "bytemuck", @@ -4775,9 +4838,9 @@ dependencies = [ [[package]] name = "solana-builtins-default-costs" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854270e266040355f5fd5b67c91855bc36cebf1d3f325eb54d8b1b0ca385f74b" +checksum = "9a9bd1b2ee1161562553bb8d04334ef4a4c083227caf4a8a82d0e5b48390eead" dependencies = [ "ahash 0.8.11", "lazy_static", @@ -4795,9 +4858,9 @@ dependencies = [ [[package]] name = "solana-clap-utils" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1709e1b0aefc8062fca29a4fde8d35f39ee95586e77cc6360e9bfc50a094c44f" +checksum = "7c82ea996f4b390ad9868e9acd6403f8809adf97f616361d3767e9376619d230" dependencies = [ "chrono", "clap", @@ -4813,9 +4876,9 @@ dependencies = [ [[package]] name = "solana-cli-config" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384fda0ddf3099eab0f702b326663f499e84731e8584fd7d0c6d8bab03bead79" +checksum = "d86ff9a279d2a5dc30223af66df1b6f7a501fc9f79def180bdff806279c1954a" dependencies = [ "dirs-next", "lazy_static", @@ -4829,9 +4892,9 @@ dependencies = [ [[package]] name = "solana-cli-output" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b82ae7fc5a012ad5bc4077a235ea5b26145fab50ca05b550e792a50bdd6d77a9" +checksum = "911d2cd5a8272328574f3b65f1dbb558c061863a8fbe0d33abd94fe37230bcdc" dependencies = [ "Inflector", "base64 0.22.1", @@ -4856,9 +4919,9 @@ dependencies = [ [[package]] name = "solana-client" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d9a40b8e9e11604e8c05e8b5fcdb89359235db47d1aae84dcba0fc98e95dd0c" +checksum = "70b4df5f628ef6b5196aceb12fa3753dad9f04dcefe8e05bb5fa34f74aebd35b" dependencies = [ "async-trait", "bincode", @@ -4888,29 +4951,30 @@ dependencies = [ [[package]] name = "solana-clock" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7848171e53fa528efd41dd4b3ab919f47b851f8bb4a827d63ff95678f08737fc" +checksum = "dd6aa6fec0cd6116c51258e60a9faa144d3ac772a210192a934b5b2d6775a850" dependencies = [ "serde", "serde_derive", "solana-sdk-macro", + "solana-sysvar-id", ] [[package]] name = "solana-compute-budget" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf2f023f471bd1195b7f420e13ffc2422592dd48e71104b4901300b49ac493e" +checksum = "60ccc544564e2c9ba7304480c8117a19ed4e7f55da9dc457d1aa1a5813d57ab5" dependencies = [ "solana-sdk", ] [[package]] name = "solana-compute-budget-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73eddf023f02a56daa838818e30894b874368a741782457468eeefdfce2f7f53" +checksum = "2edf6c5997fdce839e0d9a35d71ed02a37d11feb17d2c06a526ae26f5ffd2c94" dependencies = [ "solana-program-runtime", "solana-sdk", @@ -4918,9 +4982,9 @@ dependencies = [ [[package]] name = "solana-config-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a035a01970ebbf40a244b3b79af533329ac8d48d80b0b98e166e23e35aa88171" +checksum = "3807510e39cfb957400650e813326490cd1a526cd569254f89691a5a60d5a916" dependencies = [ "bincode", "chrono", @@ -4934,9 +4998,9 @@ dependencies = [ [[package]] name = "solana-connection-cache" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f45dd2a6d5d55ed951781486231d0d2ee9ff7047fdafaed01ee021e236319d0" +checksum = "1c3e2ed868c40c1003286f0d3d879a2bc026f23f408ec794420e1fad3a10a7e5" dependencies = [ "async-trait", "bincode", @@ -4955,9 +5019,9 @@ dependencies = [ [[package]] name = "solana-cost-model" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "448128561bb950bce19cdbbdc1780955a52ef25f1984c9c13b35b4b9cdc548c4" +checksum = "4d3aa2d039633446d7af3dc625be944099082dbd841632a0d520af431ccb3142" dependencies = [ "ahash 0.8.11", "lazy_static", @@ -4974,9 +5038,9 @@ dependencies = [ [[package]] name = "solana-cpi" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25c536ad0ce25d84a64f48dedcb773e764827e0ef781eda41fa1fa35f5d64b38" +checksum = "2d78f05dc684a6fb1090823a1e17dc9ccb0b7b1875b4486bd31a9bd9fc5d3813" dependencies = [ "solana-account-info", "solana-define-syscall", @@ -4988,9 +5052,9 @@ dependencies = [ [[package]] name = "solana-curve25519" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f934d38b6f2a940fb1e1d8eaa17a14ffd3773b37be9fb29fa4bcec1bac5e4591" +checksum = "69c77df8deb48b0da86df71092c45541044deb789366f480205034b7f4156b4f" dependencies = [ "bytemuck", "bytemuck_derive", @@ -5001,24 +5065,24 @@ dependencies = [ [[package]] name = "solana-decode-error" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a431f532d030098e81d120877f2dddbd3dd90bea5b259198a6aae4ff6456c3" +checksum = "2f2dfa7da2e4e701312d2887ee62ab7869c355e261559603b8e50d2766334935" dependencies = [ "num-traits", ] [[package]] name = "solana-define-syscall" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7062ae1de58e294d3bee5fd2c89efc155b7f7383ddce4cb88345dfafaaabc5bd" +checksum = "42087a9f1567719e19eb9f2fe91ee620881690cb8012add9926478e051329b01" [[package]] name = "solana-derivation-path" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12080d9bf8eecd559c6f40b5aaf9e47f7f28f515218087f83f02e493b46d8388" +checksum = "ac16984dca3898c1f8584ef29c9944d807bdd76e66731f0fd970da50208d8b73" dependencies = [ "derivation-path", "qstring", @@ -5027,20 +5091,21 @@ dependencies = [ [[package]] name = "solana-epoch-schedule" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c4cf7d7c266d353169cf4feeada5e4bba3a55f33715535fa1ef49080eac3e0" +checksum = "da5c12ca420f4c4a417e198c29048119187904372f0b4612b372e3a84e6437fc" dependencies = [ "serde", "serde_derive", "solana-sdk-macro", + "solana-sysvar-id", ] [[package]] name = "solana-feature-set" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cebf45992982065a0b01b4e109bf039b2ebf6394b21672382fd951516d4c9b0" +checksum = "a1a31d4660c881b79b5109bbe072f6bc41db769d96b1a235820db454c95bdc47" dependencies = [ "lazy_static", "solana-clock", @@ -5052,9 +5117,9 @@ dependencies = [ [[package]] name = "solana-fee" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833e9a34c8cb1271e360b240dce43065cc4419ad74fc7e807c4e30cf06ebca80" +checksum = "4af3ea38de93a4dcca6fbb4e1d268bd5cdff7f8e658252da75341313ce8012e6" dependencies = [ "solana-sdk", "solana-svm-transaction", @@ -5062,9 +5127,9 @@ dependencies = [ [[package]] name = "solana-fee-calculator" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2befe056ece2eb5807298c2b569a35ee52f79df859bdd16a1f97869f8224a28" +checksum = "6cf58676b6d322cd1a95425828fcd67a49de6253a550d9cd99c9728c3b97aae6" dependencies = [ "log", "serde", @@ -5073,9 +5138,9 @@ dependencies = [ [[package]] name = "solana-hash" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1807bc4e9e1d25271514167d5a1e698ce5a330bce547a368242dd63b355b5faa" +checksum = "e75e12a61d3a8a0db6fec4d69bfc33bfec7aec4466f4860ead4dc8f56252f267" dependencies = [ "borsh 1.5.7", "bs58", @@ -5091,9 +5156,9 @@ dependencies = [ [[package]] name = "solana-inflation" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a60b572cdf0ec8fcf5a53e5ba4e3e19814dd96c2b9c156d5828be68d0d2e7103" +checksum = "0c820f72a9f85537072da1ab40d75a33c8d37e093f6d24bce449803155ffbb47" dependencies = [ "serde", "serde_derive", @@ -5101,9 +5166,9 @@ dependencies = [ [[package]] name = "solana-inline-spl" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24c9c6590e4eaf91efa887b2689b2941fe4b324bccd9a95f77853168f3d9a88" +checksum = "032b37dbaf9d6096fcb50d11c2c2d0ab12821233d19e0b1d809da7013b0f1cbe" dependencies = [ "bytemuck", "solana-pubkey", @@ -5111,9 +5176,9 @@ dependencies = [ [[package]] name = "solana-instruction" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfef689e06e5c7cb6206d4dc61ac77733de4f72d754e0d531393206abc27dbe4" +checksum = "59baf8834fc97718ccad69f49b09a859c2aebc7368a6da683bcdb55e144ae8f6" dependencies = [ "bincode", "borsh 1.5.7", @@ -5129,20 +5194,21 @@ dependencies = [ [[package]] name = "solana-last-restart-slot" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3186feae497bdfd2e77bfa56caed38b1cb1b0f389506666e3331f0b9ae799cb" +checksum = "2739105d00788ee7ff24fcc6ad78998dc17536ab0e0c10b5e18958843ada4212" dependencies = [ "serde", "serde_derive", "solana-sdk-macro", + "solana-sysvar-id", ] [[package]] name = "solana-lattice-hash" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ec86f48a8694d55757922823823069a3652d2896f61f3ffc4b741646c166a62" +checksum = "5c9a2549bd1282a91abaeb5a37fe002ccd766e1cbe67798273f26a1d6053203d" dependencies = [ "base64 0.22.1", "blake3", @@ -5152,9 +5218,9 @@ dependencies = [ [[package]] name = "solana-loader-v4-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c6915a49e537925e934551dbce2db2357d555d257a311bbf5ba0810cb1017a" +checksum = "f2b6231e29d5b2d24a7a41ff93dc129a7288fe4f3f26653630a0c44ebe78f216" dependencies = [ "log", "solana-bpf-loader-program", @@ -5169,18 +5235,18 @@ dependencies = [ [[package]] name = "solana-log-collector" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b529f5736a6c0794a885dac2e091138d3db6d924335906f117a62b58b0d3b5dc" +checksum = "05e14715be3ae19be91043fa1ebf895d22d81cd740aba4849209875dc319d845" dependencies = [ "log", ] [[package]] name = "solana-logger" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "367c5431bad14b10fbb62614b48720b746672558dba3244167ff7d251890c355" +checksum = "eb294b86c24163c878c3e69db5cad0bbe8a0d5b81de9af72a6433230d988114d" dependencies = [ "env_logger", "lazy_static", @@ -5189,15 +5255,15 @@ dependencies = [ [[package]] name = "solana-measure" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b2047a2f588082b71080b060918f107c3330ae1505f759c3b2d74bae9d9c88" +checksum = "cf9efc6bae9250e8e97d0cd229ccd39a2f29664a15d9148c68328f70ec2205a9" [[package]] name = "solana-metrics" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6319c74238e8ed4f7159fd37c693a574ab8316d03b053103f9cc83dce13f1d5c" +checksum = "97c27f863635bf028c950eebddf9e6befa229e7c96e3d46858d80e3674d4f6b9" dependencies = [ "crossbeam-channel", "gethostname", @@ -5210,24 +5276,24 @@ dependencies = [ [[package]] name = "solana-msg" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f7551f85064bc7299d56dbd7126258b084a2d78d0325b1579324f818b405123" +checksum = "c9b1f994633ef77862c265e4ea81dcbc5d855d144251a7ac00ac171a2d62e469" dependencies = [ "solana-define-syscall", ] [[package]] name = "solana-native-token" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0c4074f5fc67574dabd8f30fe6e51e290a812d88326b19b49c462058e23340" +checksum = "e93442461a41eae81a833b448e354b107288488015a6953864165ffe9c357dc2" [[package]] name = "solana-net-utils" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbac19474a4c4f91cb264c2fccead8a1a4f65384ce650b24360d9df5650e65bc" +checksum = "9a194f4c9ebf06062fa6da48bfadd4dcb8bb8db5b9ce9b56e7051be7c8fe28b7" dependencies = [ "bincode", "crossbeam-channel", @@ -5250,9 +5316,9 @@ checksum = "8b8a731ed60e89177c8a7ab05fe0f1511cedd3e70e773f288f9de33a9cfdc21e" [[package]] name = "solana-packet" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dafc2d84e57dbfe32583fe915962bd2ca3af6be496628a871db3c3d697b38d7" +checksum = "87d4056d1beceb0361d7987baa1420d7041d71707ebad38c83277bfd9a916ddb" dependencies = [ "bincode", "bitflags 2.9.0", @@ -5264,9 +5330,9 @@ dependencies = [ [[package]] name = "solana-perf" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8299f1ba518f9888da8cafa861addc6ffdd639c689e3ce219ae08212c0dcd0e" +checksum = "40474d2bffedf6d2356e4eb61c105f4ee050653dff2e6e9a066d039a6820282f" dependencies = [ "ahash 0.8.11", "bincode", @@ -5291,9 +5357,9 @@ dependencies = [ [[package]] name = "solana-poseidon" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f193a65f0db7fe5615c76c2814d6450a2e4cda61f786d5bf7a6b1ad0c179b947" +checksum = "c01d7cf84273b79ee57e2df6726b20b8a2b2bbbc781078573abb40ca6fce1a9e" dependencies = [ "ark-bn254", "light-poseidon", @@ -5303,9 +5369,9 @@ dependencies = [ [[package]] name = "solana-precompile-error" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a30ab58b9e37cde4e5577282670f30df71b97b6b06dbdb420e9b84e57b831227" +checksum = "79f1e4a080b4570413865aa8d0ec62965da90d716445d245084a1b1a26fdcbdd" dependencies = [ "num-traits", "solana-decode-error", @@ -5313,9 +5379,9 @@ dependencies = [ [[package]] name = "solana-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9040decf2f295d35da22557eeab3768ab8dfca8aed9afe668663c8fa0e97d60e" +checksum = "d8afbd3d296f660dc3841c438412bfa36367816de21e515fb5e45c91772661d1" dependencies = [ "base64 0.22.1", "bincode", @@ -5378,6 +5444,7 @@ dependencies = [ "solana-slot-hashes", "solana-slot-history", "solana-stable-layout", + "solana-sysvar-id", "solana-transaction-error", "thiserror 1.0.69", "wasm-bindgen", @@ -5385,9 +5452,9 @@ dependencies = [ [[package]] name = "solana-program-entrypoint" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eb90f3fa3e979b912451a404508f1f90bb6e5c1d7767625f622b20016fb9fde" +checksum = "c3792a05e134900bb22731235dd23ec6f7b8144983d0b753b3da3566cf8092b2" dependencies = [ "solana-account-info", "solana-msg", @@ -5397,9 +5464,9 @@ dependencies = [ [[package]] name = "solana-program-error" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd089caeef26dd07bd12b7b67d45e92faddc2fc67a960f316df7ae4776a2f3d5" +checksum = "57d11f976b42dafada93b9b4a3fe12eac6948088ebb979b5f48f96ccdfd7f13d" dependencies = [ "borsh 1.5.7", "num-traits", @@ -5413,9 +5480,9 @@ dependencies = [ [[package]] name = "solana-program-memory" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed4bc044dc2b49c323aeff04aec03c908a052e278c2edf2f7616f32fc0f1bcd9" +checksum = "d56f210a300b64d483ba5907dfa4cd0e4e1ee9ea75e66d1b1293e47a5f1151bf" dependencies = [ "num-traits", "solana-define-syscall", @@ -5423,24 +5490,24 @@ dependencies = [ [[package]] name = "solana-program-option" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3babbdffd81994c043fc9a61458ce87496218825d6e9a303de643c0a53089b9a" +checksum = "a6774f4cc0cf3bf5a3359c002943a84b029e349010098c7e964f422d1ef9167c" [[package]] name = "solana-program-pack" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fb28439d23e1f505e59c7a14ed5012365ab7aa0f20dc7bda048e02ff231cf6" +checksum = "523be6ea0cbd71da490a490dc9edc3960f7086ef694f0ba6e2bbdaa2a08d9097" dependencies = [ "solana-program-error", ] [[package]] name = "solana-program-runtime" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1de51df173401d50c0f4cf750f5070d7a4c82125a03c1aec9622dc041b0b54" +checksum = "a0516a5222cdda26ce383e28731c9631390d214a7e2648f5987d78d731f651d9" dependencies = [ "base64 0.22.1", "bincode", @@ -5468,9 +5535,9 @@ dependencies = [ [[package]] name = "solana-program-test" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "974591eca853eafee8196a3445b81fd03ebd9b3e38a6dd7b6f22dc3414c32be6" +checksum = "ca41368a4746a79d5a250a71b567a424482eae1c65981390a408854b8553a81c" dependencies = [ "assert_matches", "async-trait", @@ -5504,9 +5571,9 @@ dependencies = [ [[package]] name = "solana-pubkey" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bea3215775fcedf200d47590c7e2ce9a3a46bc2b7d3f77d0eae9c6edf0a39aec" +checksum = "53bd13d0350ea7e518e038402ccdc40f23f25d058f678fbf99b98e8c40aa2d89" dependencies = [ "borsh 0.10.4", "borsh 1.5.7", @@ -5531,9 +5598,9 @@ dependencies = [ [[package]] name = "solana-pubsub-client" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d28adf5ff89c19ef3cb24d0f484afa05852697881c2e4ef12aec190d61f76d8" +checksum = "d3419ba8d310907ff0fc59f993b03cbb91134f59cc8cfdd4d00148e7fbcdc0ee" dependencies = [ "crossbeam-channel", "futures-util", @@ -5556,9 +5623,9 @@ dependencies = [ [[package]] name = "solana-quic-client" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "259c6d420c0b7620557700f13fbbdb00afbb1b82274485c27ba30dd660ea921b" +checksum = "859d9ceebb3cc2b2d13544385682ece8803d9eb9c004d2cd46fc171826c82395" dependencies = [ "async-lock", "async-trait", @@ -5582,9 +5649,9 @@ dependencies = [ [[package]] name = "solana-rayon-threadlimit" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c69806ad1a7b0986f750134e13e55d83919631d81a2328a588615740e14ed0a" +checksum = "5292c803e4ab518dcdd6f45d11cc82c1d6e95798662c26cc725746263a2d5c91" dependencies = [ "lazy_static", "num_cpus", @@ -5592,9 +5659,9 @@ dependencies = [ [[package]] name = "solana-remote-wallet" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f36cf8ad0090276b5e9c73512df889b84092761ed733a26781b164c9e95f544" +checksum = "4a1005e9a94114e02998b20f1325a92c93853bf8cf3629ac44975d471de34b2b" dependencies = [ "console", "dialoguer", @@ -5612,20 +5679,21 @@ dependencies = [ [[package]] name = "solana-rent" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aab3f4a270196c38d62c3bb3c7a2f07732af2c772b50da49c9b1e2c9d2ace286" +checksum = "be7ddfa29be6122cb9682e343b55b48687360e56950c928735a5084cafaf42ad" dependencies = [ "serde", "serde_derive", "solana-sdk-macro", + "solana-sysvar-id", ] [[package]] name = "solana-rpc-client" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b05822aceeb484074a72d82a1b289da9fc3383f9ba3f55ce4bfd003bf9d62e6" +checksum = "daff6e5efce459257dca6b158058882b6720d91f5fe9a83986c201668963a645" dependencies = [ "async-trait", "base64 0.22.1", @@ -5650,9 +5718,9 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9c6e64f01cfafef9b2d43d6adb02979bb22f579ec8ee88b77796259acce92e" +checksum = "7670d6a72467d4042da471008fc88b3ff60e94f84a29463f20907b6e114ff214" dependencies = [ "anyhow", "base64 0.22.1", @@ -5674,9 +5742,9 @@ dependencies = [ [[package]] name = "solana-rpc-client-nonce-utils" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f0ab2d1ca3769c5058c689b438d35eb1cb7d2a32fc4b2b7c16fe72fa187927c" +checksum = "2445c0db5d9953012b226dbb060f3ab67b80e92b5262cae10afad2863e72ea94" dependencies = [ "solana-rpc-client", "solana-sdk", @@ -5685,9 +5753,9 @@ dependencies = [ [[package]] name = "solana-runtime" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f579df1ed24b2e7be5c99c2b97cb2a331823008129103b5b7753057ddf3cf7" +checksum = "7a6e9b7b8554f23c62298c13638c1ceed039636c861fc11d6b3cb29503984b1d" dependencies = [ "ahash 0.8.11", "aquamarine", @@ -5774,9 +5842,9 @@ dependencies = [ [[package]] name = "solana-runtime-transaction" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e1757d4473c7a2f462d2ce5f3cb5689145cfbde3a6b12161a49e497633ab85" +checksum = "5fa69ce77907ff4bfb58819f8a5ce7680d2625446d579d100cd353945c85cbeb" dependencies = [ "agave-transaction-view", "log", @@ -5790,15 +5858,15 @@ dependencies = [ [[package]] name = "solana-sanitize" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "203b90994371db8cade8e885f74ec9f68ee02a32b25d514594158b2551a4e5ed" +checksum = "078d05d32ceef29bed59a44ef870adf7261ad99b1adbe4ffe23e2f981856b252" [[package]] name = "solana-sdk" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524604d94185c189616296e5b7da1014cc96d1e446bd2b26f247f00708b9225a" +checksum = "b255c18f83750d26d84b0d5623eb173de78cde45edff818375a864f42264a19a" dependencies = [ "bincode", "bitflags 2.9.0", @@ -5849,6 +5917,7 @@ dependencies = [ "solana-sanitize", "solana-sdk-macro", "solana-secp256k1-recover", + "solana-secp256r1-program", "solana-serde-varint", "solana-short-vec", "solana-signature", @@ -5859,9 +5928,9 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bd2265b93dce9d3dcf9f395abf1a85b5e06e4da4aa60ca147620003ac3abc67" +checksum = "a9c102ed11f8b4b0ab9a9404635b80a8a5c78e1f14aa5831cb1f78b48e5c9f16" dependencies = [ "bs58", "proc-macro2", @@ -5871,9 +5940,9 @@ dependencies = [ [[package]] name = "solana-secp256k1-recover" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2eef5a00a75648273c3fb6e3d85b0c8c02fcc1e36c4271664dcc39b6b128d41" +checksum = "0bfb2bed7da85b4720780b7c288328b5a74050eb7da2392b2d0d8c6e67e0eaff" dependencies = [ "borsh 1.5.7", "libsecp256k1 0.6.0", @@ -5881,6 +5950,20 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "solana-secp256r1-program" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29407abab67e2b814f1e828aa0b7d7a3e4b2f242ed41a69d8d815e48f3363ead" +dependencies = [ + "bytemuck", + "openssl", + "solana-feature-set", + "solana-instruction", + "solana-precompile-error", + "solana-pubkey", +] + [[package]] name = "solana-security-txt" version = "1.1.1" @@ -5889,9 +5972,9 @@ checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" [[package]] name = "solana-send-transaction-service" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dc6adaa31bdaab1e5f8932575e75160f4806553ab5e15e552c258dfe1d5594b" +checksum = "fa2f8c3d580d63477ac6cbc215c8806bb943dd7bfd5050722542d246ef473922" dependencies = [ "crossbeam-channel", "log", @@ -5906,18 +5989,18 @@ dependencies = [ [[package]] name = "solana-serde-varint" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aeb51d3c20e2a61db0ef72617f3b8c9207a342a867af454a95f17add9f6c262" +checksum = "54210a9cdf83e3cbf0ffc1dc8295a55a77bc41284a6585a3461c2b312cf238e3" dependencies = [ "serde", ] [[package]] name = "solana-serialize-utils" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cfb0b57c6a431fb15ff33053caadb6c36aed4e1ce74bea9adfc459a710b3626" +checksum = "b1bf4c8e7669760ee69b1cc2f204620068701dc9f3923d2b518d2bde856c274c" dependencies = [ "solana-instruction", "solana-pubkey", @@ -5926,9 +6009,9 @@ dependencies = [ [[package]] name = "solana-sha256-hasher" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd115f3a1136314b0183235080d29023530c3a0a5df60505fdb7ea620eff9fd6" +checksum = "98fad3fa0864a364481984d646cac28c3fb6f774f8569116a94bc15b8fb8574d" dependencies = [ "sha2 0.10.8", "solana-define-syscall", @@ -5937,18 +6020,18 @@ dependencies = [ [[package]] name = "solana-short-vec" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08e55330b694db1139dcdf2a1ea7781abe8bd994dec2ab29e36abfd06e4e9274" +checksum = "54cfcad114cdac44752604cb6d1d9c38e59f0a35ae4e5a500f6ef7bd9b0b9ede" dependencies = [ "serde", ] [[package]] name = "solana-signature" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad9784d110f195a3a4fe423479d18f05b01a1c380a1430644a3b3038fdbe2f0" +checksum = "a98a0bbb26b622725678b5c83823117fdf841b7fae08b03d69789eb8b94ba523" dependencies = [ "bs58", "ed25519-dalek", @@ -5961,31 +6044,33 @@ dependencies = [ [[package]] name = "solana-slot-hashes" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17d216c0ebf00e95acaf2b1e227e6cc900a5ce50fb81fa0743272851e88a788d" +checksum = "a7f2430f03dd7dcaa0aeb91e1083d9bae9860dc169648e09219dc2acb5d3c412" dependencies = [ "serde", "serde_derive", "solana-hash", + "solana-sysvar-id", ] [[package]] name = "solana-slot-history" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88cbcdf767891c6a40116a5ef8f7241000f074ece4ba80c8f00b4f62705fc8a4" +checksum = "cb21aba20b9feb7619145586eb41b7d2e150d1770f85290fcc1e59dcee5309f8" dependencies = [ "bv", "serde", "serde_derive", + "solana-sysvar-id", ] [[package]] name = "solana-stable-layout" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a5305ca88fb5deb219cd88f04e24f3a131769417d7fcb11a8da1126a8f98d23" +checksum = "bf24e5747d8f57e9f1d0a0792d8f28cefb27a54e222fc5654516b334c5fc4471" dependencies = [ "solana-instruction", "solana-pubkey", @@ -5993,9 +6078,9 @@ dependencies = [ [[package]] name = "solana-stake-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8bb1a59fdd929becddfaed9ec33a1ca4db853f45ae85e14e4f4054a875fc41d" +checksum = "91fd9155ab658e799e2aad8a5c866958394ed80bec43393d8a1c1baf4a0b3b5f" dependencies = [ "bincode", "log", @@ -6010,9 +6095,9 @@ dependencies = [ [[package]] name = "solana-streamer" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff771524872781eca074e0ba221d72b07fa0800cc1a7ffa400a9eb3e125fb922" +checksum = "b05259f74d7478fc7c582caae3957ab51ab533646b16e9a32dd435a08868a956" dependencies = [ "async-channel", "bytes", @@ -6048,9 +6133,9 @@ dependencies = [ [[package]] name = "solana-svm" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f3b139a001effc93295b693437013f365785fab04dcf2fa679164af4206ec8" +checksum = "4045fa0ab009043e8637cf91a559c31a8adf69c2ff37ea99a4acb536eee8a5c1" dependencies = [ "itertools 0.12.1", "log", @@ -6078,27 +6163,27 @@ dependencies = [ [[package]] name = "solana-svm-rent-collector" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e7068d6cc69c730190c96b87b106afd42cde203cf56164106792778cd0aaeb" +checksum = "f706d930e1d3f7c2842f5cb693a82e36282c42a58f6f2d2f23fd3343160d1bee" dependencies = [ "solana-sdk", ] [[package]] name = "solana-svm-transaction" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38a8533576cb7beca4a44b976ac27df9865bbf8c4cbca2ee8f4f3469cdd8175f" +checksum = "8902209a34c413f1c7ff3b207661d2651c26e369405f7cf6bcf2f7d1ec8d4f3b" dependencies = [ "solana-sdk", ] [[package]] name = "solana-system-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "242634cdc1eacaa83738cc100fdd583eb88f99cc2edcc900c8ebe57d77af51b1" +checksum = "9825034f859142f6ff4dc51d614653bad91ee5a1786f7701d626010c34d0034a" dependencies = [ "bincode", "log", @@ -6110,11 +6195,20 @@ dependencies = [ "solana-type-overrides", ] +[[package]] +name = "solana-sysvar-id" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc3d7b31a88059e9e7b0e6a3c355f911a765e5e30f3b4556a80ecd5eeebfd96" +dependencies = [ + "solana-pubkey", +] + [[package]] name = "solana-thin-client" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10314ae3e0889cf38140902862d2c2ea481895c82c19f51dc4457b7dfa3aa6d0" +checksum = "71dec075f921639dac3dd922ab18ebfa809330083a999fd4ab0a86dd401529db" dependencies = [ "bincode", "log", @@ -6127,9 +6221,9 @@ dependencies = [ [[package]] name = "solana-timings" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a8e2f926d488c1e2a65cbc05544dcb68cfa88deb4d50f89db5bfbda7ff2419" +checksum = "63b3873609ffe9b9ceb97349cd7e28cf4f81965ce4051ad2d4bae4fde4ff198f" dependencies = [ "eager", "enum-iterator", @@ -6138,9 +6232,9 @@ dependencies = [ [[package]] name = "solana-tpu-client" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516cbed8800cd36fb3ecc9a65df1e76bf8251929aa32e9b10497e8d6612de605" +checksum = "c2495e3d2a434c77c42a69f5a8c67f1a19b97bde1b178af904afcd24483701c5" dependencies = [ "async-trait", "bincode", @@ -6161,9 +6255,9 @@ dependencies = [ [[package]] name = "solana-transaction-error" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a4bea6d80b34fe6e785d19bf928fe103928d1f6c9935ec23bb6a9d4d7a33d2" +checksum = "a5b8fd565f33e5595802fa73401ce2fecd3bb6a04ba1ee9ce0f614fa31e19f4d" dependencies = [ "serde", "serde_derive", @@ -6173,9 +6267,9 @@ dependencies = [ [[package]] name = "solana-transaction-metrics-tracker" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b668c986a83e6b2eb8f130039045b54abc37ee821853250755386d26c1c668" +checksum = "e1b36a8b4c7c389459e351ef00b417071b9ca642e61ef6f248e7c0510025144c" dependencies = [ "base64 0.22.1", "bincode", @@ -6189,9 +6283,9 @@ dependencies = [ [[package]] name = "solana-transaction-status" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e8ed5bf2511c45b923de25482407c9a2eb56af73dba52c19db76df4dd35cba" +checksum = "b138ec46ceb38ff12baf73e543f1ce0b17e9dfd0c190dedc7692f3087baff36c" dependencies = [ "Inflector", "base64 0.22.1", @@ -6217,9 +6311,9 @@ dependencies = [ [[package]] name = "solana-transaction-status-client-types" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb35fb678fec581e9bdf6350d2c7f5829951a6280038fc06949b1589a9605e1" +checksum = "e5db403124c4273bcade8bf7480e2b32a9d95b704007724f88d1231e3fe8de9f" dependencies = [ "base64 0.22.1", "bincode", @@ -6235,9 +6329,9 @@ dependencies = [ [[package]] name = "solana-type-overrides" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2066f25d460d63801f91436c2640aaba4f2dc95aa18fe1e76f7f2c063e981d4e" +checksum = "0820dae5ea28d14f3397a3fb916e5aee53c4b20e08ad94bde9135583cce37bb6" dependencies = [ "lazy_static", "rand 0.8.5", @@ -6245,9 +6339,9 @@ dependencies = [ [[package]] name = "solana-udp-client" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ec0cbc2d5e3379fafb2c1493f2358f07c09e76e2081c44e3a8c36da12fbd40" +checksum = "5b18ba83acfc0480d38edddeb9ae9f0c8ccc14ed0674c2b61ca2f098f27417b6" dependencies = [ "async-trait", "solana-connection-cache", @@ -6260,9 +6354,9 @@ dependencies = [ [[package]] name = "solana-version" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7310708b642fb83c04f44934509f4f149ffd69d0cd4cf76d9645c991177d7ea0" +checksum = "f1648d5c60517387ff3dd202313834ddd5adc8ae65d2cc7aebe237bb6baa5707" dependencies = [ "semver", "serde", @@ -6274,9 +6368,9 @@ dependencies = [ [[package]] name = "solana-vote" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab46788981765ee706094ca53ad8421aae0286a6b948e892fa7db88992a5373" +checksum = "3742275b2b34421e0ce0418ed1f26ddd0145030a6cf7252db75e40a22be9ecf2" dependencies = [ "itertools 0.12.1", "log", @@ -6288,9 +6382,9 @@ dependencies = [ [[package]] name = "solana-vote-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637cadc921725d1804a451ea7d2dff83310a12b75e0b6c83a8bb67ebc02d10f1" +checksum = "9cb613a1c15df1e1a67bc748fa9703caeda13321b4205e1036a9b905dcf99484" dependencies = [ "bincode", "log", @@ -6308,9 +6402,9 @@ dependencies = [ [[package]] name = "solana-zk-elgamal-proof-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47f5ac026a972c9cbc6bd0f72f692f85ff9ceec961fc4bcb1f2550e6387e962c" +checksum = "6ca4c74a4ed3fb456292142125e19a72b1cb6c5cd29da557bf4d239cac8552c5" dependencies = [ "bytemuck", "num-derive 0.4.2", @@ -6323,9 +6417,9 @@ dependencies = [ [[package]] name = "solana-zk-sdk" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18c2d96f65cb033f4dc16d3a1b085f8af0ea38012c514a8f65b9b6d75bc9339f" +checksum = "b979adbd419c767d504eaaea57d50ab4401b3f4ebf4f5a19dd3e1a92abd814a0" dependencies = [ "aes-gcm-siv", "base64 0.22.1", @@ -6355,9 +6449,9 @@ dependencies = [ [[package]] name = "solana-zk-token-proof-program" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83029f0fac09633fc4463dd5a7d13959d1825dccf77889c6e617e2b1265fb2f1" +checksum = "4c29da28a4200646d108aae332cd9fc503a417cab6a1ba2ce22b31d196f00008" dependencies = [ "bytemuck", "num-derive 0.4.2", @@ -6371,9 +6465,9 @@ dependencies = [ [[package]] name = "solana-zk-token-sdk" -version = "2.1.0" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed293089d8eebd6b5c1b53ee4ad6817889fea254274ddb34cb01ad35a2f817cb" +checksum = "f71c422b5e52e2bae8d0a5bdf0431c1b8c3d6a15d86745808a6d0339d456bedf" dependencies = [ "aes-gcm-siv", "base64 0.22.1", @@ -7946,6 +8040,12 @@ dependencies = [ "sval_serde", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "vec_map" version = "0.8.2" diff --git a/Cargo.toml b/Cargo.toml index aa4f30b19..681c1be6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,17 +12,17 @@ members = [ # ] [workspace.dependencies] -solana-cli-output = "=2.1.0" -solana-client = "=2.1.0" -solana-sdk = "=2.1.0" -solana-logger = "=2.1.0" -solana-program = "=2.1.0" -solana-program-test = "=2.1.0" -solana-account-decoder = "=2.1.0" -# solana-measure = "=2.1.0" -# solana-metrics = "=2.1.0" -# solana-transaction-status = "=2.1.0" -# solana-address-lookup-table-program = "=2.1.0" +solana-cli-output = "=2.1.20" +solana-client = "=2.1.20" +solana-sdk = "=2.1.20" +solana-logger = "=2.1.20" +solana-program = "=2.1.20" +solana-program-test = "=2.1.20" +solana-account-decoder = "=2.1.20" +# solana-measure = "=2.1.20" +# solana-metrics = "=2.1.20" +# solana-transaction-status = "=2.1.20" +# solana-address-lookup-table-program = "=2.1.20" spl-token = "8.0.0" # spl-associated-token-account = "2.2.0" spl-transfer-hook-interface = "0.9.0" @@ -30,9 +30,9 @@ spl-tlv-account-resolution = "0.9.0" # spl-discriminator = "0.2.2" spl-token-2022 = { version = "7.0.0", features = ["no-entrypoint"] } -anchor-lang = { version = "0.31.0" } -anchor-spl = { version = "0.31.0", features = ["token_2022"] } -anchor-client = { version = "0.31.0" } +anchor-lang = { version = "0.31.1" } +anchor-spl = { version = "0.31.1", features = ["token_2022"] } +anchor-client = { version = "0.31.1" } fixtures = { path = "test-utils", package = "test-utilities" } marginfi = { path = "programs/marginfi", package = "marginfi" } @@ -70,12 +70,12 @@ codegen-units = 8 ## Notes for usable lockfile generation in Solana land -# Patch a version of half compatabile with fixed and Rust <=1.79: +# OUTDATED Patch a version of half compatabile with fixed and Rust <=1.79: # cargo update -p half --precise 2.4.1 # -# Patch zerofrom and litemap: +# OUTDATED Patch zerofrom and litemap: # cargo update -p zerofrom --precise 0.1.5 # cargo update -p litemap --precise 0.7.4 ## To fix the Anchor idl generation bug: -# cargo update -p proc-macro2 --precise 1.0.94 \ No newline at end of file +# cargo update -p proc-macro2 --precise 1.0.95 \ No newline at end of file diff --git a/programs/marginfi/src/instructions/marginfi_account/flashloan.rs b/programs/marginfi/src/instructions/marginfi_account/flashloan.rs index 48085f850..397891581 100644 --- a/programs/marginfi/src/instructions/marginfi_account/flashloan.rs +++ b/programs/marginfi/src/instructions/marginfi_account/flashloan.rs @@ -5,11 +5,11 @@ use crate::{ MarginfiAccount, RiskEngine, ACCOUNT_DISABLED, ACCOUNT_IN_FLASHLOAN, }, }; +use anchor_lang::prelude::*; use anchor_lang::solana_program::{ instruction::{get_stack_height, TRANSACTION_LEVEL_STACK_HEIGHT}, sysvar::{self, instructions}, }; -use anchor_lang::{prelude::*, Discriminator}; pub fn lending_account_start_flashloan( ctx: Context, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 628740b12..1de01fa45 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.79.0" +channel = "1.81.0" From 498b3518ee097ae4b5a6c36dd540450ab7258abe Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Tue, 22 Apr 2025 23:47:14 -0400 Subject: [PATCH 32/38] Fix CI pipeline attempt 1 --- .github/workflows/test.yaml | 14 ++--- test-utils/Cargo.toml | 1 - test-utils/src/bank.rs | 2 - test-utils/src/utils.rs | 106 ++++++++++++++++++------------------ 4 files changed, 60 insertions(+), 63 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e5410e121..9ca340ce9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,9 +14,9 @@ defaults: working-directory: . env: - RUST_TOOLCHAIN: 1.79.0 - SOLANA_CLI_VERSION: 2.1.0 - ANCHOR_CLI_VERSION: 0.31.0 + RUST_TOOLCHAIN: 1.81.0 + SOLANA_CLI_VERSION: 2.1.20 + ANCHOR_CLI_VERSION: 0.31.1 ANCHOR_SHA: e6d7dafe12da661a36ad1b4f3b5970e8986e5321 CARGO_TERM_COLOR: always @@ -129,19 +129,19 @@ jobs: - uses: ./.github/actions/setup-common/ - uses: ./.github/actions/setup-anchor-cli/ - + - name: Install Node.js dependencies run: yarn install + - name: Build transfer hook program + run: anchor build -p test_transfer_hook --no-idl + - name: Build marginfi program run: anchor build -p marginfi -- --no-default-features - name: Build mocks program run: anchor build -p mocks - - name: Build transfer hook program - run: anchor build -p test_transfer_hook --no-idl - # Handles extraneous (os error 2) that appears during testing in some versions of solana. See: # https://solana.stackexchange.com/questions/1648/error-no-such-file-or-directory-os-error-2-error-from-anchor-test - name: Run Anchor tests diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index bdf97bdcc..2f6611807 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -46,7 +46,6 @@ transfer_hook = { workspace = true, package = "test_transfer_hook", features = [ "no-entrypoint", ] } - # [dependencies.liquidity-incentive-program] # path = "../programs/liquidity-incentive-program" # optional = true diff --git a/test-utils/src/bank.rs b/test-utils/src/bank.rs index 2960317f1..4d874bf45 100644 --- a/test-utils/src/bank.rs +++ b/test-utils/src/bank.rs @@ -22,8 +22,6 @@ use solana_program::instruction::Instruction; use solana_program::sysvar::clock::Clock; use solana_program_test::BanksClientError; use solana_program_test::ProgramTestContext; -#[cfg(feature = "lip")] -use solana_sdk::signature::Keypair; use solana_sdk::{signer::Signer, transaction::Transaction}; use std::{cell::RefCell, fmt::Debug, rc::Rc}; diff --git a/test-utils/src/utils.rs b/test-utils/src/utils.rs index 370d50d7b..66e222eb0 100644 --- a/test-utils/src/utils.rs +++ b/test-utils/src/utils.rs @@ -403,56 +403,56 @@ pub fn get_sufficient_collateral_for_outflow( target_outflow * outflow_mint_price / collateral_mint_price } -#[cfg(feature = "lip")] -pub mod lip { - use super::*; - pub fn get_reward_vault_address(campaign_key: Pubkey) -> (Pubkey, u8) { - Pubkey::find_program_address( - &[ - liquidity_incentive_program::constants::CAMPAIGN_SEED.as_bytes(), - campaign_key.as_ref(), - ], - &liquidity_incentive_program::id(), - ) - } - - pub fn get_reward_vault_authority(campaign_key: Pubkey) -> (Pubkey, u8) { - Pubkey::find_program_address( - &[ - liquidity_incentive_program::constants::CAMPAIGN_AUTH_SEED.as_bytes(), - campaign_key.as_ref(), - ], - &liquidity_incentive_program::id(), - ) - } - - pub fn get_temp_token_account_authority(deposit_key: Pubkey) -> (Pubkey, u8) { - Pubkey::find_program_address( - &[ - liquidity_incentive_program::constants::TEMP_TOKEN_ACCOUNT_AUTH_SEED.as_bytes(), - deposit_key.as_ref(), - ], - &liquidity_incentive_program::id(), - ) - } - - pub fn get_deposit_mfi_authority(deposit_key: Pubkey) -> (Pubkey, u8) { - Pubkey::find_program_address( - &[ - liquidity_incentive_program::constants::DEPOSIT_MFI_AUTH_SIGNER_SEED.as_bytes(), - deposit_key.as_ref(), - ], - &liquidity_incentive_program::id(), - ) - } - - pub fn get_marginfi_account_address(deposit_key: Pubkey) -> (Pubkey, u8) { - Pubkey::find_program_address( - &[ - liquidity_incentive_program::constants::MARGINFI_ACCOUNT_SEED.as_bytes(), - deposit_key.as_ref(), - ], - &liquidity_incentive_program::id(), - ) - } -} +// #[cfg(feature = "lip")] +// pub mod lip { +// use super::*; +// pub fn get_reward_vault_address(campaign_key: Pubkey) -> (Pubkey, u8) { +// Pubkey::find_program_address( +// &[ +// liquidity_incentive_program::constants::CAMPAIGN_SEED.as_bytes(), +// campaign_key.as_ref(), +// ], +// &liquidity_incentive_program::id(), +// ) +// } + +// pub fn get_reward_vault_authority(campaign_key: Pubkey) -> (Pubkey, u8) { +// Pubkey::find_program_address( +// &[ +// liquidity_incentive_program::constants::CAMPAIGN_AUTH_SEED.as_bytes(), +// campaign_key.as_ref(), +// ], +// &liquidity_incentive_program::id(), +// ) +// } + +// pub fn get_temp_token_account_authority(deposit_key: Pubkey) -> (Pubkey, u8) { +// Pubkey::find_program_address( +// &[ +// liquidity_incentive_program::constants::TEMP_TOKEN_ACCOUNT_AUTH_SEED.as_bytes(), +// deposit_key.as_ref(), +// ], +// &liquidity_incentive_program::id(), +// ) +// } + +// pub fn get_deposit_mfi_authority(deposit_key: Pubkey) -> (Pubkey, u8) { +// Pubkey::find_program_address( +// &[ +// liquidity_incentive_program::constants::DEPOSIT_MFI_AUTH_SIGNER_SEED.as_bytes(), +// deposit_key.as_ref(), +// ], +// &liquidity_incentive_program::id(), +// ) +// } + +// pub fn get_marginfi_account_address(deposit_key: Pubkey) -> (Pubkey, u8) { +// Pubkey::find_program_address( +// &[ +// liquidity_incentive_program::constants::MARGINFI_ACCOUNT_SEED.as_bytes(), +// deposit_key.as_ref(), +// ], +// &liquidity_incentive_program::id(), +// ) +// } +// } From 331a10303f8555cdaf365cf4a8eeaf22941c5574 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 23 Apr 2025 00:16:04 -0400 Subject: [PATCH 33/38] Fix CI pipeline attempt 2 --- .github/workflows/test.yaml | 18 +-- test-utils/src/spl.rs | 222 ++++++++++++++++--------------- tests/utils/tools.ts | 1 + tests/utils/user-instructions.ts | 11 -- 4 files changed, 115 insertions(+), 137 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9ca340ce9..9bad2880a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -125,7 +125,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: "20.10.0" + node-version: "23.0.0" - uses: ./.github/actions/setup-common/ - uses: ./.github/actions/setup-anchor-cli/ @@ -168,19 +168,3 @@ jobs: echo "Test run completed successfully without extraneous errors." exit 0 fi - - # - name: Start Solana Test Validator - # run: | - # solana-test-validator --reset --limit-ledger-size 1000 \ - - # - name: Wait for Validator to Start - # run: sleep 60 - - # - name: Deploy Liquidity Incentive Program - # run: solana program deploy --program-id Lip1111111111111111111111111111111111111111 target/deploy/liquidity_incentive_program.so - - # - name: Deploy Marginfi Program - # run: solana program deploy --program-id 2jGhuVUuy3umdzByFx8sNWUAaf5vaeuDm78RDPEnhrMr target/deploy/marginfi.so - - # - name: Deploy Mocks Program - # run: solana program deploy --program-id 5XaaR94jBubdbrRrNW7DtRvZeWvLhSHkEGU3jHTEXV3C target/deploy/mocks.so diff --git a/test-utils/src/spl.rs b/test-utils/src/spl.rs index 249364eba..941bb86a3 100644 --- a/test-utils/src/spl.rs +++ b/test-utils/src/spl.rs @@ -37,6 +37,7 @@ use spl_transfer_hook_interface::{ get_extra_account_metas_address, instruction::initialize_extra_account_meta_list, }; use std::{cell::RefCell, fs::File, io::Read, path::PathBuf, rc::Rc, str::FromStr}; +use transfer_hook::TEST_HOOK_ID; #[derive(Clone)] pub struct MintFixture { @@ -105,103 +106,106 @@ impl MintFixture { } } - // pub async fn new_token_22( - // ctx: Rc>, - // mint_keypair: Option, - // mint_decimals: Option, - // extensions: &[SupportedExtension], - // ) -> MintFixture { - // let ctx_ref = Rc::clone(&ctx); - // let keypair = mint_keypair.unwrap_or_else(Keypair::new); - // let program = token_2022::ID; - // let mint = { - // let mut ctx = ctx.borrow_mut(); - - // let rent = ctx.banks_client.get_rent().await.unwrap(); - - // let extension_types = SupportedExtension::types(extensions.iter()); - // let len = ExtensionType::try_calculate_account_len::( - // &extension_types, - // ) - // .unwrap(); - // let init_account_ix = create_account( - // &ctx.payer.pubkey(), - // &keypair.pubkey(), - // rent.minimum_balance(len), - // len as u64, - // &program, - // ); - // let init_mint_ix = spl_token_2022::instruction::initialize_mint( - // &program, - // &keypair.pubkey(), - // &ctx.payer.pubkey(), - // None, - // mint_decimals.unwrap_or(6), - // ) - // .unwrap(); - - // let mut ixs = vec![init_account_ix]; - // ixs.extend( - // extensions - // .iter() - // .map(|e| e.instruction(&keypair.pubkey(), &ctx.payer.pubkey())), - // ); - // ixs.push(init_mint_ix); - // let extra_metas_address = get_extra_account_metas_address( - // &keypair.pubkey(), - // &super::transfer_hook::TEST_HOOK_ID, - // ); - // if extensions.contains(&SupportedExtension::TransferHook) { - // ixs.push(system_instruction::transfer( - // &ctx.payer.pubkey(), - // &extra_metas_address, - // 10 * LAMPORTS_PER_SOL, - // )); - // ixs.push(initialize_extra_account_meta_list( - // &super::transfer_hook::TEST_HOOK_ID, - // &extra_metas_address, - // &keypair.pubkey(), - // &ctx.payer.pubkey(), - // &[], - // )) - // } - - // let tx = Transaction::new_signed_with_payer( - // &ixs, - // Some(&ctx.payer.pubkey()), - // &[&ctx.payer, &keypair], - // ctx.last_blockhash, - // ); - - // ctx.banks_client.process_transaction_with_preflight_and_commitment(tx).await.unwrap(); - - // if extensions.contains(&SupportedExtension::TransferHook) { - // ctx.banks_client - // .get_account(extra_metas_address) - // .await - // .unwrap() - // .unwrap(); - // } - - // let mint_account = ctx - // .banks_client - // .get_account(keypair.pubkey()) - // .await - // .unwrap() - // .unwrap(); - - // StateWithExtensionsOwned::::unpack(mint_account.data) - // .unwrap() - // .base - // }; - - // MintFixture { - // ctx: ctx_ref, - // key: keypair.pubkey(), - // mint, - // token_program: token_2022::ID, - // } - // } + pub async fn new_token_22( + ctx: Rc>, + mint_keypair: Option, + mint_decimals: Option, + extensions: &[SupportedExtension], + ) -> MintFixture { + let ctx_ref = Rc::clone(&ctx); + let keypair = mint_keypair.unwrap_or_else(Keypair::new); + let program = token_2022::ID; + let mint = { + let mut ctx = ctx.borrow_mut(); + + let rent = ctx.banks_client.get_rent().await.unwrap(); + + let extension_types = SupportedExtension::types(extensions.iter()); + let len = ExtensionType::try_calculate_account_len::( + &extension_types, + ) + .unwrap(); + let init_account_ix = create_account( + &ctx.payer.pubkey(), + &keypair.pubkey(), + rent.minimum_balance(len), + len as u64, + &program, + ); + let init_mint_ix = spl_token_2022::instruction::initialize_mint( + &program, + &keypair.pubkey(), + &ctx.payer.pubkey(), + None, + mint_decimals.unwrap_or(6), + ) + .unwrap(); + + let mut ixs = vec![init_account_ix]; + ixs.extend( + extensions + .iter() + .map(|e| e.instruction(&keypair.pubkey(), &ctx.payer.pubkey())), + ); + ixs.push(init_mint_ix); + let extra_metas_address = get_extra_account_metas_address( + &keypair.pubkey(), + &super::transfer_hook::TEST_HOOK_ID, + ); + if extensions.contains(&SupportedExtension::TransferHook) { + ixs.push(system_instruction::transfer( + &ctx.payer.pubkey(), + &extra_metas_address, + 10 * LAMPORTS_PER_SOL, + )); + ixs.push(initialize_extra_account_meta_list( + &super::transfer_hook::TEST_HOOK_ID, + &extra_metas_address, + &keypair.pubkey(), + &ctx.payer.pubkey(), + &[], + )) + } + + let tx = Transaction::new_signed_with_payer( + &ixs, + Some(&ctx.payer.pubkey()), + &[&ctx.payer, &keypair], + ctx.last_blockhash, + ); + + ctx.banks_client + .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) + .await + .unwrap(); + + if extensions.contains(&SupportedExtension::TransferHook) { + ctx.banks_client + .get_account(extra_metas_address) + .await + .unwrap() + .unwrap(); + } + + let mint_account = ctx + .banks_client + .get_account(keypair.pubkey()) + .await + .unwrap() + .unwrap(); + + StateWithExtensionsOwned::::unpack(mint_account.data) + .unwrap() + .base + }; + + MintFixture { + ctx: ctx_ref, + key: keypair.pubkey(), + mint, + token_program: token_2022::ID, + } + } pub fn new_from_file( ctx: &Rc>, @@ -653,7 +657,7 @@ pub enum SupportedExtension { MintCloseAuthority, InterestBearing, PermanentDelegate, - // TransferHook, + TransferHook, TransferFee, } @@ -685,15 +689,15 @@ impl SupportedExtension { ) .unwrap() } - // Self::TransferHook => { - // spl_token_2022::extension::transfer_hook::instruction::initialize( - // &token_2022::ID, - // mint, - // Some(*key), - // Some(TEST_HOOK_ID), - // ) - // .unwrap() - // } + Self::TransferHook => { + spl_token_2022::extension::transfer_hook::instruction::initialize( + &token_2022::ID, + mint, + Some(*key), + Some(TEST_HOOK_ID), + ) + .unwrap() + } Self::TransferFee => { spl_token_2022::extension::transfer_fee::instruction::initialize_transfer_fee_config( &token_2022::ID, @@ -713,7 +717,7 @@ impl SupportedExtension { SupportedExtension::MintCloseAuthority => pod_get_packed_len::(), SupportedExtension::InterestBearing => pod_get_packed_len::(), SupportedExtension::PermanentDelegate => pod_get_packed_len::(), - // SupportedExtension::TransferHook => pod_get_packed_len::(), + SupportedExtension::TransferHook => pod_get_packed_len::(), SupportedExtension::TransferFee => pod_get_packed_len::(), }) .sum() @@ -724,7 +728,7 @@ impl SupportedExtension { SupportedExtension::MintCloseAuthority => ExtensionType::MintCloseAuthority, SupportedExtension::InterestBearing => ExtensionType::InterestBearingConfig, SupportedExtension::PermanentDelegate => ExtensionType::PermanentDelegate, - // SupportedExtension::TransferHook => ExtensionType::TransferHook, + SupportedExtension::TransferHook => ExtensionType::TransferHook, SupportedExtension::TransferFee => ExtensionType::TransferFeeConfig, }) .collect() diff --git a/tests/utils/tools.ts b/tests/utils/tools.ts index c73355f64..4df530fcd 100644 --- a/tests/utils/tools.ts +++ b/tests/utils/tools.ts @@ -1,3 +1,4 @@ +import { PublicKey } from "@solana/web3.js"; import { BanksTransactionResultWithMeta } from "solana-bankrun"; /** diff --git a/tests/utils/user-instructions.ts b/tests/utils/user-instructions.ts index 17b6d9d12..ec5711dbd 100644 --- a/tests/utils/user-instructions.ts +++ b/tests/utils/user-instructions.ts @@ -2,7 +2,6 @@ import { BN, Program } from "@coral-xyz/anchor"; import { AccountMeta, PublicKey } from "@solana/web3.js"; import { Marginfi } from "../../target/types/marginfi"; import { TOKEN_PROGRAM_ID } from "@solana/spl-token"; -import { deriveLiquidityVault } from "./pdas"; export type AccountInitArgs = { marginfiGroup: PublicKey; @@ -360,11 +359,6 @@ export const liquidateIx = ( args: LiquidateIxArgs ) => { const oracleMeta: AccountMeta[] = args.remaining.map((pubkey) => { - if (!(pubkey instanceof PublicKey)) { - console.warn("Invalid remaining key:", pubkey); - // throw new Error("remaining contains invalid keys"); - } - return { pubkey, isSigner: false, isWritable: false }; }); @@ -402,11 +396,6 @@ export const healthPulse = ( args: HealthPulseArgs ) => { const oracleMeta: AccountMeta[] = args.remaining.map((pubkey) => { - if (!(pubkey instanceof PublicKey)) { - console.warn("Invalid remaining key:", pubkey); - // throw new Error("remaining contains invalid keys"); - } - return { pubkey, isSigner: false, isWritable: false }; }); From 4371fc770649fe0b1f49f901ecf2189151692f86 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 23 Apr 2025 00:55:03 -0400 Subject: [PATCH 34/38] The triumphant return of test transfer hook and token22 fixtures to the primary rust test suite, --- .github/workflows/test.yaml | 2 +- programs/marginfi/fuzz/Cargo.lock | 4013 ++++++++++------- programs/marginfi/fuzz/Cargo.toml | 18 +- programs/marginfi/fuzz/src/account_state.rs | 5 +- programs/marginfi/src/constants.rs | 2 +- .../instructions/marginfi_account/deposit.rs | 4 +- .../marginfi_account/pulse_health.rs | 2 +- .../instructions/marginfi_account/repay.rs | 2 +- .../instructions/marginfi_account/withdraw.rs | 2 +- .../tests/admin_actions/account_transfer.rs | 2 +- .../tests/admin_actions/bankruptcy.rs | 24 +- .../tests/admin_actions/interest_accrual.rs | 4 +- .../tests/admin_actions/setup_bank.rs | 24 +- .../tests/admin_actions/withdraw_fees.rs | 8 +- .../marginfi/tests/user_actions/borrow.rs | 12 +- .../tests/user_actions/close_balance.rs | 2 +- .../marginfi/tests/user_actions/deposit.rs | 148 +- .../marginfi/tests/user_actions/flash_loan.rs | 10 +- .../marginfi/tests/user_actions/liquidate.rs | 12 +- programs/marginfi/tests/user_actions/mod.rs | 458 +- programs/marginfi/tests/user_actions/repay.rs | 14 +- .../marginfi/tests/user_actions/withdraw.rs | 18 +- programs/test_transfer_hook/src/lib.rs | 2 +- rust-toolchain.toml | 2 +- test-utils/src/bank.rs | 66 +- test-utils/src/lib.rs | 3 - test-utils/src/lip.rs | 159 - test-utils/src/marginfi_account.rs | 180 +- test-utils/src/marginfi_group.rs | 6 +- test-utils/src/spl.rs | 16 +- test-utils/src/test.rs | 91 +- test-utils/src/utils.rs | 54 - tests/utils/tools.ts | 1 - 33 files changed, 2992 insertions(+), 2374 deletions(-) delete mode 100644 test-utils/src/lip.rs diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9bad2880a..40d4e9bc6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,7 +14,7 @@ defaults: working-directory: . env: - RUST_TOOLCHAIN: 1.81.0 + RUST_TOOLCHAIN: 1.79.0 SOLANA_CLI_VERSION: 2.1.20 ANCHOR_CLI_VERSION: 0.31.1 ANCHOR_SHA: e6d7dafe12da661a36ad1b4f3b5970e8986e5321 diff --git a/programs/marginfi/fuzz/Cargo.lock b/programs/marginfi/fuzz/Cargo.lock index 659222c29..95d78b7e0 100644 --- a/programs/marginfi/fuzz/Cargo.lock +++ b/programs/marginfi/fuzz/Cargo.lock @@ -27,32 +27,38 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aead" -version = "0.4.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ + "crypto-common", "generic-array", ] [[package]] name = "aes" -version = "0.7.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", "cpufeatures", - "opaque-debug", ] [[package]] name = "aes-gcm-siv" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589c637f0e68c877bbd59a4599bbe849cac8e5f3e4b5a3ebae8f528cd218dcdc" +checksum = "ae0784134ba9375416d469ec31e7c5f9fa94405049cf08c5ce5b4698be673e0d" dependencies = [ "aead", "aes", @@ -63,6 +69,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "agave-transaction-view" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383582a0ebe68832ed6a2d6460768a3f54fd61d23cd733c439aa65c6609b550b" +dependencies = [ + "solana-sdk", + "solana-svm-transaction", +] + [[package]] name = "ahash" version = "0.7.8" @@ -96,12 +112,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "aliasable" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" - [[package]] name = "alloc-no-stdlib" version = "2.0.4" @@ -119,22 +129,11 @@ dependencies = [ [[package]] name = "anchor-attribute-access-control" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f619f1d04f53621925ba8a2e633ba5a6081f2ae14758cbb67f38fd823e0a3e" -dependencies = [ - "anchor-syn 0.29.0", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-access-control" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "3f70fd141a4d18adf11253026b32504f885447048c7494faf5fa83b01af9c0cf" dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "proc-macro2", "quote", "syn 1.0.109", @@ -142,24 +141,12 @@ dependencies = [ [[package]] name = "anchor-attribute-account" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f2a3e1df4685f18d12a943a9f2a7456305401af21a07c9fe076ef9ecd6e400" -dependencies = [ - "anchor-syn 0.29.0", - "bs58 0.5.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-account" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "715a261c57c7679581e06f07a74fa2af874ac30f86bd8ea07cca4a7e5388a064" dependencies = [ - "anchor-syn 0.30.1", - "bs58 0.5.1", + "anchor-syn", + "bs58", "proc-macro2", "quote", "syn 1.0.109", @@ -167,64 +154,33 @@ dependencies = [ [[package]] name = "anchor-attribute-constant" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9423945cb55627f0b30903288e78baf6f62c6c8ab28fb344b6b25f1ffee3dca7" -dependencies = [ - "anchor-syn 0.29.0", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-constant" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "730d6df8ae120321c5c25e0779e61789e4b70dc8297102248902022f286102e4" dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "quote", "syn 1.0.109", ] [[package]] name = "anchor-attribute-error" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ed12720033cc3c3bf3cfa293349c2275cd5ab99936e33dd4bf283aaad3e241" -dependencies = [ - "anchor-syn 0.29.0", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "27e6e449cc3a37b2880b74dcafb8e5a17b954c0e58e376432d7adc646fb333ef" dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "quote", "syn 1.0.109", ] [[package]] name = "anchor-attribute-event" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eef4dc0371eba2d8c8b54794b0b0eb786a234a559b77593d6f80825b6d2c77a2" -dependencies = [ - "anchor-syn 0.29.0", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "d7710e4c54adf485affcd9be9adec5ef8846d9c71d7f31e16ba86ff9fc1dd49f" dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "proc-macro2", "quote", "syn 1.0.109", @@ -232,24 +188,14 @@ dependencies = [ [[package]] name = "anchor-attribute-program" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b18c4f191331e078d4a6a080954d1576241c29c56638783322a18d308ab27e4f" -dependencies = [ - "anchor-syn 0.29.0", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "05ecfd49b2aeadeb32f35262230db402abed76ce87e27562b34f61318b2ec83c" dependencies = [ "anchor-lang-idl", - "anchor-syn 0.30.1", + "anchor-syn", "anyhow", - "bs58 0.5.1", + "bs58", "heck 0.3.3", "proc-macro2", "quote", @@ -259,45 +205,23 @@ dependencies = [ [[package]] name = "anchor-derive-accounts" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de10d6e9620d3bcea56c56151cad83c5992f50d5960b3a9bebc4a50390ddc3c" +checksum = "be89d160793a88495af462a7010b3978e48e30a630c91de47ce2c1d3cb7a6149" dependencies = [ - "anchor-syn 0.29.0", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" -dependencies = [ - "anchor-syn 0.30.1", + "anchor-syn", "quote", "syn 1.0.109", ] [[package]] name = "anchor-derive-serde" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e2e5be518ec6053d90a2a7f26843dbee607583c779e6c8395951b9739bdfbe" +checksum = "abc6ee78acb7bfe0c2dd2abc677aaa4789c0281a0c0ef01dbf6fe85e0fd9e6e4" dependencies = [ - "anchor-syn 0.29.0", - "borsh-derive-internal 0.10.3", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-derive-serde" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" -dependencies = [ - "anchor-syn 0.30.1", - "borsh-derive-internal 0.10.3", + "anchor-syn", + "borsh-derive-internal", "proc-macro2", "quote", "syn 1.0.109", @@ -305,19 +229,9 @@ dependencies = [ [[package]] name = "anchor-derive-space" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecc31d19fa54840e74b7a979d44bcea49d70459de846088a1d71e87ba53c419" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-derive-space" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "134a01c0703f6fd355a0e472c033f6f3e41fac1ef6e370b20c50f4c8d022cea7" dependencies = [ "proc-macro2", "quote", @@ -326,57 +240,32 @@ dependencies = [ [[package]] name = "anchor-lang" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35da4785497388af0553586d55ebdc08054a8b1724720ef2749d313494f2b8ad" -dependencies = [ - "anchor-attribute-access-control 0.29.0", - "anchor-attribute-account 0.29.0", - "anchor-attribute-constant 0.29.0", - "anchor-attribute-error 0.29.0", - "anchor-attribute-event 0.29.0", - "anchor-attribute-program 0.29.0", - "anchor-derive-accounts 0.29.0", - "anchor-derive-serde 0.29.0", - "anchor-derive-space 0.29.0", - "arrayref", - "base64 0.13.1", - "bincode", - "borsh 0.10.3", - "bytemuck", - "getrandom 0.2.15", - "solana-program", - "thiserror", -] - -[[package]] -name = "anchor-lang" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" -dependencies = [ - "anchor-attribute-access-control 0.30.1", - "anchor-attribute-account 0.30.1", - "anchor-attribute-constant 0.30.1", - "anchor-attribute-error 0.30.1", - "anchor-attribute-event 0.30.1", - "anchor-attribute-program 0.30.1", - "anchor-derive-accounts 0.30.1", - "anchor-derive-serde 0.30.1", - "anchor-derive-space 0.30.1", - "arrayref", +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6bab117055905e930f762c196e08f861f8dfe7241b92cee46677a3b15561a0a" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-program", + "anchor-derive-accounts", + "anchor-derive-serde", + "anchor-derive-space", "base64 0.21.7", "bincode", "borsh 0.10.3", "bytemuck", - "getrandom 0.2.15", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "anchor-lang-idl" -version = "0.1.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e8599d21995f68e296265aa5ab0c3cef582fd58afec014d01bd0bce18a4418" dependencies = [ "anchor-lang-idl-spec", "anyhow", @@ -389,7 +278,8 @@ dependencies = [ [[package]] name = "anchor-lang-idl-spec" version = "0.1.0" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bdf143115440fe621bdac3a29a1f7472e09f6cd82b2aa569429a0c13f103838" dependencies = [ "anyhow", "serde", @@ -397,56 +287,27 @@ dependencies = [ [[package]] name = "anchor-spl" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c4fd6e43b2ca6220d2ef1641539e678bfc31b6cc393cf892b373b5997b6a39a" -dependencies = [ - "anchor-lang 0.29.0", - "solana-program", - "spl-associated-token-account 2.3.0", - "spl-token 4.0.0", - "spl-token-2022 0.9.0", -] - -[[package]] -name = "anchor-spl" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "3c08cb5d762c0694f74bd02c9a5b04ea53cefc496e2c27b3234acffca5cd076b" dependencies = [ - "anchor-lang 0.30.1", - "spl-associated-token-account 3.0.2", - "spl-pod 0.2.2", - "spl-token 4.0.0", - "spl-token-2022 3.0.2", - "spl-token-group-interface 0.2.3", - "spl-token-metadata-interface 0.3.3", + "anchor-lang", + "spl-associated-token-account 6.0.0", + "spl-pod 0.5.0", + "spl-token 7.0.0", + "spl-token-2022 6.0.0", + "spl-token-group-interface 0.5.0", + "spl-token-metadata-interface 0.6.0", ] [[package]] name = "anchor-syn" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9101b84702fed2ea57bd22992f75065da5648017135b844283a2f6d74f27825" -dependencies = [ - "anyhow", - "bs58 0.5.1", - "heck 0.3.3", - "proc-macro2", - "quote", - "serde", - "serde_json", - "sha2 0.10.8", - "syn 1.0.109", - "thiserror", -] - -[[package]] -name = "anchor-syn" -version = "0.30.1" -source = "git+https://github.com/mrgnlabs/anchor.git?rev=fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d#fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" +checksum = "5dc7a6d90cc643df0ed2744862cdf180587d1e5d28936538c18fc8908489ed67" dependencies = [ "anyhow", - "bs58 0.5.1", + "bs58", "heck 0.3.3", "proc-macro2", "quote", @@ -454,7 +315,7 @@ dependencies = [ "serde_json", "sha2 0.10.8", "syn 1.0.109", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -472,20 +333,11 @@ dependencies = [ "libc", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "aquamarine" @@ -635,9 +487,9 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" @@ -663,7 +515,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror", + "thiserror 1.0.69", "time", ] @@ -703,7 +555,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] @@ -722,23 +574,25 @@ dependencies = [ ] [[package]] -name = "async-mutex" -version = "1.4.0" +name = "async-lock" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener", + "event-listener 5.4.0", + "event-listener-strategy", + "pin-project-lite", ] [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -774,7 +628,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] @@ -803,12 +657,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - [[package]] name = "bincode" version = "1.3.3" @@ -856,9 +704,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" dependencies = [ "arrayref", "arrayvec", @@ -874,7 +722,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "block-padding", "generic-array", ] @@ -887,22 +734,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive 0.9.3", - "hashbrown 0.11.2", -] - [[package]] name = "borsh" version = "0.10.3" @@ -915,35 +746,22 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" dependencies = [ - "borsh-derive 1.5.1", + "borsh-derive 1.5.7", "cfg_aliases", ] -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal 0.9.3", - "borsh-schema-derive-internal 0.9.3", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "borsh-derive" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" dependencies = [ - "borsh-derive-internal 0.10.3", - "borsh-schema-derive-internal 0.10.3", + "borsh-derive-internal", + "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", "proc-macro2", "syn 1.0.109", @@ -951,27 +769,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" dependencies = [ "once_cell", "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", - "syn_derive", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] @@ -985,17 +791,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "borsh-schema-derive-internal" version = "0.10.3" @@ -1028,12 +823,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - [[package]] name = "bs58" version = "0.5.1" @@ -1083,22 +872,22 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.16.1" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b" +checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1109,9 +898,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "bzip2" @@ -1141,20 +930,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190baaad529bcfbde9e1a19022c42781bdb6ff9de25721abdb8fd98c0807730b" dependencies = [ "libc", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "cc" -version = "1.0.99" +version = "1.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" dependencies = [ "jobserver", "libc", - "once_cell", + "shlex", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-if" version = "1.0.0" @@ -1167,6 +962,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "cfg_eval" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45565fc9416b9896014f5732ac776f810ee53a66730c17e4020c3ec064a8f88f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "chrono" version = "0.4.38" @@ -1193,51 +999,12 @@ dependencies = [ [[package]] name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", -] - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "textwrap 0.11.0", - "unicode-width", - "vec_map", -] - -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_lex", - "indexmap 1.9.3", - "once_cell", - "strsim 0.10.0", - "termcolor", - "textwrap 0.16.1", -] - -[[package]] -name = "clap_lex" -version = "0.2.4" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "os_str_bytes", + "crypto-common", + "inout", ] [[package]] @@ -1253,6 +1020,16 @@ dependencies = [ "unreachable", ] +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -1296,22 +1073,26 @@ dependencies = [ ] [[package]] -name = "const-oid" -version = "0.7.1" +name = "constant_time_eq" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] -name = "constant_time_eq" -version = "0.3.0" +name = "core-foundation" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "core-foundation" -version = "0.9.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" dependencies = [ "core-foundation-sys", "libc", @@ -1319,9 +1100,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" @@ -1388,6 +1169,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] @@ -1403,27 +1185,55 @@ dependencies = [ [[package]] name = "ctr" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ "cipher", ] [[package]] name = "curve25519-dalek" -version = "3.2.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ "byteorder", "digest 0.9.0", "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "rand_core 0.6.4", + "rustc_version", "serde", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "darling" version = "0.20.9" @@ -1444,8 +1254,8 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", - "syn 2.0.58", + "strsim", + "syn 2.0.100", ] [[package]] @@ -1456,7 +1266,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1479,15 +1289,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - [[package]] name = "der-parser" version = "8.2.0" @@ -1536,7 +1337,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1545,18 +1346,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c877555693c14d2f84191cfd3ad8582790fc52b5e2274b40b59cf5f5cea25c7" -[[package]] -name = "dialoguer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" -dependencies = [ - "console", - "shell-words", - "tempfile", - "zeroize", -] - [[package]] name = "difflib" version = "0.4.0" @@ -1600,7 +1389,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1623,7 +1412,7 @@ checksum = "a6cbae11b3de8fce2a456e8ea3dada226b35fe791f0dc1d360c0941f0bb681f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1659,7 +1448,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ - "curve25519-dalek", + "curve25519-dalek 3.2.0", "ed25519", "rand 0.7.3", "serde", @@ -1729,7 +1518,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1742,7 +1531,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1754,7 +1543,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -1788,9 +1577,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1802,6 +1591,27 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener 5.4.0", + "pin-project-lite", +] + [[package]] name = "fast-math" version = "0.1.1" @@ -1813,9 +1623,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "feature-probe" @@ -1823,6 +1633,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "filetime" version = "0.2.23" @@ -1835,11 +1651,26 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "five8_const" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26dec3da8bc3ef08f2c04f61eab298c3ab334523e55f076354d6d6f613799a7b" +dependencies = [ + "five8_core", +] + +[[package]] +name = "five8_core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2551bf44bc5f776c15044b9b94153a00198be06743e262afaaa61f11ac7523a5" + [[package]] name = "fixed" -version = "1.27.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc715d38bea7b5bf487fcd79bcf8c209f0b58014f3018a7a19c2b855f472048" +checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" dependencies = [ "az", "bytemuck", @@ -1884,12 +1715,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.30" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.8", ] [[package]] @@ -1907,6 +1738,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1930,9 +1776,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1945,9 +1791,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1955,15 +1801,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1972,38 +1818,44 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-timer" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -2064,6 +1916,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", + "wasm-bindgen", +] + [[package]] name = "gimli" version = "0.29.0" @@ -2071,14 +1937,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] -name = "goblin" -version = "0.5.4" +name = "governor" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7666983ed0dd8d21a6f6576ee00053ca0926fb281a5522577a4dbd0f1b54143" +checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" dependencies = [ - "log", - "plain", - "scroll", + "cfg-if", + "dashmap", + "futures", + "futures-timer", + "no-std-compat", + "nonzero_ext", + "parking_lot", + "portable-atomic", + "quanta", + "rand 0.8.5", + "smallvec", + "spinning_top", ] [[package]] @@ -2093,7 +1968,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.6", + "indexmap", "slab", "tokio", "tokio-util 0.7.11", @@ -2119,15 +1994,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.8", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -2152,6 +2018,12 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + [[package]] name = "heck" version = "0.3.3" @@ -2306,7 +2178,7 @@ dependencies = [ "futures-util", "http", "hyper", - "rustls", + "rustls 0.21.12", "tokio", "tokio-rustls", ] @@ -2393,28 +2265,18 @@ dependencies = [ [[package]] name = "index_list" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb725b6505e51229de32027e0cfcd9db29da4d89156f9747b0a5195643fa3e1" - -[[package]] -name = "indexmap" -version = "1.9.3" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] +checksum = "fa38453685e5fe724fd23ff6c1a158c1e2ca21ce0c2718fa11e96e70e99fd4de" [[package]] name = "indexmap" -version = "2.2.6" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.2", ] [[package]] @@ -2430,6 +2292,15 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "instant" version = "0.1.13" @@ -2469,6 +2340,28 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine 4.6.7", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + [[package]] name = "jobserver" version = "0.1.31" @@ -2480,10 +2373,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -2511,15 +2405,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -2528,9 +2413,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "libfuzzer-sys" @@ -2648,7 +2533,7 @@ dependencies = [ "ark-bn254", "ark-ff", "num-bigint 0.4.6", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2657,6 +2542,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + [[package]] name = "lock_api" version = "0.4.12" @@ -2705,36 +2596,26 @@ dependencies = [ "serde-value", "serde_json", "serde_yaml", - "thiserror", + "thiserror 1.0.69", "thread-id", "typemap-ors", "winapi", ] -[[package]] -name = "lru" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" -dependencies = [ - "hashbrown 0.12.3", -] - [[package]] name = "lz4" -version = "1.25.0" +version = "1.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6eab492fe7f8651add23237ea56dbf11b3c4ff762ab83d40a47f11433421f91" +checksum = "a20b523e860d03443e98350ceaac5e71c6ba89aea7d960769ec3ce37f4de5af4" dependencies = [ - "libc", "lz4-sys", ] [[package]] name = "lz4-sys" -version = "1.9.5" +version = "1.11.1+lz4-1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9764018d143cc854c9f17f0b907de70f14393b1f502da6375dce70f00514eb3" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" dependencies = [ "cc", "libc", @@ -2744,10 +2625,9 @@ dependencies = [ name = "marginfi" version = "0.1.2" dependencies = [ - "anchor-lang 0.29.0", - "anchor-lang 0.30.1", - "anchor-spl 0.30.1", - "borsh 0.10.3", + "anchor-lang", + "anchor-spl", + "borsh 1.5.7", "bytemuck", "cfg-if", "enum_dispatch", @@ -2756,13 +2636,11 @@ dependencies = [ "lazy_static", "pyth-sdk-solana", "pyth-solana-receiver-sdk", - "solana-program", + "pythnet-sdk", "solana-security-txt", - "spl-tlv-account-resolution 0.6.3", - "spl-transfer-hook-interface 0.6.3", + "spl-transfer-hook-interface 0.9.0", "static_assertions", "switchboard-on-demand", - "switchboard-solana", "type-layout", ] @@ -2770,8 +2648,8 @@ dependencies = [ name = "marginfi-fuzz" version = "0.0.0" dependencies = [ - "anchor-lang 0.30.1", - "anchor-spl 0.30.1", + "anchor-lang", + "anchor-spl", "anyhow", "arbitrary", "base64 0.22.1", @@ -2787,13 +2665,13 @@ dependencies = [ "marginfi", "once_cell", "pyth-sdk-solana", - "quinn-proto", + "quinn-proto 0.10.6", "rand 0.8.5", "safe-transmute", "solana-program", "solana-program-test", "solana-sdk", - "spl-token 4.0.0", + "spl-token 7.0.0", "strum 0.26.3", ] @@ -2821,15 +2699,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.1" @@ -2857,6 +2726,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2872,15 +2751,24 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +dependencies = [ + "adler2", +] + [[package]] name = "mio" -version = "0.8.11" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2933,17 +2821,23 @@ dependencies = [ [[package]] name = "nix" -version = "0.26.4" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "cfg-if", + "cfg_aliases", "libc", - "memoffset 0.7.1", - "pin-utils", + "memoffset 0.9.1", ] +[[package]] +name = "no-std-compat" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" + [[package]] name = "nom" version = "7.1.3" @@ -2954,6 +2848,12 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nonzero_ext" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -3053,7 +2953,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -3120,108 +3020,114 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.11" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" dependencies = [ - "num_enum_derive 0.5.11", + "num_enum_derive", ] [[package]] -name = "num_enum" -version = "0.6.1" +name = "num_enum_derive" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "num_enum_derive 0.6.1", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "num_enum" -version = "0.7.2" +name = "number_prefix" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" -dependencies = [ - "num_enum_derive 0.7.2", -] +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] -name = "num_enum_derive" -version = "0.5.11" +name = "object" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", + "memchr", ] [[package]] -name = "num_enum_derive" +name = "oid-registry" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 2.0.58", + "asn1-rs", ] [[package]] -name = "num_enum_derive" -version = "0.7.2" +name = "once_cell" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" -dependencies = [ - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 2.0.58", -] +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] -name = "number_prefix" -version = "0.4.0" +name = "opaque-debug" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] -name = "object" -version = "0.36.1" +name = "openssl" +version = "0.10.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" dependencies = [ - "memchr", + "bitflags 2.6.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", ] [[package]] -name = "oid-registry" -version = "0.6.1" +name = "openssl-macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "asn1-rs", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "once_cell" -version = "1.19.0" +name = "openssl-probe" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] -name = "opaque-debug" -version = "0.3.1" +name = "openssl-src" +version = "300.5.0+3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +checksum = "e8ce546f549326b0e6052b649198487d91320875da901e7bd11a06d1ee3f9c2f" +dependencies = [ + "cc", +] [[package]] -name = "openssl-probe" -version = "0.1.5" +name = "openssl-sys" +version = "0.9.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07" +dependencies = [ + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] [[package]] name = "opentelemetry" @@ -3239,7 +3145,7 @@ dependencies = [ "percent-encoding", "pin-project", "rand 0.8.5", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3252,33 +3158,10 @@ dependencies = [ ] [[package]] -name = "os_str_bytes" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" - -[[package]] -name = "ouroboros" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db" -dependencies = [ - "aliasable", - "ouroboros_macro", -] - -[[package]] -name = "ouroboros_macro" -version = "0.15.6" +name = "parking" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" -dependencies = [ - "Inflector", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" @@ -3309,15 +3192,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "pbkdf2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" -dependencies = [ - "crypto-mac", -] - [[package]] name = "pbkdf2" version = "0.11.0" @@ -3368,7 +3242,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -3383,34 +3257,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs8" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" -dependencies = [ - "der", - "spki", - "zeroize", -] - [[package]] name = "pkg-config" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" - [[package]] name = "polyval" -version = "0.5.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", "cpufeatures", @@ -3475,23 +3332,13 @@ dependencies = [ "toml", ] -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - [[package]] name = "proc-macro-crate" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit 0.21.1", + "toml_edit", ] [[package]] @@ -3520,9 +3367,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -3563,9 +3410,9 @@ dependencies = [ [[package]] name = "pyth-sdk-solana" -version = "0.10.1" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f913de6eb29d8def199af3beaee645e84c5281327d58777eff3fdd9f1d37105" +checksum = "5a1875ce0bee6b18af4a9700ae8e514f1dd093c29aa3400e2a40e96421adcdb5" dependencies = [ "borsh 0.10.3", "borsh-derive 0.10.3", @@ -3575,16 +3422,17 @@ dependencies = [ "pyth-sdk", "serde", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "pyth-solana-receiver-sdk" -version = "0.3.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e6559643f0b377b6f293269251f6a804ae7332c37f7310371f50c833453cd0" +checksum = "8f07e92abfc18154532ed3dabaa7dac8e693b9925bfe28b2915bc8f8c1540ca0" dependencies = [ - "anchor-lang 0.29.0", + "anchor-lang", + "bytemuck_derive", "hex", "pythnet-sdk", "solana-program", @@ -3592,24 +3440,23 @@ dependencies = [ [[package]] name = "pythnet-sdk" -version = "2.1.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bbbc0456f9f27c9ad16b6c3bf1b2a7fea61eebf900f4d024a0468b9a84fe0c1" +checksum = "498d20fd330277697aaee92f341bdabdb4695b10e05f054157a18ad8b7746a17" dependencies = [ - "anchor-lang 0.29.0", + "anchor-lang", "bincode", "borsh 0.10.3", "bytemuck", "byteorder", "fast-math", "hex", - "proc-macro2", "rustc_version", "serde", - "sha3 0.10.8", + "sha3", "slow_primes", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3629,24 +3476,42 @@ checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", +] + +[[package]] +name = "quanta" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1fe6824cea6538803de3ff1bc0cf3949024db3d43c9643024bfb33a807c0e" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid", + "wasi 0.11.0+wasi-snapshot-preview1", + "web-sys", + "winapi", ] [[package]] name = "quinn" -version = "0.10.2" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" +checksum = "c3bd15a6f2967aef83887dcb9fec0014580467e33720d073560cf015a5683012" dependencies = [ "bytes", + "cfg_aliases", "pin-project-lite", - "quinn-proto", + "quinn-proto 0.11.11", "quinn-udp", - "rustc-hash", - "rustls", - "thiserror", + "rustc-hash 2.1.1", + "rustls 0.23.26", + "socket2", + "thiserror 2.0.12", "tokio", "tracing", + "web-time", ] [[package]] @@ -3659,26 +3524,47 @@ dependencies = [ "bytes", "rand 0.8.5", "ring 0.16.20", - "rustc-hash", - "rustls", - "rustls-native-certs", + "rustc-hash 1.1.0", + "rustls 0.21.12", "slab", - "thiserror", + "thiserror 1.0.69", "tinyvec", "tracing", ] [[package]] -name = "quinn-udp" -version = "0.4.1" +name = "quinn-proto" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" +checksum = "bcbafbbdbb0f638fe3f35f3c56739f77a8a1d070cb25603226c83339b391472b" dependencies = [ "bytes", + "getrandom 0.3.2", + "rand 0.9.1", + "ring 0.17.8", + "rustc-hash 2.1.1", + "rustls 0.23.26", + "rustls-pki-types", + "rustls-platform-verifier", + "slab", + "thiserror 2.0.12", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "541d0f57c6ec747a90738a52741d3221f7960e8ac2f0ff4b1a63680e033b4ab5" +dependencies = [ + "cfg_aliases", "libc", + "once_cell", "socket2", "tracing", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3690,6 +3576,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + [[package]] name = "radium" version = "0.7.0" @@ -3720,6 +3612,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -3740,6 +3642,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + [[package]] name = "rand_core" version = "0.5.1" @@ -3758,6 +3670,15 @@ dependencies = [ "getrandom 0.2.15", ] +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.2", +] + [[package]] name = "rand_hc" version = "0.2.0" @@ -3776,6 +3697,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "raw-cpuid" +version = "11.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146" +dependencies = [ + "bitflags 2.6.0", +] + [[package]] name = "rayon" version = "1.10.0" @@ -3796,18 +3726,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "rcgen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" -dependencies = [ - "pem", - "ring 0.16.20", - "time", - "yasna", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -3828,9 +3746,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -3840,9 +3758,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -3851,9 +3769,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rend" @@ -3885,10 +3803,11 @@ dependencies = [ "js-sys", "log", "mime", + "mime_guess", "once_cell", "percent-encoding", "pin-project-lite", - "rustls", + "rustls 0.21.12", "rustls-pemfile", "serde", "serde_json", @@ -3907,6 +3826,21 @@ dependencies = [ "winreg", ] +[[package]] +name = "reqwest-middleware" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a735987236a8e238bf0296c7e351b999c188ccc11477f311b82b55c93984216" +dependencies = [ + "anyhow", + "async-trait", + "http", + "reqwest", + "serde", + "task-local-extensions", + "thiserror 1.0.69", +] + [[package]] name = "ring" version = "0.16.20" @@ -3966,27 +3900,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "rpassword" -version = "7.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80472be3c897911d0137b2d2b9055faf6eeac5b14e324073d83bc17b191d7e3f" -dependencies = [ - "libc", - "rtoolbox", - "windows-sys 0.48.0", -] - -[[package]] -name = "rtoolbox" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c247d24e63230cdb56463ae328478bd5eac8b8faa8c69461a77e8e323afac90e" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "rust_decimal" version = "1.35.0" @@ -3994,7 +3907,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a" dependencies = [ "arrayvec", - "borsh 1.5.1", + "borsh 1.5.7", "bytes", "num-traits", "rand 0.8.5", @@ -4015,6 +3928,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + [[package]] name = "rustc_version" version = "0.4.0" @@ -4042,7 +3961,20 @@ dependencies = [ "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.14", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustix" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys 0.9.4", "windows-sys 0.52.0", ] @@ -4054,18 +3986,32 @@ checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring 0.17.8", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.23.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0" +dependencies = [ + "once_cell", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki 0.103.1", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pki-types", "schannel", "security-framework", ] @@ -4080,24 +4026,71 @@ dependencies = [ ] [[package]] -name = "rustls-webpki" -version = "0.101.7" +name = "rustls-pki-types" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "web-time", ] [[package]] -name = "rustversion" -version = "1.0.17" +name = "rustls-platform-verifier" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "4a5467026f437b4cb2a533865eaa73eb840019a0916f4b9ec563c6e617e086c9" +dependencies = [ + "core-foundation 0.10.0", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls 0.23.26", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki 0.103.1", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.52.0", +] [[package]] -name = "ryu" -version = "1.0.18" +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring 0.17.8", + "untrusted 0.9.0", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +dependencies = [ + "ring 0.17.8", + "rustls-pki-types", + "untrusted 0.9.0", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ryu" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" @@ -4146,7 +4139,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -4160,20 +4153,6 @@ name = "scroll" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" -dependencies = [ - "scroll_derive", -] - -[[package]] -name = "scroll_derive" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.58", -] [[package]] name = "sct" @@ -4193,12 +4172,12 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "security-framework" -version = "2.11.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -4206,9 +4185,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -4231,9 +4210,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.204" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] @@ -4259,13 +4238,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -4276,7 +4255,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -4290,11 +4269,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -4313,24 +4293,25 @@ dependencies = [ [[package]] name = "serde_with" -version = "2.3.3" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ "serde", + "serde_derive", "serde_with_macros", ] [[package]] name = "serde_with_macros" -version = "2.3.3" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -4339,7 +4320,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.2.6", + "indexmap", "itoa", "ryu", "serde", @@ -4381,18 +4362,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug", -] - [[package]] name = "sha3" version = "0.10.8" @@ -4413,10 +4382,10 @@ dependencies = [ ] [[package]] -name = "shell-words" -version = "1.1.0" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" @@ -4470,7 +4439,7 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58267dd2fbaa6dceecba9e3e106d2d90a2b02497c0e8b01b8759beccf5113938" dependencies = [ - "num 0.2.1", + "num 0.4.3", ] [[package]] @@ -4489,192 +4458,275 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "solana-account" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc8a1697bdaf669a3786ceb8751d888463747f30a10d08fb3d3399c8e8861301" +dependencies = [ + "bincode", + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-program", +] + [[package]] name = "solana-account-decoder" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4973213a11c2e1b924b36e0c6688682b5aa4623f8d4eeaa1204c32cee524e6d6" +checksum = "e8b612a2db04fc53399d3c655f29750311307e5e24f3e02c38a6a47646556974" dependencies = [ "Inflector", - "base64 0.21.7", + "base64 0.22.1", "bincode", - "bs58 0.4.0", + "bs58", "bv", "lazy_static", "serde", "serde_derive", "serde_json", + "solana-account-decoder-client-types", "solana-config-program", "solana-sdk", - "spl-token 4.0.0", - "spl-token-2022 1.0.0", - "spl-token-group-interface 0.1.0", - "spl-token-metadata-interface 0.2.0", - "thiserror", + "spl-token 6.0.0", + "spl-token-2022 4.0.0", + "spl-token-group-interface 0.3.0", + "spl-token-metadata-interface 0.4.0", + "thiserror 1.0.69", + "zstd", +] + +[[package]] +name = "solana-account-decoder-client-types" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2249bcb1a569a9b62ace2088d45f63923667c700a4c80c58ce95dd5c00de93c" +dependencies = [ + "base64 0.22.1", + "bs58", + "serde", + "serde_derive", + "serde_json", + "solana-account", + "solana-pubkey", "zstd", ] +[[package]] +name = "solana-account-info" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0208a6ce6349850842b0a226114af298e1b9237998484c2b467fe513c84f66f4" +dependencies = [ + "bincode", + "serde", + "solana-program-error", + "solana-program-memory", + "solana-pubkey", +] + [[package]] name = "solana-accounts-db" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c06263320e399af20d46c8cebea7a1d5dc1bc56f31f8dfaacf7119576c48a7" +checksum = "74d7fca29e8ad794b181a34cdb3bd6f3469c3bd2c2e3f37315482fe0868f84b8" dependencies = [ - "arrayref", + "ahash 0.8.11", "bincode", "blake3", "bv", "bytemuck", - "byteorder", + "bytemuck_derive", "bzip2", "crossbeam-channel", "dashmap", - "flate2", - "fnv", - "im", "index_list", - "itertools 0.10.5", + "indexmap", + "itertools 0.12.1", "lazy_static", "log", "lz4", "memmap2", "modular-bitfield", - "num-derive 0.4.2", - "num-traits", "num_cpus", - "num_enum 0.7.2", - "ouroboros", - "percentage", - "qualifier_attr", + "num_enum", "rand 0.8.5", "rayon", - "regex", - "rustc_version", "seqlock", "serde", "serde_derive", "smallvec", "solana-bucket-map", - "solana-config-program", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-inline-spl", + "solana-lattice-hash", "solana-measure", "solana-metrics", "solana-nohash-hasher", - "solana-program-runtime", "solana-rayon-threadlimit", "solana-sdk", - "solana-stake-program", - "solana-system-program", - "solana-vote-program", + "solana-svm-transaction", "static_assertions", - "strum 0.24.1", - "strum_macros 0.24.3", "tar", "tempfile", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-address-lookup-table-program" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e57cb8f2e90361280b246f70bb7f5f86f4e4ff1ad5bbdfe18a81bea141f03a" +checksum = "405ca5ea0bd3172ea38359b4377f8aaf5ff5d925a99864fec57c26de840d99e6" dependencies = [ "bincode", "bytemuck", "log", "num-derive 0.4.2", "num-traits", - "rustc_version", - "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-feature-set", + "solana-log-collector", "solana-program", "solana-program-runtime", "solana-sdk", - "thiserror", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-atomic-u64" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cffca840b9aef9e35051b5addc6f8bf179594346dea8a05cb527e84c758b225" +dependencies = [ + "parking_lot", ] [[package]] name = "solana-banks-client" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c65a9540370523f3ade7190526309337cc50f1d742b3341dfa7357da3f59a56" +checksum = "db12f1f869941527d9a985fe01ed82e55312af9b9dfed795ccd41fbdb7eb835d" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "futures", "solana-banks-interface", "solana-program", "solana-sdk", "tarpc", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-serde", ] [[package]] name = "solana-banks-interface" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b1dc20a7a71cf37bcbc2a3a5dfd73d7410a13850aa68d954a9c09e6a77e652" +checksum = "5bc09d1f1c1be091ee929a9a582f9d13c4a65f19a72ae9d0aa2478d431ddc17a" dependencies = [ "serde", + "serde_derive", "solana-sdk", "tarpc", ] [[package]] name = "solana-banks-server" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d449d55d3c5c3fe4c9f0c9f790a9feabe294f8ff0b4c6b771a20b2313ad8974a" +checksum = "4921c2b6c0a952dd35025ccda66706fc0b1c1025160750de5634918892e8c7f9" dependencies = [ "bincode", "crossbeam-channel", "futures", - "solana-accounts-db", "solana-banks-interface", "solana-client", + "solana-feature-set", "solana-runtime", "solana-sdk", "solana-send-transaction-service", + "solana-svm", "tarpc", "tokio", "tokio-serde", ] +[[package]] +name = "solana-bincode" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec16f955b9fcc2021b1f8eb347d22f8f3431552107b4561958a0d5d3ae8e9dec" +dependencies = [ + "bincode", + "serde", + "solana-instruction", +] + +[[package]] +name = "solana-bn254" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d7ccd91311c95c71b7dfa9b0118e5f663005d9aa044029e2909db5241d3d55c" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "bytemuck", + "solana-program", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-borsh" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "344fee9277ae2c36c8560ba4478b474fa1689c73e086fedb7a5265a926e8c63a" +dependencies = [ + "borsh 0.10.3", + "borsh 1.5.7", +] + [[package]] name = "solana-bpf-loader-program" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1a55b8533f2dc716602e7c1b2bd555d5ac598ef6e80d28a517e6f31baf042e" +checksum = "c139606662646889222bc1499f12bd4287de7a13a6ab3ed0f582208e41cf67be" dependencies = [ "bincode", "byteorder", "libsecp256k1 0.6.0", "log", "scopeguard", + "solana-bn254", + "solana-compute-budget", + "solana-curve25519", + "solana-feature-set", + "solana-log-collector", "solana-measure", + "solana-poseidon", + "solana-program-memory", "solana-program-runtime", "solana-sdk", - "solana-zk-token-sdk", + "solana-timings", + "solana-type-overrides", "solana_rbpf", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-bucket-map" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda213af7ae26ce249120f211060d2a85d87fe367c6490ee19b70845cbd320fc" +checksum = "071f4066a875d79e596903f0db2ea760d64fafa8077286e29abd36d3f4c8e5e3" dependencies = [ "bv", "bytemuck", + "bytemuck_derive", "log", "memmap2", "modular-bitfield", - "num_enum 0.7.2", + "num_enum", "rand 0.8.5", "solana-measure", "solana-sdk", @@ -4682,41 +4734,43 @@ dependencies = [ ] [[package]] -name = "solana-clap-utils" -version = "1.18.17" +name = "solana-builtins-default-costs" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909f4553d0b31bb5b97533a6b64cc321a4eace9112d6efbabcf4408ea1b3f1db" +checksum = "9a9bd1b2ee1161562553bb8d04334ef4a4c083227caf4a8a82d0e5b48390eead" dependencies = [ - "chrono", - "clap 2.34.0", - "rpassword", - "solana-remote-wallet", + "ahash 0.8.11", + "lazy_static", + "log", + "solana-address-lookup-table-program", + "solana-bpf-loader-program", + "solana-compute-budget-program", + "solana-config-program", + "solana-loader-v4-program", "solana-sdk", - "thiserror", - "tiny-bip39", - "uriparse", - "url", + "solana-stake-program", + "solana-system-program", + "solana-vote-program", ] [[package]] name = "solana-client" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5cc431df6cc1dd964134fa4ec7df765d3af3fae9c2148f96a3c4fb500290633" +checksum = "70b4df5f628ef6b5196aceb12fa3753dad9f04dcefe8e05bb5fa34f74aebd35b" dependencies = [ "async-trait", "bincode", "dashmap", "futures", "futures-util", - "indexmap 2.2.6", + "indexmap", "indicatif", "log", "quinn", "rayon", "solana-connection-cache", "solana-measure", - "solana-metrics", "solana-pubsub-client", "solana-quic-client", "solana-rpc-client", @@ -4727,15 +4781,36 @@ dependencies = [ "solana-thin-client", "solana-tpu-client", "solana-udp-client", - "thiserror", + "thiserror 1.0.69", "tokio", ] +[[package]] +name = "solana-clock" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd6aa6fec0cd6116c51258e60a9faa144d3ac772a210192a934b5b2d6775a850" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-compute-budget" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60ccc544564e2c9ba7304480c8117a19ed4e7f55da9dc457d1aa1a5813d57ab5" +dependencies = [ + "solana-sdk", +] + [[package]] name = "solana-compute-budget-program" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eb36ef3c3a1f38515c1ae0d255c4d6e5e635a856ac2aa1cd5f892b3db58e857" +checksum = "2edf6c5997fdce839e0d9a35d71ed02a37d11feb17d2c06a526ae26f5ffd2c94" dependencies = [ "solana-program-runtime", "solana-sdk", @@ -4743,189 +4818,363 @@ dependencies = [ [[package]] name = "solana-config-program" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e38b040d3a42e8f7d80c4a86bb0d49d7aed663b56b0fe0ae135d2d145fb7ae3a" +checksum = "3807510e39cfb957400650e813326490cd1a526cd569254f89691a5a60d5a916" dependencies = [ "bincode", "chrono", "serde", "serde_derive", + "solana-log-collector", "solana-program-runtime", "solana-sdk", + "solana-short-vec", ] [[package]] name = "solana-connection-cache" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae02622c63943485f0af3d0896626eaf6478e734f0b6bc61c7cc5320963c6e75" +checksum = "1c3e2ed868c40c1003286f0d3d879a2bc026f23f408ec794420e1fad3a10a7e5" dependencies = [ "async-trait", "bincode", "crossbeam-channel", "futures-util", - "indexmap 2.2.6", + "indexmap", "log", "rand 0.8.5", "rayon", - "rcgen", "solana-measure", "solana-metrics", "solana-sdk", - "thiserror", + "thiserror 1.0.69", "tokio", ] [[package]] name = "solana-cost-model" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "838532d8437d00958621d2589d6033e9c69ea95cd0936efa8964146e49dcff53" +checksum = "4d3aa2d039633446d7af3dc625be944099082dbd841632a0d520af431ccb3142" dependencies = [ + "ahash 0.8.11", "lazy_static", "log", - "rustc_version", - "solana-address-lookup-table-program", - "solana-bpf-loader-program", - "solana-compute-budget-program", - "solana-config-program", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-loader-v4-program", + "solana-builtins-default-costs", + "solana-compute-budget", + "solana-feature-set", "solana-metrics", - "solana-program-runtime", + "solana-runtime-transaction", "solana-sdk", - "solana-stake-program", - "solana-system-program", + "solana-svm-transaction", "solana-vote-program", ] [[package]] -name = "solana-frozen-abi" -version = "1.18.17" +name = "solana-cpi" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4867f66e9527fa44451c861c1dc6d9b2a7c7a668d7c6a297cdefbe39f4395b33" +checksum = "2d78f05dc684a6fb1090823a1e17dc9ccb0b7b1875b4486bd31a9bd9fc5d3813" dependencies = [ - "block-buffer 0.10.4", - "bs58 0.4.0", - "bv", - "either", - "generic-array", - "im", - "lazy_static", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_bytes", - "serde_derive", - "sha2 0.10.8", - "solana-frozen-abi-macro", - "subtle", - "thiserror", + "solana-account-info", + "solana-define-syscall", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-stable-layout", ] [[package]] -name = "solana-frozen-abi-macro" -version = "1.18.17" +name = "solana-curve25519" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168f24d97347b85f05192df58d6be3e3047a4aadc4001bc1b9e711a5ec878eea" +checksum = "69c77df8deb48b0da86df71092c45541044deb789366f480205034b7f4156b4f" dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn 2.0.58", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "solana-program", + "thiserror 1.0.69", ] [[package]] -name = "solana-loader-v4-program" -version = "1.18.17" +name = "solana-decode-error" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c426482234b7c267a5e0dfa8198442e1ffad2ad6c521f6b810949bc2719215" +checksum = "2f2dfa7da2e4e701312d2887ee62ab7869c355e261559603b8e50d2766334935" dependencies = [ - "log", - "solana-measure", - "solana-program-runtime", - "solana-sdk", - "solana_rbpf", + "num-traits", ] [[package]] -name = "solana-logger" -version = "1.18.17" +name = "solana-define-syscall" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42087a9f1567719e19eb9f2fe91ee620881690cb8012add9926478e051329b01" + +[[package]] +name = "solana-derivation-path" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0511082fc62f2d086520fff5aa1917c389d8c840930c08ad255ae05952c08a2" +checksum = "ac16984dca3898c1f8584ef29c9944d807bdd76e66731f0fd970da50208d8b73" dependencies = [ - "env_logger", - "lazy_static", - "log", + "derivation-path", + "qstring", + "uriparse", ] [[package]] -name = "solana-measure" -version = "1.18.17" +name = "solana-epoch-schedule" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55a3df105431d25f86f2a7da0cbbde5f54c1f0782ca59367ea4a8037bc6797" +checksum = "da5c12ca420f4c4a417e198c29048119187904372f0b4612b372e3a84e6437fc" dependencies = [ - "log", - "solana-sdk", + "serde", + "serde_derive", + "solana-sdk-macro", + "solana-sysvar-id", ] [[package]] -name = "solana-metrics" -version = "1.18.17" +name = "solana-feature-set" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddec097ed7572804389195128dbd57958b427829153c6cd8ec3343c86fe3cd22" +checksum = "a1a31d4660c881b79b5109bbe072f6bc41db769d96b1a235820db454c95bdc47" dependencies = [ - "crossbeam-channel", - "gethostname", "lazy_static", - "log", - "reqwest", - "solana-sdk", - "thiserror", + "solana-clock", + "solana-epoch-schedule", + "solana-hash", + "solana-pubkey", + "solana-sha256-hasher", ] [[package]] -name = "solana-net-utils" -version = "1.18.17" +name = "solana-fee" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258fa7c29fb7605b8d2ed89aa0d43c640d14f4147ad1f5b3fdad19a1ac145ca5" +checksum = "4af3ea38de93a4dcca6fbb4e1d268bd5cdff7f8e658252da75341313ce8012e6" dependencies = [ - "bincode", - "clap 3.2.25", - "crossbeam-channel", - "log", - "nix", - "rand 0.8.5", - "serde", - "serde_derive", - "socket2", - "solana-logger", "solana-sdk", - "solana-version", - "tokio", - "url", + "solana-svm-transaction", ] [[package]] -name = "solana-nohash-hasher" -version = "0.2.1" +name = "solana-fee-calculator" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b8a731ed60e89177c8a7ab05fe0f1511cedd3e70e773f288f9de33a9cfdc21e" +checksum = "6cf58676b6d322cd1a95425828fcd67a49de6253a550d9cd99c9728c3b97aae6" +dependencies = [ + "log", + "serde", + "serde_derive", +] [[package]] -name = "solana-perf" -version = "1.18.17" +name = "solana-hash" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca422edcf16a6e64003ca118575ea641f7b750f14a0ad28c71dd84f33dcb912a" +checksum = "e75e12a61d3a8a0db6fec4d69bfc33bfec7aec4466f4860ead4dc8f56252f267" dependencies = [ - "ahash 0.8.11", - "bincode", - "bv", + "borsh 1.5.7", + "bs58", + "bytemuck", + "bytemuck_derive", + "js-sys", + "serde", + "serde_derive", + "solana-atomic-u64", + "solana-sanitize", + "wasm-bindgen", +] + +[[package]] +name = "solana-inflation" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c820f72a9f85537072da1ab40d75a33c8d37e093f6d24bce449803155ffbb47" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "solana-inline-spl" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "032b37dbaf9d6096fcb50d11c2c2d0ab12821233d19e0b1d809da7013b0f1cbe" +dependencies = [ + "bytemuck", + "solana-pubkey", +] + +[[package]] +name = "solana-instruction" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59baf8834fc97718ccad69f49b09a859c2aebc7368a6da683bcdb55e144ae8f6" +dependencies = [ + "bincode", + "borsh 1.5.7", + "getrandom 0.2.15", + "js-sys", + "num-traits", + "serde", + "serde_derive", + "solana-define-syscall", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-last-restart-slot" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2739105d00788ee7ff24fcc6ad78998dc17536ab0e0c10b5e18958843ada4212" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-lattice-hash" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c9a2549bd1282a91abaeb5a37fe002ccd766e1cbe67798273f26a1d6053203d" +dependencies = [ + "base64 0.22.1", + "blake3", + "bs58", + "bytemuck", +] + +[[package]] +name = "solana-loader-v4-program" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b6231e29d5b2d24a7a41ff93dc129a7288fe4f3f26653630a0c44ebe78f216" +dependencies = [ + "log", + "solana-bpf-loader-program", + "solana-compute-budget", + "solana-log-collector", + "solana-measure", + "solana-program-runtime", + "solana-sdk", + "solana-type-overrides", + "solana_rbpf", +] + +[[package]] +name = "solana-log-collector" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e14715be3ae19be91043fa1ebf895d22d81cd740aba4849209875dc319d845" +dependencies = [ + "log", +] + +[[package]] +name = "solana-logger" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb294b86c24163c878c3e69db5cad0bbe8a0d5b81de9af72a6433230d988114d" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-measure" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9efc6bae9250e8e97d0cd229ccd39a2f29664a15d9148c68328f70ec2205a9" + +[[package]] +name = "solana-metrics" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97c27f863635bf028c950eebddf9e6befa229e7c96e3d46858d80e3674d4f6b9" +dependencies = [ + "crossbeam-channel", + "gethostname", + "lazy_static", + "log", + "reqwest", + "solana-sdk", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-msg" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9b1f994633ef77862c265e4ea81dcbc5d855d144251a7ac00ac171a2d62e469" +dependencies = [ + "solana-define-syscall", +] + +[[package]] +name = "solana-native-token" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e93442461a41eae81a833b448e354b107288488015a6953864165ffe9c357dc2" + +[[package]] +name = "solana-net-utils" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a194f4c9ebf06062fa6da48bfadd4dcb8bb8db5b9ce9b56e7051be7c8fe28b7" +dependencies = [ + "bincode", + "crossbeam-channel", + "log", + "nix", + "rand 0.8.5", + "serde", + "serde_derive", + "socket2", + "solana-sdk", + "tokio", + "url", +] + +[[package]] +name = "solana-nohash-hasher" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b8a731ed60e89177c8a7ab05fe0f1511cedd3e70e773f288f9de33a9cfdc21e" + +[[package]] +name = "solana-packet" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87d4056d1beceb0361d7987baa1420d7041d71707ebad38c83277bfd9a916ddb" +dependencies = [ + "bincode", + "bitflags 2.6.0", + "cfg_eval", + "serde", + "serde_derive", + "serde_with", +] + +[[package]] +name = "solana-perf" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40474d2bffedf6d2356e4eb61c105f4ee050653dff2e6e9a066d039a6820282f" +dependencies = [ + "ahash 0.8.11", + "bincode", + "bv", "caps", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "dlopen2", "fnv", "lazy_static", @@ -4934,47 +5183,59 @@ dependencies = [ "nix", "rand 0.8.5", "rayon", - "rustc_version", "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", "solana-metrics", "solana-rayon-threadlimit", "solana-sdk", + "solana-short-vec", "solana-vote-program", ] [[package]] -name = "solana-program" -version = "1.18.17" +name = "solana-poseidon" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc5a636dc75e5c25651e34f7a36afc9ae60d38166687c5b0375abb580ac81a2" +checksum = "c01d7cf84273b79ee57e2df6726b20b8a2b2bbbc781078573abb40ca6fce1a9e" dependencies = [ "ark-bn254", - "ark-ec", - "ark-ff", - "ark-serialize", - "base64 0.21.7", + "light-poseidon", + "solana-define-syscall", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-precompile-error" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79f1e4a080b4570413865aa8d0ec62965da90d716445d245084a1b1a26fdcbdd" +dependencies = [ + "num-traits", + "solana-decode-error", +] + +[[package]] +name = "solana-program" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8afbd3d296f660dc3841c438412bfa36367816de21e515fb5e45c91772661d1" +dependencies = [ + "base64 0.22.1", "bincode", "bitflags 2.6.0", "blake3", "borsh 0.10.3", - "borsh 0.9.3", - "borsh 1.5.1", - "bs58 0.4.0", + "borsh 1.5.7", + "bs58", "bv", "bytemuck", - "cc", + "bytemuck_derive", "console_error_panic_hook", "console_log", - "curve25519-dalek", + "curve25519-dalek 4.1.3", + "five8_const", "getrandom 0.2.15", - "itertools 0.10.5", "js-sys", "lazy_static", - "libc", - "libsecp256k1 0.6.0", - "light-poseidon", "log", "memoffset 0.9.1", "num-bigint 0.4.6", @@ -4982,60 +5243,141 @@ dependencies = [ "num-traits", "parking_lot", "rand 0.8.5", - "rustc_version", - "rustversion", "serde", "serde_bytes", "serde_derive", - "serde_json", "sha2 0.10.8", - "sha3 0.10.8", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "sha3", + "solana-account-info", + "solana-atomic-u64", + "solana-bincode", + "solana-borsh", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-define-syscall", + "solana-epoch-schedule", + "solana-fee-calculator", + "solana-hash", + "solana-instruction", + "solana-last-restart-slot", + "solana-msg", + "solana-native-token", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sanitize", "solana-sdk-macro", - "thiserror", - "tiny-bip39", + "solana-secp256k1-recover", + "solana-serde-varint", + "solana-serialize-utils", + "solana-sha256-hasher", + "solana-short-vec", + "solana-slot-hashes", + "solana-slot-history", + "solana-stable-layout", + "solana-sysvar-id", + "solana-transaction-error", + "thiserror 1.0.69", "wasm-bindgen", - "zeroize", +] + +[[package]] +name = "solana-program-entrypoint" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3792a05e134900bb22731235dd23ec6f7b8144983d0b753b3da3566cf8092b2" +dependencies = [ + "solana-account-info", + "solana-msg", + "solana-program-error", + "solana-pubkey", +] + +[[package]] +name = "solana-program-error" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d11f976b42dafada93b9b4a3fe12eac6948088ebb979b5f48f96ccdfd7f13d" +dependencies = [ + "borsh 1.5.7", + "num-traits", + "serde", + "serde_derive", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-pubkey", +] + +[[package]] +name = "solana-program-memory" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56f210a300b64d483ba5907dfa4cd0e4e1ee9ea75e66d1b1293e47a5f1151bf" +dependencies = [ + "num-traits", + "solana-define-syscall", +] + +[[package]] +name = "solana-program-option" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6774f4cc0cf3bf5a3359c002943a84b029e349010098c7e964f422d1ef9167c" + +[[package]] +name = "solana-program-pack" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523be6ea0cbd71da490a490dc9edc3960f7086ef694f0ba6e2bbdaa2a08d9097" +dependencies = [ + "solana-program-error", ] [[package]] name = "solana-program-runtime" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf373c3da0387f47fee4c5ed2465a9628b9db026a62211a692a9285aa9251544" +checksum = "a0516a5222cdda26ce383e28731c9631390d214a7e2648f5987d78d731f651d9" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "bincode", - "eager", "enum-iterator", - "itertools 0.10.5", + "itertools 0.12.1", "libc", "log", "num-derive 0.4.2", "num-traits", "percentage", "rand 0.8.5", - "rustc_version", "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-compute-budget", + "solana-feature-set", + "solana-log-collector", "solana-measure", "solana-metrics", "solana-sdk", + "solana-timings", + "solana-type-overrides", + "solana-vote", "solana_rbpf", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-program-test" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9194b8744c5b135401ab4a2923a1072d3a67697bd50f7450a4ed5302f36a6999" +checksum = "ca41368a4746a79d5a250a71b567a424482eae1c65981390a408854b8553a81c" dependencies = [ "assert_matches", "async-trait", - "base64 0.21.7", + "base64 0.22.1", "bincode", "chrono-humanize", "crossbeam-channel", @@ -5046,22 +5388,55 @@ dependencies = [ "solana-banks-interface", "solana-banks-server", "solana-bpf-loader-program", + "solana-compute-budget", + "solana-feature-set", + "solana-inline-spl", + "solana-instruction", + "solana-log-collector", "solana-logger", "solana-program-runtime", "solana-runtime", "solana-sdk", + "solana-svm", + "solana-timings", "solana-vote-program", "solana_rbpf", - "test-case", - "thiserror", + "thiserror 1.0.69", "tokio", ] +[[package]] +name = "solana-pubkey" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53bd13d0350ea7e518e038402ccdc40f23f25d058f678fbf99b98e8c40aa2d89" +dependencies = [ + "borsh 0.10.3", + "borsh 1.5.7", + "bs58", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "five8_const", + "getrandom 0.2.15", + "js-sys", + "num-traits", + "rand 0.8.5", + "serde", + "serde_derive", + "solana-atomic-u64", + "solana-decode-error", + "solana-define-syscall", + "solana-sanitize", + "solana-sha256-hasher", + "wasm-bindgen", +] + [[package]] name = "solana-pubsub-client" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b9abc76168d19927561db6a3685b98752bd0961b4ce4f8b7f85ee12238c017" +checksum = "d3419ba8d310907ff0fc59f993b03cbb91134f59cc8cfdd4d00148e7fbcdc0ee" dependencies = [ "crossbeam-channel", "futures-util", @@ -5074,7 +5449,7 @@ dependencies = [ "solana-account-decoder", "solana-rpc-client-api", "solana-sdk", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-stream", "tokio-tungstenite", @@ -5084,20 +5459,19 @@ dependencies = [ [[package]] name = "solana-quic-client" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7952c5306a0be5f5276448cd20246b31265bfa884f29a077a24303c6a16aeb34" +checksum = "859d9ceebb3cc2b2d13544385682ece8803d9eb9c004d2cd46fc171826c82395" dependencies = [ - "async-mutex", + "async-lock", "async-trait", "futures", - "itertools 0.10.5", + "itertools 0.12.1", "lazy_static", "log", "quinn", - "quinn-proto", - "rcgen", - "rustls", + "quinn-proto 0.11.11", + "rustls 0.23.26", "solana-connection-cache", "solana-measure", "solana-metrics", @@ -5105,60 +5479,54 @@ dependencies = [ "solana-rpc-client-api", "solana-sdk", "solana-streamer", - "thiserror", + "thiserror 1.0.69", "tokio", ] [[package]] name = "solana-rayon-threadlimit" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4fa0cc66f8e73d769bca2ede3012ba2ef8ab67963e832808665369f2cf81743" +checksum = "5292c803e4ab518dcdd6f45d11cc82c1d6e95798662c26cc725746263a2d5c91" dependencies = [ "lazy_static", "num_cpus", ] [[package]] -name = "solana-remote-wallet" -version = "1.18.17" +name = "solana-rent" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "289803796d4ff7b4699504d3ab9e9d9c5205ea3892b2ebe397b377494dbd75d4" +checksum = "be7ddfa29be6122cb9682e343b55b48687360e56950c928735a5084cafaf42ad" dependencies = [ - "console", - "dialoguer", - "log", - "num-derive 0.4.2", - "num-traits", - "parking_lot", - "qstring", - "semver", - "solana-sdk", - "thiserror", - "uriparse", + "serde", + "serde_derive", + "solana-sdk-macro", + "solana-sysvar-id", ] [[package]] name = "solana-rpc-client" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb55a08018776a62ecff52139fbcdab1a7baa4e8f077202be58156e8dde4d5f" +checksum = "daff6e5efce459257dca6b158058882b6720d91f5fe9a83986c201668963a645" dependencies = [ "async-trait", - "base64 0.21.7", + "base64 0.22.1", "bincode", - "bs58 0.4.0", + "bs58", "indicatif", "log", "reqwest", + "reqwest-middleware", "semver", "serde", "serde_derive", "serde_json", - "solana-account-decoder", + "solana-account-decoder-client-types", "solana-rpc-client-api", "solana-sdk", - "solana-transaction-status", + "solana-transaction-status-client-types", "solana-version", "solana-vote-program", "tokio", @@ -5166,48 +5534,49 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a8403038f4d6ab65bc7e7afb3afe8d9824c592232553c5cef55cf3de36025d" +checksum = "7670d6a72467d4042da471008fc88b3ff60e94f84a29463f20907b6e114ff214" dependencies = [ - "base64 0.21.7", - "bs58 0.4.0", + "anyhow", + "base64 0.22.1", + "bs58", "jsonrpc-core", "reqwest", + "reqwest-middleware", "semver", "serde", "serde_derive", "serde_json", - "solana-account-decoder", + "solana-account-decoder-client-types", + "solana-inline-spl", "solana-sdk", - "solana-transaction-status", + "solana-transaction-status-client-types", "solana-version", - "spl-token-2022 1.0.0", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-rpc-client-nonce-utils" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4caca735caf76d51c074c3bacbfe38094bf7f92cfbe7b5b13f3bc4946e64f889" +checksum = "2445c0db5d9953012b226dbb060f3ab67b80e92b5262cae10afad2863e72ea94" dependencies = [ - "clap 2.34.0", - "solana-clap-utils", "solana-rpc-client", "solana-sdk", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-runtime" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699943045665038bfa4e76dd2582b4c390f1aec6ab5edef36da43afe3469f1d" +checksum = "7a6e9b7b8554f23c62298c13638c1ceed039636c861fc11d6b3cb29503984b1d" dependencies = [ + "ahash 0.8.11", "aquamarine", "arrayref", - "base64 0.21.7", + "base64 0.22.1", "bincode", "blake3", "bv", @@ -5221,10 +5590,10 @@ dependencies = [ "fnv", "im", "index_list", - "itertools 0.10.5", + "itertools 0.12.1", "lazy_static", + "libc", "log", - "lru", "lz4", "memmap2", "mockall", @@ -5232,38 +5601,49 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_cpus", - "num_enum 0.7.2", - "ouroboros", + "num_enum", "percentage", "qualifier_attr", "rand 0.8.5", "rayon", "regex", - "rustc_version", "serde", "serde_derive", "serde_json", + "serde_with", "solana-accounts-db", "solana-address-lookup-table-program", "solana-bpf-loader-program", "solana-bucket-map", + "solana-compute-budget", "solana-compute-budget-program", "solana-config-program", "solana-cost-model", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-feature-set", + "solana-fee", + "solana-inline-spl", + "solana-lattice-hash", "solana-loader-v4-program", "solana-measure", "solana-metrics", "solana-perf", + "solana-program", "solana-program-runtime", "solana-rayon-threadlimit", + "solana-runtime-transaction", "solana-sdk", "solana-stake-program", + "solana-svm", + "solana-svm-rent-collector", + "solana-svm-transaction", "solana-system-program", + "solana-timings", + "solana-transaction-status", "solana-version", "solana-vote", "solana-vote-program", + "solana-zk-elgamal-proof-program", + "solana-zk-sdk", "solana-zk-token-proof-program", "solana-zk-token-sdk", "static_assertions", @@ -5272,32 +5652,52 @@ dependencies = [ "symlink", "tar", "tempfile", - "thiserror", + "thiserror 1.0.69", "zstd", ] +[[package]] +name = "solana-runtime-transaction" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa69ce77907ff4bfb58819f8a5ce7680d2625446d579d100cd353945c85cbeb" +dependencies = [ + "agave-transaction-view", + "log", + "solana-builtins-default-costs", + "solana-compute-budget", + "solana-pubkey", + "solana-sdk", + "solana-svm-transaction", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-sanitize" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078d05d32ceef29bed59a44ef870adf7261ad99b1adbe4ffe23e2f981856b252" + [[package]] name = "solana-sdk" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df43d3a1e1637397ab43cbc216a5a8f977ec8a3cc3f3ae8c3851c83a3255dbcf" +checksum = "b255c18f83750d26d84b0d5623eb173de78cde45edff818375a864f42264a19a" dependencies = [ - "assert_matches", - "base64 0.21.7", "bincode", "bitflags 2.6.0", - "borsh 1.5.1", - "bs58 0.4.0", + "borsh 1.5.7", + "bs58", "bytemuck", + "bytemuck_derive", "byteorder", "chrono", - "derivation-path", "digest 0.10.7", "ed25519-dalek", "ed25519-dalek-bip32", - "generic-array", + "getrandom 0.1.16", "hmac 0.12.1", - "itertools 0.10.5", + "itertools 0.12.1", "js-sys", "lazy_static", "libsecp256k1 0.6.0", @@ -5305,43 +5705,79 @@ dependencies = [ "memmap2", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.2", - "pbkdf2 0.11.0", - "qstring", - "qualifier_attr", + "num_enum", + "pbkdf2", "rand 0.7.3", "rand 0.8.5", - "rustc_version", - "rustversion", "serde", "serde_bytes", "serde_derive", "serde_json", "serde_with", "sha2 0.10.8", - "sha3 0.10.8", + "sha3", "siphasher", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", + "solana-account", + "solana-bn254", + "solana-decode-error", + "solana-derivation-path", + "solana-feature-set", + "solana-inflation", + "solana-instruction", + "solana-native-token", + "solana-packet", + "solana-precompile-error", "solana-program", + "solana-program-memory", + "solana-pubkey", + "solana-sanitize", "solana-sdk-macro", - "thiserror", - "uriparse", + "solana-secp256k1-recover", + "solana-secp256r1-program", + "solana-serde-varint", + "solana-short-vec", + "solana-signature", + "solana-transaction-error", + "thiserror 1.0.69", "wasm-bindgen", ] [[package]] name = "solana-sdk-macro" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86c76414183a325038ff020b22c07d1e9d2da0703ddc0244acfed37ee2921d96" +checksum = "a9c102ed11f8b4b0ab9a9404635b80a8a5c78e1f14aa5831cb1f78b48e5c9f16" dependencies = [ - "bs58 0.4.0", + "bs58", "proc-macro2", "quote", - "rustversion", - "syn 2.0.58", + "syn 2.0.100", +] + +[[package]] +name = "solana-secp256k1-recover" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb2bed7da85b4720780b7c288328b5a74050eb7da2392b2d0d8c6e67e0eaff" +dependencies = [ + "borsh 1.5.7", + "libsecp256k1 0.6.0", + "solana-define-syscall", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-secp256r1-program" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29407abab67e2b814f1e828aa0b7d7a3e4b2f242ed41a69d8d815e48f3363ead" +dependencies = [ + "bytemuck", + "openssl", + "solana-feature-set", + "solana-instruction", + "solana-precompile-error", + "solana-pubkey", ] [[package]] @@ -5352,13 +5788,14 @@ checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" [[package]] name = "solana-send-transaction-service" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e056d865d22548bb7228121e118aa632486fc1a33a100961e5e98b5663371384" +checksum = "fa2f8c3d580d63477ac6cbc215c8806bb943dd7bfd5050722542d246ef473922" dependencies = [ "crossbeam-channel", "log", "solana-client", + "solana-connection-cache", "solana-measure", "solana-metrics", "solana-runtime", @@ -5366,73 +5803,228 @@ dependencies = [ "solana-tpu-client", ] +[[package]] +name = "solana-serde-varint" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54210a9cdf83e3cbf0ffc1dc8295a55a77bc41284a6585a3461c2b312cf238e3" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-serialize-utils" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1bf4c8e7669760ee69b1cc2f204620068701dc9f3923d2b518d2bde856c274c" +dependencies = [ + "solana-instruction", + "solana-pubkey", + "solana-sanitize", +] + +[[package]] +name = "solana-sha256-hasher" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98fad3fa0864a364481984d646cac28c3fb6f774f8569116a94bc15b8fb8574d" +dependencies = [ + "sha2 0.10.8", + "solana-define-syscall", + "solana-hash", +] + +[[package]] +name = "solana-short-vec" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54cfcad114cdac44752604cb6d1d9c38e59f0a35ae4e5a500f6ef7bd9b0b9ede" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-signature" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a98a0bbb26b622725678b5c83823117fdf841b7fae08b03d69789eb8b94ba523" +dependencies = [ + "bs58", + "ed25519-dalek", + "generic-array", + "rand 0.8.5", + "serde", + "serde_derive", + "solana-sanitize", +] + +[[package]] +name = "solana-slot-hashes" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7f2430f03dd7dcaa0aeb91e1083d9bae9860dc169648e09219dc2acb5d3c412" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", + "solana-sysvar-id", +] + +[[package]] +name = "solana-slot-history" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb21aba20b9feb7619145586eb41b7d2e150d1770f85290fcc1e59dcee5309f8" +dependencies = [ + "bv", + "serde", + "serde_derive", + "solana-sysvar-id", +] + +[[package]] +name = "solana-stable-layout" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf24e5747d8f57e9f1d0a0792d8f28cefb27a54e222fc5654516b334c5fc4471" +dependencies = [ + "solana-instruction", + "solana-pubkey", +] + [[package]] name = "solana-stake-program" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5dd1bc07beb75da5df5e07301d3d0d6104872c9afade22b910af9061fb4bc15" +checksum = "91fd9155ab658e799e2aad8a5c866958394ed80bec43393d8a1c1baf4a0b3b5f" dependencies = [ "bincode", "log", - "rustc_version", "solana-config-program", + "solana-feature-set", + "solana-log-collector", "solana-program-runtime", "solana-sdk", + "solana-type-overrides", "solana-vote-program", ] [[package]] name = "solana-streamer" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad1bdb955ec6d23a1dbf87e403ff3e610d68616275693125a893d7ed4b2d323" +checksum = "b05259f74d7478fc7c582caae3957ab51ab533646b16e9a32dd435a08868a956" dependencies = [ "async-channel", "bytes", "crossbeam-channel", + "dashmap", + "futures", "futures-util", + "governor", "histogram", - "indexmap 2.2.6", - "itertools 0.10.5", + "indexmap", + "itertools 0.12.1", "libc", "log", "nix", "pem", "percentage", - "pkcs8", "quinn", - "quinn-proto", + "quinn-proto 0.11.11", "rand 0.8.5", - "rcgen", - "rustls", + "rustls 0.23.26", "smallvec", + "socket2", + "solana-measure", "solana-metrics", "solana-perf", "solana-sdk", - "thiserror", + "solana-transaction-metrics-tracker", + "thiserror 1.0.69", "tokio", + "tokio-util 0.7.11", "x509-parser", ] +[[package]] +name = "solana-svm" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4045fa0ab009043e8637cf91a559c31a8adf69c2ff37ea99a4acb536eee8a5c1" +dependencies = [ + "itertools 0.12.1", + "log", + "percentage", + "serde", + "serde_derive", + "solana-bpf-loader-program", + "solana-compute-budget", + "solana-feature-set", + "solana-fee", + "solana-loader-v4-program", + "solana-log-collector", + "solana-measure", + "solana-program-runtime", + "solana-runtime-transaction", + "solana-sdk", + "solana-svm-rent-collector", + "solana-svm-transaction", + "solana-system-program", + "solana-timings", + "solana-type-overrides", + "solana-vote", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-svm-rent-collector" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f706d930e1d3f7c2842f5cb693a82e36282c42a58f6f2d2f23fd3343160d1bee" +dependencies = [ + "solana-sdk", +] + +[[package]] +name = "solana-svm-transaction" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8902209a34c413f1c7ff3b207661d2651c26e369405f7cf6bcf2f7d1ec8d4f3b" +dependencies = [ + "solana-sdk", +] + [[package]] name = "solana-system-program" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78733745268c96d5a29c09cde9f0a6c9d662abba43e661b75dd858da8e3d0b2e" +checksum = "9825034f859142f6ff4dc51d614653bad91ee5a1786f7701d626010c34d0034a" dependencies = [ "bincode", "log", "serde", "serde_derive", + "solana-log-collector", "solana-program-runtime", "solana-sdk", + "solana-type-overrides", +] + +[[package]] +name = "solana-sysvar-id" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc3d7b31a88059e9e7b0e6a3c355f911a765e5e30f3b4556a80ecd5eeebfd96" +dependencies = [ + "solana-pubkey", ] [[package]] name = "solana-thin-client" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc301310ba0755c449a8800136f67f8ad14419b366404629894cd10021495360" +checksum = "71dec075f921639dac3dd922ab18ebfa809330083a999fd4ab0a86dd401529db" dependencies = [ "bincode", "log", @@ -5443,41 +6035,79 @@ dependencies = [ "solana-sdk", ] +[[package]] +name = "solana-timings" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b3873609ffe9b9ceb97349cd7e28cf4f81965ce4051ad2d4bae4fde4ff198f" +dependencies = [ + "eager", + "enum-iterator", + "solana-sdk", +] + [[package]] name = "solana-tpu-client" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb887bd5078ff015e103e9ee54a6713380590efa8ff1804b3a653f07188928c6" +checksum = "c2495e3d2a434c77c42a69f5a8c67f1a19b97bde1b178af904afcd24483701c5" dependencies = [ "async-trait", "bincode", "futures-util", - "indexmap 2.2.6", + "indexmap", "indicatif", "log", - "rayon", - "solana-connection-cache", - "solana-measure", - "solana-metrics", - "solana-pubsub-client", - "solana-rpc-client", - "solana-rpc-client-api", + "rayon", + "solana-connection-cache", + "solana-measure", + "solana-pubsub-client", + "solana-rpc-client", + "solana-rpc-client-api", + "solana-sdk", + "thiserror 1.0.69", + "tokio", +] + +[[package]] +name = "solana-transaction-error" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5b8fd565f33e5595802fa73401ce2fecd3bb6a04ba1ee9ce0f614fa31e19f4d" +dependencies = [ + "serde", + "serde_derive", + "solana-instruction", + "solana-sanitize", +] + +[[package]] +name = "solana-transaction-metrics-tracker" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b36a8b4c7c389459e351ef00b417071b9ca642e61ef6f248e7c0510025144c" +dependencies = [ + "base64 0.22.1", + "bincode", + "lazy_static", + "log", + "rand 0.8.5", + "solana-perf", "solana-sdk", - "thiserror", - "tokio", + "solana-short-vec", ] [[package]] name = "solana-transaction-status" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a0cdfdf63192fb60de094fae8e81159e4e3e9aac9659fe3f9ef0e707023fb32" +checksum = "b138ec46ceb38ff12baf73e543f1ce0b17e9dfd0c190dedc7692f3087baff36c" dependencies = [ "Inflector", - "base64 0.21.7", + "base64 0.22.1", "bincode", - "borsh 0.10.3", - "bs58 0.4.0", + "borsh 1.5.7", + "bs58", "lazy_static", "log", "serde", @@ -5485,94 +6115,165 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-sdk", - "spl-associated-token-account 2.3.0", - "spl-memo", - "spl-token 4.0.0", - "spl-token-2022 1.0.0", - "thiserror", + "solana-transaction-status-client-types", + "spl-associated-token-account 4.0.0", + "spl-memo 5.0.0", + "spl-token 6.0.0", + "spl-token-2022 4.0.0", + "spl-token-group-interface 0.3.0", + "spl-token-metadata-interface 0.4.0", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-transaction-status-client-types" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5db403124c4273bcade8bf7480e2b32a9d95b704007724f88d1231e3fe8de9f" +dependencies = [ + "base64 0.22.1", + "bincode", + "bs58", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder-client-types", + "solana-sdk", + "solana-signature", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-type-overrides" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0820dae5ea28d14f3397a3fb916e5aee53c4b20e08ad94bde9135583cce37bb6" +dependencies = [ + "lazy_static", + "rand 0.8.5", ] [[package]] name = "solana-udp-client" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea0d6d8d66e36371577f51c4d1d6192a66f1fa4efe7161a36d94677640dcadb" +checksum = "5b18ba83acfc0480d38edddeb9ae9f0c8ccc14ed0674c2b61ca2f098f27417b6" dependencies = [ "async-trait", "solana-connection-cache", "solana-net-utils", "solana-sdk", "solana-streamer", - "thiserror", + "thiserror 1.0.69", "tokio", ] [[package]] name = "solana-version" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f4c2f531c22ce806b211118be8928a791425f97de4592371fb57b246ed33e34" +checksum = "f1648d5c60517387ff3dd202313834ddd5adc8ae65d2cc7aebe237bb6baa5707" dependencies = [ - "log", - "rustc_version", "semver", "serde", "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-sdk", + "solana-feature-set", + "solana-sanitize", + "solana-serde-varint", ] [[package]] name = "solana-vote" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28ab95a5d19ff0464def1777adaae5a74e1edc9e6818103064c18fdc2643f6cb" +checksum = "3742275b2b34421e0ce0418ed1f26ddd0145030a6cf7252db75e40a22be9ecf2" dependencies = [ - "crossbeam-channel", - "itertools 0.10.5", + "itertools 0.12.1", "log", - "rustc_version", "serde", "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", "solana-sdk", - "solana-vote-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "solana-vote-program" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d8a6486017e71a3714a8e1a635e17209135cc20535ba9808ccf106d80ff6e8b" +checksum = "9cb613a1c15df1e1a67bc748fa9703caeda13321b4205e1036a9b905dcf99484" dependencies = [ "bincode", "log", "num-derive 0.4.2", "num-traits", - "rustc_version", "serde", "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-feature-set", "solana-metrics", "solana-program", "solana-program-runtime", "solana-sdk", - "thiserror", + "thiserror 1.0.69", +] + +[[package]] +name = "solana-zk-elgamal-proof-program" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ca4c74a4ed3fb456292142125e19a72b1cb6c5cd29da557bf4d239cac8552c5" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-log-collector", + "solana-program-runtime", + "solana-sdk", + "solana-zk-sdk", +] + +[[package]] +name = "solana-zk-sdk" +version = "2.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b979adbd419c767d504eaaea57d50ab4401b3f4ebf4f5a19dd3e1a92abd814a0" +dependencies = [ + "aes-gcm-siv", + "base64 0.22.1", + "bincode", + "bytemuck", + "bytemuck_derive", + "curve25519-dalek 4.1.3", + "itertools 0.12.1", + "js-sys", + "lazy_static", + "merlin", + "num-derive 0.4.2", + "num-traits", + "rand 0.8.5", + "serde", + "serde_derive", + "serde_json", + "sha3", + "solana-derivation-path", + "solana-program", + "solana-sdk", + "subtle", + "thiserror 1.0.69", + "wasm-bindgen", + "zeroize", ] [[package]] name = "solana-zk-token-proof-program" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e3dfb2deb449f7eb1dbd0c7e66dd95ec7b1303a5788673f9fbc9b5a5ea59f2" +checksum = "4c29da28a4200646d108aae332cd9fc503a417cab6a1ba2ce22b31d196f00008" dependencies = [ "bytemuck", "num-derive 0.4.2", "num-traits", + "solana-feature-set", + "solana-log-collector", "solana-program-runtime", "solana-sdk", "solana-zk-token-sdk", @@ -5580,49 +6281,51 @@ dependencies = [ [[package]] name = "solana-zk-token-sdk" -version = "1.18.17" +version = "2.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "513407f88394e437b4ff5aad892bc5bf51a655ae2401e6e63549734d3695c46f" +checksum = "f71c422b5e52e2bae8d0a5bdf0431c1b8c3d6a15d86745808a6d0339d456bedf" dependencies = [ "aes-gcm-siv", - "base64 0.21.7", + "base64 0.22.1", "bincode", "bytemuck", + "bytemuck_derive", "byteorder", - "curve25519-dalek", - "getrandom 0.1.16", - "itertools 0.10.5", + "curve25519-dalek 4.1.3", + "itertools 0.12.1", "lazy_static", "merlin", "num-derive 0.4.2", "num-traits", - "rand 0.7.3", + "rand 0.8.5", "serde", + "serde_derive", "serde_json", - "sha3 0.9.1", + "sha3", + "solana-curve25519", + "solana-derivation-path", "solana-program", "solana-sdk", "subtle", - "thiserror", + "thiserror 1.0.69", "zeroize", ] [[package]] name = "solana_rbpf" -version = "0.8.0" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d457cc2ba742c120492a64b7fa60e22c575e891f6b55039f4d736568fb112a3" +checksum = "1c1941b5ef0c3ce8f2ac5dd984d0fb1a97423c4ff2a02eec81e3913f02e2ac2b" dependencies = [ "byteorder", - "combine", - "goblin", + "combine 3.8.1", "hash32", "libc", "log", "rand 0.8.5", "rustc-demangle", "scroll", - "thiserror", + "thiserror 1.0.69", "winapi", ] @@ -5639,56 +6342,70 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] -name = "spki" -version = "0.5.4" +name = "spinning_top" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" dependencies = [ - "base64ct", - "der", + "lock_api", ] [[package]] name = "spl-associated-token-account" -version = "2.3.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "992d9c64c2564cc8f63a4b508bf3ebcdf2254b0429b13cd1d31adb6162432a5f" +checksum = "a2e688554bac5838217ffd1fab7845c573ff106b6336bf7d290db7c98d5a8efd" dependencies = [ "assert_matches", - "borsh 0.10.3", + "borsh 1.5.7", "num-derive 0.4.2", "num-traits", "solana-program", - "spl-token 4.0.0", - "spl-token-2022 1.0.0", - "thiserror", + "spl-token 4.0.2", + "spl-token-2022 3.0.2", + "thiserror 1.0.69", ] [[package]] name = "spl-associated-token-account" -version = "3.0.2" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2e688554bac5838217ffd1fab7845c573ff106b6336bf7d290db7c98d5a8efd" +checksum = "68034596cf4804880d265f834af1ff2f821ad5293e41fa0f8f59086c181fc38e" dependencies = [ "assert_matches", - "borsh 1.5.1", + "borsh 1.5.7", "num-derive 0.4.2", "num-traits", "solana-program", - "spl-token 4.0.0", - "spl-token-2022 3.0.2", - "thiserror", + "spl-token 6.0.0", + "spl-token-2022 4.0.0", + "thiserror 1.0.69", ] [[package]] -name = "spl-discriminator" -version = "0.1.0" +name = "spl-associated-token-account" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" +checksum = "76fee7d65013667032d499adc3c895e286197a35a0d3a4643c80e7fd3e9969e3" dependencies = [ - "bytemuck", + "borsh 1.5.7", + "num-derive 0.4.2", + "num-traits", "solana-program", - "spl-discriminator-derive 0.1.2", + "spl-associated-token-account-client", + "spl-token 7.0.0", + "spl-token-2022 6.0.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-associated-token-account-client" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f8349dbcbe575f354f9a533a21f272f3eb3808a49e2fdc1c34393b88ba76cb" +dependencies = [ + "solana-instruction", + "solana-pubkey", ] [[package]] @@ -5699,18 +6416,30 @@ checksum = "34d1814406e98b08c5cd02c1126f83fd407ad084adce0b05fda5730677822eac" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator-derive 0.2.0", + "spl-discriminator-derive", ] [[package]] -name = "spl-discriminator-derive" -version = "0.1.2" +name = "spl-discriminator" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fd7858fc4ff8fb0e34090e41d7eb06a823e1057945c26d480bfc21d2338a93" +checksum = "a38ea8b6dedb7065887f12d62ed62c1743aa70749e8558f963609793f6fb12bc" dependencies = [ - "quote", - "spl-discriminator-syn 0.1.2", - "syn 2.0.58", + "bytemuck", + "solana-program", + "spl-discriminator-derive", +] + +[[package]] +name = "spl-discriminator" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7398da23554a31660f17718164e31d31900956054f54f52d5ec1be51cb4f4b3" +dependencies = [ + "bytemuck", + "solana-program-error", + "solana-sha256-hasher", + "spl-discriminator-derive", ] [[package]] @@ -5720,56 +6449,66 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9e8418ea6269dcfb01c712f0444d2c75542c04448b480e87de59d2865edc750" dependencies = [ "quote", - "spl-discriminator-syn 0.2.0", - "syn 2.0.58", + "spl-discriminator-syn", + "syn 2.0.100", ] [[package]] name = "spl-discriminator-syn" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fea7be851bd98d10721782ea958097c03a0c2a07d8d4997041d0ece6319a63" +checksum = "8c1f05593b7ca9eac7caca309720f2eafb96355e037e6d373b909a80fe7b69b9" dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.58", - "thiserror", + "syn 2.0.100", + "thiserror 1.0.69", ] [[package]] -name = "spl-discriminator-syn" -version = "0.2.0" +name = "spl-elgamal-registry" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f05593b7ca9eac7caca309720f2eafb96355e037e6d373b909a80fe7b69b9" +checksum = "ce0f668975d2b0536e8a8fd60e56a05c467f06021dae037f1d0cfed0de2e231d" dependencies = [ - "proc-macro2", - "quote", - "sha2 0.10.8", - "syn 2.0.58", - "thiserror", + "bytemuck", + "solana-program", + "solana-zk-sdk", + "spl-pod 0.5.0", + "spl-token-confidential-transfer-proof-extraction", ] [[package]] name = "spl-memo" -version = "4.0.0" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f180b03318c3dbab3ef4e1e4d46d5211ae3c780940dd0a28695aba4b59a75a" +checksum = "64f13e674ae639249a78e2445fb043cf70e18f60e6dcf87a5411bc8c9580f130" dependencies = [ "solana-program", ] [[package]] -name = "spl-pod" -version = "0.1.0" +name = "spl-memo" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2881dddfca792737c0706fa0175345ab282b1b0879c7d877bad129645737c079" +checksum = "a0dba2f2bb6419523405d21c301a32c9f9568354d4742552e7972af801f4bdb3" dependencies = [ - "borsh 0.10.3", - "bytemuck", "solana-program", - "solana-zk-token-sdk", - "spl-program-error 0.3.0", +] + +[[package]] +name = "spl-memo" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f09647c0974e33366efeb83b8e2daebb329f0420149e74d3a4bd2c08cf9f7cb" +dependencies = [ + "solana-account-info", + "solana-instruction", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-pubkey", ] [[package]] @@ -5778,7 +6517,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046ce669f48cf2eca1ec518916d8725596bfb655beb1c74374cf71dc6cb773c9" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "bytemuck", "solana-program", "solana-zk-token-sdk", @@ -5786,16 +6525,37 @@ dependencies = [ ] [[package]] -name = "spl-program-error" -version = "0.3.0" +name = "spl-pod" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c704c88fc457fa649ba3aabe195c79d885c3f26709efaddc453c8de352c90b87" +dependencies = [ + "borsh 1.5.7", + "bytemuck", + "bytemuck_derive", + "solana-program", + "solana-zk-token-sdk", + "spl-program-error 0.5.0", +] + +[[package]] +name = "spl-pod" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "249e0318493b6bcf27ae9902600566c689b7dfba9f1bdff5893e92253374e78c" +checksum = "41a7d5950993e1ff2680bd989df298eeb169367fb2f9deeef1f132de6e4e8016" dependencies = [ + "borsh 1.5.7", + "bytemuck", + "bytemuck_derive", "num-derive 0.4.2", "num-traits", - "solana-program", - "spl-program-error-derive 0.3.2", - "thiserror", + "solana-decode-error", + "solana-msg", + "solana-program-error", + "solana-program-option", + "solana-pubkey", + "solana-zk-sdk", + "thiserror 1.0.69", ] [[package]] @@ -5807,20 +6567,34 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "solana-program", - "spl-program-error-derive 0.4.1", - "thiserror", + "spl-program-error-derive", + "thiserror 1.0.69", ] [[package]] -name = "spl-program-error-derive" -version = "0.3.2" +name = "spl-program-error" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1845dfe71fd68f70382232742e758557afe973ae19e6c06807b2c30f5d5cb474" +checksum = "d7b28bed65356558133751cc32b48a7a5ddfc59ac4e941314630bbed1ac10532" dependencies = [ - "proc-macro2", - "quote", - "sha2 0.10.8", - "syn 2.0.58", + "num-derive 0.4.2", + "num-traits", + "solana-program", + "spl-program-error-derive", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-program-error" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d39b5186f42b2b50168029d81e58e800b690877ef0b30580d107659250da1d1" +dependencies = [ + "num-derive 0.4.2", + "num-traits", + "solana-program", + "spl-program-error-derive", + "thiserror 1.0.69", ] [[package]] @@ -5832,162 +6606,215 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] name = "spl-tlv-account-resolution" -version = "0.4.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062e148d3eab7b165582757453632ffeef490c02c86a48bfdb4988f63eefb3b9" +checksum = "cace91ba08984a41556efe49cbf2edca4db2f577b649da7827d3621161784bf8" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-type-length-value 0.3.0", + "spl-discriminator 0.2.2", + "spl-pod 0.2.2", + "spl-program-error 0.4.1", + "spl-type-length-value 0.4.3", ] [[package]] name = "spl-tlv-account-resolution" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615d381f48ddd2bb3c57c7f7fb207591a2a05054639b18a62e785117dd7a8683" +checksum = "37a75a5f0fcc58126693ed78a17042e9dc53f07e357d6be91789f7d62aff61a4" dependencies = [ "bytemuck", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-type-length-value 0.3.0", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", + "spl-type-length-value 0.5.0", ] [[package]] name = "spl-tlv-account-resolution" -version = "0.6.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cace91ba08984a41556efe49cbf2edca4db2f577b649da7827d3621161784bf8" +checksum = "cd99ff1e9ed2ab86e3fd582850d47a739fec1be9f4661cba1782d3a0f26805f3" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "spl-program-error 0.6.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-token" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e9e171cbcb4b1f72f6d78ed1e975cb467f56825c27d09b8dd2608e4e7fc8b3b" dependencies = [ + "arrayref", "bytemuck", + "num-derive 0.4.2", + "num-traits", + "num_enum", "solana-program", - "spl-discriminator 0.2.2", - "spl-pod 0.2.2", - "spl-program-error 0.4.1", - "spl-type-length-value 0.4.3", + "thiserror 1.0.69", ] [[package]] name = "spl-token" -version = "3.5.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e85e168a785e82564160dcb87b2a8e04cee9bfd1f4d488c729d53d6a4bd300d" +checksum = "70a0f06ac7f23dc0984931b1fe309468f14ea58e32660439c1cef19456f5d0e3" dependencies = [ "arrayref", "bytemuck", - "num-derive 0.3.3", + "num-derive 0.4.2", "num-traits", - "num_enum 0.5.11", + "num_enum", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "spl-token" -version = "4.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08459ba1b8f7c1020b4582c4edf0f5c7511a5e099a7a97570c9698d4f2337060" +checksum = "ed320a6c934128d4f7e54fe00e16b8aeaecf215799d060ae14f93378da6dc834" dependencies = [ "arrayref", "bytemuck", - "num-derive 0.3.3", + "num-derive 0.4.2", "num-traits", - "num_enum 0.6.1", + "num_enum", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "spl-token-2022" -version = "0.9.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4abf34a65ba420584a0c35f3903f8d727d1f13ababbdc3f714c6b065a686e86" +checksum = "e5412f99ae7ee6e0afde00defaa354e6228e47e30c0e3adf553e2e01e6abb584" dependencies = [ "arrayref", "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.2", + "num_enum", "solana-program", + "solana-security-txt", "solana-zk-token-sdk", - "spl-memo", - "spl-pod 0.1.0", - "spl-token 4.0.0", - "spl-token-metadata-interface 0.2.0", - "spl-transfer-hook-interface 0.3.0", - "spl-type-length-value 0.3.0", - "thiserror", + "spl-memo 4.0.3", + "spl-pod 0.2.2", + "spl-token 4.0.2", + "spl-token-group-interface 0.2.3", + "spl-token-metadata-interface 0.3.3", + "spl-transfer-hook-interface 0.6.3", + "spl-type-length-value 0.4.3", + "thiserror 1.0.69", ] [[package]] name = "spl-token-2022" -version = "1.0.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d697fac19fd74ff472dfcc13f0b442dd71403178ce1de7b5d16f83a33561c059" +checksum = "d9c10f3483e48679619c76598d4e4aebb955bc49b0a5cc63323afbf44135c9bf" dependencies = [ "arrayref", "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.2", + "num_enum", "solana-program", "solana-security-txt", "solana-zk-token-sdk", - "spl-memo", - "spl-pod 0.1.0", - "spl-token 4.0.0", - "spl-token-group-interface 0.1.0", - "spl-token-metadata-interface 0.2.0", - "spl-transfer-hook-interface 0.4.1", - "spl-type-length-value 0.3.0", - "thiserror", + "spl-memo 5.0.0", + "spl-pod 0.3.1", + "spl-token 6.0.0", + "spl-token-group-interface 0.3.0", + "spl-token-metadata-interface 0.4.0", + "spl-transfer-hook-interface 0.7.0", + "spl-type-length-value 0.5.0", + "thiserror 1.0.69", ] [[package]] name = "spl-token-2022" -version = "3.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5412f99ae7ee6e0afde00defaa354e6228e47e30c0e3adf553e2e01e6abb584" +checksum = "5b27f7405010ef816587c944536b0eafbcc35206ab6ba0f2ca79f1d28e488f4f" dependencies = [ "arrayref", "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.2", + "num_enum", "solana-program", "solana-security-txt", - "solana-zk-token-sdk", - "spl-memo", - "spl-pod 0.2.2", - "spl-token 4.0.0", - "spl-token-group-interface 0.2.3", - "spl-token-metadata-interface 0.3.3", - "spl-transfer-hook-interface 0.6.3", - "spl-type-length-value 0.4.3", - "thiserror", + "solana-zk-sdk", + "spl-elgamal-registry", + "spl-memo 6.0.0", + "spl-pod 0.5.0", + "spl-token 7.0.0", + "spl-token-confidential-transfer-ciphertext-arithmetic", + "spl-token-confidential-transfer-proof-extraction", + "spl-token-confidential-transfer-proof-generation", + "spl-token-group-interface 0.5.0", + "spl-token-metadata-interface 0.6.0", + "spl-transfer-hook-interface 0.9.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-token-confidential-transfer-ciphertext-arithmetic" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170378693c5516090f6d37ae9bad2b9b6125069be68d9acd4865bbe9fc8499fd" +dependencies = [ + "base64 0.22.1", + "bytemuck", + "solana-curve25519", + "solana-zk-sdk", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-extraction" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff2d6a445a147c9d6dd77b8301b1e116c8299601794b558eafa409b342faf96" +dependencies = [ + "bytemuck", + "solana-curve25519", + "solana-program", + "solana-zk-sdk", + "spl-pod 0.5.0", + "thiserror 2.0.12", ] [[package]] -name = "spl-token-group-interface" -version = "0.1.0" +name = "spl-token-confidential-transfer-proof-generation" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b889509d49fa74a4a033ca5dae6c2307e9e918122d97e58562f5c4ffa795c75d" +checksum = "8627184782eec1894de8ea26129c61303f1f0adeed65c20e0b10bc584f09356d" dependencies = [ - "bytemuck", - "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", + "curve25519-dalek 4.1.3", + "solana-zk-sdk", + "thiserror 1.0.69", ] [[package]] @@ -6004,17 +6831,35 @@ dependencies = [ ] [[package]] -name = "spl-token-metadata-interface" -version = "0.2.0" +name = "spl-token-group-interface" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c16ce3ba6979645fb7627aa1e435576172dd63088dc7848cb09aa331fa1fe4f" +checksum = "df8752b85a5ecc1d9f3a43bce3dd9a6a053673aacf5deb513d1cbb88d3534ffd" dependencies = [ - "borsh 0.10.3", + "bytemuck", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-type-length-value 0.3.0", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", +] + +[[package]] +name = "spl-token-group-interface" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d595667ed72dbfed8c251708f406d7c2814a3fa6879893b323d56a10bedfc799" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "thiserror 1.0.69", ] [[package]] @@ -6023,7 +6868,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30179c47e93625680dabb620c6e7931bd12d62af390f447bc7beb4a3a9b5feee" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.7", "solana-program", "spl-discriminator 0.2.2", "spl-pod 0.2.2", @@ -6032,35 +6877,38 @@ dependencies = [ ] [[package]] -name = "spl-transfer-hook-interface" -version = "0.3.0" +name = "spl-token-metadata-interface" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051d31803f873cabe71aec3c1b849f35248beae5d19a347d93a5c9cccc5d5a9b" +checksum = "c6c2318ddff97e006ed9b1291ebec0750a78547f870f62a69c56fe3b46a5d8fc" dependencies = [ - "arrayref", - "bytemuck", + "borsh 1.5.7", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-tlv-account-resolution 0.4.0", - "spl-type-length-value 0.3.0", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", + "spl-type-length-value 0.5.0", ] [[package]] -name = "spl-transfer-hook-interface" -version = "0.4.1" +name = "spl-token-metadata-interface" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aabdb7c471566f6ddcee724beb8618449ea24b399e58d464d6b5bc7db550259" +checksum = "dfb9c89dbc877abd735f05547dcf9e6e12c00c11d6d74d8817506cab4c99fdbb" dependencies = [ - "arrayref", - "bytemuck", - "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", - "spl-tlv-account-resolution 0.5.1", - "spl-type-length-value 0.3.0", + "borsh 1.5.7", + "num-derive 0.4.2", + "num-traits", + "solana-borsh", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", ] [[package]] @@ -6080,16 +6928,44 @@ dependencies = [ ] [[package]] -name = "spl-type-length-value" -version = "0.3.0" +name = "spl-transfer-hook-interface" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a468e6f6371f9c69aae760186ea9f1a01c2908351b06a5e0026d21cfc4d7ecac" +checksum = "a110f33d941275d9f868b96daaa993f1e73b6806cc8836e43075b4d3ad8338a7" dependencies = [ + "arrayref", "bytemuck", "solana-program", - "spl-discriminator 0.1.0", - "spl-pod 0.1.0", - "spl-program-error 0.3.0", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", + "spl-tlv-account-resolution 0.7.0", + "spl-type-length-value 0.5.0", +] + +[[package]] +name = "spl-transfer-hook-interface" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aa7503d52107c33c88e845e1351565050362c2314036ddf19a36cd25137c043" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "spl-program-error 0.6.0", + "spl-tlv-account-resolution 0.9.0", + "spl-type-length-value 0.7.0", + "thiserror 1.0.69", ] [[package]] @@ -6106,22 +6982,41 @@ dependencies = [ ] [[package]] -name = "static_assertions" -version = "1.1.0" +name = "spl-type-length-value" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "bdcd73ec187bc409464c60759232e309f83b52a18a9c5610bf281c9c6432918c" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator 0.3.0", + "spl-pod 0.3.1", + "spl-program-error 0.5.0", +] [[package]] -name = "strsim" -version = "0.8.0" +name = "spl-type-length-value" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "ba70ef09b13af616a4c987797870122863cba03acc4284f226a4473b043923f9" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-msg", + "solana-program-error", + "spl-discriminator 0.4.1", + "spl-pod 0.5.0", + "thiserror 1.0.69", +] [[package]] -name = "strsim" -version = "0.10.0" +name = "static_assertions" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" @@ -6170,20 +7065,14 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "superslice" -version = "1.0.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sval" @@ -6275,14 +7164,14 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "sha3 0.10.8", + "sha3", ] [[package]] name = "switchboard-on-demand" -version = "0.1.14" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3852951c42f8876a443060b6882bda945f1621224236ead37959e80f5369cf81" +checksum = "2ee00734181d7fdb6a5c9c72374d5257ba3991185db7dd6c5512f500faf70527" dependencies = [ "arc-swap", "async-trait", @@ -6294,36 +7183,14 @@ dependencies = [ "lazy_static", "libsecp256k1 0.7.1", "log", - "num 0.4.3", + "once_cell", "rust_decimal", "serde", - "serde_json", "sha2 0.10.8", "solana-address-lookup-table-program", "solana-program", - "spl-associated-token-account 2.3.0", - "spl-token 3.5.0", - "switchboard-common", -] - -[[package]] -name = "switchboard-solana" -version = "0.29.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb0cb2cd26bcd72a11fae679d07207bca093c303c9cc72bcdc7866bb7bf8a6b" -dependencies = [ - "anchor-lang 0.29.0", - "anchor-spl 0.29.0", - "bytemuck", - "hex", - "kv-log-macro", - "lazy_static", - "libsecp256k1 0.7.1", - "log", - "rust_decimal", - "solana-address-lookup-table-program", - "solana-program", - "superslice", + "spl-associated-token-account 3.0.2", + "spl-token 7.0.0", "switchboard-common", ] @@ -6346,27 +7213,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.58", -] - [[package]] name = "sync_wrapper" version = "0.1.2" @@ -6392,7 +7247,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -6414,9 +7269,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tar" -version = "0.4.41" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" dependencies = [ "filetime", "libc", @@ -6439,7 +7294,7 @@ dependencies = [ "serde", "static_assertions", "tarpc-plugins", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-serde", "tokio-util 0.6.10", @@ -6458,15 +7313,25 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "task-local-extensions" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba323866e5d033818e3240feeb9f7db2c4296674e4d9e16b97b7bf8f490434e8" +dependencies = [ + "pin-utils", +] + [[package]] name = "tempfile" -version = "3.10.1" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ - "cfg-if", "fastrand", - "rustix", + "getrandom 0.3.2", + "once_cell", + "rustix 1.0.5", "windows-sys 0.52.0", ] @@ -6486,71 +7351,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] -name = "test-case" -version = "3.3.1" +name = "thiserror" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2550dd13afcd286853192af8601920d959b14c401fcece38071d53bf0768a8" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "test-case-macros", + "thiserror-impl 1.0.69", ] [[package]] -name = "test-case-core" -version = "3.3.1" +name = "thiserror" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcb7fd841cd518e279be3d5a3eb0636409487998a4aff22f3de87b81e88384f" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "syn 2.0.58", + "thiserror-impl 2.0.12", ] [[package]] -name = "test-case-macros" -version = "3.3.1" +name = "thiserror-impl" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", - "test-case-core", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "textwrap" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" - -[[package]] -name = "thiserror" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" -dependencies = [ - "thiserror-impl", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -6604,25 +7441,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-bip39" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" -dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - [[package]] name = "tinyvec" version = "1.8.0" @@ -6640,32 +7458,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.44.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -6674,7 +7491,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.12", "tokio", ] @@ -6696,9 +7513,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -6713,7 +7530,7 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "rustls", + "rustls 0.21.12", "tokio", "tokio-rustls", "tungstenite", @@ -6763,24 +7580,13 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.2.6", - "toml_datetime", - "winnow", -] - [[package]] name = "toml_edit" version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.6", + "indexmap", "toml_datetime", "winnow", ] @@ -6811,7 +7617,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] @@ -6867,9 +7673,9 @@ dependencies = [ "httparse", "log", "rand 0.8.5", - "rustls", + "rustls 0.21.12", "sha1", - "thiserror", + "thiserror 1.0.69", "url", "utf-8", "webpki-roots 0.24.0", @@ -6917,6 +7723,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "unicase" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" + [[package]] name = "unicode-bidi" version = "0.3.15" @@ -6958,11 +7770,11 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "universal-hash" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ - "generic-array", + "crypto-common", "subtle", ] @@ -7078,10 +7890,10 @@ dependencies = [ ] [[package]] -name = "vec_map" -version = "0.8.2" +name = "vcpkg" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" @@ -7126,28 +7938,38 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", "wasm-bindgen-shared", ] @@ -7165,9 +7987,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7175,22 +7997,25 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" @@ -7202,13 +8027,32 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-root-certs" +version = "0.26.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09aed61f5e8d2c18344b3faa33a4c837855fe56642757754775548fee21386c4" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "webpki-roots" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" dependencies = [ - "rustls-webpki", + "rustls-webpki 0.101.7", ] [[package]] @@ -7257,6 +8101,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -7275,6 +8128,21 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -7306,6 +8174,12 @@ dependencies = [ "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -7318,6 +8192,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -7330,6 +8210,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -7348,6 +8234,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -7360,6 +8252,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -7372,6 +8270,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -7384,6 +8288,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -7415,6 +8325,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags 2.6.0", +] + [[package]] name = "wyz" version = "0.5.1" @@ -7438,7 +8357,7 @@ dependencies = [ "nom", "oid-registry", "rusticata-macros", - "thiserror", + "thiserror 1.0.69", "time", ] @@ -7449,17 +8368,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", - "linux-raw-sys", - "rustix", -] - -[[package]] -name = "yasna" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" -dependencies = [ - "time", + "linux-raw-sys 0.4.14", + "rustix 0.38.34", ] [[package]] @@ -7479,14 +8389,14 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] name = "zeroize" -version = "1.3.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -7499,33 +8409,32 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.100", ] [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" dependencies = [ - "libc", "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.12+zstd.1.5.6" +version = "2.0.15+zstd.1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a4e40c320c3cb459d9a9ff6de98cff88f4751ee9275d140e2be94a2b74e4c13" +checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" dependencies = [ "cc", "pkg-config", diff --git a/programs/marginfi/fuzz/Cargo.toml b/programs/marginfi/fuzz/Cargo.toml index 7a2d82569..030aa650f 100644 --- a/programs/marginfi/fuzz/Cargo.toml +++ b/programs/marginfi/fuzz/Cargo.toml @@ -14,15 +14,15 @@ test = false doc = false [dependencies] -solana-sdk = "=1.18.17" -solana-program = "=1.18.17" -solana-program-test = "=1.18.17" -spl-token = "4.0.0" +solana-sdk = "=2.1.20" +solana-program = "=2.1.20" +solana-program-test = "=2.1.20" +spl-token = "7.0.0" -anchor-lang = { git = "https://github.com/mrgnlabs/anchor.git", rev = "fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" } -anchor-spl = { git = "https://github.com/mrgnlabs/anchor.git", rev = "fdcf299dc55ecf7cfa8c4d598aecb1363b99c02d" } +anchor-lang = { version = "0.31.1" } +anchor-spl = { version = "0.31.1", features = ["token_2022"] } -pyth-sdk-solana = "=0.10.1" +pyth-sdk-solana = "=0.10.4" anyhow = "1.0.68" arbitrary = { version = "1.2.2", features = ["derive"] } @@ -30,8 +30,8 @@ bumpalo = "=3.11.1" libfuzzer-sys = "0.4" safe-transmute = "0.11.2" rand = "0.8.5" -bytemuck = "1.12.3" -fixed = "1.21.0" +bytemuck = "1.22.0" +fixed = "=1.28.0" fixed-macro = "1.2.0" lazy_static = "1.4.0" log = { version = "0.4.17", optional = true } diff --git a/programs/marginfi/fuzz/src/account_state.rs b/programs/marginfi/fuzz/src/account_state.rs index f28a6424e..586019114 100644 --- a/programs/marginfi/fuzz/src/account_state.rs +++ b/programs/marginfi/fuzz/src/account_state.rs @@ -20,7 +20,7 @@ use marginfi::{ use pyth_sdk_solana::state::{ AccountType, PriceInfo, PriceStatus, Rational, SolanaPriceAccount, MAGIC, VERSION_2, }; -use safe_transmute::{transmute_to_bytes, transmute_to_bytes_mut}; +use safe_transmute::transmute_to_bytes_mut; use solana_program::{ bpf_loader, program_pack::Pack, stake_history::Epoch, system_program, sysvar, }; @@ -38,8 +38,7 @@ impl AccountsState { fn random_pubkey<'bump>(&'bump self) -> &Pubkey { #[allow(deprecated)] - self.bump - .alloc(Pubkey::new(transmute_to_bytes(&rand::random::<[u64; 4]>()))) + self.bump.alloc(Pubkey::new_unique()) } pub fn new_sol_account<'bump>( diff --git a/programs/marginfi/src/constants.rs b/programs/marginfi/src/constants.rs index 4e66fb889..af038061f 100644 --- a/programs/marginfi/src/constants.rs +++ b/programs/marginfi/src/constants.rs @@ -1,8 +1,8 @@ use anchor_lang::prelude::*; +use anchor_lang::solana_program::pubkey; use fixed::types::I80F48; use fixed_macro::types::I80F48; use pyth_solana_receiver_sdk::price_update::VerificationLevel; -use anchor_lang::solana_program::pubkey; pub const LIQUIDITY_VAULT_AUTHORITY_SEED: &str = "liquidity_vault_auth"; pub const INSURANCE_VAULT_AUTHORITY_SEED: &str = "insurance_vault_auth"; diff --git a/programs/marginfi/src/instructions/marginfi_account/deposit.rs b/programs/marginfi/src/instructions/marginfi_account/deposit.rs index 2cde8fe38..5e8f17069 100644 --- a/programs/marginfi/src/instructions/marginfi_account/deposit.rs +++ b/programs/marginfi/src/instructions/marginfi_account/deposit.rs @@ -10,10 +10,10 @@ use crate::{ utils::{self, validate_asset_tags}, }; use anchor_lang::prelude::*; -use anchor_spl::token_interface::{TokenAccount, TokenInterface}; -use fixed::types::I80F48; use anchor_lang::solana_program::clock::Clock; use anchor_lang::solana_program::sysvar::Sysvar; +use anchor_spl::token_interface::{TokenAccount, TokenInterface}; +use fixed::types::I80F48; /// 1. Accrue interest /// 2. Create the user's bank account for the asset deposited if it does not exist yet diff --git a/programs/marginfi/src/instructions/marginfi_account/pulse_health.rs b/programs/marginfi/src/instructions/marginfi_account/pulse_health.rs index 7d3ecc9da..4822b590e 100644 --- a/programs/marginfi/src/instructions/marginfi_account/pulse_health.rs +++ b/programs/marginfi/src/instructions/marginfi_account/pulse_health.rs @@ -1,6 +1,6 @@ use anchor_lang::prelude::*; -use bytemuck::Zeroable; use anchor_lang::solana_program::{clock::Clock, sysvar::Sysvar}; +use bytemuck::Zeroable; use crate::{ state::{ diff --git a/programs/marginfi/src/instructions/marginfi_account/repay.rs b/programs/marginfi/src/instructions/marginfi_account/repay.rs index 982b23491..421e1f3eb 100644 --- a/programs/marginfi/src/instructions/marginfi_account/repay.rs +++ b/programs/marginfi/src/instructions/marginfi_account/repay.rs @@ -9,9 +9,9 @@ use crate::{ utils, }; use anchor_lang::prelude::*; +use anchor_lang::solana_program::{clock::Clock, sysvar::Sysvar}; use anchor_spl::token_interface::{TokenAccount, TokenInterface}; use fixed::types::I80F48; -use anchor_lang::solana_program::{clock::Clock, sysvar::Sysvar}; /// 1. Accrue interest /// 2. Find the user's existing bank account for the asset repaid diff --git a/programs/marginfi/src/instructions/marginfi_account/withdraw.rs b/programs/marginfi/src/instructions/marginfi_account/withdraw.rs index 69426cc64..081530f02 100644 --- a/programs/marginfi/src/instructions/marginfi_account/withdraw.rs +++ b/programs/marginfi/src/instructions/marginfi_account/withdraw.rs @@ -11,10 +11,10 @@ use crate::{ utils, }; use anchor_lang::prelude::*; +use anchor_lang::solana_program::{clock::Clock, sysvar::Sysvar}; use anchor_spl::token_interface::{TokenAccount, TokenInterface}; use bytemuck::Zeroable; use fixed::types::I80F48; -use anchor_lang::solana_program::{clock::Clock, sysvar::Sysvar}; /// 1. Accrue interest /// 2. Find the user's existing bank account for the asset withdrawn diff --git a/programs/marginfi/tests/admin_actions/account_transfer.rs b/programs/marginfi/tests/admin_actions/account_transfer.rs index c802298df..0b4a41039 100644 --- a/programs/marginfi/tests/admin_actions/account_transfer.rs +++ b/programs/marginfi/tests/admin_actions/account_transfer.rs @@ -69,7 +69,7 @@ async fn marginfi_account_authority_transfer_not_account_owner() -> anyhow::Resu // Note: Sending this tx takes a very long time (longer than all the other tests combined) // because for some reason it takes longer for a signature verification fail to return than it // does for other errors. We simulate instead here for testing SPEEEEEED - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let res = ctx.banks_client.simulate_transaction(tx).await; let is_err = res.unwrap().result.unwrap().is_err(); diff --git a/programs/marginfi/tests/admin_actions/bankruptcy.rs b/programs/marginfi/tests/admin_actions/bankruptcy.rs index b3afb5b04..8690797b5 100644 --- a/programs/marginfi/tests/admin_actions/bankruptcy.rs +++ b/programs/marginfi/tests/admin_actions/bankruptcy.rs @@ -14,8 +14,8 @@ use test_case::test_case; #[test_case(BankMint::Usdc, BankMint::Sol)] #[test_case(BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(BankMint::T22WithFee, BankMint::Sol)] +#[test_case(BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_failure_not_bankrupt( collateral_mint: BankMint, @@ -99,8 +99,8 @@ async fn marginfi_group_handle_bankruptcy_failure_not_bankrupt( #[test_case(BankMint::Usdc, BankMint::Sol)] #[test_case(BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(BankMint::T22WithFee, BankMint::Sol)] +#[test_case(BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_failure_no_debt( collateral_mint: BankMint, @@ -191,8 +191,8 @@ async fn marginfi_group_handle_bankruptcy_failure_no_debt( #[test_case(BankMint::Usdc, BankMint::Sol)] #[test_case(BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(BankMint::T22WithFee, BankMint::Sol)] +#[test_case(BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_success( collateral_mint: BankMint, @@ -281,8 +281,8 @@ async fn marginfi_group_handle_bankruptcy_success( #[test_case(10_000., BankMint::Usdc, BankMint::Sol)] #[test_case(10_000., BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(10_000., BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(10_000., BankMint::T22WithFee, BankMint::Sol)] +#[test_case(10_000., BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(10_000., BankMint::T22WithFee, BankMint::Sol)] #[test_case(10_000., BankMint::Usdc, BankMint::SolSwbOrigFee)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_group_handle_bankruptcy_success_fully_insured( @@ -545,8 +545,8 @@ async fn marginfi_group_handle_bankruptcy_success_fully_insured( #[test_case(10_000., 5000., BankMint::Usdc, BankMint::Sol)] #[test_case(10_000., 5000., BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(10_000., 5000., BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(10_000., 5000., BankMint::T22WithFee, BankMint::Sol)] +#[test_case(10_000., 5000., BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(10_000., 5000., BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_success_partially_insured( borrow_amount: f64, @@ -721,8 +721,8 @@ async fn marginfi_group_handle_bankruptcy_success_partially_insured( #[test_case(10_000., BankMint::Usdc, BankMint::Sol)] #[test_case(10_000., BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(10_000., BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(10_000., BankMint::T22WithFee, BankMint::Sol)] +#[test_case(10_000., BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(10_000., BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_group_handle_bankruptcy_success_not_insured( borrow_amount: f64, diff --git a/programs/marginfi/tests/admin_actions/interest_accrual.rs b/programs/marginfi/tests/admin_actions/interest_accrual.rs index 2892d0d18..eb4662816 100644 --- a/programs/marginfi/tests/admin_actions/interest_accrual.rs +++ b/programs/marginfi/tests/admin_actions/interest_accrual.rs @@ -57,7 +57,7 @@ async fn marginfi_group_accrue_interest_rates_success_1() -> anyhow::Result<()> .await?; { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let mut clock: Clock = ctx.banks_client.get_sysvar().await?; // Advance clock by 1 year clock.unix_timestamp += 365 * 24 * 60 * 60; @@ -152,7 +152,7 @@ async fn marginfi_group_accrue_interest_rates_success_2() -> anyhow::Result<()> // Advance clock by 1 minute { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let mut clock: Clock = ctx.banks_client.get_sysvar().await?; clock.unix_timestamp += 60; ctx.set_sysvar(&clock); diff --git a/programs/marginfi/tests/admin_actions/setup_bank.rs b/programs/marginfi/tests/admin_actions/setup_bank.rs index 4e7a08bd0..8c4b421b8 100644 --- a/programs/marginfi/tests/admin_actions/setup_bank.rs +++ b/programs/marginfi/tests/admin_actions/setup_bank.rs @@ -42,7 +42,7 @@ async fn add_bank_success() -> anyhow::Result<()> { // Load the fee state before the start of the test let fee_balance_before: u64; { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); fee_balance_before = ctx .banks_client .get_account(fee_wallet) @@ -126,7 +126,7 @@ async fn add_bank_success() -> anyhow::Result<()> { // Load the fee state after the test let fee_balance_after: u64; { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); fee_balance_after = ctx .banks_client .get_account(fee_wallet) @@ -168,7 +168,7 @@ async fn add_bank_with_seed_success() -> anyhow::Result<()> { for (mint_f, bank_config) in mints { let fee_balance_before: u64; { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); fee_balance_before = ctx .banks_client .get_account(fee_wallet) @@ -254,7 +254,7 @@ async fn add_bank_with_seed_success() -> anyhow::Result<()> { let fee_balance_after: u64; { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); fee_balance_after = ctx .banks_client .get_account(fee_wallet) @@ -297,8 +297,8 @@ async fn marginfi_group_add_bank_failure_inexistent_pyth_feed() -> anyhow::Resul } #[test_case(BankMint::Usdc)] -// t22 #[test_case(BankMint::PyUSD)] -// t22 #[test_case(BankMint::T22WithFee)] +#[test_case(BankMint::PyUSD)] +#[test_case(BankMint::T22WithFee)] #[test_case(BankMint::SolSwbPull)] #[tokio::test] async fn configure_bank_success(bank_mint: BankMint) -> anyhow::Result<()> { @@ -513,8 +513,8 @@ async fn config_group_as_arena_too_many_banks() -> anyhow::Result<()> { } #[test_case(BankMint::Usdc)] -// t22 #[test_case(BankMint::PyUSD)] -// t22 #[test_case(BankMint::T22WithFee)] +#[test_case(BankMint::PyUSD)] +#[test_case(BankMint::T22WithFee)] #[test_case(BankMint::SolSwbPull)] #[tokio::test] async fn configure_bank_emode_success(bank_mint: BankMint) -> anyhow::Result<()> { @@ -538,7 +538,7 @@ async fn configure_bank_emode_success(bank_mint: BankMint) -> anyhow::Result<()> // Load bank and check that the emode settings got applied let loaded_bank: Bank = test_f.load_and_deserialize(&bank.key).await; let timestamp = { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let clock: Clock = ctx.banks_client.get_sysvar().await?; clock.unix_timestamp }; @@ -568,7 +568,7 @@ async fn configure_bank_emode_success(bank_mint: BankMint) -> anyhow::Result<()> // Load bank and check that the emode settings got applied let loaded_bank: Bank = test_f.load_and_deserialize(&bank.key).await; let timestamp = { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let clock: Clock = ctx.banks_client.get_sysvar().await?; clock.unix_timestamp }; @@ -594,8 +594,8 @@ async fn configure_bank_emode_success(bank_mint: BankMint) -> anyhow::Result<()> } #[test_case(BankMint::Usdc)] -// t22 #[test_case(BankMint::PyUSD)] -// t22 #[test_case(BankMint::T22WithFee)] +#[test_case(BankMint::PyUSD)] +#[test_case(BankMint::T22WithFee)] #[test_case(BankMint::SolSwbPull)] #[tokio::test] async fn configure_bank_emode_invalid_args(bank_mint: BankMint) -> anyhow::Result<()> { diff --git a/programs/marginfi/tests/admin_actions/withdraw_fees.rs b/programs/marginfi/tests/admin_actions/withdraw_fees.rs index f128468fa..403d8e815 100644 --- a/programs/marginfi/tests/admin_actions/withdraw_fees.rs +++ b/programs/marginfi/tests/admin_actions/withdraw_fees.rs @@ -12,8 +12,8 @@ use test_case::test_case; #[test_case(BankMint::Usdc)] #[test_case(BankMint::Sol)] -// t22 #[test_case(BankMint::PyUSD)] -// t22 #[test_case(BankMint::T22WithFee)] +#[test_case(BankMint::PyUSD)] +#[test_case(BankMint::T22WithFee)] #[tokio::test] async fn marginfi_group_withdraw_fees_and_insurance_fund_as_admin_success( bank_mint: BankMint, @@ -81,8 +81,8 @@ async fn marginfi_group_withdraw_fees_and_insurance_fund_as_admin_success( #[test_case(BankMint::Usdc)] #[test_case(BankMint::Sol)] -// t22 #[test_case(BankMint::PyUSD)] -// t22 #[test_case(BankMint::T22WithFee)] +#[test_case(BankMint::PyUSD)] +#[test_case(BankMint::T22WithFee)] #[tokio::test] async fn marginfi_group_withdraw_fees_and_insurance_fund_as_non_admin_failure( bank_mint: BankMint, diff --git a/programs/marginfi/tests/user_actions/borrow.rs b/programs/marginfi/tests/user_actions/borrow.rs index 13f098bfd..99608852b 100644 --- a/programs/marginfi/tests/user_actions/borrow.rs +++ b/programs/marginfi/tests/user_actions/borrow.rs @@ -19,8 +19,8 @@ use test_case::test_case; #[test_case(100., 9., BankMint::Usdc, BankMint::Sol)] #[test_case(123456.0, 12345.599999999, BankMint::Usdc, BankMint::Sol)] #[test_case(1.0, 5.0, BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(240., 0.092, BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(36., 1.7, BankMint::T22WithFee, BankMint::Sol)] +#[test_case(240., 0.092, BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(36., 1.7, BankMint::T22WithFee, BankMint::Sol)] #[test_case(200., 1.1, BankMint::Usdc, BankMint::SolSwbOrigFee)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_account_borrow_success( @@ -211,8 +211,8 @@ async fn marginfi_account_borrow_success( #[test_case(100., 9., 10.000000001, BankMint::Usdc, BankMint::Sol)] #[test_case(123_456., 12_345.6, 12_345.9, BankMint::Usdc, BankMint::Sol)] #[test_case(1., 5., 11.98224, BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(240., 0.092, 500., BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(36., 1.7, 1.9, BankMint::T22WithFee, BankMint::Sol)] +#[test_case(240., 0.092, 500., BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(36., 1.7, 1.9, BankMint::T22WithFee, BankMint::Sol)] #[test_case(1., 100., 155.1, BankMint::SolSwbPull, BankMint::Usdc)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_account_borrow_failure_not_enough_collateral( @@ -301,8 +301,8 @@ async fn marginfi_account_borrow_failure_not_enough_collateral( #[test_case(505., 500., 505.0000000001, BankMint::Usdc, BankMint::Sol)] #[test_case(12_345.6, 12_345.5, 12_345.9, BankMint::Usdc, BankMint::Sol)] #[test_case(0.91, 0.1, 0.98, BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(505., 0.092, 500., BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(1.8, 1.7, 1.9, BankMint::T22WithFee, BankMint::Sol)] +#[test_case(505., 0.092, 500., BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(1.8, 1.7, 1.9, BankMint::T22WithFee, BankMint::Sol)] #[test_case(1.5, 1.4, 1.6, BankMint::SolSwbPull, BankMint::Usdc)] #[tokio::test] async fn marginfi_account_borrow_failure_borrow_limit( diff --git a/programs/marginfi/tests/user_actions/close_balance.rs b/programs/marginfi/tests/user_actions/close_balance.rs index 29648e367..5571bc234 100644 --- a/programs/marginfi/tests/user_actions/close_balance.rs +++ b/programs/marginfi/tests/user_actions/close_balance.rs @@ -76,7 +76,7 @@ async fn lending_account_close_balance() -> anyhow::Result<()> { // Let a second go b { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let mut clock: Clock = ctx.banks_client.get_sysvar().await?; // Advance clock by 1 second clock.unix_timestamp += 1; diff --git a/programs/marginfi/tests/user_actions/deposit.rs b/programs/marginfi/tests/user_actions/deposit.rs index 52532292c..639e31808 100644 --- a/programs/marginfi/tests/user_actions/deposit.rs +++ b/programs/marginfi/tests/user_actions/deposit.rs @@ -14,11 +14,11 @@ use test_case::test_case; #[test_case(0.0, BankMint::Usdc)] #[test_case(1_000.0, BankMint::Usdc)] #[test_case(0.05, BankMint::Sol)] -// t22 #[test_case(0.05, BankMint::PyUSD)] -// t22 #[test_case(15_002.0, BankMint::PyUSD)] -// t22 #[test_case(0.0, BankMint::T22WithFee)] -// t22 #[test_case(0.05, BankMint::T22WithFee)] -// t22 #[test_case(15_002.0, BankMint::T22WithFee)] +#[test_case(0.05, BankMint::PyUSD)] +#[test_case(15_002.0, BankMint::PyUSD)] +#[test_case(0.0, BankMint::T22WithFee)] +#[test_case(0.05, BankMint::T22WithFee)] +#[test_case(15_002.0, BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_deposit_success( deposit_amount: f64, @@ -101,9 +101,9 @@ async fn marginfi_account_deposit_success( #[test_case(1_000., 456., 2345., BankMint::Usdc)] #[test_case(1_000., 456., 2345., BankMint::Sol)] -// t22 #[test_case(1_000., 456., 2345., BankMint::PyUSD)] -// t22 #[test_case(1_000., 456., 2345., BankMint::T22WithFee)] -// t22 #[test_case(1_000., 999.999999, 1000., BankMint::T22WithFee)] +#[test_case(1_000., 456., 2345., BankMint::PyUSD)] +#[test_case(1_000., 456., 2345., BankMint::T22WithFee)] +#[test_case(1_000., 999.999999, 1000., BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_deposit_failure_capacity_exceeded( deposit_cap: f64, @@ -154,75 +154,75 @@ async fn marginfi_account_deposit_failure_capacity_exceeded( Ok(()) } -// #[tokio::test] -// async fn marginfi_account_deposit_failure_wrong_token_program() -> anyhow::Result<()> { -// // ------------------------------------------------------------------------- -// // Setup -// // ------------------------------------------------------------------------- - -// let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; - -// // User - -// let deposit_amount = 1_000.; -// let bank_mint = BankMint::T22WithFee; - -// let user_mfi_account_f = test_f.create_marginfi_account().await; -// let user_wallet_balance = get_max_deposit_amount_pre_fee(deposit_amount); -// let bank_f = test_f.get_bank(&bank_mint); -// let user_token_account = bank_f -// .mint -// .create_token_account_and_mint_to(user_wallet_balance) -// .await; - -// // ------------------------------------------------------------------------- -// // Test -// // ------------------------------------------------------------------------- - -// let marginfi_account = user_mfi_account_f.load().await; - -// let accounts = marginfi::accounts::LendingAccountDeposit { -// group: marginfi_account.group, -// marginfi_account: user_mfi_account_f.key, -// authority: test_f.context.borrow().payer.pubkey(), -// bank: bank_f.key, -// signer_token_account: user_token_account.key, -// liquidity_vault: bank_f.get_vault(BankVaultType::Liquidity).0, -// token_program: spl_token::ID, -// } -// .to_account_metas(Some(true)); - -// let deposit_ix = Instruction { -// program_id: marginfi::id(), -// accounts, -// data: marginfi::instruction::LendingAccountDeposit { -// amount: native!(deposit_amount, bank_f.mint.mint.decimals, f64), -// deposit_up_to_limit: None, -// } -// .data(), -// }; - -// let tx = { -// let ctx = test_f.context.borrow(); -// Transaction::new_signed_with_payer( -// &[deposit_ix], -// Some(&ctx.payer.pubkey().clone()), -// &[&ctx.payer], -// ctx.last_blockhash, -// ) -// }; - -// let mut ctx = test_f.context.borrow_mut(); -// let res = ctx.banks_client.process_transaction(tx).await; -// assert!(res.is_err()); - -// Ok(()) -// } +#[tokio::test] +async fn marginfi_account_deposit_failure_wrong_token_program() -> anyhow::Result<()> { + // ------------------------------------------------------------------------- + // Setup + // ------------------------------------------------------------------------- + + let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; + + // User + + let deposit_amount = 1_000.; + let bank_mint = BankMint::T22WithFee; + + let user_mfi_account_f = test_f.create_marginfi_account().await; + let user_wallet_balance = get_max_deposit_amount_pre_fee(deposit_amount); + let bank_f = test_f.get_bank(&bank_mint); + let user_token_account = bank_f + .mint + .create_token_account_and_mint_to(user_wallet_balance) + .await; + + // ------------------------------------------------------------------------- + // Test + // ------------------------------------------------------------------------- + + let marginfi_account = user_mfi_account_f.load().await; + + let accounts = marginfi::accounts::LendingAccountDeposit { + group: marginfi_account.group, + marginfi_account: user_mfi_account_f.key, + authority: test_f.context.borrow().payer.pubkey(), + bank: bank_f.key, + signer_token_account: user_token_account.key, + liquidity_vault: bank_f.get_vault(BankVaultType::Liquidity).0, + token_program: spl_token::ID, + } + .to_account_metas(Some(true)); + + let deposit_ix = Instruction { + program_id: marginfi::id(), + accounts, + data: marginfi::instruction::LendingAccountDeposit { + amount: native!(deposit_amount, bank_f.mint.mint.decimals, f64), + deposit_up_to_limit: None, + } + .data(), + }; + + let tx = { + let ctx = test_f.context.borrow(); + Transaction::new_signed_with_payer( + &[deposit_ix], + Some(&ctx.payer.pubkey().clone()), + &[&ctx.payer], + ctx.last_blockhash, + ) + }; + + let ctx = test_f.context.borrow_mut(); + let res = ctx.banks_client.process_transaction(tx).await; + assert!(res.is_err()); + + Ok(()) +} #[test_case(1_000., 500., 800., 500., BankMint::Usdc)] #[test_case(1_000., 500., 800., 500., BankMint::Sol)] -// t22 #[test_case(1_000., 500., 800., 500., BankMint::PyUSD)] -// t22 #[test_case(1_000., 500., 800., 500., BankMint::T22WithFee)] +#[test_case(1_000., 500., 800., 500., BankMint::PyUSD)] +#[test_case(1_000., 500., 800., 500., BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_deposit_up_to_limit_success( deposit_cap: f64, diff --git a/programs/marginfi/tests/user_actions/flash_loan.rs b/programs/marginfi/tests/user_actions/flash_loan.rs index 512790da7..a661678e3 100644 --- a/programs/marginfi/tests/user_actions/flash_loan.rs +++ b/programs/marginfi/tests/user_actions/flash_loan.rs @@ -244,7 +244,7 @@ async fn flashloan_fail_missing_fe_ix() -> anyhow::Result<()> { ixs.insert(0, start_ix); - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let tx = Transaction::new_signed_with_payer( &ixs, @@ -319,7 +319,7 @@ async fn flashloan_fail_missing_invalid_sysvar_ixs() -> anyhow::Result<()> { ixs.insert(0, start_ix); ixs.push(end_ix); - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let tx = Transaction::new_signed_with_payer( &ixs, @@ -375,7 +375,7 @@ async fn flashloan_fail_invalid_end_fl_order() -> anyhow::Result<()> { ixs.insert(0, start_ix); ixs.insert(0, end_ix); - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let tx = Transaction::new_signed_with_payer( &ixs, @@ -431,7 +431,7 @@ async fn flashloan_fail_invalid_end_fl_different_m_account() -> anyhow::Result<( ixs.insert(0, start_ix); ixs.push(end_ix); - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let tx = Transaction::new_signed_with_payer( &ixs, @@ -488,7 +488,7 @@ async fn flashloan_fail_already_in_flashloan() -> anyhow::Result<()> { ixs.insert(0, start_ix.clone()); ixs.push(end_ix); - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let tx = Transaction::new_signed_with_payer( &ixs, diff --git a/programs/marginfi/tests/user_actions/liquidate.rs b/programs/marginfi/tests/user_actions/liquidate.rs index 8a3666842..c8fe959ab 100644 --- a/programs/marginfi/tests/user_actions/liquidate.rs +++ b/programs/marginfi/tests/user_actions/liquidate.rs @@ -17,9 +17,9 @@ use test_case::test_case; #[test_case(100., 9.9, 1., BankMint::Usdc, BankMint::Sol)] #[test_case(123., 122., 10., BankMint::SolEquivalent, BankMint::SolEqIsolated)] -// t22 #[test_case(1_000., 999., 10., BankMint::Usdc, BankMint::T22WithFee)] -// t22 #[test_case(2_000., 99., 1_000., BankMint::T22WithFee, BankMint::SolEquivalent)] -// t22 #[test_case(2_000., 1_999., 2_000., BankMint::Usdc, BankMint::PyUSD)] +#[test_case(1_000., 999., 10., BankMint::Usdc, BankMint::T22WithFee)] +#[test_case(2_000., 99., 1_000., BankMint::T22WithFee, BankMint::SolEquivalent)] +#[test_case(2_000., 1_999., 2_000., BankMint::Usdc, BankMint::PyUSD)] #[tokio::test] async fn marginfi_account_liquidation_success( deposit_amount: f64, @@ -641,9 +641,9 @@ async fn marginfi_account_liquidation_failure_bank_not_liquidatable() -> anyhow: #[test_case(100., 9.9, 1., BankMint::Usdc, BankMint::Sol)] #[test_case(123., 122., 1.23, BankMint::SolEquivalent, BankMint::SolEqIsolated)] -// t22 #[test_case(1_000., 1900., 10., BankMint::Usdc, BankMint::T22WithFee)] -// t22 #[test_case(2_000., 99., 20., BankMint::T22WithFee, BankMint::SolEquivalent)] -// t22 #[test_case(2_000., 1_999., 20., BankMint::Usdc, BankMint::PyUSD)] +#[test_case(1_000., 1900., 10., BankMint::Usdc, BankMint::T22WithFee)] +#[test_case(2_000., 99., 20., BankMint::T22WithFee, BankMint::SolEquivalent)] +#[test_case(2_000., 1_999., 20., BankMint::Usdc, BankMint::PyUSD)] #[tokio::test] async fn marginfi_account_liquidation_emode( deposit_amount: f64, diff --git a/programs/marginfi/tests/user_actions/mod.rs b/programs/marginfi/tests/user_actions/mod.rs index 1e981b8dc..b4e7693f3 100644 --- a/programs/marginfi/tests/user_actions/mod.rs +++ b/programs/marginfi/tests/user_actions/mod.rs @@ -61,7 +61,7 @@ async fn automatic_interest_payments() -> anyhow::Result<()> { // Let a year go by { - let mut ctx = test_f.context.borrow_mut(); + let ctx = test_f.context.borrow_mut(); let mut clock: Clock = ctx.banks_client.get_sysvar().await?; // Advance clock by 1 year clock.unix_timestamp += 365 * 24 * 60 * 60; @@ -161,182 +161,182 @@ async fn marginfi_account_correct_balance_selection_after_closing_position() -> Ok(()) } -// #[tokio::test] -// async fn emissions_test() -> anyhow::Result<()> { -// let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; - -// let usdc_bank = test_f.get_bank(&BankMint::Usdc); -// let sol_bank = test_f.get_bank(&BankMint::Sol); - -// // Setup emissions (Deposit for USDC, Borrow for SOL) - -// let funding_account = test_f.usdc_mint.create_token_account_and_mint_to(100).await; - -// usdc_bank -// .try_setup_emissions( -// EMISSIONS_FLAG_LENDING_ACTIVE, -// 1_000_000, -// native!(50, "USDC"), -// usdc_bank.mint.key, -// funding_account.key, -// usdc_bank.get_token_program(), -// ) -// .await?; - -// // SOL Emissions are not in SOL Bank mint -// let sol_emissions_mint = -// MintFixture::new_token_22(test_f.context.clone(), None, Some(6), &[]).await; - -// let funding_account = sol_emissions_mint -// .create_token_account_and_mint_to(200) -// .await; - -// sol_bank -// .try_setup_emissions( -// EMISSIONS_FLAG_BORROW_ACTIVE, -// 1_000_000, -// native!(100, 6), -// sol_emissions_mint.key, -// funding_account.key, -// sol_emissions_mint.token_program, -// ) -// .await?; - -// let sol_emissions_mint_2 = -// MintFixture::new_token_22(test_f.context.clone(), None, Some(6), &[]).await; - -// let funding_account = sol_emissions_mint_2 -// .create_token_account_and_mint_to(200) -// .await; - -// let res = sol_bank -// .try_setup_emissions( -// EMISSIONS_FLAG_BORROW_ACTIVE, -// 1_000_000, -// native!(50, 6), -// sol_emissions_mint_2.key, -// funding_account.key, -// sol_emissions_mint_2.token_program, -// ) -// .await; - -// assert_custom_error!(res.unwrap_err(), MarginfiError::EmissionsAlreadySetup); - -// // Fund SOL bank -// let sol_lender_account = test_f.create_marginfi_account().await; -// let sol_lender_token_account = test_f.sol_mint.create_token_account_and_mint_to(100).await; - -// sol_lender_account -// .try_bank_deposit(sol_lender_token_account.key, sol_bank, 100, None) -// .await?; - -// // Create account and setup positions -// test_f.set_time(MIN_EMISSIONS_START_TIME as i64); -// test_f -// .set_pyth_oracle_timestamp(PYTH_USDC_FEED, MIN_EMISSIONS_START_TIME as i64) -// .await; -// test_f -// .set_pyth_oracle_timestamp(PYTH_SOL_FEED, MIN_EMISSIONS_START_TIME as i64) -// .await; - -// let mfi_account_f = test_f.create_marginfi_account().await; -// let lender_token_account_usdc = test_f.usdc_mint.create_token_account_and_mint_to(50).await; - -// mfi_account_f -// .try_bank_deposit(lender_token_account_usdc.key, usdc_bank, 50, None) -// .await?; - -// let sol_account = test_f.sol_mint.create_empty_token_account().await; - -// mfi_account_f -// .try_bank_borrow(sol_account.key, sol_bank, 2) -// .await?; - -// // Advance for half a year and claim half emissions -// test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; - -// let lender_token_account_usdc = test_f.usdc_mint.create_empty_token_account().await; - -// mfi_account_f -// .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) -// .await?; - -// let sol_emissions_ta = sol_emissions_mint.create_empty_token_account().await; - -// mfi_account_f -// .try_withdraw_emissions(sol_bank, &sol_emissions_ta) -// .await?; - -// assert_eq_with_tolerance!( -// lender_token_account_usdc.balance().await as i64, -// native!(25, "USDC") as i64, -// native!(1, "USDC") as i64 -// ); - -// assert_eq_with_tolerance!( -// sol_emissions_ta.balance().await as i64, -// native!(1, 6) as i64, -// native!(0.1, 6, f64) as i64 -// ); - -// // Advance for another half a year and claim the rest -// test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; - -// mfi_account_f -// .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) -// .await?; - -// assert_eq_with_tolerance!( -// lender_token_account_usdc.balance().await as i64, -// native!(50, "USDC") as i64, -// native!(1, "USDC") as i64 -// ); - -// mfi_account_f -// .try_withdraw_emissions(sol_bank, &sol_emissions_ta) -// .await?; - -// assert_eq_with_tolerance!( -// sol_emissions_ta.balance().await as i64, -// native!(2, 6) as i64, -// native!(0.1, 6, f64) as i64 -// ); +#[tokio::test] +async fn emissions_test() -> anyhow::Result<()> { + let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; + + let usdc_bank = test_f.get_bank(&BankMint::Usdc); + let sol_bank = test_f.get_bank(&BankMint::Sol); + + // Setup emissions (Deposit for USDC, Borrow for SOL) + + let funding_account = test_f.usdc_mint.create_token_account_and_mint_to(100).await; + + usdc_bank + .try_setup_emissions( + EMISSIONS_FLAG_LENDING_ACTIVE, + 1_000_000, + native!(50, "USDC"), + usdc_bank.mint.key, + funding_account.key, + usdc_bank.get_token_program(), + ) + .await?; + + // SOL Emissions are not in SOL Bank mint + let sol_emissions_mint = + MintFixture::new_token_22(test_f.context.clone(), None, Some(6), &[]).await; + + let funding_account = sol_emissions_mint + .create_token_account_and_mint_to(200) + .await; + + sol_bank + .try_setup_emissions( + EMISSIONS_FLAG_BORROW_ACTIVE, + 1_000_000, + native!(100, 6), + sol_emissions_mint.key, + funding_account.key, + sol_emissions_mint.token_program, + ) + .await?; + + let sol_emissions_mint_2 = + MintFixture::new_token_22(test_f.context.clone(), None, Some(6), &[]).await; + + let funding_account = sol_emissions_mint_2 + .create_token_account_and_mint_to(200) + .await; + + let res = sol_bank + .try_setup_emissions( + EMISSIONS_FLAG_BORROW_ACTIVE, + 1_000_000, + native!(50, 6), + sol_emissions_mint_2.key, + funding_account.key, + sol_emissions_mint_2.token_program, + ) + .await; + + assert_custom_error!(res.unwrap_err(), MarginfiError::EmissionsAlreadySetup); + + // Fund SOL bank + let sol_lender_account = test_f.create_marginfi_account().await; + let sol_lender_token_account = test_f.sol_mint.create_token_account_and_mint_to(100).await; + + sol_lender_account + .try_bank_deposit(sol_lender_token_account.key, sol_bank, 100, None) + .await?; + + // Create account and setup positions + test_f.set_time(MIN_EMISSIONS_START_TIME as i64); + test_f + .set_pyth_oracle_timestamp(PYTH_USDC_FEED, MIN_EMISSIONS_START_TIME as i64) + .await; + test_f + .set_pyth_oracle_timestamp(PYTH_SOL_FEED, MIN_EMISSIONS_START_TIME as i64) + .await; + + let mfi_account_f = test_f.create_marginfi_account().await; + let lender_token_account_usdc = test_f.usdc_mint.create_token_account_and_mint_to(50).await; + + mfi_account_f + .try_bank_deposit(lender_token_account_usdc.key, usdc_bank, 50, None) + .await?; + + let sol_account = test_f.sol_mint.create_empty_token_account().await; + + mfi_account_f + .try_bank_borrow(sol_account.key, sol_bank, 2) + .await?; + + // Advance for half a year and claim half emissions + test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; + + let lender_token_account_usdc = test_f.usdc_mint.create_empty_token_account().await; -// // Advance a year, and no more USDC emissions can be claimed (drained), SOL emissions can be claimed + mfi_account_f + .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) + .await?; + + let sol_emissions_ta = sol_emissions_mint.create_empty_token_account().await; + + mfi_account_f + .try_withdraw_emissions(sol_bank, &sol_emissions_ta) + .await?; + + assert_eq_with_tolerance!( + lender_token_account_usdc.balance().await as i64, + native!(25, "USDC") as i64, + native!(1, "USDC") as i64 + ); + + assert_eq_with_tolerance!( + sol_emissions_ta.balance().await as i64, + native!(1, 6) as i64, + native!(0.1, 6, f64) as i64 + ); + + // Advance for another half a year and claim the rest + test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; + + mfi_account_f + .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) + .await?; + + assert_eq_with_tolerance!( + lender_token_account_usdc.balance().await as i64, + native!(50, "USDC") as i64, + native!(1, "USDC") as i64 + ); -// test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; - -// mfi_account_f -// .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) -// .await?; - -// mfi_account_f -// .try_withdraw_emissions(sol_bank, &sol_emissions_ta) -// .await?; + mfi_account_f + .try_withdraw_emissions(sol_bank, &sol_emissions_ta) + .await?; -// assert_eq_with_tolerance!( -// lender_token_account_usdc.balance().await as i64, -// native!(50, "USDC") as i64, -// native!(1, "USDC") as i64 -// ); + assert_eq_with_tolerance!( + sol_emissions_ta.balance().await as i64, + native!(2, 6) as i64, + native!(0.1, 6, f64) as i64 + ); -// assert_eq_with_tolerance!( -// sol_emissions_ta.balance().await as i64, -// native!(3, 6) as i64, -// native!(0.1, 6, f64) as i64 -// ); + // Advance a year, and no more USDC emissions can be claimed (drained), SOL emissions can be claimed -// // SOL lendeing account can't claim emissions, bc SOL is borrow only emissions -// let sol_lender_emissions = sol_emissions_mint.create_empty_token_account().await; + test_f.advance_time((SECONDS_PER_YEAR / 2.0) as i64).await; -// sol_lender_account -// .try_withdraw_emissions(sol_bank, &sol_lender_emissions) -// .await?; + mfi_account_f + .try_withdraw_emissions(usdc_bank, &lender_token_account_usdc) + .await?; -// assert_eq!(sol_lender_emissions.balance().await as i64, 0); + mfi_account_f + .try_withdraw_emissions(sol_bank, &sol_emissions_ta) + .await?; -// Ok(()) -// } + assert_eq_with_tolerance!( + lender_token_account_usdc.balance().await as i64, + native!(50, "USDC") as i64, + native!(1, "USDC") as i64 + ); + + assert_eq_with_tolerance!( + sol_emissions_ta.balance().await as i64, + native!(3, 6) as i64, + native!(0.1, 6, f64) as i64 + ); + + // SOL lendeing account can't claim emissions, bc SOL is borrow only emissions + let sol_lender_emissions = sol_emissions_mint.create_empty_token_account().await; + + sol_lender_account + .try_withdraw_emissions(sol_bank, &sol_lender_emissions) + .await?; + + assert_eq!(sol_lender_emissions.balance().await as i64, 0); + + Ok(()) +} #[tokio::test] async fn emissions_test_2() -> anyhow::Result<()> { @@ -391,86 +391,86 @@ async fn emissions_test_2() -> anyhow::Result<()> { Ok(()) } -// #[tokio::test] -// async fn emissions_setup_t22_with_fee() -> anyhow::Result<()> { -// let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; +#[tokio::test] +async fn emissions_setup_t22_with_fee() -> anyhow::Result<()> { + let test_f = TestFixture::new(Some(TestSettings::all_banks_payer_not_admin())).await; -// let collateral_mint = BankMint::T22WithFee; -// let bank_f = test_f.get_bank(&collateral_mint); + let collateral_mint = BankMint::T22WithFee; + let bank_f = test_f.get_bank(&collateral_mint); -// let funding_account = bank_f.mint.create_token_account_and_mint_to(100).await; + let funding_account = bank_f.mint.create_token_account_and_mint_to(100).await; -// let emissions_vault = get_emissions_token_account_address(bank_f.key, bank_f.mint.key).0; + let emissions_vault = get_emissions_token_account_address(bank_f.key, bank_f.mint.key).0; -// let pre_vault_balance = 0; + let pre_vault_balance = 0; -// bank_f -// .try_setup_emissions( -// EMISSIONS_FLAG_LENDING_ACTIVE, -// 1_000_000, -// native!(50, bank_f.mint.mint.decimals), -// bank_f.mint.key, -// funding_account.key, -// bank_f.get_token_program(), -// ) -// .await?; + bank_f + .try_setup_emissions( + EMISSIONS_FLAG_LENDING_ACTIVE, + 1_000_000, + native!(50, bank_f.mint.mint.decimals), + bank_f.mint.key, + funding_account.key, + bank_f.get_token_program(), + ) + .await?; -// let post_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) -// .await -// .balance() -// .await; + let post_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) + .await + .balance() + .await; -// let bank = bank_f.load().await; + let bank = bank_f.load().await; -// assert_eq!(bank.flags, EMISSIONS_FLAG_LENDING_ACTIVE); + assert_eq!(bank.flags, EMISSIONS_FLAG_LENDING_ACTIVE); -// assert_eq!(bank.emissions_rate, 1_000_000); + assert_eq!(bank.emissions_rate, 1_000_000); -// assert_eq!( -// I80F48::from(bank.emissions_remaining), -// I80F48::from_num(native!(50, bank_f.mint.mint.decimals)) -// ); + assert_eq!( + I80F48::from(bank.emissions_remaining), + I80F48::from_num(native!(50, bank_f.mint.mint.decimals)) + ); -// let expected_vault_balance_delta = native!(50, bank_f.mint.mint.decimals) as u64; -// let actual_vault_balance_delta = post_vault_balance - pre_vault_balance; -// assert_eq!(expected_vault_balance_delta, actual_vault_balance_delta); + let expected_vault_balance_delta = native!(50, bank_f.mint.mint.decimals) as u64; + let actual_vault_balance_delta = post_vault_balance - pre_vault_balance; + assert_eq!(expected_vault_balance_delta, actual_vault_balance_delta); -// let pre_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) -// .await -// .balance() -// .await; + let pre_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) + .await + .balance() + .await; -// bank_f -// .try_update_emissions( -// Some(EMISSIONS_FLAG_BORROW_ACTIVE), -// Some(500_000), -// Some((native!(25, bank_f.mint.mint.decimals), funding_account.key)), -// bank_f.get_token_program(), -// ) -// .await?; + bank_f + .try_update_emissions( + Some(EMISSIONS_FLAG_BORROW_ACTIVE), + Some(500_000), + Some((native!(25, bank_f.mint.mint.decimals), funding_account.key)), + bank_f.get_token_program(), + ) + .await?; -// let post_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) -// .await -// .balance() -// .await; + let post_vault_balance = TokenAccountFixture::fetch(test_f.context.clone(), emissions_vault) + .await + .balance() + .await; -// let bank_data = bank_f.load().await; + let bank_data = bank_f.load().await; -// assert_eq!(bank_data.flags, EMISSIONS_FLAG_BORROW_ACTIVE); + assert_eq!(bank_data.flags, EMISSIONS_FLAG_BORROW_ACTIVE); -// assert_eq!(bank_data.emissions_rate, 500_000); + assert_eq!(bank_data.emissions_rate, 500_000); -// assert_eq!( -// I80F48::from(bank_data.emissions_remaining), -// I80F48::from_num(native!(75, bank_f.mint.mint.decimals)) -// ); + assert_eq!( + I80F48::from(bank_data.emissions_remaining), + I80F48::from_num(native!(75, bank_f.mint.mint.decimals)) + ); -// let expected_vault_balance_delta = native!(25, bank_f.mint.mint.decimals) as u64; -// let actual_vault_balance_delta = post_vault_balance - pre_vault_balance; -// assert_eq!(expected_vault_balance_delta, actual_vault_balance_delta); + let expected_vault_balance_delta = native!(25, bank_f.mint.mint.decimals) as u64; + let actual_vault_balance_delta = post_vault_balance - pre_vault_balance; + assert_eq!(expected_vault_balance_delta, actual_vault_balance_delta); -// Ok(()) -// } + Ok(()) +} #[tokio::test] async fn account_flags() -> anyhow::Result<()> { diff --git a/programs/marginfi/tests/user_actions/repay.rs b/programs/marginfi/tests/user_actions/repay.rs index 6b86aebc6..8c15a5198 100644 --- a/programs/marginfi/tests/user_actions/repay.rs +++ b/programs/marginfi/tests/user_actions/repay.rs @@ -12,8 +12,8 @@ use test_case::test_case; #[test_case(100., 9., BankMint::Usdc, BankMint::Sol)] #[test_case(123456., 12345.599999999, BankMint::Usdc, BankMint::Sol)] #[test_case(1., 1., BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(240., 0.092, BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(36., 20., BankMint::T22WithFee, BankMint::Sol)] +#[test_case(240., 0.092, BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(36., 20., BankMint::T22WithFee, BankMint::Sol)] #[test_case(200., 1.1, BankMint::Usdc, BankMint::SolSwbOrigFee)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_account_repay_success( @@ -142,8 +142,8 @@ async fn marginfi_account_repay_success( #[test_case(100., BankMint::Usdc, BankMint::Sol)] #[test_case(123456., BankMint::Usdc, BankMint::Sol)] #[test_case(1., BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(240., BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(36., BankMint::T22WithFee, BankMint::Sol)] +#[test_case(240., BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(36., BankMint::T22WithFee, BankMint::Sol)] #[test_case(200., BankMint::Usdc, BankMint::SolSwbOrigFee)] // Sol @ ~ $153 #[tokio::test] async fn marginfi_account_repay_all_success( @@ -297,9 +297,9 @@ async fn marginfi_account_repay_all_success( #[test_case(100., 110., BankMint::Usdc, BankMint::Sol)] #[test_case(123456., 123457., BankMint::Usdc, BankMint::Sol)] #[test_case(1., 1.000002, BankMint::Sol, BankMint::Usdc)] -// t22 #[test_case(9834., 234749., BankMint::PyUSD, BankMint::SolSwb)] -// t22 #[test_case(0.092, 240., BankMint::PyUSD, BankMint::T22WithFee)] -// t22 #[test_case(1.7, 36., BankMint::T22WithFee, BankMint::Sol)] +#[test_case(9834., 234749., BankMint::PyUSD, BankMint::Sol)] +#[test_case(0.092, 240., BankMint::PyUSD, BankMint::T22WithFee)] +#[test_case(1.7, 36., BankMint::T22WithFee, BankMint::Sol)] #[tokio::test] async fn marginfi_account_repay_failure_repaying_too_much( borrow_amount: f64, diff --git a/programs/marginfi/tests/user_actions/withdraw.rs b/programs/marginfi/tests/user_actions/withdraw.rs index 3cfa24115..19fe78656 100644 --- a/programs/marginfi/tests/user_actions/withdraw.rs +++ b/programs/marginfi/tests/user_actions/withdraw.rs @@ -9,9 +9,9 @@ use solana_program_test::*; use test_case::test_case; #[test_case(0.03, 0.012, BankMint::Usdc)] -// t22 #[test_case(128932.0, 9834.0, BankMint::PyUSD)] -// t22 #[test_case(0.1, 0.092, BankMint::T22WithFee)] -// t22 #[test_case(100.0, 92.0, BankMint::T22WithFee)] +#[test_case(128932.0, 9834.0, BankMint::PyUSD)] +#[test_case(0.1, 0.092, BankMint::T22WithFee)] +#[test_case(100.0, 92.0, BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_withdraw_success( deposit_amount: f64, @@ -173,9 +173,9 @@ async fn marginfi_account_withdraw_success( #[test_case(0.03, BankMint::Usdc)] #[test_case(100.0, BankMint::Usdc)] #[test_case(100.0, BankMint::Sol)] -// t22 #[test_case(128932.0, BankMint::PyUSD)] -// t22 #[test_case(0.1, BankMint::T22WithFee)] -// t22 #[test_case(100.0, BankMint::T22WithFee)] +#[test_case(128932.0, BankMint::PyUSD)] +#[test_case(0.1, BankMint::T22WithFee)] +#[test_case(100.0, BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_withdraw_all_success( deposit_amount: f64, @@ -273,9 +273,9 @@ async fn marginfi_account_withdraw_all_success( #[test_case(0.03, 0.030001, BankMint::Usdc)] #[test_case(100., 102., BankMint::Sol)] -// t22 #[test_case(109247394., 109247394.000001, BankMint::PyUSD)] -// t22 #[test_case(16., 16., BankMint::T22WithFee)] -// t22 #[test_case(100., 98., BankMint::T22WithFee)] +#[test_case(109247394., 109247394.000001, BankMint::PyUSD)] +#[test_case(16., 16., BankMint::T22WithFee)] +#[test_case(100., 98., BankMint::T22WithFee)] #[tokio::test] async fn marginfi_account_withdraw_failure_withdrawing_too_much( deposit_amount: f64, diff --git a/programs/test_transfer_hook/src/lib.rs b/programs/test_transfer_hook/src/lib.rs index 3e0aa0de6..5ec634ff2 100644 --- a/programs/test_transfer_hook/src/lib.rs +++ b/programs/test_transfer_hook/src/lib.rs @@ -227,7 +227,7 @@ pub fn process(program_id: &Pubkey, accounts: &[AccountInfo], input: &[u8]) -> P // #[tokio::test] // async fn invoke_hook() { -// let mut ctx = ProgramTest::new("transfer_hook", TEST_HOOK_ID, processor!(super::process)) +// let ctx = ProgramTest::new("transfer_hook", TEST_HOOK_ID, processor!(super::process)) // .start_with_context() // .await; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 1de01fa45..628740b12 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.81.0" +channel = "1.79.0" diff --git a/test-utils/src/bank.rs b/test-utils/src/bank.rs index 4d874bf45..c6484a8f7 100644 --- a/test-utils/src/bank.rs +++ b/test-utils/src/bank.rs @@ -144,68 +144,6 @@ impl BankFixture { Ok(()) } - #[cfg(feature = "lip")] - pub async fn try_create_campaign( - &self, - lockup_period: u64, - max_deposits: u64, - max_rewards: u64, - reward_funding_account: Pubkey, - ) -> Result { - use crate::prelude::lip::*; - - let campaign_key = Keypair::new(); - - let bank = self.load().await; - - let ix = Instruction { - program_id: liquidity_incentive_program::id(), - accounts: liquidity_incentive_program::accounts::CreateCampaign { - campaign: campaign_key.pubkey(), - campaign_reward_vault: get_reward_vault_address(campaign_key.pubkey()).0, - campaign_reward_vault_authority: get_reward_vault_authority(campaign_key.pubkey()) - .0, - asset_mint: bank.mint, - marginfi_bank: self.key, - admin: self.ctx.borrow().payer.pubkey(), - funding_account: reward_funding_account, - rent: solana_program::sysvar::rent::id(), - token_program: self.get_token_program(), - system_program: solana_program::system_program::id(), - } - .to_account_metas(Some(true)), - data: liquidity_incentive_program::instruction::CreateCampaign { - lockup_period, - max_deposits, - max_rewards, - } - .data(), - }; - - let tx = { - let ctx = self.ctx.borrow_mut(); - - Transaction::new_signed_with_payer( - &[ix], - Some(&ctx.payer.pubkey()), - &[&ctx.payer, &campaign_key], - ctx.last_blockhash, - ) - }; - - self.ctx - .borrow_mut() - .banks_client - .process_transaction(tx) - .await?; - - Ok(crate::lip::LipCampaignFixture::new( - self.ctx.clone(), - self.clone(), - campaign_key.pubkey(), - )) - } - pub async fn try_setup_emissions( &self, flags: u64, @@ -320,7 +258,7 @@ impl BankFixture { amount: u64, ) -> Result<(), BanksClientError> { let bank = self.load().await; - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let signer_pk = ctx.payer.pubkey(); let (fee_vault_authority, _) = Pubkey::find_program_address( bank_authority_seed!(BankVaultType::Fee, self.key), @@ -365,7 +303,7 @@ impl BankFixture { amount: u64, ) -> Result<(), BanksClientError> { let bank = self.load().await; - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let signer_pk = ctx.payer.pubkey(); let (insurance_vault_authority, _) = Pubkey::find_program_address( bank_authority_seed!(BankVaultType::Insurance, self.key), diff --git a/test-utils/src/lib.rs b/test-utils/src/lib.rs index 6dc28c1f0..e44b918ed 100644 --- a/test-utils/src/lib.rs +++ b/test-utils/src/lib.rs @@ -1,12 +1,9 @@ pub mod bank; -// #[cfg(feature = "lip")] -// pub mod lip; pub mod marginfi_account; pub mod marginfi_group; pub mod prelude; pub mod spl; pub mod test; -// pub mod transfer_hook; pub mod utils; pub use transfer_hook; diff --git a/test-utils/src/lip.rs b/test-utils/src/lip.rs deleted file mode 100644 index c2e22b1e7..000000000 --- a/test-utils/src/lip.rs +++ /dev/null @@ -1,159 +0,0 @@ -#![cfg(feature = "lip")] - -use crate::utils::lip::*; -use anchor_lang::AnchorDeserialize; -use anchor_lang::{ - prelude::{Pubkey, ToAccountMetas}, - InstructionData, -}; -use anyhow::Result; -use liquidity_incentive_program as lip; -use solana_program::instruction::Instruction; -use solana_program_test::{BanksClientError, ProgramTestContext}; -use solana_sdk::{signature::Keypair, signer::Signer, transaction::Transaction}; -use std::{cell::RefCell, rc::Rc}; - -use crate::bank::BankFixture; - -pub struct LipCampaignFixture { - pub key: Pubkey, - bank_f: BankFixture, - ctx: Rc>, -} - -impl LipCampaignFixture { - pub fn new(ctx: Rc>, bank_f: BankFixture, key: Pubkey) -> Self { - Self { key, bank_f, ctx } - } - - pub async fn try_create_deposit( - &self, - funding_account: Pubkey, - amount: u64, - ) -> Result { - let bank = self.bank_f.load().await; - let deposit_key = Keypair::new(); - let temp_token_account_key = Keypair::new(); - - let ix = Instruction { - program_id: lip::id(), - accounts: lip::accounts::CreateDeposit { - campaign: self.key, - signer: self.ctx.borrow().payer.pubkey(), - deposit: deposit_key.pubkey(), - mfi_pda_signer: get_deposit_mfi_authority(deposit_key.pubkey()).0, - funding_account, - temp_token_account: temp_token_account_key.pubkey(), - asset_mint: bank.mint, - marginfi_group: bank.group, - marginfi_bank: self.bank_f.key, - marginfi_account: get_marginfi_account_address(deposit_key.pubkey()).0, - marginfi_bank_vault: bank.liquidity_vault, - marginfi_program: marginfi::id(), - token_program: self.bank_f.get_token_program(), - rent: anchor_lang::solana_program::sysvar::rent::id(), - system_program: solana_program::system_program::id(), - } - .to_account_metas(Some(true)), - data: lip::instruction::CreateDeposit { amount }.data(), - }; - - let tx = Transaction::new_signed_with_payer( - &[ix], - Some(&self.ctx.borrow().payer.pubkey()), - &[ - &self.ctx.borrow().payer, - &deposit_key, - &temp_token_account_key, - ], - self.ctx.borrow().last_blockhash, - ); - - self.ctx - .borrow_mut() - .banks_client - .process_transaction(tx) - .await?; - - Ok(deposit_key.pubkey()) - } - - pub async fn try_end_deposit( - &self, - deposit_pk: Pubkey, - destination_account_address: Pubkey, - ) -> Result<()> { - let bank = self.bank_f.load().await; - let temp_token_account_key = Keypair::new(); - - let ix = Instruction { - program_id: lip::id(), - accounts: lip::accounts::EndDeposit { - campaign: self.key, - campaign_reward_vault: get_reward_vault_address(self.key).0, - campaign_reward_vault_authority: get_reward_vault_authority(self.key).0, - signer: self.ctx.borrow().payer.pubkey(), - deposit: deposit_pk, - mfi_pda_signer: get_deposit_mfi_authority(deposit_pk).0, - temp_token_account: temp_token_account_key.pubkey(), - temp_token_account_authority: get_temp_token_account_authority(deposit_pk).0, - destination_account: destination_account_address, - asset_mint: bank.mint, - marginfi_account: get_marginfi_account_address(deposit_pk).0, - marginfi_group: bank.group, - marginfi_bank: self.bank_f.key, - marginfi_bank_vault: bank.liquidity_vault, - marginfi_bank_vault_authority: self - .bank_f - .get_vault_authority(marginfi::state::marginfi_group::BankVaultType::Liquidity) - .0, - marginfi_program: marginfi::id(), - token_program: self.bank_f.get_token_program(), - system_program: solana_program::system_program::id(), - } - .to_account_metas(Some(true)), - data: lip::instruction::EndDeposit {}.data(), - }; - - let tx = Transaction::new_signed_with_payer( - &[ix], - Some(&self.ctx.borrow().payer.pubkey()), - &[&self.ctx.borrow().payer, &temp_token_account_key], - self.ctx.borrow().last_blockhash, - ); - - self.ctx - .borrow_mut() - .banks_client - .process_transaction(tx) - .await?; - - Ok(()) - } - - pub async fn load(&self) -> lip::state::Campaign { - let account = self - .ctx - .borrow_mut() - .banks_client - .get_account(self.key) - .await - .unwrap() - .unwrap(); - - lip::state::Campaign::deserialize(&mut &account.data[8..]).unwrap() - } - - pub async fn load_deposit(&self, deposit_key: Pubkey) -> lip::state::Deposit { - let account = self - .ctx - .borrow_mut() - .banks_client - .get_account(deposit_key) - .await - .unwrap() - .unwrap(); - - lip::state::Deposit::deserialize(&mut &account.data[8..]).unwrap() - } -} diff --git a/test-utils/src/marginfi_account.rs b/test-utils/src/marginfi_account.rs index 75ecfd4a0..f701319e2 100644 --- a/test-utils/src/marginfi_account.rs +++ b/test-utils/src/marginfi_account.rs @@ -31,7 +31,7 @@ impl MarginfiAccountFixture { let account_key = Keypair::new(); { - let mut ctx = ctx.borrow_mut(); + let ctx = ctx.borrow_mut(); let accounts = marginfi::accounts::MarginfiAccountInitialize { marginfi_account: account_key.pubkey(), @@ -110,37 +110,37 @@ impl MarginfiAccountFixture { .make_bank_deposit_ix(funding_account, bank, ui_amount, deposit_up_to_limit) .await; - // // If t22 with transfer hook, add remaining accounts - // let fetch_account_data_fn = |key| async move { - // Ok(self - // .ctx - // .borrow_mut() - // .banks_client - // .get_account(key) - // .await - // .map(|acc| acc.map(|a| a.data))?) - // }; - // let payer = self.ctx.borrow_mut().payer.pubkey(); - // if bank.mint.token_program == spl_token_2022::ID { - // // TODO: do that only if hook exists - // println!( - // "[TODO] Adding extra account metas for execute for mint {:?}", - // bank.mint.key - // ); - // let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( - // &mut ix, - // &super::transfer_hook::TEST_HOOK_ID, - // &funding_account, - // &bank.mint.key, - // &bank.get_vault(BankVaultType::Liquidity).0, - // &payer, - // ui_to_native!(ui_amount.into(), bank.mint.mint.decimals), - // fetch_account_data_fn, - // ) - // .await; - // } + // If t22 with transfer hook, add remaining accounts + let fetch_account_data_fn = |key| async move { + Ok(self + .ctx + .borrow_mut() + .banks_client + .get_account(key) + .await + .map(|acc| acc.map(|a| a.data))?) + }; + let payer = self.ctx.borrow_mut().payer.pubkey(); + if bank.mint.token_program == spl_token_2022::ID { + // TODO: do that only if hook exists + println!( + "[TODO] Adding extra account metas for execute for mint {:?}", + bank.mint.key + ); + let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( + &mut ix, + &super::transfer_hook::TEST_HOOK_ID, + &funding_account, + &bank.mint.key, + &bank.get_vault(BankVaultType::Liquidity).0, + &payer, + ui_to_native!(ui_amount.into(), bank.mint.mint.decimals), + fetch_account_data_fn, + ) + .await; + } - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &[ix], Some(&ctx.payer.pubkey().clone()), @@ -213,7 +213,7 @@ impl MarginfiAccountFixture { .make_bank_withdraw_ix(destination_account, bank, ui_amount, withdraw_all) .await; - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &[ix], Some(&ctx.payer.pubkey().clone()), @@ -290,35 +290,35 @@ impl MarginfiAccountFixture { .make_bank_borrow_ix(destination_account, bank, ui_amount) .await; - // if bank.mint.token_program == spl_token_2022::ID { - // let fetch_account_data_fn = |key| async move { - // Ok(self - // .ctx - // .borrow_mut() - // .banks_client - // .get_account(key) - // .await - // .map(|acc| acc.map(|a| a.data))?) - // }; - - // let payer = self.ctx.borrow().payer.pubkey(); - // let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( - // &mut ix, - // &super::transfer_hook::TEST_HOOK_ID, - // &bank.get_vault(BankVaultType::Liquidity).0, - // &bank.mint.key, - // &destination_account, - // &payer, - // ui_to_native!(ui_amount.into(), bank.mint.mint.decimals), - // fetch_account_data_fn, - // ) - // .await; - // } + if bank.mint.token_program == spl_token_2022::ID { + let fetch_account_data_fn = |key| async move { + Ok(self + .ctx + .borrow_mut() + .banks_client + .get_account(key) + .await + .map(|acc| acc.map(|a| a.data))?) + }; + + let payer = self.ctx.borrow().payer.pubkey(); + let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( + &mut ix, + &super::transfer_hook::TEST_HOOK_ID, + &bank.get_vault(BankVaultType::Liquidity).0, + &bank.mint.key, + &destination_account, + &payer, + ui_to_native!(ui_amount.into(), bank.mint.mint.decimals), + fetch_account_data_fn, + ) + .await; + } let compute_budget_ix = ComputeBudgetInstruction::set_compute_unit_limit(1_400_000); let nonce_ix = ComputeBudgetInstruction::set_compute_unit_price(nonce); - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &[compute_budget_ix, nonce_ix, ix], Some(&ctx.payer.pubkey().clone()), @@ -378,7 +378,7 @@ impl MarginfiAccountFixture { let ix = self .make_bank_repay_ix(funding_account, bank, ui_amount, repay_all) .await; - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &[ix], Some(&ctx.payer.pubkey().clone()), @@ -398,7 +398,7 @@ impl MarginfiAccountFixture { bank: &BankFixture, ) -> anyhow::Result<(), BanksClientError> { let marginfi_account = self.load().await; - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let ix = Instruction { program_id: marginfi::id(), @@ -489,30 +489,30 @@ impl MarginfiAccountFixture { .data(), }; - // if liab_bank_fixture.mint.token_program == spl_token_2022::ID { - // let payer = self.ctx.borrow().payer.pubkey(); - // let fetch_account_data_fn = |key| async move { - // Ok(self - // .ctx - // .borrow_mut() - // .banks_client - // .get_account(key) - // .await - // .map(|acc| acc.map(|a| a.data))?) - // }; - - // let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( - // &mut ix, - // &super::transfer_hook::TEST_HOOK_ID, - // &liab_bank_fixture.mint.key, - // &liab_bank_fixture.mint.key, - // &liab_bank_fixture.mint.key, - // &payer, - // 0, - // fetch_account_data_fn, - // ) - // .await; - // } + if liab_bank_fixture.mint.token_program == spl_token_2022::ID { + let payer = self.ctx.borrow().payer.pubkey(); + let fetch_account_data_fn = |key| async move { + Ok(self + .ctx + .borrow_mut() + .banks_client + .get_account(key) + .await + .map(|acc| acc.map(|a| a.data))?) + }; + + let _ = spl_transfer_hook_interface::offchain::add_extra_account_metas_for_execute( + &mut ix, + &super::transfer_hook::TEST_HOOK_ID, + &liab_bank_fixture.mint.key, + &liab_bank_fixture.mint.key, + &liab_bank_fixture.mint.key, + &payer, + 0, + fetch_account_data_fn, + ) + .await; + } ix.accounts.extend_from_slice( &self @@ -531,7 +531,7 @@ impl MarginfiAccountFixture { let compute_budget_ix = ComputeBudgetInstruction::set_compute_unit_limit(1_400_000); - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &[compute_budget_ix, ix], Some(&ctx.payer.pubkey().clone()), @@ -567,7 +567,7 @@ impl MarginfiAccountFixture { data: marginfi::instruction::LendingAccountWithdrawEmissions {}.data(), }; - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &[ix], Some(&ctx.payer.pubkey().clone()), @@ -595,7 +595,7 @@ impl MarginfiAccountFixture { data: marginfi::instruction::SetAccountFlag { flag }.data(), }; - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &[ix], Some(&ctx.payer.pubkey().clone()), @@ -623,7 +623,7 @@ impl MarginfiAccountFixture { data: marginfi::instruction::UnsetAccountFlag { flag }.data(), }; - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &[ix], Some(&ctx.payer.pubkey().clone()), @@ -691,7 +691,7 @@ impl MarginfiAccountFixture { ixs.insert(0, start_ix); ixs.push(end_ix); - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &ixs, @@ -838,7 +838,7 @@ impl MarginfiAccountFixture { let tx = self .build_transfer_authority_tx(new_authority, signer_keypair) .await; - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); ctx.banks_client .process_transaction_with_preflight_and_commitment(tx, CommitmentLevel::Confirmed) .await @@ -857,7 +857,7 @@ impl MarginfiAccountFixture { } pub async fn try_close_account(&self, nonce: u64) -> std::result::Result<(), BanksClientError> { - let mut ctx: std::cell::RefMut = self.ctx.borrow_mut(); + let ctx: std::cell::RefMut = self.ctx.borrow_mut(); let ix = Instruction { program_id: marginfi::id(), diff --git a/test-utils/src/marginfi_group.rs b/test-utils/src/marginfi_group.rs index 564da0332..77b9e4cdf 100644 --- a/test-utils/src/marginfi_group.rs +++ b/test-utils/src/marginfi_group.rs @@ -462,7 +462,7 @@ impl MarginfiGroupFixture { } pub async fn try_accrue_interest(&self, bank: &BankFixture) -> Result<()> { - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let ix = Instruction { program_id: marginfi::id(), @@ -524,7 +524,7 @@ impl MarginfiGroupFixture { } pub async fn try_collect_fees(&self, bank: &BankFixture) -> Result<()> { - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let fee_ata = get_associated_token_address_with_program_id( &self.fee_wallet, @@ -602,7 +602,7 @@ impl MarginfiGroupFixture { .await, ); - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let ix = Instruction { program_id: marginfi::id(), diff --git a/test-utils/src/spl.rs b/test-utils/src/spl.rs index 941bb86a3..9ef40b783 100644 --- a/test-utils/src/spl.rs +++ b/test-utils/src/spl.rs @@ -56,7 +56,7 @@ impl MintFixture { let ctx_ref = Rc::clone(&ctx); let keypair = mint_keypair.unwrap_or_else(Keypair::new); let mint = { - let mut ctx = ctx.borrow_mut(); + let ctx = ctx.borrow_mut(); let rent = ctx.banks_client.get_rent().await.unwrap(); @@ -116,7 +116,7 @@ impl MintFixture { let keypair = mint_keypair.unwrap_or_else(Keypair::new); let program = token_2022::ID; let mint = { - let mut ctx = ctx.borrow_mut(); + let ctx = ctx.borrow_mut(); let rent = ctx.banks_client.get_rent().await.unwrap(); @@ -327,7 +327,7 @@ impl MintFixture { ui_to_native!(ui_amount.into(), self.mint.decimals), ); - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let tx = Transaction::new_signed_with_payer( &[mint_to_ix], @@ -437,7 +437,7 @@ impl TokenAccountFixture { pub async fn new_account(&self) -> Pubkey { let keypair = Keypair::new(); - let mut ctx = self.ctx.borrow_mut(); + let ctx = self.ctx.borrow_mut(); let ixs = Self::create_ixs( &self.ctx, @@ -505,7 +505,7 @@ impl TokenAccountFixture { .unwrap(); } - let mut ctx = ctx.borrow_mut(); + let ctx = ctx.borrow_mut(); let account = ctx .banks_client .get_account(keypair.pubkey()) @@ -556,7 +556,7 @@ impl TokenAccountFixture { } // Now retrieve the account info for the newly created ATA - let mut ctx = ctx.borrow_mut(); + let ctx = ctx.borrow_mut(); let account = ctx .banks_client .get_account(ata_address) @@ -629,7 +629,7 @@ pub async fn get_and_deserialize( ctx: Rc>, pubkey: Pubkey, ) -> T { - let mut ctx = ctx.borrow_mut(); + let ctx = ctx.borrow_mut(); let account = ctx.banks_client.get_account(pubkey).await.unwrap().unwrap(); T::try_deserialize(&mut account.data.as_slice()).unwrap() @@ -638,7 +638,7 @@ pub async fn get_and_deserialize_t22( ctx: Rc>, pubkey: Pubkey, ) -> T { - let mut ctx = ctx.borrow_mut(); + let ctx = ctx.borrow_mut(); let account = ctx.banks_client.get_account(pubkey).await.unwrap().unwrap(); StateWithExtensionsOwned::::unpack(account.data) diff --git a/test-utils/src/test.rs b/test-utils/src/test.rs index ac87dede3..a9cea73b2 100644 --- a/test-utils/src/test.rs +++ b/test-utils/src/test.rs @@ -1,11 +1,6 @@ use super::marginfi_account::MarginfiAccountFixture; use crate::{ - bank::BankFixture, - marginfi_group::*, - native, - spl::*, - utils::*, - // transfer_hook::TEST_HOOK_ID, + bank::BankFixture, marginfi_group::*, native, spl::*, transfer_hook::TEST_HOOK_ID, utils::*, }; use anchor_lang::prelude::*; @@ -58,14 +53,14 @@ impl TestSettings { mint: BankMint::SolEquivalent, ..TestBankSetting::default() }, - // TestBankSetting { - // mint: BankMint::PyUSD, - // ..TestBankSetting::default() - // }, - // TestBankSetting { - // mint: BankMint::T22WithFee, - // ..TestBankSetting::default() - // }, + TestBankSetting { + mint: BankMint::PyUSD, + ..TestBankSetting::default() + }, + TestBankSetting { + mint: BankMint::T22WithFee, + ..TestBankSetting::default() + }, TestBankSetting { mint: BankMint::SolEqIsolated, ..TestBankSetting::default() @@ -174,9 +169,9 @@ pub enum BankMint { SolEquivalent7, SolEquivalent8, SolEquivalent9, - // UsdcT22, - // T22WithFee, - // PyUSD, + UsdcT22, + T22WithFee, + PyUSD, SolEqIsolated, } @@ -194,8 +189,8 @@ pub struct TestFixture { pub sol_mint: MintFixture, pub sol_equivalent_mint: MintFixture, pub mnde_mint: MintFixture, - // pub usdc_t22_mint: MintFixture, - // pub pyusd_mint: MintFixture, + pub usdc_t22_mint: MintFixture, + pub pyusd_mint: MintFixture, } pub const PYTH_USDC_FEED: Pubkey = pubkey!("PythUsdcPrice111111111111111111111111111111"); @@ -416,13 +411,7 @@ impl TestFixture { program.prefer_bpf(true); program.add_program("marginfi", marginfi::ID, None); - // program.add_program("test_transfer_hook", TEST_HOOK_ID, None); - #[cfg(feature = "lip")] - program.add_program( - "liquidity_incentive_program", - liquidity_incentive_program::ID, - None, - ); + program.add_program("test_transfer_hook", TEST_HOOK_ID, None); let usdc_keypair = Keypair::new(); let pyusd_keypair = Keypair::new(); @@ -539,7 +528,7 @@ impl TestFixture { let context = Rc::new(RefCell::new(program.start_with_context().await)); { - let mut ctx = context.borrow_mut(); + let ctx = context.borrow_mut(); let mut clock: Clock = ctx.banks_client.get_sysvar().await.unwrap(); clock.unix_timestamp = 0; ctx.set_sysvar(&clock); @@ -572,21 +561,21 @@ impl TestFixture { Some(MNDE_MINT_DECIMALS), ) .await; - // let usdc_t22_mint_f = MintFixture::new_token_22( - // Rc::clone(&context), - // Some(usdc_t22_keypair), - // Some(USDC_MINT_DECIMALS), - // extensions, - // ) - // .await; - // let pyusd_mint_f = MintFixture::new_from_file(&context, "src/fixtures/pyUSD.json"); - // let t22_with_fee_mint_f = MintFixture::new_token_22( - // Rc::clone(&context), - // Some(t22_with_fee_keypair), - // Some(T22_WITH_FEE_MINT_DECIMALS), - // &[SupportedExtension::TransferFee], - // ) - // .await; + let usdc_t22_mint_f = MintFixture::new_token_22( + Rc::clone(&context), + Some(usdc_t22_keypair), + Some(USDC_MINT_DECIMALS), + extensions, + ) + .await; + let pyusd_mint_f = MintFixture::new_from_file(&context, "src/fixtures/pyUSD.json"); + let t22_with_fee_mint_f = MintFixture::new_token_22( + Rc::clone(&context), + Some(t22_with_fee_keypair), + Some(T22_WITH_FEE_MINT_DECIMALS), + &[SupportedExtension::TransferFee], + ) + .await; let tester_group = MarginfiGroupFixture::new(Rc::clone(&context)).await; @@ -647,11 +636,11 @@ impl TestFixture { &sol_equivalent_mint_f, *DEFAULT_SOL_EQUIVALENT_TEST_BANK_CONFIG, ), - // BankMint::T22WithFee => { - // (&t22_with_fee_mint_f, *DEFAULT_T22_WITH_FEE_TEST_BANK_CONFIG) - // } - // BankMint::UsdcT22 => (&usdc_t22_mint_f, *DEFAULT_USDC_TEST_BANK_CONFIG), - // BankMint::PyUSD => (&pyusd_mint_f, *DEFAULT_PYUSD_TEST_BANK_CONFIG), + BankMint::T22WithFee => { + (&t22_with_fee_mint_f, *DEFAULT_T22_WITH_FEE_TEST_BANK_CONFIG) + } + BankMint::UsdcT22 => (&usdc_t22_mint_f, *DEFAULT_USDC_TEST_BANK_CONFIG), + BankMint::PyUSD => (&pyusd_mint_f, *DEFAULT_PYUSD_TEST_BANK_CONFIG), BankMint::SolEqIsolated => { (&sol_equivalent_mint_f, *DEFAULT_SOL_EQ_ISO_TEST_BANK_CONFIG) } @@ -675,8 +664,8 @@ impl TestFixture { sol_mint: sol_mint_f, sol_equivalent_mint: sol_equivalent_mint_f, mnde_mint: mnde_mint_f, - // usdc_t22_mint: usdc_t22_mint_f, - // pyusd_mint: pyusd_mint_f, + usdc_t22_mint: usdc_t22_mint_f, + pyusd_mint: pyusd_mint_f, } } @@ -849,9 +838,9 @@ impl TestFixture { pub fn get_mint_price(mint: BankMint) -> f64 { match mint { // For the T22 with fee variant, it's 50 cents - // BankMint::T22WithFee => 0.5, + BankMint::T22WithFee => 0.5, // For USDC-based and PYUSD mints, the price is roughly 1.0. - BankMint::Usdc /* | BankMint::UsdcT22 | BankMint::PyUSD */ => 1.0, + BankMint::Usdc | BankMint::UsdcT22 | BankMint::PyUSD => 1.0, // For SOL and its equivalents, use the SOL price (here, roughly 10.0). BankMint::Sol | BankMint::SolSwbPull diff --git a/test-utils/src/utils.rs b/test-utils/src/utils.rs index 66e222eb0..366ec4366 100644 --- a/test-utils/src/utils.rs +++ b/test-utils/src/utils.rs @@ -402,57 +402,3 @@ pub fn get_sufficient_collateral_for_outflow( ) -> f64 { target_outflow * outflow_mint_price / collateral_mint_price } - -// #[cfg(feature = "lip")] -// pub mod lip { -// use super::*; -// pub fn get_reward_vault_address(campaign_key: Pubkey) -> (Pubkey, u8) { -// Pubkey::find_program_address( -// &[ -// liquidity_incentive_program::constants::CAMPAIGN_SEED.as_bytes(), -// campaign_key.as_ref(), -// ], -// &liquidity_incentive_program::id(), -// ) -// } - -// pub fn get_reward_vault_authority(campaign_key: Pubkey) -> (Pubkey, u8) { -// Pubkey::find_program_address( -// &[ -// liquidity_incentive_program::constants::CAMPAIGN_AUTH_SEED.as_bytes(), -// campaign_key.as_ref(), -// ], -// &liquidity_incentive_program::id(), -// ) -// } - -// pub fn get_temp_token_account_authority(deposit_key: Pubkey) -> (Pubkey, u8) { -// Pubkey::find_program_address( -// &[ -// liquidity_incentive_program::constants::TEMP_TOKEN_ACCOUNT_AUTH_SEED.as_bytes(), -// deposit_key.as_ref(), -// ], -// &liquidity_incentive_program::id(), -// ) -// } - -// pub fn get_deposit_mfi_authority(deposit_key: Pubkey) -> (Pubkey, u8) { -// Pubkey::find_program_address( -// &[ -// liquidity_incentive_program::constants::DEPOSIT_MFI_AUTH_SIGNER_SEED.as_bytes(), -// deposit_key.as_ref(), -// ], -// &liquidity_incentive_program::id(), -// ) -// } - -// pub fn get_marginfi_account_address(deposit_key: Pubkey) -> (Pubkey, u8) { -// Pubkey::find_program_address( -// &[ -// liquidity_incentive_program::constants::MARGINFI_ACCOUNT_SEED.as_bytes(), -// deposit_key.as_ref(), -// ], -// &liquidity_incentive_program::id(), -// ) -// } -// } diff --git a/tests/utils/tools.ts b/tests/utils/tools.ts index 4df530fcd..c73355f64 100644 --- a/tests/utils/tools.ts +++ b/tests/utils/tools.ts @@ -1,4 +1,3 @@ -import { PublicKey } from "@solana/web3.js"; import { BanksTransactionResultWithMeta } from "solana-bankrun"; /** From fe512cae17162ccdc8ffb187fc1520b57c0c52e7 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 23 Apr 2025 01:20:48 -0400 Subject: [PATCH 35/38] Update fuzz, update guide, lint fixes --- Cargo.lock | 1 - .../rust/marginfi-cli/src/processor/mod.rs | 12 ++--- guides/GETTING_STARTED_DEV.md | 46 ++++++++++++++++--- programs/marginfi/fuzz/src/account_state.rs | 4 +- programs/marginfi/fuzz/src/lib.rs | 14 +++--- programs/marginfi/fuzz/src/stubs.rs | 2 +- programs/marginfi/src/state/price.rs | 2 +- test-utils/Cargo.toml | 2 +- test-utils/src/bank.rs | 5 +- test-utils/src/marginfi_account.rs | 16 +++---- test-utils/src/marginfi_group.rs | 4 +- 11 files changed, 69 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b801ee1d..ad8d854d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7450,7 +7450,6 @@ dependencies = [ "solana-program", "solana-program-test", "solana-sdk", - "spl-token-2022 7.0.0", "spl-transfer-hook-interface 0.9.0", "static_assertions", "switchboard-on-demand", diff --git a/clients/rust/marginfi-cli/src/processor/mod.rs b/clients/rust/marginfi-cli/src/processor/mod.rs index 160df7f62..8164a3dd4 100644 --- a/clients/rust/marginfi-cli/src/processor/mod.rs +++ b/clients/rust/marginfi-cli/src/processor/mod.rs @@ -769,7 +769,7 @@ fn handle_bankruptcy_for_an_account( data: marginfi::instruction::LendingPoolHandleBankruptcy {}.data(), }; - if token_program == spl_token_2022::ID { + if token_program == anchor_spl::token_2022::ID { handle_bankruptcy_ix .accounts .push(AccountMeta::new_readonly(bank.mint, false)); @@ -923,7 +923,7 @@ fn make_bankruptcy_ix( data: marginfi::instruction::LendingPoolHandleBankruptcy {}.data(), }; - if token_program == spl_token_2022::ID { + if token_program == anchor_spl::token_2022::ID { handle_bankruptcy_ix .accounts .push(AccountMeta::new_readonly(bank.mint, false)); @@ -2128,7 +2128,7 @@ pub fn marginfi_account_deposit( } .data(), }; - if token_program == spl_token_2022::ID { + if token_program == anchor_spl::token_2022::ID { ix.accounts .push(AccountMeta::new_readonly(bank.mint, false)); } @@ -2215,7 +2215,7 @@ pub fn marginfi_account_withdraw( .data(), }; - if token_program == spl_token_2022::ID { + if token_program == anchor_spl::token_2022::ID { ix.accounts .push(AccountMeta::new_readonly(bank.mint, false)); } @@ -2310,7 +2310,7 @@ pub fn marginfi_account_borrow( data: marginfi::instruction::LendingAccountBorrow { amount }.data(), }; - if token_program == spl_token_2022::ID { + if token_program == anchor_spl::token_2022::ID { ix.accounts .push(AccountMeta::new_readonly(bank.mint, false)); } @@ -2432,7 +2432,7 @@ pub fn marginfi_account_liquidate( ix.accounts.extend(oracle_accounts); - if token_program == spl_token_2022::ID { + if token_program == anchor_spl::token_2022::ID { ix.accounts .push(AccountMeta::new_readonly(liability_bank.mint, false)); } diff --git a/guides/GETTING_STARTED_DEV.md b/guides/GETTING_STARTED_DEV.md index 7909020b1..42049a23f 100644 --- a/guides/GETTING_STARTED_DEV.md +++ b/guides/GETTING_STARTED_DEV.md @@ -2,14 +2,14 @@ New developer getting started working on the mrgnv2 program side? Read on. -### Things to Install (Feb 2025) +### Things to Install (April 2025) - rust/cargo - latest stable - node - 23.0.0 - yarn - 1.22.22 -- avm - 0.30.1 -- anchor - 0.30.1 -- solana - 1.18.17 +- avm - 0.30.1 or later +- anchor - 0.31.1 +- solana - 2.1.20 - cargo-nextest - use `cargo install cargo-nextest --version "0.9.81" --locked` exactly - cargo-fuzz - 0.12.0 @@ -30,7 +30,29 @@ anchor test --skip-build Note: you may need to build the other programs (mock, liquidity incentive, etc) if you have never run anchor build before. -Segmentation fault? Just try again. That happens sometimes. +Segmentation fault? Just try again. That happens sometimes, generally on the first run of the day. + +Each letter prefix is referred to as a "suite" and is broadly end-to-end. The localnet tests +multithread with bankrun and will create a fairly substantial CPU load. Completetion varies +substantially by hardware. If you your workflow is too slow, go to this portion of Anchor.toml and +comment out the top line, comment in the suite you actually want to run: + +``` +[scripts] +test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/*.spec.ts --exit --require tests/rootHooks.ts" + +# Staked collateral tests only +# test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/s*.spec.ts --exit --require tests/rootHooks.ts" + +# Pyth pull tests only +# test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/p*.spec.ts --exit --require tests/rootHooks.ts" + +# Edmode tests only +# test = "RUST_LOG= yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/e*.spec.ts --exit --require tests/rootHooks.ts" +``` + +Note: You cannot run individual tests, most of the tests in a suite must run in order, where the +number after the prefix determines their run order through the magic of filenames. ### For the Rust test suite: @@ -47,19 +69,29 @@ This is much slower than the remix test command, but stable on any system. ./scripts/test-program-remix.sh -p marginfi -l warn -c mainnet-beta -f mainnet-beta ``` -This will throttle your CPU and may error sporadically as a reminder to buy a better CPU if you try to do anything else (like say, compile another Rust repo) while this is running. +This will throttle your CPU and may error sporadically as a reminder to buy a better CPU if you try to do anything else (like say, compile another Rust repo) while this is running. It is approximately 10x faster than test-program.sh, so use this one if you value your time and sanity. Feel free to add your flex below: Benchmarks: - 9700X: `Summary [ 6.302s] 238 tests run: 238 passed, 0 skipped` -### To just one Rust test: +### To run just one Rust test: ``` ./scripts/single-test.sh marginfi accrue_interest --verbose ./scripts/single-test.sh test_name --verbose ``` +### To run the fuzz suite + +Don't. + +If you really want to, open the fuzz directory in a new IDE window (it's not part of the workspace, +by design). Run the generate-corpus Python script (you may need to install Python), then cargo +build, then run it. It may take a very long time and use a very large amount of disk space. +Typically, we run this to see if there are errors, and close it early if there are not, there is +typically no need to wait for the suite to finish locally. + ## Common issues ### The TS suite fails with `Environment supports crypto: false` at the top diff --git a/programs/marginfi/fuzz/src/account_state.rs b/programs/marginfi/fuzz/src/account_state.rs index 586019114..bb99caca0 100644 --- a/programs/marginfi/fuzz/src/account_state.rs +++ b/programs/marginfi/fuzz/src/account_state.rs @@ -124,7 +124,7 @@ impl AccountsState { true, self.bump.alloc(rent.minimum_balance(data.len())), data, - &spl_token_2022::ID, + &anchor_spl::token_2022::ID, false, Epoch::default(), ) @@ -179,7 +179,7 @@ impl AccountsState { true, self.bump.alloc(rent.minimum_balance(data.len())), data, - &spl_token_2022::ID, + &anchor_spl::token_2022::ID, false, Epoch::default(), ) diff --git a/programs/marginfi/fuzz/src/lib.rs b/programs/marginfi/fuzz/src/lib.rs index 01ab89ccd..bb0d8bffb 100644 --- a/programs/marginfi/fuzz/src/lib.rs +++ b/programs/marginfi/fuzz/src/lib.rs @@ -238,7 +238,7 @@ impl<'state> MarginfiFuzzContext<'state> { let token_program = match initial_bank_config.token_type { TokenType::Tokenkeg => state.new_program(spl_token::id()), TokenType::Token22 | TokenType::Token22WithFee { .. } => { - state.new_program(spl_token_2022::id()) + state.new_program(anchor_spl::token_2022::ID()) } }; @@ -406,7 +406,7 @@ impl<'state> MarginfiFuzzContext<'state> { ]); let mut remaining_accounts: Vec = vec![]; - if bank.token_program.key() == spl_token_2022::ID { + if bank.token_program.key() == anchor_spl::token_2022::ID { remaining_accounts.push(ails(bank.mint.clone())); } @@ -480,7 +480,7 @@ impl<'state> MarginfiFuzzContext<'state> { ]); let mut remaining_accounts = vec![]; - if bank.token_program.key() == spl_token_2022::ID { + if bank.token_program.key() == anchor_spl::token_2022::ID { remaining_accounts.push(ails(bank.mint.clone())); } @@ -573,7 +573,7 @@ impl<'state> MarginfiFuzzContext<'state> { }; let mut remaining_accounts = vec![]; - if bank.token_program.key() == spl_token_2022::ID { + if bank.token_program.key() == anchor_spl::token_2022::ID { remaining_accounts.push(ails(bank.mint.clone())); } remaining_accounts.extend(marginfi_account.get_remaining_accounts( @@ -658,7 +658,7 @@ impl<'state> MarginfiFuzzContext<'state> { sort_balances(airls(&marginfi_account.margin_account)); let mut remaining_accounts = vec![]; - if bank.token_program.key() == spl_token_2022::ID { + if bank.token_program.key() == anchor_spl::token_2022::ID { remaining_accounts.push(ails(bank.mint.clone())); } remaining_accounts.extend(marginfi_account.get_remaining_accounts( @@ -777,7 +777,7 @@ impl<'state> MarginfiFuzzContext<'state> { ]); let mut remaining_accounts = vec![]; - if liab_bank.token_program.key() == spl_token_2022::ID { + if liab_bank.token_program.key() == anchor_spl::token_2022::ID { remaining_accounts.push(ails(liab_bank.mint.clone())); } remaining_accounts.extend(vec![asset_bank.oracle.clone(), liab_bank.oracle.clone()]); @@ -880,7 +880,7 @@ impl<'state> MarginfiFuzzContext<'state> { ]); let mut remaining_accounts = vec![]; - if bank.token_program.key() == spl_token_2022::ID { + if bank.token_program.key() == anchor_spl::token_2022::ID { remaining_accounts.push(ails(bank.mint.clone())); } remaining_accounts.extend(marginfi_account.get_remaining_accounts( diff --git a/programs/marginfi/fuzz/src/stubs.rs b/programs/marginfi/fuzz/src/stubs.rs index a099addde..0528c9591 100644 --- a/programs/marginfi/fuzz/src/stubs.rs +++ b/programs/marginfi/fuzz/src/stubs.rs @@ -74,7 +74,7 @@ impl program_stubs::SyscallStubs for TestSyscallStubs { &new_account_infos, &instruction.data, ) - } else if instruction.program_id == spl_token_2022::ID { + } else if instruction.program_id == anchor_spl::token_2022::ID { spl_token_2022::processor::Processor::process( &instruction.program_id, &new_account_infos, diff --git a/programs/marginfi/src/state/price.rs b/programs/marginfi/src/state/price.rs index 45d913cdc..1db3e6fe9 100644 --- a/programs/marginfi/src/state/price.rs +++ b/programs/marginfi/src/state/price.rs @@ -687,7 +687,7 @@ impl PriceAdapter for SwitchboardPullPriceFeed { // (including bpf next-test) where the struct is "properly" aligned 16 /// The same as PullFeedAccountData::parse but completely ignores input alignment. pub fn parse_swb_ignore_alignment<'info>( - data: Ref<'info, &mut [u8]>, + data: Ref<&mut [u8]>, ) -> MarginfiResult> { if data.len() < 8 { return err!(MarginfiError::SwitchboardInvalidAccount); diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 2f6611807..5d637b106 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -16,7 +16,7 @@ solana-sdk = { workspace = true } spl-transfer-hook-interface = { workspace = true } # spl-tlv-account-resolution = { workspace = true } # spl-discriminator = { workspace = true } -spl-token-2022 = { workspace = true } +# spl-token-2022 = { workspace = true } anchor-lang = { workspace = true } anchor-spl = { workspace = true } diff --git a/test-utils/src/bank.rs b/test-utils/src/bank.rs index c6484a8f7..864e5d102 100644 --- a/test-utils/src/bank.rs +++ b/test-utils/src/bank.rs @@ -7,7 +7,6 @@ use anchor_lang::{ prelude::{AccountMeta, Pubkey}, InstructionData, ToAccountMetas, }; - use fixed::types::I80F48; use marginfi::{ bank_authority_seed, @@ -275,7 +274,7 @@ impl BankFixture { dst_token_account: receiving_account.key, } .to_account_metas(Some(true)); - if self.mint.token_program == spl_token_2022::ID { + if self.mint.token_program == anchor_spl::token_2022::ID { accounts.push(AccountMeta::new_readonly(self.mint.key, false)); } @@ -320,7 +319,7 @@ impl BankFixture { dst_token_account: receiving_account.key, } .to_account_metas(Some(true)); - if self.mint.token_program == spl_token_2022::ID { + if self.mint.token_program == anchor_spl::token_2022::ID { accounts.push(AccountMeta::new_readonly(self.mint.key, false)); } diff --git a/test-utils/src/marginfi_account.rs b/test-utils/src/marginfi_account.rs index f701319e2..821946ac8 100644 --- a/test-utils/src/marginfi_account.rs +++ b/test-utils/src/marginfi_account.rs @@ -84,7 +84,7 @@ impl MarginfiAccountFixture { token_program: bank.get_token_program(), } .to_account_metas(Some(true)); - if bank.mint.token_program == spl_token_2022::ID { + if bank.mint.token_program == anchor_spl::token_2022::ID { accounts.push(AccountMeta::new_readonly(bank.mint.key, false)); } @@ -121,7 +121,7 @@ impl MarginfiAccountFixture { .map(|acc| acc.map(|a| a.data))?) }; let payer = self.ctx.borrow_mut().payer.pubkey(); - if bank.mint.token_program == spl_token_2022::ID { + if bank.mint.token_program == anchor_spl::token_2022::ID { // TODO: do that only if hook exists println!( "[TODO] Adding extra account metas for execute for mint {:?}", @@ -175,7 +175,7 @@ impl MarginfiAccountFixture { token_program: bank.get_token_program(), } .to_account_metas(Some(true)); - if bank.mint.token_program == spl_token_2022::ID { + if bank.mint.token_program == anchor_spl::token_2022::ID { accounts.push(AccountMeta::new_readonly(bank.mint.key, false)); } @@ -247,7 +247,7 @@ impl MarginfiAccountFixture { token_program: bank.get_token_program(), } .to_account_metas(Some(true)); - if bank.mint.token_program == spl_token_2022::ID { + if bank.mint.token_program == anchor_spl::token_2022::ID { accounts.push(AccountMeta::new_readonly(bank.mint.key, false)); } @@ -290,7 +290,7 @@ impl MarginfiAccountFixture { .make_bank_borrow_ix(destination_account, bank, ui_amount) .await; - if bank.mint.token_program == spl_token_2022::ID { + if bank.mint.token_program == anchor_spl::token_2022::ID { let fetch_account_data_fn = |key| async move { Ok(self .ctx @@ -353,7 +353,7 @@ impl MarginfiAccountFixture { token_program: bank.get_token_program(), } .to_account_metas(Some(true)); - if bank.mint.token_program == spl_token_2022::ID { + if bank.mint.token_program == anchor_spl::token_2022::ID { accounts.push(AccountMeta::new_readonly(bank.mint.key, false)); } @@ -454,7 +454,7 @@ impl MarginfiAccountFixture { } .to_account_metas(Some(true)); - if liab_bank_fixture.mint.token_program == spl_token_2022::ID { + if liab_bank_fixture.mint.token_program == anchor_spl::token_2022::ID { accounts.push(AccountMeta::new_readonly(liab_bank_fixture.mint.key, false)); } @@ -489,7 +489,7 @@ impl MarginfiAccountFixture { .data(), }; - if liab_bank_fixture.mint.token_program == spl_token_2022::ID { + if liab_bank_fixture.mint.token_program == anchor_spl::token_2022::ID { let payer = self.ctx.borrow().payer.pubkey(); let fetch_account_data_fn = |key| async move { Ok(self diff --git a/test-utils/src/marginfi_group.rs b/test-utils/src/marginfi_group.rs index 77b9e4cdf..e386fcb34 100644 --- a/test-utils/src/marginfi_group.rs +++ b/test-utils/src/marginfi_group.rs @@ -544,7 +544,7 @@ impl MarginfiGroupFixture { fee_ata, } .to_account_metas(Some(true)); - if bank.mint.token_program == spl_token_2022::ID { + if bank.mint.token_program == anchor_spl::token_2022::ID { accounts.push(AccountMeta::new_readonly(bank.mint.key, false)); } @@ -592,7 +592,7 @@ impl MarginfiGroupFixture { token_program: bank.get_token_program(), } .to_account_metas(Some(true)); - if bank.mint.token_program == spl_token_2022::ID { + if bank.mint.token_program == anchor_spl::token_2022::ID { accounts.push(AccountMeta::new_readonly(bank.mint.key, false)); } From 35e78bc516eac60c72ed1e05723fcac90bceb41c Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 23 Apr 2025 01:44:12 -0400 Subject: [PATCH 36/38] Fix fuzz attempt 1 --- programs/marginfi/fuzz/src/lib.rs | 3 +-- programs/marginfi/src/state/price.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/programs/marginfi/fuzz/src/lib.rs b/programs/marginfi/fuzz/src/lib.rs index bb0d8bffb..fe22c81b8 100644 --- a/programs/marginfi/fuzz/src/lib.rs +++ b/programs/marginfi/fuzz/src/lib.rs @@ -12,7 +12,6 @@ use anchor_lang::{ prelude::{AccountInfo, AccountLoader, Context, Program, Pubkey, Rent, Signer, Sysvar}, Discriminator, Key, }; -use anchor_spl::token_2022::spl_token_2022; use arbitrary_helpers::{ AccountIdx, AssetAmount, BankAndOracleConfig, BankIdx, PriceChange, TokenType, }; @@ -238,7 +237,7 @@ impl<'state> MarginfiFuzzContext<'state> { let token_program = match initial_bank_config.token_type { TokenType::Tokenkeg => state.new_program(spl_token::id()), TokenType::Token22 | TokenType::Token22WithFee { .. } => { - state.new_program(anchor_spl::token_2022::ID()) + state.new_program(anchor_spl::token_2022::ID) } }; diff --git a/programs/marginfi/src/state/price.rs b/programs/marginfi/src/state/price.rs index 1db3e6fe9..ee5255551 100644 --- a/programs/marginfi/src/state/price.rs +++ b/programs/marginfi/src/state/price.rs @@ -686,7 +686,7 @@ impl PriceAdapter for SwitchboardPullPriceFeed { // (TargetAlignmentGreaterAndInputNotAligned) when bytemuck::from_bytes executes on any local system // (including bpf next-test) where the struct is "properly" aligned 16 /// The same as PullFeedAccountData::parse but completely ignores input alignment. -pub fn parse_swb_ignore_alignment<'info>( +pub fn parse_swb_ignore_alignment( data: Ref<&mut [u8]>, ) -> MarginfiResult> { if data.len() < 8 { From deb20ee5647bbc5ea716a398a9ff8e7882e97e30 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 23 Apr 2025 02:09:58 -0400 Subject: [PATCH 37/38] Fix lint, remove transmute in test utils --- test-utils/src/test.rs | 15 +++++---------- test-utils/src/utils.rs | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/test-utils/src/test.rs b/test-utils/src/test.rs index a9cea73b2..87428ee3e 100644 --- a/test-utils/src/test.rs +++ b/test-utils/src/test.rs @@ -383,17 +383,12 @@ pub const T22_WITH_FEE_MINT_DECIMALS: u8 = 6; pub const SOL_MINT_DECIMALS: u8 = 9; pub const MNDE_MINT_DECIMALS: u8 = 9; -pub fn marginfi_entry(program_id: &Pubkey, accounts: &[AccountInfo], data: &[u8]) -> ProgramResult { - marginfi::entry(program_id, unsafe { core::mem::transmute(accounts) }, data) -} - -#[cfg(feature = "lip")] -pub fn lip_entry<'a, 'b, 'c, 'info>( - program_id: &'a Pubkey, - accounts: &'b [AccountInfo<'info>], - data: &'c [u8], +pub fn marginfi_entry<'info>( + program_id: &Pubkey, + accounts: &'info [AccountInfo<'info>], + data: &[u8], ) -> ProgramResult { - liquidity_incentive_program::entry(program_id, unsafe { core::mem::transmute(accounts) }, data) + marginfi::entry(program_id, accounts, data) } impl TestFixture { diff --git a/test-utils/src/utils.rs b/test-utils/src/utils.rs index 366ec4366..f77490fe9 100644 --- a/test-utils/src/utils.rs +++ b/test-utils/src/utils.rs @@ -135,7 +135,7 @@ pub fn create_pyth_push_oracle_account( let mut data = vec![]; let mut account_data = vec![]; - data.extend_from_slice(&PriceUpdateV2::DISCRIMINATOR); + data.extend_from_slice(PriceUpdateV2::DISCRIMINATOR); price_update.serialize(&mut account_data).unwrap(); From 67a17e70813b8f1a1adca15af3ca19faf5bb0e89 Mon Sep 17 00:00:00 2001 From: jgur-psyops Date: Wed, 23 Apr 2025 10:39:34 -0400 Subject: [PATCH 38/38] Restore missing token exetensions test --- .../marginfi/tests/misc/token_extensions.rs | 390 +++++++++--------- 1 file changed, 195 insertions(+), 195 deletions(-) diff --git a/programs/marginfi/tests/misc/token_extensions.rs b/programs/marginfi/tests/misc/token_extensions.rs index 8f54cc109..33487f339 100644 --- a/programs/marginfi/tests/misc/token_extensions.rs +++ b/programs/marginfi/tests/misc/token_extensions.rs @@ -1,195 +1,195 @@ -// use anchor_spl::token_2022::spl_token_2022::extension::{ -// transfer_fee::TransferFeeConfig, BaseStateWithExtensions, -// }; -// use fixed::types::I80F48; -// use fixed_macro::types::I80F48; -// use fixtures::{ -// assert_eq_noise, native, -// spl::SupportedExtension, -// test::{BankMint, TestBankSetting, TestFixture, TestSettings, DEFAULT_SOL_TEST_BANK_CONFIG}, -// ui_to_native, -// }; -// use marginfi::state::marginfi_group::{Bank, BankConfig, BankConfigOpt, BankVaultType}; -// use solana_program_test::tokio; -// use test_case::test_case; - -// #[test_case(vec![])] -// #[test_case(vec![SupportedExtension::TransferFee])] -// #[test_case(vec![SupportedExtension::TransferHook])] -// #[test_case(vec![SupportedExtension::PermanentDelegate])] -// #[test_case(vec![SupportedExtension::InterestBearing])] -// #[test_case(vec![SupportedExtension::MintCloseAuthority])] -// #[test_case(vec![SupportedExtension::PermanentDelegate, SupportedExtension::InterestBearing])] -// #[test_case(vec![SupportedExtension::MintCloseAuthority, SupportedExtension::InterestBearing])] -// #[test_case(vec![SupportedExtension::PermanentDelegate,SupportedExtension::MintCloseAuthority])] -// #[test_case(vec![SupportedExtension::InterestBearing, SupportedExtension::MintCloseAuthority])] -// #[test_case(vec![SupportedExtension::PermanentDelegate, SupportedExtension::InterestBearing, SupportedExtension::MintCloseAuthority])] -// #[tokio::test] -// async fn marginfi_account_liquidation_success_with_extension( -// extensions: Vec, -// ) -> anyhow::Result<()> { -// let test_f = TestFixture::new_with_t22_extension( -// Some(TestSettings { -// banks: vec![ -// TestBankSetting { -// mint: BankMint::Usdc, -// ..TestBankSetting::default() -// }, -// TestBankSetting { -// mint: BankMint::UsdcT22, -// ..TestBankSetting::default() -// }, -// TestBankSetting { -// mint: BankMint::PyUSD, -// ..TestBankSetting::default() -// }, -// TestBankSetting { -// mint: BankMint::Sol, -// config: Some(BankConfig { -// asset_weight_init: I80F48!(1).into(), -// asset_weight_maint: I80F48!(1).into(), -// ..*DEFAULT_SOL_TEST_BANK_CONFIG -// }), -// }, -// ], -// protocol_fees: false, -// }), -// &extensions, -// ) -// .await; - -// let usdc_t22_bank_f = test_f.get_bank(&BankMint::UsdcT22); -// let sol_bank_f = test_f.get_bank(&BankMint::Sol); - -// let lender_mfi_account_f = test_f.create_marginfi_account().await; -// let lender_token_account_usdc_t22 = test_f -// .usdc_t22_mint -// .create_token_account_and_mint_to(2_500) -// .await; -// lender_mfi_account_f -// .try_bank_deposit( -// lender_token_account_usdc_t22.key, -// usdc_t22_bank_f, -// 2_000, -// None, -// ) -// .await -// .unwrap(); - -// let borrower_mfi_account_f = test_f.create_marginfi_account().await; -// let borrower_token_account_sol = test_f.sol_mint.create_token_account_and_mint_to(100).await; -// let borrower_token_account_usdc_t22 = test_f.usdc_t22_mint.create_empty_token_account().await; - -// // Borrower deposits 100 SOL worth of $1000 -// borrower_mfi_account_f -// .try_bank_deposit(borrower_token_account_sol.key, sol_bank_f, 100, None) -// .await?; - -// // Borrower borrows $999 -// // u32 is fine for this test.. not in production. Needed for Into -// let usdc_t22_mint_state = usdc_t22_bank_f.mint.load_state().await; -// let transfer_fee_offset: u32 = usdc_t22_mint_state -// .get_extension::() -// .map(|config| { -// config -// .calculate_inverse_epoch_fee(0, native!(900, "USDC")) -// .unwrap_or(0) as u32 -// }) -// .unwrap_or(0); - -// borrower_mfi_account_f -// .try_bank_borrow(borrower_token_account_usdc_t22.key, usdc_t22_bank_f, 900) -// .await -// .unwrap(); -// assert_eq!( -// borrower_token_account_usdc_t22.balance().await, -// native!(900, "USDC") -// ); - -// // Synthetically bring down the borrower account health by reducing the asset weights of the SOL bank -// sol_bank_f -// .update_config( -// BankConfigOpt { -// asset_weight_init: Some(I80F48!(0.25).into()), -// asset_weight_maint: Some(I80F48!(0.5).into()), -// ..Default::default() -// }, -// None, -// ) -// .await?; - -// lender_mfi_account_f -// .try_liquidate(&borrower_mfi_account_f, sol_bank_f, 1, usdc_t22_bank_f) -// .await -// .unwrap(); - -// // Checks -// let sol_bank: Bank = sol_bank_f.load().await; -// let usdc_t22_bank: Bank = usdc_t22_bank_f.load().await; - -// let depositor_ma = lender_mfi_account_f.load().await; -// let borrower_ma = borrower_mfi_account_f.load().await; - -// // Depositors should have 1 SOL -// assert_eq!( -// sol_bank -// .get_asset_amount(depositor_ma.lending_account.balances[1].asset_shares.into()) -// .unwrap(), -// I80F48::from(native!(1, "SOL")) -// ); - -// // Depositors should have 1990.25 USDC -// assert_eq_noise!( -// usdc_t22_bank -// .get_asset_amount(depositor_ma.lending_account.balances[0].asset_shares.into()) -// .unwrap(), -// I80F48::from(native!(1990.25, "USDC", f64)), -// native!(0.00001, "USDC", f64) -// ); - -// // Borrower should have 99 SOL -// assert_eq!( -// sol_bank -// .get_asset_amount(borrower_ma.lending_account.balances[0].asset_shares.into()) -// .unwrap(), -// I80F48::from(native!(99, "SOL")) -// ); - -// // Borrower should have 890.50 USDC -// assert_eq_noise!( -// usdc_t22_bank -// .get_liability_amount( -// borrower_ma.lending_account.balances[1] -// .liability_shares -// .into() -// ) -// .unwrap(), -// I80F48::from(native!( -// 890.50 + transfer_fee_offset as f64 / 1e6, -// "USDC", -// f64 -// )), -// native!(0.00001, "USDC", f64) -// ); - -// // Check insurance fund fee -// let insurance_fund_usdc = usdc_t22_bank_f -// .get_vault_token_account(BankVaultType::Insurance) -// .await; - -// let fee = usdc_t22_mint_state -// .get_extension::() -// .map(|config| { -// config -// .calculate_epoch_fee(0, ui_to_native!(0.25, 6)) -// .unwrap_or(0) as u32 -// }) -// .unwrap_or(0); -// assert_eq_noise!( -// insurance_fund_usdc.balance().await as i64, -// native!(0.25 - fee as f64 / 1e6, "USDC", f64) as i64, -// 1 -// ); - -// Ok(()) -// } +use anchor_spl::token_2022::spl_token_2022::extension::{ + transfer_fee::TransferFeeConfig, BaseStateWithExtensions, +}; +use fixed::types::I80F48; +use fixed_macro::types::I80F48; +use fixtures::{ + assert_eq_noise, native, + spl::SupportedExtension, + test::{BankMint, TestBankSetting, TestFixture, TestSettings, DEFAULT_SOL_TEST_BANK_CONFIG}, + ui_to_native, +}; +use marginfi::state::marginfi_group::{Bank, BankConfig, BankConfigOpt, BankVaultType}; +use solana_program_test::tokio; +use test_case::test_case; + +#[test_case(vec![])] +#[test_case(vec![SupportedExtension::TransferFee])] +#[test_case(vec![SupportedExtension::TransferHook])] +#[test_case(vec![SupportedExtension::PermanentDelegate])] +#[test_case(vec![SupportedExtension::InterestBearing])] +#[test_case(vec![SupportedExtension::MintCloseAuthority])] +#[test_case(vec![SupportedExtension::PermanentDelegate, SupportedExtension::InterestBearing])] +#[test_case(vec![SupportedExtension::MintCloseAuthority, SupportedExtension::InterestBearing])] +#[test_case(vec![SupportedExtension::PermanentDelegate,SupportedExtension::MintCloseAuthority])] +#[test_case(vec![SupportedExtension::InterestBearing, SupportedExtension::MintCloseAuthority])] +#[test_case(vec![SupportedExtension::PermanentDelegate, SupportedExtension::InterestBearing, SupportedExtension::MintCloseAuthority])] +#[tokio::test] +async fn marginfi_account_liquidation_success_with_extension( + extensions: Vec, +) -> anyhow::Result<()> { + let test_f = TestFixture::new_with_t22_extension( + Some(TestSettings { + banks: vec![ + TestBankSetting { + mint: BankMint::Usdc, + ..TestBankSetting::default() + }, + TestBankSetting { + mint: BankMint::UsdcT22, + ..TestBankSetting::default() + }, + TestBankSetting { + mint: BankMint::PyUSD, + ..TestBankSetting::default() + }, + TestBankSetting { + mint: BankMint::Sol, + config: Some(BankConfig { + asset_weight_init: I80F48!(1).into(), + asset_weight_maint: I80F48!(1).into(), + ..*DEFAULT_SOL_TEST_BANK_CONFIG + }), + }, + ], + protocol_fees: false, + }), + &extensions, + ) + .await; + + let usdc_t22_bank_f = test_f.get_bank(&BankMint::UsdcT22); + let sol_bank_f = test_f.get_bank(&BankMint::Sol); + + let lender_mfi_account_f = test_f.create_marginfi_account().await; + let lender_token_account_usdc_t22 = test_f + .usdc_t22_mint + .create_token_account_and_mint_to(2_500) + .await; + lender_mfi_account_f + .try_bank_deposit( + lender_token_account_usdc_t22.key, + usdc_t22_bank_f, + 2_000, + None, + ) + .await + .unwrap(); + + let borrower_mfi_account_f = test_f.create_marginfi_account().await; + let borrower_token_account_sol = test_f.sol_mint.create_token_account_and_mint_to(100).await; + let borrower_token_account_usdc_t22 = test_f.usdc_t22_mint.create_empty_token_account().await; + + // Borrower deposits 100 SOL worth of $1000 + borrower_mfi_account_f + .try_bank_deposit(borrower_token_account_sol.key, sol_bank_f, 100, None) + .await?; + + // Borrower borrows $999 + // u32 is fine for this test.. not in production. Needed for Into + let usdc_t22_mint_state = usdc_t22_bank_f.mint.load_state().await; + let transfer_fee_offset: u32 = usdc_t22_mint_state + .get_extension::() + .map(|config| { + config + .calculate_inverse_epoch_fee(0, native!(900, "USDC")) + .unwrap_or(0) as u32 + }) + .unwrap_or(0); + + borrower_mfi_account_f + .try_bank_borrow(borrower_token_account_usdc_t22.key, usdc_t22_bank_f, 900) + .await + .unwrap(); + assert_eq!( + borrower_token_account_usdc_t22.balance().await, + native!(900, "USDC") + ); + + // Synthetically bring down the borrower account health by reducing the asset weights of the SOL bank + sol_bank_f + .update_config( + BankConfigOpt { + asset_weight_init: Some(I80F48!(0.25).into()), + asset_weight_maint: Some(I80F48!(0.5).into()), + ..Default::default() + }, + None, + ) + .await?; + + lender_mfi_account_f + .try_liquidate(&borrower_mfi_account_f, sol_bank_f, 1, usdc_t22_bank_f) + .await + .unwrap(); + + // Checks + let sol_bank: Bank = sol_bank_f.load().await; + let usdc_t22_bank: Bank = usdc_t22_bank_f.load().await; + + let depositor_ma = lender_mfi_account_f.load().await; + let borrower_ma = borrower_mfi_account_f.load().await; + + // Depositors should have 1 SOL + assert_eq!( + sol_bank + .get_asset_amount(depositor_ma.lending_account.balances[1].asset_shares.into()) + .unwrap(), + I80F48::from(native!(1, "SOL")) + ); + + // Depositors should have 1990.25 USDC + assert_eq_noise!( + usdc_t22_bank + .get_asset_amount(depositor_ma.lending_account.balances[0].asset_shares.into()) + .unwrap(), + I80F48::from(native!(1990.25, "USDC", f64)), + native!(0.00001, "USDC", f64) + ); + + // Borrower should have 99 SOL + assert_eq!( + sol_bank + .get_asset_amount(borrower_ma.lending_account.balances[0].asset_shares.into()) + .unwrap(), + I80F48::from(native!(99, "SOL")) + ); + + // Borrower should have 890.50 USDC + assert_eq_noise!( + usdc_t22_bank + .get_liability_amount( + borrower_ma.lending_account.balances[1] + .liability_shares + .into() + ) + .unwrap(), + I80F48::from(native!( + 890.50 + transfer_fee_offset as f64 / 1e6, + "USDC", + f64 + )), + native!(0.00001, "USDC", f64) + ); + + // Check insurance fund fee + let insurance_fund_usdc = usdc_t22_bank_f + .get_vault_token_account(BankVaultType::Insurance) + .await; + + let fee = usdc_t22_mint_state + .get_extension::() + .map(|config| { + config + .calculate_epoch_fee(0, ui_to_native!(0.25, 6)) + .unwrap_or(0) as u32 + }) + .unwrap_or(0); + assert_eq_noise!( + insurance_fund_usdc.balance().await as i64, + native!(0.25 - fee as f64 / 1e6, "USDC", f64) as i64, + 1 + ); + + Ok(()) +}