From 9b2925f03b16062df6d95dd42d3ccb3324e6ab71 Mon Sep 17 00:00:00 2001 From: Sarfaraz Nawaz Date: Wed, 17 Sep 2025 12:33:30 +0530 Subject: [PATCH 1/4] feat: optimize delegate instruction using Pinocchio for lower CU consumption --- Cargo.lock | 61 +- Cargo.toml | 4 + src/error.rs | 8 + src/lib.rs | 93 +- src/processor/fast/delegate.rs | 165 ++ src/processor/fast/mod.rs | 10 + src/processor/fast/utils/mod.rs | 2 + src/processor/fast/utils/pda.rs | 61 + src/processor/fast/utils/requires.rs | 143 ++ src/processor/mod.rs | 2 + src/processor/utils/curve.rs | 26 + src/processor/utils/loaders.rs | 9 +- src/state/delegation_metadata.rs | 10 + src/state/utils/discriminator.rs | 4 +- src/testlib.rs | 119 ++ tests/fixtures/mod.rs | 120 ++ tests/integration/package-lock.json | 133 +- tests/integration/tests/test-delegation.ts | 84 +- tests/integration/yarn.lock | 1461 ----------------- tests/test_call_handler.rs | 3 +- tests/test_close_validator_fees_vault.rs | 5 +- tests/test_commit_on_curve.rs | 3 +- tests/test_commit_state.rs | 3 +- tests/test_commit_state_from_buffer.rs | 3 +- .../test_commit_state_with_program_config.rs | 3 +- tests/test_delegate.rs | 11 +- tests/test_delegate_on_curve.rs | 3 +- tests/test_finalize.rs | 3 +- tests/test_init_fees_vault.rs | 3 +- tests/test_init_validator_fees_vault.rs | 3 +- tests/test_lamports_settlement.rs | 3 +- tests/test_protocol_claim_fees.rs | 3 +- tests/test_top_up.rs | 3 +- tests/test_undelegate.rs | 3 +- tests/test_undelegate_on_curve.rs | 3 +- tests/test_undelegate_without_commit.rs | 3 +- tests/test_validator_claim_fees.rs | 3 +- tests/test_whitelist_validator_for_program.rs | 3 +- 38 files changed, 973 insertions(+), 1609 deletions(-) create mode 100644 src/processor/fast/delegate.rs create mode 100644 src/processor/fast/mod.rs create mode 100644 src/processor/fast/utils/mod.rs create mode 100644 src/processor/fast/utils/pda.rs create mode 100644 src/processor/fast/utils/requires.rs create mode 100644 src/testlib.rs delete mode 100644 tests/integration/yarn.lock diff --git a/Cargo.lock b/Cargo.lock index 7c820d6a..c651213e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1322,9 +1322,9 @@ dependencies = [ [[package]] name = "five8_const" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b4f62f0f8ca357f93ae90c8c2dd1041a1f665fde2f889ea9b1787903829015" +checksum = "26dec3da8bc3ef08f2c04f61eab298c3ab334523e55f076354d6d6f613799a7b" dependencies = [ "five8_core", ] @@ -2228,6 +2228,10 @@ dependencies = [ "magicblock-delegation-program", "num_enum", "paste", + "pinocchio", + "pinocchio-log", + "pinocchio-pubkey", + "pinocchio-system", "rand 0.8.5", "solana-curve25519", "solana-program", @@ -2739,6 +2743,53 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pinocchio" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b971851087bc3699b001954ad02389d50c41405ece3548cbcafc88b3e20017a" + +[[package]] +name = "pinocchio-log" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f266eb7ddac75ef32c42025d5cc571da4f8c9e6d5c3d70820c204d5fee72e57a" +dependencies = [ + "pinocchio-log-macro", +] + +[[package]] +name = "pinocchio-log-macro" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69fb52edb3c5736b044cc462b0957b9767d0f574d138f4e2761438c498a4b467" +dependencies = [ + "quote", + "regex", + "syn 1.0.109", +] + +[[package]] +name = "pinocchio-pubkey" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0225638cadcbebae8932cb7f49cb5da7c15c21beb19f048f05a5ca7d93f065" +dependencies = [ + "five8_const", + "pinocchio", + "sha2-const-stable", +] + +[[package]] +name = "pinocchio-system" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "141ed5eafb4ab04568bb0e224e3dc9a9de13c933de4c004e0d1a553498be3a7c" +dependencies = [ + "pinocchio", + "pinocchio-pubkey", +] + [[package]] name = "pkg-config" version = "0.3.30" @@ -3536,6 +3587,12 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha2-const-stable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9" + [[package]] name = "sha3" version = "0.10.8" diff --git a/Cargo.toml b/Cargo.toml index 1a849512..30a1dc5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,10 @@ thiserror = "^1.0.57" solana-security-txt = { version = "1.1.1", optional = true } solana-curve25519 = "2.2" bincode = "1.3.3" +pinocchio-log = "0.5.0" +pinocchio = "0.9.2" +pinocchio-pubkey = "0.3.0" +pinocchio-system = "0.3.0" [dev-dependencies] base64 = "0.22.1" diff --git a/src/error.rs b/src/error.rs index 26add356..3ec84cdc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -33,6 +33,8 @@ pub enum DlpError { NonceOutOfOrder = 12, #[error("Computation overflow detected")] Overflow = 13, + #[error("Too many seeds")] + TooManySeeds = 14, } impl From for ProgramError { @@ -40,3 +42,9 @@ impl From for ProgramError { ProgramError::Custom(e as u32) } } + +impl From for pinocchio::program_error::ProgramError { + fn from(e: DlpError) -> Self { + pinocchio::program_error::ProgramError::Custom(e as u32) + } +} diff --git a/src/lib.rs b/src/lib.rs index 946aef92..7ea543fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,18 @@ #![allow(unexpected_cfgs)] // silence clippy for target_os solana and other solana program custom features use crate::processor::process_call_handler; +use pinocchio_log::log; use solana_program::{ - account_info::AccountInfo, declare_id, entrypoint::ProgramResult, msg, - program_error::ProgramError, pubkey::Pubkey, + account_info::AccountInfo, + declare_id, + entrypoint::{self, ProgramResult}, + msg, + program_error::ProgramError, + pubkey::Pubkey, }; +use discriminator::DlpDiscriminator; + pub mod args; pub mod consts; mod discriminator; @@ -15,10 +22,17 @@ pub mod pda; mod processor; pub mod state; +#[cfg(feature = "unit_test_config")] +pub mod testlib; + declare_id!("DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh"); -#[cfg(not(feature = "no-entrypoint"))] -solana_program::entrypoint!(process_instruction); +pub mod fast { + pinocchio_pubkey::declare_id!("DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh"); +} + +entrypoint::custom_heap_default!(); +entrypoint::custom_panic_default!(); #[cfg(all(not(feature = "no-entrypoint"), feature = "solana-security-txt"))] solana_security_txt::security_txt! { @@ -30,7 +44,76 @@ solana_security_txt::security_txt! { source_code: "https://github.com/magicblock-labs/delegation-program" } -pub fn process_instruction( +/// # Safety +/// +/// It's pretty close to the code generated by entrypoint!() macro, with one minor tweak to +/// support fallback branch. +#[no_mangle] +pub unsafe extern "C" fn entrypoint(input: *mut u8) -> u64 { + const UNINIT: core::mem::MaybeUninit = + core::mem::MaybeUninit::::uninit(); + let mut accounts = [UNINIT; { pinocchio::MAX_TX_ACCOUNTS }]; + + let (program_id, count, data) = + pinocchio::entrypoint::deserialize::<{ pinocchio::MAX_TX_ACCOUNTS }>(input, &mut accounts); + match fast_process_instruction( + program_id, + core::slice::from_raw_parts(accounts.as_ptr() as _, count), + data, + ) { + Some(Ok(())) => pinocchio::SUCCESS, + Some(Err(error)) => error.into(), + + // Fallback to the slow path that does not use pinocchio SDK. + None => slow_entrypoint(input), + } +} + +/// # Safety +/// +/// It's pretty close to the code generated by entrypoint!() macro, with one difference: the +/// function name is slow_entrypoint() as opposed to entrypoint() because this is a fallback +/// entrypoint (a slow one). +pub unsafe fn slow_entrypoint(input: *mut u8) -> u64 { + let (program_id, accounts, instruction_data) = unsafe { entrypoint::deserialize(input) }; + match slow_process_instruction(program_id, &accounts, instruction_data) { + Ok(()) => entrypoint::SUCCESS, + Err(error) => error.into(), + } +} + +pub fn fast_process_instruction( + program_id: &pinocchio::pubkey::Pubkey, + accounts: &[pinocchio::account_info::AccountInfo], + data: &[u8], +) -> Option { + // TODO (snawaz): why the size of discriminator is 8, when 1 is enough, and in the rest 7 bytes + // we can store 7 bumps that could give us huge performance boost as it'd simplify validations! + let (discriminator, data) = data.split_at(8); + + let discriminator = match discriminator + .try_into() + .ok() + .and_then(|bytes: [u8; 8]| DlpDiscriminator::try_from(bytes).ok()) + { + Some(discriminator) => discriminator, + None => { + log!("Failed to read and parse discriminator"); + return Some(Err( + pinocchio::program_error::ProgramError::InvalidInstructionData, + )); + } + }; + + match discriminator { + discriminator::DlpDiscriminator::Delegate => Some(processor::fast::process_delegate( + program_id, accounts, data, + )), + _ => None, + } +} + +pub fn slow_process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], data: &[u8], diff --git a/src/processor/fast/delegate.rs b/src/processor/fast/delegate.rs new file mode 100644 index 00000000..079ae280 --- /dev/null +++ b/src/processor/fast/delegate.rs @@ -0,0 +1,165 @@ +use borsh::BorshDeserialize; +use pinocchio::instruction::{Seed, Signer}; +use pinocchio::pubkey::{self, pubkey_eq}; +use pinocchio::sysvars::clock::Clock; +use pinocchio::sysvars::Sysvar; +use pinocchio::{ + account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey, ProgramResult, +}; +use pinocchio_log::log; + +use crate::args::DelegateArgs; +use crate::consts::DEFAULT_VALIDATOR_IDENTITY; +use crate::error::DlpError; +use crate::pda; +use crate::processor::fast::to_pinocchio_program_error; +use crate::processor::fast::utils::{pda::create_pda, requires::require_uninitialized_pda}; +use crate::processor::utils::curve::is_on_curve_fast; +use crate::state::{DelegationMetadata, DelegationRecord}; + +use super::utils::requires::{require_owned_pda, require_pda, require_program, require_signer}; + +pub fn process_delegate( + _program_id: &Pubkey, + accounts: &[AccountInfo], + data: &[u8], +) -> ProgramResult { + let [payer, delegated_account, owner_program, delegate_buffer_account, delegation_record_account, delegation_metadata_account, system_program] = + accounts + else { + return Err(ProgramError::NotEnoughAccountKeys); + }; + + log!("PROCESS DELEGATE"); + + require_owned_pda(delegated_account, &crate::fast::ID, "delegated account")?; + require_program(system_program, &pinocchio_system::ID, "system program")?; + + // Check that payer and delegated_account are signers, this ensures the instruction is being called from CPI + require_signer(payer, "payer")?; + require_signer(delegated_account, "delegated account")?; + + // Check that the buffer PDA is initialized and derived correctly from the PDA + require_pda( + delegate_buffer_account, + &[pda::DELEGATE_BUFFER_TAG, delegated_account.key()], + owner_program.key(), + true, + "delegate buffer", + )?; + + // Check that the delegation record PDA is uninitialized + let delegation_record_bump = require_uninitialized_pda( + delegation_record_account, + &[pda::DELEGATION_RECORD_TAG, delegated_account.key()], + &crate::fast::ID, + true, + "delegation record", + )?; + + // Check that the delegation metadata PDA is uninitialized + let delegation_metadata_bump = require_uninitialized_pda( + delegation_metadata_account, + &[pda::DELEGATION_METADATA_TAG, delegated_account.key()], + &crate::fast::ID, + true, + "delegation metadata", + )?; + + let args = + DelegateArgs::try_from_slice(data).map_err(|_| ProgramError::InvalidInstructionData)?; + + // Validate seeds if the delegate account is not on curve, i.e. is a PDA + // If the owner is the system program, we check if the account is derived from the delegation program, + // allowing delegation of escrow accounts + if !is_on_curve_fast(delegated_account.key()) { + let program_id = if pubkey_eq(owner_program.key(), &pinocchio_system::ID) { + &crate::fast::ID + } else { + owner_program.key() + }; + let seeds_to_validate: &[&[u8]] = match args.seeds.len() { + 1 => &[&args.seeds[0]], + 2 => &[&args.seeds[0], &args.seeds[1]], + 3 => &[&args.seeds[0], &args.seeds[1], &args.seeds[2]], + 4 => &[ + &args.seeds[0], + &args.seeds[1], + &args.seeds[2], + &args.seeds[3], + ], + _ => return Err(DlpError::TooManySeeds.into()), + }; + let derived_pda = pubkey::find_program_address(seeds_to_validate, program_id).0; + + if !pubkey_eq(&derived_pda, delegated_account.key()) { + log!("Expected delegated PDA to be: "); + pubkey::log(&derived_pda); + log!("but got: "); + pubkey::log(delegated_account.key()); + return Err(ProgramError::InvalidSeeds); + } + } + + create_pda( + delegation_record_account, + &crate::fast::ID, + DelegationRecord::size_with_discriminator(), + &[Signer::from(&[ + Seed::from(pda::DELEGATION_RECORD_TAG), + Seed::from(delegated_account.key()), + Seed::from(&[delegation_record_bump]), + ])], + payer, + )?; + + // Initialize the delegation record + let delegation_record = DelegationRecord { + owner: (*owner_program.key()).into(), + authority: args.validator.unwrap_or(DEFAULT_VALIDATOR_IDENTITY), + commit_frequency_ms: args.commit_frequency_ms as u64, + delegation_slot: Clock::get()?.slot, + lamports: delegated_account.lamports(), + }; + + let mut delegation_record_data = delegation_record_account.try_borrow_mut_data()?; + delegation_record + .to_bytes_with_discriminator(&mut delegation_record_data) + .map_err(to_pinocchio_program_error)?; + + let delegation_metadata = DelegationMetadata { + seeds: args.seeds, + last_update_nonce: 0, + is_undelegatable: false, + rent_payer: (*payer.key()).into(), + }; + + // Initialize the delegation metadata PDA + create_pda( + delegation_metadata_account, + &crate::fast::ID, + delegation_metadata.serialized_size(), + &[Signer::from(&[ + Seed::from(pda::DELEGATION_METADATA_TAG), + Seed::from(delegated_account.key()), + Seed::from(&[delegation_metadata_bump]), + ])], + payer, + )?; + + // Copy the seeds to the delegated metadata PDA + let mut delegation_metadata_data = delegation_metadata_account.try_borrow_mut_data()?; + delegation_metadata + .to_bytes_with_discriminator(&mut delegation_metadata_data.as_mut()) + .map_err(to_pinocchio_program_error)?; + + // TODO (snawaz): why do we conditionally copy? + // Copy the data from the buffer into the original account + if !delegate_buffer_account.data_is_empty() { + let mut delegated_data = delegated_account.try_borrow_mut_data()?; + let delegate_buffer_data = delegate_buffer_account.try_borrow_data()?; + (*delegated_data).copy_from_slice(&delegate_buffer_data); + } + + Ok(()) +} diff --git a/src/processor/fast/mod.rs b/src/processor/fast/mod.rs new file mode 100644 index 00000000..e40bc425 --- /dev/null +++ b/src/processor/fast/mod.rs @@ -0,0 +1,10 @@ +mod delegate; +mod utils; + +pub use delegate::*; + +pub fn to_pinocchio_program_error( + error: solana_program::program_error::ProgramError, +) -> pinocchio::program_error::ProgramError { + u64::from(error).into() +} diff --git a/src/processor/fast/utils/mod.rs b/src/processor/fast/utils/mod.rs new file mode 100644 index 00000000..02cf2aa7 --- /dev/null +++ b/src/processor/fast/utils/mod.rs @@ -0,0 +1,2 @@ +pub(crate) mod pda; +pub(crate) mod requires; diff --git a/src/processor/fast/utils/pda.rs b/src/processor/fast/utils/pda.rs new file mode 100644 index 00000000..95da4f12 --- /dev/null +++ b/src/processor/fast/utils/pda.rs @@ -0,0 +1,61 @@ +use pinocchio::account_info::AccountInfo; +use pinocchio::instruction::Signer; +use pinocchio::pubkey::Pubkey; +use pinocchio::sysvars::rent::Rent; +use pinocchio::sysvars::Sysvar; +use pinocchio::ProgramResult; +use pinocchio_system::instructions as system; + +/// Creates a new pda +#[inline(always)] +pub(crate) fn create_pda( + target_account: &AccountInfo, + owner: &Pubkey, + space: usize, + pda_signers: &[Signer], + payer: &AccountInfo, +) -> ProgramResult { + // Create the account manually or using the create instruction + + let rent = Rent::get()?; + if target_account.lamports().eq(&0) { + // If balance is zero, create account + system::CreateAccount { + from: payer, + to: target_account, + lamports: rent.minimum_balance(space), + space: space as u64, + owner, + } + .invoke_signed(pda_signers) + } else { + // Otherwise, if balance is nonzero: + + // 1) transfer sufficient lamports for rent exemption + let rent_exempt_balance = rent + .minimum_balance(space) + .saturating_sub(target_account.lamports()); + if rent_exempt_balance > 0 { + system::Transfer { + from: payer, + to: target_account, + lamports: rent_exempt_balance, + } + .invoke()?; + } + + // 2) allocate space for the account + system::Allocate { + account: target_account, + space: space as u64, + } + .invoke_signed(pda_signers)?; + + // 3) assign our program as the owner + system::Assign { + account: target_account, + owner, + } + .invoke_signed(pda_signers) + } +} diff --git a/src/processor/fast/utils/requires.rs b/src/processor/fast/utils/requires.rs new file mode 100644 index 00000000..848683df --- /dev/null +++ b/src/processor/fast/utils/requires.rs @@ -0,0 +1,143 @@ +use pinocchio::account_info::AccountInfo; +use pinocchio::program_error::ProgramError; +use pinocchio::pubkey::{self, pubkey_eq, Pubkey}; +use pinocchio_log::log; + +/// Errors if: +/// - Account is not owned by expected program. +#[inline(always)] +pub fn require_owned_pda( + info: &AccountInfo, + owner: &Pubkey, + label: &str, +) -> Result<(), ProgramError> { + if !pubkey_eq(info.owner(), owner) { + log!("Invalid account owner for {}:", label); + pubkey::log(info.key()); + return Err(ProgramError::InvalidAccountOwner); + } + Ok(()) +} + +/// Errors if: +/// - Account is not a signer. +#[inline(always)] +pub fn require_signer(info: &AccountInfo, label: &str) -> Result<(), ProgramError> { + if !info.is_signer() { + log!("Account needs to be signer {}: ", label); + pubkey::log(info.key()); + return Err(ProgramError::MissingRequiredSignature); + } + + Ok(()) +} + +/// Errors if: +/// - Address does not match PDA derived from provided seeds. +#[inline(always)] +pub fn require_pda( + info: &AccountInfo, + seeds: &[&[u8]], + program_id: &Pubkey, + is_writable: bool, + label: &str, +) -> Result { + let pda = pubkey::find_program_address(seeds, program_id); + + if !pubkey_eq(info.key(), &pda.0) { + log!("Invalid seeds for {}: ", label); + pubkey::log(info.key()); + return Err(ProgramError::InvalidSeeds); + } + + if !info.is_writable().eq(&is_writable) { + // TODO (snawaz): misleading msg + // also better use more granular error here ProgramError::InvalidPermission + log!("Account needs to be writable. Label: {}", label); + pubkey::log(info.key()); + return Err(ProgramError::InvalidAccountData); + } + + Ok(pda.1) +} + +/// Errors if: +/// - Owner is not the system program. +/// - Data is not empty. +/// - Account is not writable. +#[inline(always)] +pub fn require_uninitialized_account( + info: &AccountInfo, + is_writable: bool, + label: &str, +) -> Result<(), ProgramError> { + if !pubkey_eq(info.owner(), &pinocchio_system::id()) { + log!( + "Invalid owner for account. Label: {}; account and owner: ", + label + ); + pubkey::log(info.key()); + pubkey::log(info.owner()); + return Err(ProgramError::InvalidAccountOwner); + } + + if !info.data_is_empty() { + log!( + "Account needs to be uninitialized. Label: {}, account: ", + label, + ); + pubkey::log(info.key()); + return Err(ProgramError::AccountAlreadyInitialized); + } + + if is_writable && !info.is_writable() { + log!("Account needs to be writable. label: {}, account: ", label); + pubkey::log(info.key()); + return Err(ProgramError::InvalidAccountData); + } + + Ok(()) +} + +/// Errors if: +/// - Address does not match PDA derived from provided seeds. +/// - Cannot load as an uninitialized account. +#[inline(always)] +pub fn require_uninitialized_pda( + info: &AccountInfo, + seeds: &[&[u8]], + program_id: &Pubkey, + is_writable: bool, + label: &str, +) -> Result { + let pda = pubkey::find_program_address(seeds, program_id); + + if !pubkey_eq(info.key(), &pda.0) { + log!("Invalid seeds for account {}: ", label); + pubkey::log(info.key()); + return Err(ProgramError::InvalidSeeds); + } + + require_uninitialized_account(info, is_writable, label)?; + Ok(pda.1) +} + +/// Errors if: +/// - Address does not match the expected value. +/// - Account is not executable. +#[inline(always)] +pub fn require_program(info: &AccountInfo, key: &Pubkey, label: &str) -> Result<(), ProgramError> { + if !pubkey_eq(info.key(), key) { + log!("Invalid program account {}: ", label); + pubkey::log(info.key()); + return Err(ProgramError::IncorrectProgramId); + } + + if !info.executable() { + log!("{} program is not executable: ", label); + pubkey::log(info.key()); + return Err(ProgramError::InvalidAccountData); + } + + Ok(()) +} diff --git a/src/processor/mod.rs b/src/processor/mod.rs index 9c4f9155..2ee22557 100644 --- a/src/processor/mod.rs +++ b/src/processor/mod.rs @@ -15,6 +15,8 @@ mod utils; mod validator_claim_fees; mod whitelist_validator_for_program; +pub mod fast; + pub use call_handler::*; pub use close_ephemeral_balance::*; pub use close_validator_fees_vault::*; diff --git a/src/processor/utils/curve.rs b/src/processor/utils/curve.rs index 3ae60ee1..b3b77786 100644 --- a/src/processor/utils/curve.rs +++ b/src/processor/utils/curve.rs @@ -1,6 +1,32 @@ +use pinocchio::syscalls::sol_curve_validate_point; use solana_curve25519::edwards::{validate_edwards, PodEdwardsPoint}; use solana_program::pubkey::Pubkey; pub fn is_on_curve(key: &Pubkey) -> bool { validate_edwards(&PodEdwardsPoint(key.to_bytes())) } + +pub fn is_on_curve_fast(key: &pinocchio::pubkey::Pubkey) -> bool { + // SAFETY: the layout of pinocchio::pubkey::Pubkey and PodEdwardsPoint is identical + // so one can be casted to the other without any issue. + #[cfg(feature = "unit_test_config")] + { + validate_edwards(unsafe { &*(key as *const u8 as *const PodEdwardsPoint) }) + } + + #[cfg(not(feature = "unit_test_config"))] + { + // The above commented code works great but the following one saves 7 CUs. + // ref: https://github.com/anza-xyz/agave/blob/aa5cb43d1e/curves/curve25519/src/edwards.rs#L148-L158 + let mut result: u8 = 0; + let ret = unsafe { + sol_curve_validate_point( + 0, // 0 means Ed25519 + key.as_ptr(), + &mut result as *mut u8, + ) + }; + + ret == 0 + } +} diff --git a/src/processor/utils/loaders.rs b/src/processor/utils/loaders.rs index f1bbecd9..a88deb00 100644 --- a/src/processor/utils/loaders.rs +++ b/src/processor/utils/loaders.rs @@ -51,6 +51,8 @@ pub fn load_pda( } if !info.is_writable.eq(&is_writable) { + // TODO (snawaz): misleading msg + // also better use more granular error here ProgramError::InvalidPermission msg!("Account {} ({}) needs to be writable", label, info.key); return Err(ProgramError::InvalidAccountData); } @@ -125,7 +127,12 @@ pub fn load_uninitialized_account( label: &str, ) -> Result<(), ProgramError> { if info.owner.ne(&system_program::id()) { - msg!("Invalid owner for account: {} ({})", label, info.key); + msg!( + "Invalid owner for account: {}, account: {}, owner: {}", + label, + info.key, + info.owner + ); return Err(ProgramError::InvalidAccountOwner); } diff --git a/src/state/delegation_metadata.rs b/src/state/delegation_metadata.rs index 669fc774..f9b9d8a2 100644 --- a/src/state/delegation_metadata.rs +++ b/src/state/delegation_metadata.rs @@ -26,6 +26,16 @@ impl AccountWithDiscriminator for DelegationMetadata { } } +impl DelegationMetadata { + pub fn serialized_size(&self) -> usize { + AccountDiscriminator::SPACE + + 8 // last_update_nonce (u64) + + 1 // is_undelegatable (bool) + + 32 // rent_payer (Pubkey) + + (4 + self.seeds.iter().map(|s| 4 + s.len()).sum::()) // seeds (Vec>) + } +} + impl_to_bytes_with_discriminator_borsh!(DelegationMetadata); impl_try_from_bytes_with_discriminator_borsh!(DelegationMetadata); diff --git a/src/state/utils/discriminator.rs b/src/state/utils/discriminator.rs index 6f0c832e..39989b02 100644 --- a/src/state/utils/discriminator.rs +++ b/src/state/utils/discriminator.rs @@ -10,7 +10,9 @@ pub enum AccountDiscriminator { } impl AccountDiscriminator { - pub const fn to_bytes(&self) -> [u8; 8] { + pub const SPACE: usize = 8; + + pub const fn to_bytes(&self) -> [u8; Self::SPACE] { let num = (*self) as u64; num.to_le_bytes() } diff --git a/src/testlib.rs b/src/testlib.rs new file mode 100644 index 00000000..8f21f4bb --- /dev/null +++ b/src/testlib.rs @@ -0,0 +1,119 @@ +use std::collections::hash_map::Entry; +use std::collections::HashMap; + +use pinocchio::msg; +use solana_program::entrypoint::{deserialize, NON_DUP_MARKER}; +use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; + +pub fn process_instruction( + program_id: &Pubkey, + accounts: &[AccountInfo], + instruction_data: &[u8], +) -> ProgramResult { + msg!("LETS PANIC"); + assert!(false, "process_instruction is false"); + + Err(solana_program::program_error::ProgramError::InvalidAccountData) + + //Ok(()) + + // 1️⃣ Build the serialized buffer that entrypoint() expects + //let mut serialized_input = serialize(program_id, accounts, instruction_data); + + //test_serialize(&serialized_input, (program_id, accounts, instruction_data)); + + //// 2️⃣ Call the real entrypoint just like the runtime would + //let rc = unsafe { dlp::entrypoint(serialized_input.as_mut_ptr()) }; + + //// 3️⃣ Convert return code to Result + //if rc == pinocchio::SUCCESS { + // Ok(()) + //} else { + // Err(solana_program::program_error::ProgramError::Custom( + // rc as u32, + // )) + //} +} + +fn test_serialize(input: &[u8], expected: (&Pubkey, &[AccountInfo], &[u8])) { + let mut used_input = input.to_vec(); + let actual = unsafe { deserialize(used_input.as_mut_ptr()) }; + + assert_eq!( + actual.0, expected.0, + "actual: {}, expected: {}", + actual.0, expected.0 + ); + + assert_eq!( + actual.1.len(), + expected.1.len(), + "actual (len): {}, expected (len): {}", + actual.1.len(), + expected.1.len(), + ); + + for (a, b) in actual.1.iter().zip(expected.1) { + test_account_eq(a, b); + } + + assert_eq!( + actual.2, + expected.2, + "actual (len): {}, expected (len): {}", + actual.2.len(), + expected.2.len() + ); +} + +fn test_account_eq(a: &AccountInfo, b: &AccountInfo) { + todo!(); +} + +fn serialize(program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8]) -> Vec { + let mut input = vec![]; + + // Number of accounts present + input.extend_from_slice(&(accounts.len() as u64).to_le_bytes()); + + // Account Infos + let mut dups = HashMap::new(); + for (i, account) in accounts.iter().enumerate() { + match dups.entry(account.key) { + Entry::Vacant(v) => { + v.insert(i); // cache the index, to detect duplicate + input.extend_from_slice(&[NON_DUP_MARKER]); + serialize_account_info(&mut input, account); + } + Entry::Occupied(o) => { + let found = *o.get(); + input.extend_from_slice(&[found as u8]); + input.extend_from_slice(&[0u8; 7]); + } + } + } + // Instruction data + + // Program Id + input.extend_from_slice(program_id.as_array()); + + input +} + +fn serialize_account_info<'a>(input: &mut Vec, account: &AccountInfo<'a>) { + input.push(if account.is_signer { 1 } else { 0 }); + input.push(if account.is_writable { 1 } else { 0 }); + input.push(if account.executable { 1 } else { 0 }); + + // data-len saved here as u32 + input.extend_from_slice(&(account.data_len() as u32).to_le_bytes()); + + input.extend_from_slice(account.key.as_array()); + input.extend_from_slice(account.owner.as_array()); + input.extend_from_slice(&account.lamports().to_le_bytes()); + input.extend_from_slice(&(account.data_len() as u64).to_le_bytes()); + + input.extend_from_slice(account.data.as_ref().take()); + + input.extend_from_slice(&account.rent_epoch.to_le_bytes()); +} diff --git a/tests/fixtures/mod.rs b/tests/fixtures/mod.rs index 5903b91f..ec23270d 100644 --- a/tests/fixtures/mod.rs +++ b/tests/fixtures/mod.rs @@ -1,4 +1,124 @@ pub mod accounts; +use std::collections::hash_map::Entry; +use std::collections::HashMap; + #[allow(unused_imports)] pub(crate) use accounts::*; + +use pinocchio::msg; +use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; +use solana_sdk::entrypoint::{deserialize, NON_DUP_MARKER}; + +pub fn process_instruction( + program_id: &Pubkey, + accounts: &[AccountInfo], + instruction_data: &[u8], +) -> ProgramResult { + msg!("LETS PANIC"); + assert!(false, "process_instruction is false"); + + Err(solana_sdk::program_error::ProgramError::InvalidAccountData) + + //Ok(()) + + // 1️⃣ Build the serialized buffer that entrypoint() expects + //let mut serialized_input = serialize(program_id, accounts, instruction_data); + + //test_serialize(&serialized_input, (program_id, accounts, instruction_data)); + + //// 2️⃣ Call the real entrypoint just like the runtime would + //let rc = unsafe { dlp::entrypoint(serialized_input.as_mut_ptr()) }; + + //// 3️⃣ Convert return code to Result + //if rc == pinocchio::SUCCESS { + // Ok(()) + //} else { + // Err(solana_program::program_error::ProgramError::Custom( + // rc as u32, + // )) + //} +} + +fn test_serialize(input: &[u8], expected: (&Pubkey, &[AccountInfo], &[u8])) { + let mut used_input = input.to_vec(); + let actual = unsafe { deserialize(used_input.as_mut_ptr()) }; + + assert_eq!( + actual.0, expected.0, + "actual: {}, expected: {}", + actual.0, expected.0 + ); + + assert_eq!( + actual.1.len(), + expected.1.len(), + "actual (len): {}, expected (len): {}", + actual.1.len(), + expected.1.len(), + ); + + for (a, b) in actual.1.iter().zip(expected.1) { + test_account_eq(a, b); + } + + assert_eq!( + actual.2, + expected.2, + "actual (len): {}, expected (len): {}", + actual.2.len(), + expected.2.len() + ); +} + +fn test_account_eq(a: &AccountInfo, b: &AccountInfo) { + todo!(); +} + +fn serialize(program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8]) -> Vec { + let mut input = vec![]; + + // Number of accounts present + input.extend_from_slice(&(accounts.len() as u64).to_le_bytes()); + + // Account Infos + let mut dups = HashMap::new(); + for (i, account) in accounts.iter().enumerate() { + match dups.entry(account.key) { + Entry::Vacant(v) => { + v.insert(i); // cache the index, to detect duplicate + input.extend_from_slice(&[NON_DUP_MARKER]); + serialize_account_info(&mut input, account); + } + Entry::Occupied(o) => { + let found = *o.get(); + input.extend_from_slice(&[found as u8]); + input.extend_from_slice(&[0u8; 7]); + } + } + } + // Instruction data + + // Program Id + input.extend_from_slice(program_id.as_array()); + + input +} + +fn serialize_account_info<'a>(input: &mut Vec, account: &AccountInfo<'a>) { + input.push(if account.is_signer { 1 } else { 0 }); + input.push(if account.is_writable { 1 } else { 0 }); + input.push(if account.executable { 1 } else { 0 }); + + // data-len saved here as u32 + input.extend_from_slice(&(account.data_len() as u32).to_le_bytes()); + + input.extend_from_slice(account.key.as_array()); + input.extend_from_slice(account.owner.as_array()); + input.extend_from_slice(&account.lamports().to_le_bytes()); + input.extend_from_slice(&(account.data_len() as u64).to_le_bytes()); + + input.extend_from_slice(account.data.as_ref().take()); + + input.extend_from_slice(&account.rent_epoch.to_le_bytes()); +} diff --git a/tests/integration/package-lock.json b/tests/integration/package-lock.json index d60e3949..96c462a6 100644 --- a/tests/integration/package-lock.json +++ b/tests/integration/package-lock.json @@ -4,12 +4,11 @@ "requires": true, "packages": { "": { - "name": "integration", "dependencies": { "@coral-xyz/anchor": "0.31.1" }, "devDependencies": { - "@magicblock-labs/ephemeral-rollups-sdk": "^0.2.10", + "@magicblock-labs/ephemeral-rollups-sdk": "0.2.11", "@metaplex-foundation/beet": "^0.7.1", "@metaplex-foundation/beet-solana": "^0.4.0", "@types/bn.js": "^5.1.0", @@ -22,6 +21,9 @@ "typescript": "^4.3.5" } }, + "../../../ts": { + "extraneous": true + }, "node_modules/@babel/runtime": { "version": "7.28.4", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz", @@ -87,7 +89,9 @@ "license": "MIT" }, "node_modules/@magicblock-labs/ephemeral-rollups-sdk": { - "version": "0.2.10", + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/@magicblock-labs/ephemeral-rollups-sdk/-/ephemeral-rollups-sdk-0.2.11.tgz", + "integrity": "sha512-I9pqYBsWhkUpndt9b4P6jqpVhAKaMdyyiBuxEX+Y2VdWeXuRpF0qXngyn26i1oKCVvbPNQYLu033LpNeSB4BKg==", "dev": true, "license": "MIT", "dependencies": { @@ -95,129 +99,41 @@ "@phala/dcap-qvl-web": "^0.2.7", "@solana/web3.js": "^1.98.0", "bs58": "^6.0.0", - "rpc-websockets": "^9.0.4" - } - }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/@phala/dcap-qvl-web": { - "version": "0.2.7", - "dev": true, - "license": "MIT" - }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/@swc/helpers": { - "version": "0.5.17", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.8.0" - } - }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/@types/node": { - "version": "24.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~7.10.0" - } - }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/@types/ws": { - "version": "8.18.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" + "rpc-websockets": "^9.0.4", + "typescript": "^5.3.0" } }, "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/base-x": { "version": "5.0.1", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.1.tgz", + "integrity": "sha512-M7uio8Zt++eg3jPj+rHMfCC+IuygQHHCOU+IYsVtik6FWjuYpVt/+MRKcgsAMHh8mMFAwnB+Bs+mTrFiXjMzKg==", "dev": true, "license": "MIT" }, "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/bs58": { "version": "6.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz", + "integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==", "dev": true, "license": "MIT", "dependencies": { "base-x": "^5.0.0" } }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/bufferutil": { - "version": "4.0.9", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/node-gyp-build": { - "version": "4.8.4", + "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/typescript": { + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", + "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", "dev": true, - "license": "MIT", - "optional": true, + "license": "Apache-2.0", "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/rpc-websockets": { - "version": "9.1.3", - "dev": true, - "license": "LGPL-3.0-only", - "dependencies": { - "@swc/helpers": "^0.5.11", - "@types/uuid": "^8.3.4", - "@types/ws": "^8.2.2", - "buffer": "^6.0.3", - "eventemitter3": "^5.0.1", - "uuid": "^8.3.2", - "ws": "^8.5.0" - }, - "funding": { - "type": "paypal", - "url": "https://paypal.me/kozjak" + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, - "optionalDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - } - }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/rpc-websockets/node_modules/ws": { - "version": "8.18.3", - "dev": true, - "license": "MIT", "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } + "node": ">=14.17" } }, - "node_modules/@magicblock-labs/ephemeral-rollups-sdk/node_modules/undici-types": { - "version": "7.10.0", - "dev": true, - "license": "MIT" - }, "node_modules/@metaplex-foundation/beet": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.7.2.tgz", @@ -300,6 +216,13 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@phala/dcap-qvl-web": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@phala/dcap-qvl-web/-/dcap-qvl-web-0.2.7.tgz", + "integrity": "sha512-OgDIN8ZRsLg0dJgUAk0HCXMjkAmrif7p0C+P74YrtxgE/8fNSFpqNDjVW3mCVB2Q/V7X6mUhbEQWa5wJmM9OSQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@solana/buffer-layout": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", diff --git a/tests/integration/tests/test-delegation.ts b/tests/integration/tests/test-delegation.ts index d8a378ab..80de8355 100644 --- a/tests/integration/tests/test-delegation.ts +++ b/tests/integration/tests/test-delegation.ts @@ -9,9 +9,12 @@ import { DELEGATION_PROGRAM_ID, } from "@magicblock-labs/ephemeral-rollups-sdk"; import { ON_CURVE_ACCOUNT } from "./fixtures/consts"; +import { assert } from "chai"; const SEED_TEST_PDA = "test-pda"; -const BPF_LOADER = new web3.PublicKey("BPFLoaderUpgradeab1e11111111111111111111111") +const BPF_LOADER = new web3.PublicKey( + "BPFLoaderUpgradeab1e11111111111111111111111" +); describe("TestDelegation", () => { // Configure the client to use the local cluster. @@ -31,6 +34,18 @@ describe("TestDelegation", () => { const ownerProgram = testDelegation.programId; const reimbursement = provider.wallet.publicKey; + async function fetchTransaction(txhash: string) { + for (let i = 0; i < 10; i++) { + const tx = await provider.connection.getTransaction(txhash, { + commitment: "confirmed", + maxSupportedTransactionVersion: 0, + }); + if (tx) return tx; + await new Promise((r) => setTimeout(r, 500)); // wait 0.5s + } + throw new Error("Transaction not found after waiting"); + } + it("Initialize protocol fees vault", async () => { const ix = createInitFeesVaultInstruction(payer); const txId = await processInstruction(ix); @@ -99,6 +114,50 @@ describe("TestDelegation", () => { console.log("Counter: ", counterAccount.count.toString()); }); + it.only("Delegate one PDA", async () => { + const counterAccountInfo = await provider.connection.getAccountInfo(pda); + if (counterAccountInfo === null) { + const tx = await testDelegation.methods + .initialize() + .accounts({ + user: provider.wallet.publicKey, + }) + .rpc({ skipPreflight: true }); + console.log("Init Pda Tx: ", tx); + } + + const ca = await provider.connection.getAccountInfo(pda); + console.log(`owner: ${ca?.owner?.toBase58()}`); + + // Delegate 1 PDA in a single instruction + const txhash = await testDelegation.methods + .delegate() + .accounts({ + payer: provider.wallet.publicKey, + }) + .rpc({ skipPreflight: true }); + console.log("Your transaction signature", txhash); + + const tx = await fetchTransaction(txhash); + console.log(tx.meta.logMessages); + + const consumedLog = tx.meta.logMessages.find((m) => + m.includes("DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh consumed") + ); + + assert.isAtMost( + parseInt(consumedLog.split(" ").at(3)), + 18500, + "delegate instruction must consume less than 18500" + ); + + const counterAccount = await provider.connection.getAccountInfo(pda); + assert.strictEqual( + counterAccount.owner.toBase58(), + "DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh" + ); + }); + it("Delegate two PDAs", async () => { // Delegate 2 PDAs in a single instruction const tx = await testDelegation.methods @@ -410,8 +469,8 @@ describe("TestDelegation", () => { ) { const validatorFeesVault = validatorFeesVaultPdaFromValidator(validator); const delegationProgramData = web3.PublicKey.findProgramAddressSync( - [DELEGATION_PROGRAM_ID.toBuffer()], - BPF_LOADER + [DELEGATION_PROGRAM_ID.toBuffer()], + BPF_LOADER )[0]; const keys = [ { pubkey: payer, isSigner: true, isWritable: true }, @@ -435,9 +494,7 @@ describe("TestDelegation", () => { } /// Instruction to claim fees from the validator vault - function createClaimValidatorFeesVaultInstruction( - validator: web3.PublicKey - ) { + function createClaimValidatorFeesVaultInstruction(validator: web3.PublicKey) { const feesVault = feesVaultPda(); const validatorFeesVault = validatorFeesVaultPdaFromValidator(validator); const keys = [ @@ -455,13 +512,11 @@ describe("TestDelegation", () => { } /// Instruction to claim fees from the protocol vault - function createClaimProtocolFeesVaultInstruction( - admin: web3.PublicKey - ) { + function createClaimProtocolFeesVaultInstruction(admin: web3.PublicKey) { const feesVault = feesVaultPda(); const delegationProgramData = web3.PublicKey.findProgramAddressSync( - [DELEGATION_PROGRAM_ID.toBuffer()], - BPF_LOADER + [DELEGATION_PROGRAM_ID.toBuffer()], + BPF_LOADER )[0]; const keys = [ { pubkey: admin, isSigner: true, isWritable: true }, @@ -485,10 +540,11 @@ describe("TestDelegation", () => { ) { const programData = web3.PublicKey.findProgramAddressSync( [program.toBuffer()], - BPF_LOADER)[0]; + BPF_LOADER + )[0]; const delegationProgramData = web3.PublicKey.findProgramAddressSync( - [DELEGATION_PROGRAM_ID.toBuffer()], - BPF_LOADER + [DELEGATION_PROGRAM_ID.toBuffer()], + BPF_LOADER )[0]; const programConfig = programConfigPdaFromProgramId(program); const keys = [ diff --git a/tests/integration/yarn.lock b/tests/integration/yarn.lock deleted file mode 100644 index 692c6818..00000000 --- a/tests/integration/yarn.lock +++ /dev/null @@ -1,1461 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/runtime@^7.25.0": - version "7.28.4" - resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz" - integrity sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ== - -"@coral-xyz/anchor-errors@^0.31.1": - version "0.31.1" - resolved "https://registry.npmjs.org/@coral-xyz/anchor-errors/-/anchor-errors-0.31.1.tgz" - integrity sha512-NhNEku4F3zzUSBtrYz84FzYWm48+9OvmT1Hhnwr6GnPQry2dsEqH/ti/7ASjjpoFTWRnPXrjAIT1qM6Isop+LQ== - -"@coral-xyz/anchor@0.31.1": - version "0.31.1" - resolved "https://registry.npmjs.org/@coral-xyz/anchor/-/anchor-0.31.1.tgz" - integrity sha512-QUqpoEK+gi2S6nlYc2atgT2r41TT3caWr/cPUEL8n8Md9437trZ68STknq897b82p5mW0XrTBNOzRbmIRJtfsA== - dependencies: - "@coral-xyz/anchor-errors" "^0.31.1" - "@coral-xyz/borsh" "^0.31.1" - "@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/borsh@^0.31.1": - version "0.31.1" - resolved "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.31.1.tgz" - integrity sha512-9N8AU9F0ubriKfNE3g1WF0/4dtlGXoBN/hd1PvbNBamBNwRgHxH4P+o3Zt7rSEloW1HUs6LfZEchlx9fW7POYw== - dependencies: - bn.js "^5.1.2" - buffer-layout "^1.2.0" - -"@magicblock-labs/ephemeral-rollups-sdk@^0.2.11": - version "0.2.11" - resolved "https://registry.yarnpkg.com/@magicblock-labs/ephemeral-rollups-sdk/-/ephemeral-rollups-sdk-0.2.11.tgz#6347a8e37440e438c4d8717f454f5e922cf94e13" - integrity sha512-I9pqYBsWhkUpndt9b4P6jqpVhAKaMdyyiBuxEX+Y2VdWeXuRpF0qXngyn26i1oKCVvbPNQYLu033LpNeSB4BKg== - dependencies: - "@metaplex-foundation/beet" "^0.7.2" - "@phala/dcap-qvl-web" "^0.2.7" - "@solana/web3.js" "^1.98.0" - bs58 "^6.0.0" - rpc-websockets "^9.0.4" - typescript "^5.3.0" - -"@metaplex-foundation/beet-solana@^0.4.0": - version "0.4.1" - resolved "https://registry.npmjs.org/@metaplex-foundation/beet-solana/-/beet-solana-0.4.1.tgz" - integrity sha512-/6o32FNUtwK8tjhotrvU/vorP7umBuRFvBZrC6XCk51aKidBHe5LPVPA5AjGPbV3oftMfRuXPNd9yAGeEqeCDQ== - dependencies: - "@metaplex-foundation/beet" ">=0.1.0" - "@solana/web3.js" "^1.56.2" - bs58 "^5.0.0" - debug "^4.3.4" - -"@metaplex-foundation/beet@>=0.1.0", "@metaplex-foundation/beet@^0.7.1", "@metaplex-foundation/beet@^0.7.2": - version "0.7.2" - resolved "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.7.2.tgz" - integrity sha512-K+g3WhyFxKPc0xIvcIjNyV1eaTVJTiuaHZpig7Xx0MuYRMoJLLvhLTnUXhFdR5Tu2l2QSyKwfyXDgZlzhULqFg== - dependencies: - ansicolors "^0.3.2" - assert "^2.1.0" - bn.js "^5.2.0" - debug "^4.3.3" - -"@noble/curves@^1.4.2": - version "1.7.0" - resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.7.0.tgz" - integrity sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw== - dependencies: - "@noble/hashes" "1.6.0" - -"@noble/hashes@1.6.0": - version "1.6.0" - resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz" - integrity sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ== - -"@noble/hashes@^1.3.1", "@noble/hashes@^1.4.0": - version "1.4.0" - resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz" - integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== - -"@phala/dcap-qvl-web@^0.2.7": - version "0.2.7" - resolved "https://registry.yarnpkg.com/@phala/dcap-qvl-web/-/dcap-qvl-web-0.2.7.tgz#d7a03b059a201355262ca9c1bb6c77a1c22472dd" - integrity sha512-OgDIN8ZRsLg0dJgUAk0HCXMjkAmrif7p0C+P74YrtxgE/8fNSFpqNDjVW3mCVB2Q/V7X6mUhbEQWa5wJmM9OSQ== - -"@solana/buffer-layout@^4.0.1": - version "4.0.1" - resolved "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz" - integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA== - dependencies: - buffer "~6.0.3" - -"@solana/codecs-core@2.1.0": - version "2.1.0" - resolved "https://registry.npmjs.org/@solana/codecs-core/-/codecs-core-2.1.0.tgz" - integrity sha512-SR7pKtmJBg2mhmkel2NeHA1pz06QeQXdMv8WJoIR9m8F/hw80K/612uaYbwTt2nkK0jg/Qn/rNSd7EcJ4SBGjw== - dependencies: - "@solana/errors" "2.1.0" - -"@solana/codecs-numbers@^2.1.0": - version "2.1.0" - resolved "https://registry.npmjs.org/@solana/codecs-numbers/-/codecs-numbers-2.1.0.tgz" - integrity sha512-XMu4yw5iCgQnMKsxSWPPOrGgtaohmupN3eyAtYv3K3C/MJEc5V90h74k5B1GUCiHvcrdUDO9RclNjD9lgbjFag== - dependencies: - "@solana/codecs-core" "2.1.0" - "@solana/errors" "2.1.0" - -"@solana/errors@2.1.0": - version "2.1.0" - resolved "https://registry.npmjs.org/@solana/errors/-/errors-2.1.0.tgz" - integrity sha512-l+GxAv0Ar4d3c3PlZdA9G++wFYZREEbbRyAFP8+n8HSg0vudCuzogh/13io6hYuUhG/9Ve8ARZNamhV7UScKNw== - dependencies: - chalk "^5.3.0" - commander "^13.1.0" - -"@solana/web3.js@^1.56.2", "@solana/web3.js@^1.69.0", "@solana/web3.js@^1.98.0": - version "1.98.4" - resolved "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.98.4.tgz" - integrity sha512-vv9lfnvjUsRiq//+j5pBdXig0IQdtzA0BRZ3bXEP4KaIyF1CcaydWqgyzQgfZMNIsWNWmG+AUHwPy4AHOD6gpw== - 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" - 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" - -"@swc/helpers@^0.5.11": - version "0.5.15" - resolved "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz" - integrity sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g== - dependencies: - tslib "^2.8.0" - -"@types/bn.js@^5.1.0": - version "5.1.5" - resolved "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.5.tgz" - integrity sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A== - dependencies: - "@types/node" "*" - -"@types/chai@^4.3.0": - version "4.3.14" - resolved "https://registry.npmjs.org/@types/chai/-/chai-4.3.14.tgz" - integrity sha512-Wj71sXE4Q4AkGdG9Tvq1u/fquNz9EdG4LIJMwVVII7ashjD/8cf8fyIfJAjRr6YcsXnSE8cOGQPq1gqeR8z+3w== - -"@types/connect@^3.4.33": - version "3.4.38" - resolved "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz" - integrity sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug== - dependencies: - "@types/node" "*" - -"@types/json5@^0.0.29": - version "0.0.29" - resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" - integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== - -"@types/mocha@^9.0.0": - version "9.1.1" - resolved "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz" - integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw== - -"@types/node@*": - version "20.12.7" - resolved "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz" - integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg== - dependencies: - undici-types "~5.26.4" - -"@types/node@^12.12.54": - version "12.20.55" - resolved "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz" - integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== - -"@types/uuid@^8.3.4": - version "8.3.4" - resolved "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz" - integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw== - -"@types/ws@^7.4.4": - version "7.4.7" - resolved "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz" - integrity sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww== - dependencies: - "@types/node" "*" - -"@types/ws@^8.2.2": - version "8.18.1" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.18.1.tgz#48464e4bf2ddfd17db13d845467f6070ffea4aa9" - integrity sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg== - dependencies: - "@types/node" "*" - -"@ungap/promise-all-settled@1.1.2": - version "1.1.2" - resolved "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz" - integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== - -JSONStream@^1.3.5: - version "1.3.5" - resolved "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz" - integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" - -agentkeepalive@^4.5.0: - version "4.5.0" - resolved "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz" - integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== - dependencies: - humanize-ms "^1.2.1" - -ansi-colors@4.1.1: - version "4.1.1" - resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz" - integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -ansicolors@^0.3.2: - version "0.3.2" - resolved "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz" - integrity sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg== - -anymatch@~3.1.2: - version "3.1.3" - resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz" - integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -arrify@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" - integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== - -assert@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz" - integrity sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw== - dependencies: - call-bind "^1.0.2" - is-nan "^1.3.2" - object-is "^1.1.5" - object.assign "^4.1.4" - util "^0.12.5" - -assertion-error@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz" - integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== - -available-typed-arrays@^1.0.7: - version "1.0.7" - resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz" - integrity sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ== - dependencies: - possible-typed-array-names "^1.0.0" - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -base-x@^3.0.2: - version "3.0.11" - resolved "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz" - integrity sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA== - dependencies: - safe-buffer "^5.0.1" - -base-x@^4.0.0: - version "4.0.1" - resolved "https://registry.npmjs.org/base-x/-/base-x-4.0.1.tgz" - integrity sha512-uAZ8x6r6S3aUM9rbHGVOIsR15U/ZSc82b3ymnCPsT45Gk1DDvhDPdIgB5MrhirZWt+5K0EEPQH985kNqZgNPFw== - -base-x@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-5.0.1.tgz#16bf35254be1df8aca15e36b7c1dda74b2aa6b03" - integrity sha512-M7uio8Zt++eg3jPj+rHMfCC+IuygQHHCOU+IYsVtik6FWjuYpVt/+MRKcgsAMHh8mMFAwnB+Bs+mTrFiXjMzKg== - -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -binary-extensions@^2.0.0: - version "2.3.0" - resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz" - integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== - -bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: - version "5.2.1" - resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz" - integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== - -borsh@^0.7.0: - version "0.7.0" - resolved "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz" - integrity sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA== - dependencies: - bn.js "^5.2.0" - bs58 "^4.0.0" - text-encoding-utf-8 "^1.0.2" - -brace-expansion@^1.1.7: - version "1.1.12" - resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz" - integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@~3.0.2: - version "3.0.3" - resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" - integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== - dependencies: - fill-range "^7.1.1" - -browser-stdout@1.3.1: - version "1.3.1" - resolved "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz" - integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== - -bs58@^4.0.0, bs58@^4.0.1: - version "4.0.1" - resolved "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz" - integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== - dependencies: - base-x "^3.0.2" - -bs58@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz" - integrity sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ== - dependencies: - base-x "^4.0.0" - -bs58@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-6.0.0.tgz#a2cda0130558535dd281a2f8697df79caaf425d8" - integrity sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw== - dependencies: - base-x "^5.0.0" - -buffer-from@^1.0.0, buffer-from@^1.1.0: - version "1.1.2" - resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - -buffer-layout@^1.2.0, buffer-layout@^1.2.2: - version "1.2.2" - resolved "https://registry.npmjs.org/buffer-layout/-/buffer-layout-1.2.2.tgz" - integrity sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA== - -buffer@6.0.3, buffer@^6.0.3, buffer@~6.0.3: - version "6.0.3" - resolved "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz" - integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.2.1" - -bufferutil@^4.0.1: - version "4.0.8" - resolved "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz" - integrity sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw== - dependencies: - node-gyp-build "^4.3.0" - -call-bind@^1.0.0, call-bind@^1.0.2, call-bind@^1.0.5, call-bind@^1.0.7: - version "1.0.7" - resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz" - integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== - dependencies: - es-define-property "^1.0.0" - es-errors "^1.3.0" - function-bind "^1.1.2" - get-intrinsic "^1.2.4" - set-function-length "^1.2.1" - -camelcase@^6.0.0, camelcase@^6.3.0: - version "6.3.0" - resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" - integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - -chai@^4.3.4: - version "4.4.1" - resolved "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz" - integrity sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g== - dependencies: - assertion-error "^1.1.0" - check-error "^1.0.3" - deep-eql "^4.1.3" - get-func-name "^2.0.2" - loupe "^2.3.6" - pathval "^1.1.1" - type-detect "^4.0.8" - -chalk@^4.1.0: - version "4.1.2" - resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chalk@^5.3.0: - version "5.4.1" - resolved "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz" - integrity sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w== - -check-error@^1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz" - integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== - dependencies: - get-func-name "^2.0.2" - -chokidar@3.5.3: - version "3.5.3" - resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz" - integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -commander@^13.1.0: - version "13.1.0" - resolved "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz" - integrity sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw== - -commander@^2.20.3: - version "2.20.3" - resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -cross-fetch@^3.1.5: - version "3.1.8" - resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz" - integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== - dependencies: - node-fetch "^2.6.12" - -debug@4.3.3: - version "4.3.3" - resolved "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz" - integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== - dependencies: - ms "2.1.2" - -debug@^4.3.3, debug@^4.3.4: - version "4.3.4" - resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -decamelize@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz" - integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== - -deep-eql@^4.1.3: - version "4.1.3" - resolved "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz" - integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== - dependencies: - type-detect "^4.0.0" - -define-data-property@^1.0.1, define-data-property@^1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz" - integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== - dependencies: - es-define-property "^1.0.0" - es-errors "^1.3.0" - gopd "^1.0.1" - -define-properties@^1.1.3, define-properties@^1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz" - integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== - dependencies: - define-data-property "^1.0.1" - has-property-descriptors "^1.0.0" - object-keys "^1.1.1" - -delay@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz" - integrity sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw== - -diff@5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz" - integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== - -diff@^3.1.0: - version "3.5.0" - resolved "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz" - integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -es-define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz" - integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== - dependencies: - get-intrinsic "^1.2.4" - -es-errors@^1.3.0: - version "1.3.0" - resolved "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz" - integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== - -es6-promise@^4.0.3: - version "4.2.8" - resolved "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz" - integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - -es6-promisify@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz" - integrity sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ== - dependencies: - es6-promise "^4.0.3" - -escalade@^3.1.1: - version "3.1.2" - resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz" - integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== - -escape-string-regexp@4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - -eventemitter3@^4.0.7: - version "4.0.7" - resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz" - integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== - -eventemitter3@^5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz" - integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== - -eyes@^0.1.8: - version "0.1.8" - resolved "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz" - integrity sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ== - -fast-stable-stringify@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz" - integrity sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag== - -fill-range@^7.1.1: - version "7.1.1" - resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz" - integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== - dependencies: - to-regex-range "^5.0.1" - -find-up@5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - -flat@^5.0.2: - version "5.0.2" - resolved "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz" - integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== - -for-each@^0.3.3: - version "0.3.3" - resolved "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz" - integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== - dependencies: - is-callable "^1.1.3" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -fsevents@~2.3.2: - version "2.3.3" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - -function-bind@^1.1.2: - version "1.1.2" - resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" - integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-func-name@^2.0.1, get-func-name@^2.0.2: - version "2.0.2" - resolved "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz" - integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== - -get-intrinsic@^1.1.3, get-intrinsic@^1.2.4: - version "1.2.4" - resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz" - integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== - dependencies: - es-errors "^1.3.0" - function-bind "^1.1.2" - has-proto "^1.0.1" - has-symbols "^1.0.3" - hasown "^2.0.0" - -glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - -glob@7.2.0: - version "7.2.0" - resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -gopd@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz" - integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== - dependencies: - get-intrinsic "^1.1.3" - -growl@1.10.5: - version "1.10.5" - resolved "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz" - integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz" - integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== - dependencies: - es-define-property "^1.0.0" - -has-proto@^1.0.1: - version "1.0.3" - resolved "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz" - integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q== - -has-symbols@^1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz" - integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== - -has-tostringtag@^1.0.0, has-tostringtag@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz" - integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== - dependencies: - has-symbols "^1.0.3" - -hasown@^2.0.0: - version "2.0.2" - resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== - dependencies: - function-bind "^1.1.2" - -he@1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" - integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== - -humanize-ms@^1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz" - integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== - dependencies: - ms "^2.0.0" - -ieee754@^1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.3: - version "2.0.4" - resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-arguments@^1.0.4: - version "1.1.1" - resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz" - integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - -is-callable@^1.1.3: - version "1.2.7" - resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz" - integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-generator-function@^1.0.7: - version "1.0.10" - resolved "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz" - integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A== - dependencies: - has-tostringtag "^1.0.0" - -is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.3" - resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-nan@^1.3.2: - version "1.3.2" - resolved "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz" - integrity sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w== - dependencies: - call-bind "^1.0.0" - define-properties "^1.1.3" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-plain-obj@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz" - integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== - -is-typed-array@^1.1.3: - version "1.1.13" - resolved "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz" - integrity sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw== - dependencies: - which-typed-array "^1.1.14" - -is-unicode-supported@^0.1.0: - version "0.1.0" - resolved "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz" - integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -isomorphic-ws@^4.0.1: - version "4.0.1" - resolved "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz" - integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== - -jayson@^4.1.1: - version "4.1.3" - resolved "https://registry.npmjs.org/jayson/-/jayson-4.1.3.tgz" - integrity sha512-LtXh5aYZodBZ9Fc3j6f2w+MTNcnxteMOrb+QgIouguGOulWi0lieEkOUg+HkjjFs0DGoWDds6bi4E9hpNFLulQ== - dependencies: - "@types/connect" "^3.4.33" - "@types/node" "^12.12.54" - "@types/ws" "^7.4.4" - JSONStream "^1.3.5" - 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" - uuid "^8.3.2" - ws "^7.5.10" - -js-yaml@4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" - -json-stringify-safe@^5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" - integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== - -json5@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz" - integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== - dependencies: - minimist "^1.2.0" - -jsonparse@^1.2.0: - version "1.3.1" - resolved "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz" - integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== - -locate-path@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz" - integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== - dependencies: - p-locate "^5.0.0" - -log-symbols@4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz" - integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== - dependencies: - chalk "^4.1.0" - is-unicode-supported "^0.1.0" - -loupe@^2.3.6: - version "2.3.7" - resolved "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz" - integrity sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA== - dependencies: - get-func-name "^2.0.1" - -make-error@^1.1.1: - version "1.3.6" - resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - -minimatch@4.2.1: - version "4.2.1" - resolved "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz" - integrity sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g== - dependencies: - brace-expansion "^1.1.7" - -minimatch@^3.0.4: - version "3.1.2" - resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.0, minimist@^1.2.6: - version "1.2.8" - resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== - -mkdirp@^0.5.1: - version "0.5.6" - resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - -mocha@^9.0.3: - version "9.2.2" - resolved "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz" - integrity sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g== - dependencies: - "@ungap/promise-all-settled" "1.1.2" - ansi-colors "4.1.1" - browser-stdout "1.3.1" - chokidar "3.5.3" - debug "4.3.3" - diff "5.0.0" - escape-string-regexp "4.0.0" - find-up "5.0.0" - glob "7.2.0" - growl "1.10.5" - he "1.2.0" - js-yaml "4.1.0" - log-symbols "4.1.0" - minimatch "4.2.1" - ms "2.1.3" - nanoid "3.3.1" - serialize-javascript "6.0.0" - strip-json-comments "3.1.1" - supports-color "8.1.1" - which "2.0.2" - workerpool "6.2.0" - yargs "16.2.0" - yargs-parser "20.2.4" - yargs-unparser "2.0.0" - -ms@2.1.2, ms@^2.0.0: - version "2.1.2" - resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -ms@2.1.3: - version "2.1.3" - resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -nanoid@3.3.1: - version "3.3.1" - resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz" - integrity sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw== - -node-fetch@^2.6.12, node-fetch@^2.7.0: - version "2.7.0" - resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz" - integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== - dependencies: - whatwg-url "^5.0.0" - -node-gyp-build@^4.3.0: - version "4.8.0" - resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.0.tgz" - integrity sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og== - -normalize-path@^3.0.0, normalize-path@~3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -object-is@^1.1.5: - version "1.1.6" - resolved "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz" - integrity sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q== - dependencies: - call-bind "^1.0.7" - define-properties "^1.2.1" - -object-keys@^1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz" - integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== - -object.assign@^4.1.4: - version "4.1.5" - resolved "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz" - integrity sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ== - dependencies: - call-bind "^1.0.5" - define-properties "^1.2.1" - has-symbols "^1.0.3" - object-keys "^1.1.1" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -p-limit@^3.0.2: - version "3.1.0" - resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz" - integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== - dependencies: - yocto-queue "^0.1.0" - -p-locate@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz" - integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== - dependencies: - p-limit "^3.0.2" - -pako@^2.0.3: - version "2.1.0" - resolved "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz" - integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - -pathval@^1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz" - integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== - -picomatch@^2.0.4, picomatch@^2.2.1: - version "2.3.1" - resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -possible-typed-array-names@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz" - integrity sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q== - -prettier@^2.6.2: - version "2.8.8" - resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== - -randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - -readdirp@~3.6.0: - version "3.6.0" - resolved "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz" - integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== - dependencies: - picomatch "^2.2.1" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" - integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== - -rpc-websockets@^9.0.2: - version "9.0.4" - resolved "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-9.0.4.tgz" - integrity sha512-yWZWN0M+bivtoNLnaDbtny4XchdAIF5Q4g/ZsC5UC61Ckbp0QczwO8fg44rV3uYmY4WHd+EZQbn90W1d8ojzqQ== - dependencies: - "@swc/helpers" "^0.5.11" - "@types/uuid" "^8.3.4" - "@types/ws" "^8.2.2" - buffer "^6.0.3" - eventemitter3 "^5.0.1" - uuid "^8.3.2" - ws "^8.5.0" - optionalDependencies: - bufferutil "^4.0.1" - utf-8-validate "^5.0.2" - -rpc-websockets@^9.0.4: - version "9.1.3" - resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-9.1.3.tgz#6805dfc01232389dab043861ab9fbfe9d1d75572" - integrity sha512-I+kNjW0udB4Fetr3vvtRuYZJS0PcSPyyvBcH5sDdoV8DFs5E4W2pTr7aiMlKfPxANTClP9RlqCPolj9dd5MsEA== - dependencies: - "@swc/helpers" "^0.5.11" - "@types/uuid" "^8.3.4" - "@types/ws" "^8.2.2" - buffer "^6.0.3" - eventemitter3 "^5.0.1" - uuid "^8.3.2" - ws "^8.5.0" - optionalDependencies: - bufferutil "^4.0.1" - utf-8-validate "^5.0.2" - -safe-buffer@^5.0.1, safe-buffer@^5.1.0: - version "5.2.1" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -serialize-javascript@6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz" - integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== - dependencies: - randombytes "^2.1.0" - -set-function-length@^1.2.1: - version "1.2.2" - resolved "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz" - integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== - dependencies: - define-data-property "^1.1.4" - es-errors "^1.3.0" - function-bind "^1.1.2" - get-intrinsic "^1.2.4" - gopd "^1.0.1" - has-property-descriptors "^1.0.2" - -source-map-support@^0.5.6: - version "0.5.21" - resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0: - version "0.6.1" - resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -string-width@^4.1.0, string-width@^4.2.0: - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" - integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== - -strip-json-comments@3.1.1: - version "3.1.1" - resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -superstruct@^0.15.4: - version "0.15.5" - resolved "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz" - integrity sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ== - -superstruct@^2.0.2: - version "2.0.2" - resolved "https://registry.npmjs.org/superstruct/-/superstruct-2.0.2.tgz" - integrity sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A== - -supports-color@8.1.1: - version "8.1.1" - resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -text-encoding-utf-8@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz" - integrity sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg== - -"through@>=2.2.7 <3": - version "2.3.8" - resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz" - integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -toml@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz" - integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - -ts-mocha@^10.0.0: - version "10.0.0" - resolved "https://registry.npmjs.org/ts-mocha/-/ts-mocha-10.0.0.tgz" - integrity sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw== - dependencies: - ts-node "7.0.1" - optionalDependencies: - tsconfig-paths "^3.5.0" - -ts-node@7.0.1: - version "7.0.1" - resolved "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz" - integrity sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw== - dependencies: - arrify "^1.0.0" - buffer-from "^1.1.0" - diff "^3.1.0" - make-error "^1.1.1" - minimist "^1.2.0" - mkdirp "^0.5.1" - source-map-support "^0.5.6" - yn "^2.0.0" - -tsconfig-paths@^3.5.0: - version "3.15.0" - resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz" - integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg== - dependencies: - "@types/json5" "^0.0.29" - json5 "^1.0.2" - minimist "^1.2.6" - strip-bom "^3.0.0" - -tslib@^2.8.0: - version "2.8.1" - resolved "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz" - integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== - -type-detect@^4.0.0, type-detect@^4.0.8: - version "4.0.8" - resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== - -typescript@^4.3.5: - version "4.9.5" - resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== - -typescript@^5.3.0: - version "5.9.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.2.tgz#d93450cddec5154a2d5cabe3b8102b83316fb2a6" - integrity sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A== - -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - -utf-8-validate@^5.0.2: - version "5.0.10" - resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz" - integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== - dependencies: - node-gyp-build "^4.3.0" - -util@^0.12.5: - version "0.12.5" - resolved "https://registry.npmjs.org/util/-/util-0.12.5.tgz" - integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== - dependencies: - inherits "^2.0.3" - is-arguments "^1.0.4" - is-generator-function "^1.0.7" - is-typed-array "^1.1.3" - which-typed-array "^1.1.2" - -uuid@^8.3.2: - version "8.3.2" - resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - -which-typed-array@^1.1.14, which-typed-array@^1.1.2: - version "1.1.15" - resolved "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz" - integrity sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA== - dependencies: - available-typed-arrays "^1.0.7" - call-bind "^1.0.7" - for-each "^0.3.3" - gopd "^1.0.1" - has-tostringtag "^1.0.2" - -which@2.0.2: - version "2.0.2" - resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -workerpool@6.2.0: - version "6.2.0" - resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz" - integrity sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A== - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -ws@^7.5.10: - version "7.5.10" - resolved "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz" - integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== - -ws@^8.5.0: - version "8.18.3" - resolved "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz" - integrity sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg== - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yargs-parser@20.2.4, yargs-parser@^20.2.2: - version "20.2.4" - resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz" - integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== - -yargs-unparser@2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz" - integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== - dependencies: - camelcase "^6.0.0" - decamelize "^4.0.0" - flat "^5.0.2" - is-plain-obj "^2.1.0" - -yargs@16.2.0: - version "16.2.0" - resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.0" - y18n "^5.0.5" - yargs-parser "^20.2.2" - -yn@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz" - integrity sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ== - -yocto-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== diff --git a/tests/test_call_handler.rs b/tests/test_call_handler.rs index 5b92652e..f0711f68 100644 --- a/tests/test_call_handler.rs +++ b/tests/test_call_handler.rs @@ -216,7 +216,8 @@ async fn setup_ephemeral_balance(program_test: &mut ProgramTest, payer: &Keypair } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let payer = Keypair::new(); diff --git a/tests/test_close_validator_fees_vault.rs b/tests/test_close_validator_fees_vault.rs index 719fadca..aaf522d0 100644 --- a/tests/test_close_validator_fees_vault.rs +++ b/tests/test_close_validator_fees_vault.rs @@ -25,7 +25,7 @@ async fn test_close_validator_fees_vault() { ); let tx = Transaction::new_signed_with_payer(&[ix], Some(&admin.pubkey()), &[&admin], blockhash); let res = banks.process_transaction(tx).await; - assert!(res.is_ok()); + assert!(res.is_ok(), "error: {:?}", res); // Assert the validator fees vault now has been closed let validator_fees_vault_account = banks.get_account(validator_fees_vault_pda).await.unwrap(); @@ -33,7 +33,8 @@ async fn test_close_validator_fees_vault() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let admin_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_commit_on_curve.rs b/tests/test_commit_on_curve.rs index b66f685d..b55387ca 100644 --- a/tests/test_commit_on_curve.rs +++ b/tests/test_commit_on_curve.rs @@ -79,7 +79,8 @@ async fn test_commit_on_curve() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); // Setup the validator authority diff --git a/tests/test_commit_state.rs b/tests/test_commit_state.rs index 50e9d418..b57f4b25 100644 --- a/tests/test_commit_state.rs +++ b/tests/test_commit_state.rs @@ -120,7 +120,8 @@ async fn test_commit_out_of_order() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let validator_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_commit_state_from_buffer.rs b/tests/test_commit_state_from_buffer.rs index d2047dd8..29724dab 100644 --- a/tests/test_commit_state_from_buffer.rs +++ b/tests/test_commit_state_from_buffer.rs @@ -85,7 +85,8 @@ async fn test_commit_new_state_from_buffer() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let validator_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_commit_state_with_program_config.rs b/tests/test_commit_state_with_program_config.rs index 889e8a0a..3a60e99c 100644 --- a/tests/test_commit_state_with_program_config.rs +++ b/tests/test_commit_state_with_program_config.rs @@ -99,7 +99,8 @@ async fn test_commit_new_state(valid_config: bool) { } async fn setup_program_test_env(valid_config: bool) -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let validator_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_delegate.rs b/tests/test_delegate.rs index c706e5a3..07318c14 100644 --- a/tests/test_delegate.rs +++ b/tests/test_delegate.rs @@ -34,7 +34,9 @@ async fn test_delegate() { let ix = delegate_from_wrapper_program(payer.pubkey(), DELEGATED_PDA_ID); let tx = Transaction::new_signed_with_payer(&[ix], Some(&payer.pubkey()), &[&payer], blockhash); + eprintln!(">>>>>>>>>>>>>>>> invoke ix <<<<<<<<<<<<<<<<<<<<<<<<<<"); let res = banks.process_transaction(tx).await; + eprintln!(">>>>>>>>>>>>>>>> invoke ix DONE <<<<<<<<<<<<<<<<<<<<<<<<<<"); println!("{:?}", res); assert!(res.is_ok()); @@ -77,7 +79,14 @@ async fn test_delegate() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = ProgramTest::new( + "dlp", + dlp::ID, + None, //processor!(dlp::testlib::process_instruction), + ); + + println!(">>>>>>>>>>>>>>>> setup_program_test_env <<<<<<<<<<<<<<<<<<<<<<<<<<"); + program_test.prefer_bpf(true); let payer_alt = Keypair::new(); diff --git a/tests/test_delegate_on_curve.rs b/tests/test_delegate_on_curve.rs index 8628442a..3830af5a 100644 --- a/tests/test_delegate_on_curve.rs +++ b/tests/test_delegate_on_curve.rs @@ -121,7 +121,8 @@ async fn test_delegate_on_curve() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let payer_alt = Keypair::from_bytes(&ON_CURVE_KEYPAIR).unwrap(); diff --git a/tests/test_finalize.rs b/tests/test_finalize.rs index fcfe5a31..26ffbb06 100644 --- a/tests/test_finalize.rs +++ b/tests/test_finalize.rs @@ -83,7 +83,8 @@ async fn test_finalize() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let authority = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_init_fees_vault.rs b/tests/test_init_fees_vault.rs index cf4db900..eca7175b 100644 --- a/tests/test_init_fees_vault.rs +++ b/tests/test_init_fees_vault.rs @@ -26,7 +26,8 @@ async fn test_init_fees_vault() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let payer_alt = Keypair::new(); diff --git a/tests/test_init_validator_fees_vault.rs b/tests/test_init_validator_fees_vault.rs index f95772cb..b27e286f 100644 --- a/tests/test_init_validator_fees_vault.rs +++ b/tests/test_init_validator_fees_vault.rs @@ -49,7 +49,8 @@ async fn test_init_validator_fees_vault() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let admin_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_lamports_settlement.rs b/tests/test_lamports_settlement.rs index 46ec383f..3c58af1a 100644 --- a/tests/test_lamports_settlement.rs +++ b/tests/test_lamports_settlement.rs @@ -531,7 +531,8 @@ struct SetupProgramCommitTestEnvArgs { async fn setup_program_for_commit_test_env( args: SetupProgramCommitTestEnvArgs, ) -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let validator_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_protocol_claim_fees.rs b/tests/test_protocol_claim_fees.rs index 8218ccb0..2f6a98f9 100644 --- a/tests/test_protocol_claim_fees.rs +++ b/tests/test_protocol_claim_fees.rs @@ -46,7 +46,8 @@ async fn test_protocol_claim_fees() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let admin_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_top_up.rs b/tests/test_top_up.rs index e55daf20..609d0376 100644 --- a/tests/test_top_up.rs +++ b/tests/test_top_up.rs @@ -261,7 +261,8 @@ async fn test_undelegate_and_close() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let payer_alt = Keypair::new(); diff --git a/tests/test_undelegate.rs b/tests/test_undelegate.rs index 9135c280..3272aacc 100644 --- a/tests/test_undelegate.rs +++ b/tests/test_undelegate.rs @@ -76,7 +76,8 @@ async fn test_finalize_and_undelegate() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let authority = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_undelegate_on_curve.rs b/tests/test_undelegate_on_curve.rs index 8e2f7cb2..a2281884 100644 --- a/tests/test_undelegate_on_curve.rs +++ b/tests/test_undelegate_on_curve.rs @@ -64,7 +64,8 @@ async fn test_undelegate_on_curve() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let validator = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); let payer_alt = Keypair::from_bytes(&ON_CURVE_KEYPAIR).unwrap(); diff --git a/tests/test_undelegate_without_commit.rs b/tests/test_undelegate_without_commit.rs index f0ce4fe3..f9dc58b2 100644 --- a/tests/test_undelegate_without_commit.rs +++ b/tests/test_undelegate_without_commit.rs @@ -76,7 +76,8 @@ async fn test_undelegate_without_commit() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let validator = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_validator_claim_fees.rs b/tests/test_validator_claim_fees.rs index 4a5db94b..011982f9 100644 --- a/tests/test_validator_claim_fees.rs +++ b/tests/test_validator_claim_fees.rs @@ -78,7 +78,8 @@ async fn test_validator_claim_fees() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let validator = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_whitelist_validator_for_program.rs b/tests/test_whitelist_validator_for_program.rs index d5a7788b..70fe82a3 100644 --- a/tests/test_whitelist_validator_for_program.rs +++ b/tests/test_whitelist_validator_for_program.rs @@ -98,7 +98,8 @@ async fn test_remove_validator_for_program() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new("dlp", dlp::ID, processor!(dlp::process_instruction)); + let mut program_test = + ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); program_test.prefer_bpf(true); let validator = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); From 82a5bb90a90ea3ecaf797845370feb78905217e7 Mon Sep 17 00:00:00 2001 From: Sarfaraz Nawaz Date: Tue, 7 Oct 2025 22:06:51 +0530 Subject: [PATCH 2/4] fix tests --- src/lib.rs | 3 - src/processor/fast/delegate.rs | 2 - src/processor/utils/curve.rs | 10 +- src/testlib.rs | 119 ----------------- tests/fixtures/mod.rs | 120 ------------------ tests/integration/tests/test-delegation.ts | 3 +- tests/test_call_handler.rs | 5 +- tests/test_close_validator_fees_vault.rs | 7 +- tests/test_commit_on_curve.rs | 5 +- tests/test_commit_state.rs | 5 +- tests/test_commit_state_from_buffer.rs | 5 +- .../test_commit_state_with_program_config.rs | 5 +- tests/test_delegate.rs | 12 +- tests/test_delegate_on_curve.rs | 5 +- tests/test_finalize.rs | 5 +- tests/test_init_fees_vault.rs | 5 +- tests/test_init_validator_fees_vault.rs | 5 +- tests/test_lamports_settlement.rs | 5 +- tests/test_protocol_claim_fees.rs | 5 +- tests/test_top_up.rs | 5 +- tests/test_undelegate.rs | 5 +- tests/test_undelegate_on_curve.rs | 5 +- tests/test_undelegate_without_commit.rs | 5 +- tests/test_validator_claim_fees.rs | 5 +- tests/test_whitelist_validator_for_program.rs | 5 +- 25 files changed, 46 insertions(+), 315 deletions(-) delete mode 100644 src/testlib.rs diff --git a/src/lib.rs b/src/lib.rs index 7ea543fe..92ed6e79 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,9 +22,6 @@ pub mod pda; mod processor; pub mod state; -#[cfg(feature = "unit_test_config")] -pub mod testlib; - declare_id!("DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh"); pub mod fast { diff --git a/src/processor/fast/delegate.rs b/src/processor/fast/delegate.rs index 079ae280..40068523 100644 --- a/src/processor/fast/delegate.rs +++ b/src/processor/fast/delegate.rs @@ -30,8 +30,6 @@ pub fn process_delegate( return Err(ProgramError::NotEnoughAccountKeys); }; - log!("PROCESS DELEGATE"); - require_owned_pda(delegated_account, &crate::fast::ID, "delegated account")?; require_program(system_program, &pinocchio_system::ID, "system program")?; diff --git a/src/processor/utils/curve.rs b/src/processor/utils/curve.rs index b3b77786..f0743752 100644 --- a/src/processor/utils/curve.rs +++ b/src/processor/utils/curve.rs @@ -1,4 +1,3 @@ -use pinocchio::syscalls::sol_curve_validate_point; use solana_curve25519::edwards::{validate_edwards, PodEdwardsPoint}; use solana_program::pubkey::Pubkey; @@ -7,20 +6,21 @@ pub fn is_on_curve(key: &Pubkey) -> bool { } pub fn is_on_curve_fast(key: &pinocchio::pubkey::Pubkey) -> bool { - // SAFETY: the layout of pinocchio::pubkey::Pubkey and PodEdwardsPoint is identical - // so one can be casted to the other without any issue. #[cfg(feature = "unit_test_config")] { + // SAFETY: the layout of pinocchio::pubkey::Pubkey and PodEdwardsPoint is identical + // so one can be casted to the other without any issue. validate_edwards(unsafe { &*(key as *const u8 as *const PodEdwardsPoint) }) } #[cfg(not(feature = "unit_test_config"))] { - // The above commented code works great but the following one saves 7 CUs. + // The above unit_test_config-version works great but the following one saves 7 CUs. // ref: https://github.com/anza-xyz/agave/blob/aa5cb43d1e/curves/curve25519/src/edwards.rs#L148-L158 + let mut result: u8 = 0; let ret = unsafe { - sol_curve_validate_point( + pinocchio::syscalls::sol_curve_validate_point( 0, // 0 means Ed25519 key.as_ptr(), &mut result as *mut u8, diff --git a/src/testlib.rs b/src/testlib.rs deleted file mode 100644 index 8f21f4bb..00000000 --- a/src/testlib.rs +++ /dev/null @@ -1,119 +0,0 @@ -use std::collections::hash_map::Entry; -use std::collections::HashMap; - -use pinocchio::msg; -use solana_program::entrypoint::{deserialize, NON_DUP_MARKER}; -use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; - -pub fn process_instruction( - program_id: &Pubkey, - accounts: &[AccountInfo], - instruction_data: &[u8], -) -> ProgramResult { - msg!("LETS PANIC"); - assert!(false, "process_instruction is false"); - - Err(solana_program::program_error::ProgramError::InvalidAccountData) - - //Ok(()) - - // 1️⃣ Build the serialized buffer that entrypoint() expects - //let mut serialized_input = serialize(program_id, accounts, instruction_data); - - //test_serialize(&serialized_input, (program_id, accounts, instruction_data)); - - //// 2️⃣ Call the real entrypoint just like the runtime would - //let rc = unsafe { dlp::entrypoint(serialized_input.as_mut_ptr()) }; - - //// 3️⃣ Convert return code to Result - //if rc == pinocchio::SUCCESS { - // Ok(()) - //} else { - // Err(solana_program::program_error::ProgramError::Custom( - // rc as u32, - // )) - //} -} - -fn test_serialize(input: &[u8], expected: (&Pubkey, &[AccountInfo], &[u8])) { - let mut used_input = input.to_vec(); - let actual = unsafe { deserialize(used_input.as_mut_ptr()) }; - - assert_eq!( - actual.0, expected.0, - "actual: {}, expected: {}", - actual.0, expected.0 - ); - - assert_eq!( - actual.1.len(), - expected.1.len(), - "actual (len): {}, expected (len): {}", - actual.1.len(), - expected.1.len(), - ); - - for (a, b) in actual.1.iter().zip(expected.1) { - test_account_eq(a, b); - } - - assert_eq!( - actual.2, - expected.2, - "actual (len): {}, expected (len): {}", - actual.2.len(), - expected.2.len() - ); -} - -fn test_account_eq(a: &AccountInfo, b: &AccountInfo) { - todo!(); -} - -fn serialize(program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8]) -> Vec { - let mut input = vec![]; - - // Number of accounts present - input.extend_from_slice(&(accounts.len() as u64).to_le_bytes()); - - // Account Infos - let mut dups = HashMap::new(); - for (i, account) in accounts.iter().enumerate() { - match dups.entry(account.key) { - Entry::Vacant(v) => { - v.insert(i); // cache the index, to detect duplicate - input.extend_from_slice(&[NON_DUP_MARKER]); - serialize_account_info(&mut input, account); - } - Entry::Occupied(o) => { - let found = *o.get(); - input.extend_from_slice(&[found as u8]); - input.extend_from_slice(&[0u8; 7]); - } - } - } - // Instruction data - - // Program Id - input.extend_from_slice(program_id.as_array()); - - input -} - -fn serialize_account_info<'a>(input: &mut Vec, account: &AccountInfo<'a>) { - input.push(if account.is_signer { 1 } else { 0 }); - input.push(if account.is_writable { 1 } else { 0 }); - input.push(if account.executable { 1 } else { 0 }); - - // data-len saved here as u32 - input.extend_from_slice(&(account.data_len() as u32).to_le_bytes()); - - input.extend_from_slice(account.key.as_array()); - input.extend_from_slice(account.owner.as_array()); - input.extend_from_slice(&account.lamports().to_le_bytes()); - input.extend_from_slice(&(account.data_len() as u64).to_le_bytes()); - - input.extend_from_slice(account.data.as_ref().take()); - - input.extend_from_slice(&account.rent_epoch.to_le_bytes()); -} diff --git a/tests/fixtures/mod.rs b/tests/fixtures/mod.rs index ec23270d..5903b91f 100644 --- a/tests/fixtures/mod.rs +++ b/tests/fixtures/mod.rs @@ -1,124 +1,4 @@ pub mod accounts; -use std::collections::hash_map::Entry; -use std::collections::HashMap; - #[allow(unused_imports)] pub(crate) use accounts::*; - -use pinocchio::msg; -use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; -use solana_sdk::entrypoint::{deserialize, NON_DUP_MARKER}; - -pub fn process_instruction( - program_id: &Pubkey, - accounts: &[AccountInfo], - instruction_data: &[u8], -) -> ProgramResult { - msg!("LETS PANIC"); - assert!(false, "process_instruction is false"); - - Err(solana_sdk::program_error::ProgramError::InvalidAccountData) - - //Ok(()) - - // 1️⃣ Build the serialized buffer that entrypoint() expects - //let mut serialized_input = serialize(program_id, accounts, instruction_data); - - //test_serialize(&serialized_input, (program_id, accounts, instruction_data)); - - //// 2️⃣ Call the real entrypoint just like the runtime would - //let rc = unsafe { dlp::entrypoint(serialized_input.as_mut_ptr()) }; - - //// 3️⃣ Convert return code to Result - //if rc == pinocchio::SUCCESS { - // Ok(()) - //} else { - // Err(solana_program::program_error::ProgramError::Custom( - // rc as u32, - // )) - //} -} - -fn test_serialize(input: &[u8], expected: (&Pubkey, &[AccountInfo], &[u8])) { - let mut used_input = input.to_vec(); - let actual = unsafe { deserialize(used_input.as_mut_ptr()) }; - - assert_eq!( - actual.0, expected.0, - "actual: {}, expected: {}", - actual.0, expected.0 - ); - - assert_eq!( - actual.1.len(), - expected.1.len(), - "actual (len): {}, expected (len): {}", - actual.1.len(), - expected.1.len(), - ); - - for (a, b) in actual.1.iter().zip(expected.1) { - test_account_eq(a, b); - } - - assert_eq!( - actual.2, - expected.2, - "actual (len): {}, expected (len): {}", - actual.2.len(), - expected.2.len() - ); -} - -fn test_account_eq(a: &AccountInfo, b: &AccountInfo) { - todo!(); -} - -fn serialize(program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8]) -> Vec { - let mut input = vec![]; - - // Number of accounts present - input.extend_from_slice(&(accounts.len() as u64).to_le_bytes()); - - // Account Infos - let mut dups = HashMap::new(); - for (i, account) in accounts.iter().enumerate() { - match dups.entry(account.key) { - Entry::Vacant(v) => { - v.insert(i); // cache the index, to detect duplicate - input.extend_from_slice(&[NON_DUP_MARKER]); - serialize_account_info(&mut input, account); - } - Entry::Occupied(o) => { - let found = *o.get(); - input.extend_from_slice(&[found as u8]); - input.extend_from_slice(&[0u8; 7]); - } - } - } - // Instruction data - - // Program Id - input.extend_from_slice(program_id.as_array()); - - input -} - -fn serialize_account_info<'a>(input: &mut Vec, account: &AccountInfo<'a>) { - input.push(if account.is_signer { 1 } else { 0 }); - input.push(if account.is_writable { 1 } else { 0 }); - input.push(if account.executable { 1 } else { 0 }); - - // data-len saved here as u32 - input.extend_from_slice(&(account.data_len() as u32).to_le_bytes()); - - input.extend_from_slice(account.key.as_array()); - input.extend_from_slice(account.owner.as_array()); - input.extend_from_slice(&account.lamports().to_le_bytes()); - input.extend_from_slice(&(account.data_len() as u64).to_le_bytes()); - - input.extend_from_slice(account.data.as_ref().take()); - - input.extend_from_slice(&account.rent_epoch.to_le_bytes()); -} diff --git a/tests/integration/tests/test-delegation.ts b/tests/integration/tests/test-delegation.ts index 80de8355..9efdc130 100644 --- a/tests/integration/tests/test-delegation.ts +++ b/tests/integration/tests/test-delegation.ts @@ -114,7 +114,8 @@ describe("TestDelegation", () => { console.log("Counter: ", counterAccount.count.toString()); }); - it.only("Delegate one PDA", async () => { + // TODO (snawaz): currently, we cannot run two similar tests twice or more. + it.skip("Delegate one PDA", async () => { const counterAccountInfo = await provider.connection.getAccountInfo(pda); if (counterAccountInfo === null) { const tx = await testDelegation.methods diff --git a/tests/test_call_handler.rs b/tests/test_call_handler.rs index f0711f68..d0dd33bd 100644 --- a/tests/test_call_handler.rs +++ b/tests/test_call_handler.rs @@ -14,7 +14,7 @@ use dlp::pda::{ use solana_program::instruction::AccountMeta; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, read_file, BanksClient, ProgramTest}; +use solana_program_test::{read_file, BanksClient, ProgramTest}; use solana_sdk::pubkey::Pubkey; use solana_sdk::{ account::Account, @@ -216,8 +216,7 @@ async fn setup_ephemeral_balance(program_test: &mut ProgramTest, payer: &Keypair } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let payer = Keypair::new(); diff --git a/tests/test_close_validator_fees_vault.rs b/tests/test_close_validator_fees_vault.rs index aaf522d0..9bbcb8f4 100644 --- a/tests/test_close_validator_fees_vault.rs +++ b/tests/test_close_validator_fees_vault.rs @@ -1,7 +1,7 @@ use crate::fixtures::TEST_AUTHORITY; use dlp::pda::validator_fees_vault_pda_from_validator; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -25,7 +25,7 @@ async fn test_close_validator_fees_vault() { ); let tx = Transaction::new_signed_with_payer(&[ix], Some(&admin.pubkey()), &[&admin], blockhash); let res = banks.process_transaction(tx).await; - assert!(res.is_ok(), "error: {:?}", res); + assert!(res.is_ok()); // Assert the validator fees vault now has been closed let validator_fees_vault_account = banks.get_account(validator_fees_vault_pda).await.unwrap(); @@ -33,8 +33,7 @@ async fn test_close_validator_fees_vault() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let admin_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_commit_on_curve.rs b/tests/test_commit_on_curve.rs index b55387ca..e86bf9cb 100644 --- a/tests/test_commit_on_curve.rs +++ b/tests/test_commit_on_curve.rs @@ -7,7 +7,7 @@ use dlp::pda::{ use dlp::state::{CommitRecord, DelegationMetadata}; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -79,8 +79,7 @@ async fn test_commit_on_curve() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); // Setup the validator authority diff --git a/tests/test_commit_state.rs b/tests/test_commit_state.rs index b57f4b25..07c32f99 100644 --- a/tests/test_commit_state.rs +++ b/tests/test_commit_state.rs @@ -7,7 +7,7 @@ use dlp::pda::{ use dlp::state::{CommitRecord, DelegationMetadata}; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -120,8 +120,7 @@ async fn test_commit_out_of_order() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let validator_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_commit_state_from_buffer.rs b/tests/test_commit_state_from_buffer.rs index 29724dab..cac16ac4 100644 --- a/tests/test_commit_state_from_buffer.rs +++ b/tests/test_commit_state_from_buffer.rs @@ -11,7 +11,7 @@ use dlp::pda::{ use dlp::state::{CommitRecord, DelegationMetadata}; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::pubkey::Pubkey; use solana_sdk::{ account::Account, @@ -85,8 +85,7 @@ async fn test_commit_new_state_from_buffer() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let validator_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_commit_state_with_program_config.rs b/tests/test_commit_state_with_program_config.rs index 3a60e99c..763681d1 100644 --- a/tests/test_commit_state_with_program_config.rs +++ b/tests/test_commit_state_with_program_config.rs @@ -8,7 +8,7 @@ use dlp::state::{CommitRecord, DelegationMetadata}; use fixtures::create_program_config_data; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -99,8 +99,7 @@ async fn test_commit_new_state(valid_config: bool) { } async fn setup_program_test_env(valid_config: bool) -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let validator_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_delegate.rs b/tests/test_delegate.rs index 07318c14..37173765 100644 --- a/tests/test_delegate.rs +++ b/tests/test_delegate.rs @@ -1,7 +1,7 @@ use solana_program::pubkey::Pubkey; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, read_file, BanksClient, ProgramTest}; +use solana_program_test::{read_file, BanksClient, ProgramTest}; use solana_sdk::instruction::{AccountMeta, Instruction}; use solana_sdk::{ account::Account, @@ -34,9 +34,7 @@ async fn test_delegate() { let ix = delegate_from_wrapper_program(payer.pubkey(), DELEGATED_PDA_ID); let tx = Transaction::new_signed_with_payer(&[ix], Some(&payer.pubkey()), &[&payer], blockhash); - eprintln!(">>>>>>>>>>>>>>>> invoke ix <<<<<<<<<<<<<<<<<<<<<<<<<<"); let res = banks.process_transaction(tx).await; - eprintln!(">>>>>>>>>>>>>>>> invoke ix DONE <<<<<<<<<<<<<<<<<<<<<<<<<<"); println!("{:?}", res); assert!(res.is_ok()); @@ -79,13 +77,7 @@ async fn test_delegate() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = ProgramTest::new( - "dlp", - dlp::ID, - None, //processor!(dlp::testlib::process_instruction), - ); - - println!(">>>>>>>>>>>>>>>> setup_program_test_env <<<<<<<<<<<<<<<<<<<<<<<<<<"); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let payer_alt = Keypair::new(); diff --git a/tests/test_delegate_on_curve.rs b/tests/test_delegate_on_curve.rs index 3830af5a..1ded45ee 100644 --- a/tests/test_delegate_on_curve.rs +++ b/tests/test_delegate_on_curve.rs @@ -1,5 +1,5 @@ use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -121,8 +121,7 @@ async fn test_delegate_on_curve() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let payer_alt = Keypair::from_bytes(&ON_CURVE_KEYPAIR).unwrap(); diff --git a/tests/test_finalize.rs b/tests/test_finalize.rs index 26ffbb06..08a05552 100644 --- a/tests/test_finalize.rs +++ b/tests/test_finalize.rs @@ -10,7 +10,7 @@ use dlp::pda::{ use dlp::state::{CommitRecord, DelegationMetadata}; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -83,8 +83,7 @@ async fn test_finalize() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let authority = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_init_fees_vault.rs b/tests/test_init_fees_vault.rs index eca7175b..3b59457b 100644 --- a/tests/test_init_fees_vault.rs +++ b/tests/test_init_fees_vault.rs @@ -1,6 +1,6 @@ use dlp::pda::fees_vault_pda; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -26,8 +26,7 @@ async fn test_init_fees_vault() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let payer_alt = Keypair::new(); diff --git a/tests/test_init_validator_fees_vault.rs b/tests/test_init_validator_fees_vault.rs index b27e286f..1e3eae97 100644 --- a/tests/test_init_validator_fees_vault.rs +++ b/tests/test_init_validator_fees_vault.rs @@ -2,7 +2,7 @@ use crate::fixtures::TEST_AUTHORITY; use dlp::pda::validator_fees_vault_pda_from_validator; use solana_program::pubkey::Pubkey; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -49,8 +49,7 @@ async fn test_init_validator_fees_vault() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let admin_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_lamports_settlement.rs b/tests/test_lamports_settlement.rs index 3c58af1a..431d89b1 100644 --- a/tests/test_lamports_settlement.rs +++ b/tests/test_lamports_settlement.rs @@ -13,7 +13,7 @@ use dlp::state::{CommitRecord, DelegationMetadata}; use solana_program::pubkey::Pubkey; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, read_file, BanksClient, ProgramTest}; +use solana_program_test::{read_file, BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -531,8 +531,7 @@ struct SetupProgramCommitTestEnvArgs { async fn setup_program_for_commit_test_env( args: SetupProgramCommitTestEnvArgs, ) -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let validator_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_protocol_claim_fees.rs b/tests/test_protocol_claim_fees.rs index 2f6a98f9..a750703f 100644 --- a/tests/test_protocol_claim_fees.rs +++ b/tests/test_protocol_claim_fees.rs @@ -2,7 +2,7 @@ use crate::fixtures::TEST_AUTHORITY; use dlp::pda::fees_vault_pda; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -46,8 +46,7 @@ async fn test_protocol_claim_fees() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let admin_keypair = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_top_up.rs b/tests/test_top_up.rs index 609d0376..8df8af73 100644 --- a/tests/test_top_up.rs +++ b/tests/test_top_up.rs @@ -10,7 +10,7 @@ use dlp::pda::{ use dlp::state::DelegationRecord; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::{Account, ReadableAccount}, signature::{Keypair, Signer}, @@ -261,8 +261,7 @@ async fn test_undelegate_and_close() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let payer_alt = Keypair::new(); diff --git a/tests/test_undelegate.rs b/tests/test_undelegate.rs index 3272aacc..684d3e13 100644 --- a/tests/test_undelegate.rs +++ b/tests/test_undelegate.rs @@ -5,7 +5,7 @@ use dlp::pda::{ }; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, read_file, BanksClient, ProgramTest}; +use solana_program_test::{read_file, BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -76,8 +76,7 @@ async fn test_finalize_and_undelegate() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let authority = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_undelegate_on_curve.rs b/tests/test_undelegate_on_curve.rs index a2281884..307a4539 100644 --- a/tests/test_undelegate_on_curve.rs +++ b/tests/test_undelegate_on_curve.rs @@ -4,7 +4,7 @@ use dlp::pda::{ }; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -64,8 +64,7 @@ async fn test_undelegate_on_curve() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let validator = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); let payer_alt = Keypair::from_bytes(&ON_CURVE_KEYPAIR).unwrap(); diff --git a/tests/test_undelegate_without_commit.rs b/tests/test_undelegate_without_commit.rs index f9dc58b2..6c1e31f5 100644 --- a/tests/test_undelegate_without_commit.rs +++ b/tests/test_undelegate_without_commit.rs @@ -5,7 +5,7 @@ use dlp::pda::{ }; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, read_file, BanksClient, ProgramTest}; +use solana_program_test::{read_file, BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -76,8 +76,7 @@ async fn test_undelegate_without_commit() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let validator = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_validator_claim_fees.rs b/tests/test_validator_claim_fees.rs index 011982f9..8c989021 100644 --- a/tests/test_validator_claim_fees.rs +++ b/tests/test_validator_claim_fees.rs @@ -2,7 +2,7 @@ use crate::fixtures::TEST_AUTHORITY; use dlp::consts::PROTOCOL_FEES_PERCENTAGE; use dlp::pda::{fees_vault_pda, validator_fees_vault_pda_from_validator}; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, BanksClient, ProgramTest}; +use solana_program_test::{BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -78,8 +78,7 @@ async fn test_validator_claim_fees() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let validator = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); diff --git a/tests/test_whitelist_validator_for_program.rs b/tests/test_whitelist_validator_for_program.rs index 70fe82a3..bc6d8d4a 100644 --- a/tests/test_whitelist_validator_for_program.rs +++ b/tests/test_whitelist_validator_for_program.rs @@ -3,7 +3,7 @@ use dlp::pda::program_config_from_program_id; use dlp::state::ProgramConfig; use solana_program::rent::Rent; use solana_program::{hash::Hash, native_token::LAMPORTS_PER_SOL, system_program}; -use solana_program_test::{processor, read_file, BanksClient, ProgramTest}; +use solana_program_test::{read_file, BanksClient, ProgramTest}; use solana_sdk::{ account::Account, signature::{Keypair, Signer}, @@ -98,8 +98,7 @@ async fn test_remove_validator_for_program() { } async fn setup_program_test_env() -> (BanksClient, Keypair, Keypair, Hash) { - let mut program_test = - ProgramTest::new("dlp", dlp::ID, processor!(fixtures::process_instruction)); + let mut program_test = ProgramTest::new("dlp", dlp::ID, None); program_test.prefer_bpf(true); let validator = Keypair::from_bytes(&TEST_AUTHORITY).unwrap(); From f45c82dc4d88a338a32c0574289ec8f1f7d5221f Mon Sep 17 00:00:00 2001 From: Sarfaraz Nawaz Date: Wed, 8 Oct 2025 15:35:11 +0530 Subject: [PATCH 3/4] Remove TODO as now I know why it's 8 bytes --- src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 92ed6e79..3e30e0c3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,8 +84,6 @@ pub fn fast_process_instruction( accounts: &[pinocchio::account_info::AccountInfo], data: &[u8], ) -> Option { - // TODO (snawaz): why the size of discriminator is 8, when 1 is enough, and in the rest 7 bytes - // we can store 7 bumps that could give us huge performance boost as it'd simplify validations! let (discriminator, data) = data.split_at(8); let discriminator = match discriminator From 1910e4e448dc1187a03fc6199c1c7234413377b9 Mon Sep 17 00:00:00 2001 From: Sarfaraz Nawaz Date: Sat, 11 Oct 2025 19:15:14 +0530 Subject: [PATCH 4/4] Address the feedbacks on first review --- src/lib.rs | 18 ++++++++++-------- src/processor/fast/delegate.rs | 13 +++++++++---- src/processor/fast/utils/requires.rs | 1 + src/processor/utils/curve.rs | 4 ++-- tests/integration/tests/test-delegation.ts | 2 +- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3e30e0c3..9f5bc2cd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,15 +84,17 @@ pub fn fast_process_instruction( accounts: &[pinocchio::account_info::AccountInfo], data: &[u8], ) -> Option { - let (discriminator, data) = data.split_at(8); + if data.len() < 8 { + return Some(Err( + pinocchio::program_error::ProgramError::InvalidInstructionData, + )); + } - let discriminator = match discriminator - .try_into() - .ok() - .and_then(|bytes: [u8; 8]| DlpDiscriminator::try_from(bytes).ok()) - { - Some(discriminator) => discriminator, - None => { + let (discriminator_bytes, data) = data.split_at(8); + + let discriminator = match DlpDiscriminator::try_from(discriminator_bytes[0]) { + Ok(discriminator) => discriminator, + Err(_) => { log!("Failed to read and parse discriminator"); return Some(Err( pinocchio::program_error::ProgramError::InvalidInstructionData, diff --git a/src/processor/fast/delegate.rs b/src/processor/fast/delegate.rs index 40068523..2137faec 100644 --- a/src/processor/fast/delegate.rs +++ b/src/processor/fast/delegate.rs @@ -17,21 +17,23 @@ use crate::processor::fast::utils::{pda::create_pda, requires::require_uninitial use crate::processor::utils::curve::is_on_curve_fast; use crate::state::{DelegationMetadata, DelegationRecord}; -use super::utils::requires::{require_owned_pda, require_pda, require_program, require_signer}; +use super::utils::requires::{require_owned_pda, require_pda, require_signer}; pub fn process_delegate( _program_id: &Pubkey, accounts: &[AccountInfo], data: &[u8], ) -> ProgramResult { - let [payer, delegated_account, owner_program, delegate_buffer_account, delegation_record_account, delegation_metadata_account, system_program] = + let [payer, delegated_account, owner_program, delegate_buffer_account, delegation_record_account, delegation_metadata_account, _system_program] = accounts else { return Err(ProgramError::NotEnoughAccountKeys); }; require_owned_pda(delegated_account, &crate::fast::ID, "delegated account")?; - require_program(system_program, &pinocchio_system::ID, "system program")?; + + // we do not need system_program anywhere + // require_program(system_program, &pinocchio_system::ID, "system program")?; // Check that payer and delegated_account are signers, this ensures the instruction is being called from CPI require_signer(payer, "payer")?; @@ -47,6 +49,8 @@ pub fn process_delegate( )?; // Check that the delegation record PDA is uninitialized + // TODO (snawaz): This check could be safely avoided, as create_pda would anyway fail. + // Could save considerable CU, especially in the v2 version where we will pass the bumps let delegation_record_bump = require_uninitialized_pda( delegation_record_account, &[pda::DELEGATION_RECORD_TAG, delegated_account.key()], @@ -56,6 +60,8 @@ pub fn process_delegate( )?; // Check that the delegation metadata PDA is uninitialized + // TODO (snawaz): This check could be safely avoided, as create_pda would anyway fail. + // Could save considerable CU, especially in the v2 version where we will pass the bumps let delegation_metadata_bump = require_uninitialized_pda( delegation_metadata_account, &[pda::DELEGATION_METADATA_TAG, delegated_account.key()], @@ -151,7 +157,6 @@ pub fn process_delegate( .to_bytes_with_discriminator(&mut delegation_metadata_data.as_mut()) .map_err(to_pinocchio_program_error)?; - // TODO (snawaz): why do we conditionally copy? // Copy the data from the buffer into the original account if !delegate_buffer_account.data_is_empty() { let mut delegated_data = delegated_account.try_borrow_mut_data()?; diff --git a/src/processor/fast/utils/requires.rs b/src/processor/fast/utils/requires.rs index 848683df..3eab1921 100644 --- a/src/processor/fast/utils/requires.rs +++ b/src/processor/fast/utils/requires.rs @@ -126,6 +126,7 @@ pub fn require_uninitialized_pda( /// - Address does not match the expected value. /// - Account is not executable. #[inline(always)] +#[allow(dead_code)] pub fn require_program(info: &AccountInfo, key: &Pubkey, label: &str) -> Result<(), ProgramError> { if !pubkey_eq(info.key(), key) { log!("Invalid program account {}: ", label); diff --git a/src/processor/utils/curve.rs b/src/processor/utils/curve.rs index f0743752..a130fb96 100644 --- a/src/processor/utils/curve.rs +++ b/src/processor/utils/curve.rs @@ -6,14 +6,14 @@ pub fn is_on_curve(key: &Pubkey) -> bool { } pub fn is_on_curve_fast(key: &pinocchio::pubkey::Pubkey) -> bool { - #[cfg(feature = "unit_test_config")] + #[cfg(not(target_os = "solana"))] { // SAFETY: the layout of pinocchio::pubkey::Pubkey and PodEdwardsPoint is identical // so one can be casted to the other without any issue. validate_edwards(unsafe { &*(key as *const u8 as *const PodEdwardsPoint) }) } - #[cfg(not(feature = "unit_test_config"))] + #[cfg(target_os = "solana")] { // The above unit_test_config-version works great but the following one saves 7 CUs. // ref: https://github.com/anza-xyz/agave/blob/aa5cb43d1e/curves/curve25519/src/edwards.rs#L148-L158 diff --git a/tests/integration/tests/test-delegation.ts b/tests/integration/tests/test-delegation.ts index 9efdc130..5143693e 100644 --- a/tests/integration/tests/test-delegation.ts +++ b/tests/integration/tests/test-delegation.ts @@ -114,7 +114,7 @@ describe("TestDelegation", () => { console.log("Counter: ", counterAccount.count.toString()); }); - // TODO (snawaz): currently, we cannot run two similar tests twice or more. + // .skip() because currently tests are not independent and we cannot run two similar tests twice or more. it.skip("Delegate one PDA", async () => { const counterAccountInfo = await provider.connection.getAccountInfo(pda); if (counterAccountInfo === null) {