Skip to content

Commit 313952b

Browse files
lint
1 parent 2b2e1e8 commit 313952b

File tree

9 files changed

+27
-17
lines changed

9 files changed

+27
-17
lines changed

program-tests/package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44
"license": "Apache-2.0",
55
"description": "Test programs for Light Protocol uses test-sbf to build because build-sbf -- -p creates an infinite loop.",
66
"scripts": {
7-
"build": "cargo test-sbf -p create-address-test-program"
7+
"build": "cargo test-sbf -p create-address-test-program",
8+
"test": "RUSTFLAGS=\"-D warnings\" && pnpm test-account-compression && pnpm test-system && pnpm test-registry && pnpm test-compressed-token && pnpm test-system-cpi && pnpm test-system-cpi-v2 && pnpm test-e2e && pnpm test-sdk-anchor && pnpm test-sdk-pinocchio",
9+
"test-account-compression": "cargo test-sbf -p account-compression-test",
10+
"test-system": "cargo test-sbf -p system-test",
11+
"test-registry": "cargo test-sbf -p registry-test",
12+
"test-compressed-token": "cargo test-sbf -p compressed-token-test",
13+
"test-system-cpi": "cargo test-sbf -p system-cpi-test",
14+
"test-system-cpi-v2": "cargo test-sbf -p system-cpi-v2-test",
15+
"test-e2e": "cargo test-sbf -p e2e-test",
16+
"test-sdk-anchor": "cargo test-sbf -p sdk-anchor-test",
17+
"test-sdk-pinocchio": "cargo test-sbf -p sdk-pinocchio-test"
818
},
919
"nx": {
1020
"targets": {

program-tests/system-cpi-test/tests/test_program_owned_trees.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ async fn test_program_owned_merkle_tree() {
126126
assert_ne!(post_merkle_tree.root(), pre_merkle_tree.root());
127127
assert_eq!(
128128
post_merkle_tree.root(),
129-
test_indexer.state_merkle_trees[2].merkle_tree.root()
129+
test_indexer.state_merkle_trees[3].merkle_tree.root()
130130
);
131131

132132
let invalid_program_owned_merkle_tree_keypair = Keypair::new();

sdk-libs/macros/src/compressible.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ pub(crate) fn add_compressible_instructions(
286286
});
287287

288288
let compressed_account_variant_enum: ItemEnum = syn::parse_quote! {
289-
#[derive(Clone, Debug, AnchorSerialize, AnchorDeserialize)]
289+
#[derive(Clone, Debug, light_sdk::AnchorSerialize, light_sdk::AnchorDeserialize)]
290290
pub enum CompressedAccountVariant {
291291
#(#enum_variants),*
292292
}
@@ -382,7 +382,7 @@ pub(crate) fn add_compressible_instructions(
382382

383383
// Generate the CompressedAccountData struct
384384
let compressed_account_data: ItemStruct = syn::parse_quote! {
385-
#[derive(Clone, Debug, AnchorDeserialize, AnchorSerialize)]
385+
#[derive(Clone, Debug, light_sdk::AnchorDeserialize, light_sdk::AnchorSerialize)]
386386
pub struct CompressedAccountData {
387387
pub meta: light_sdk_types::instruction::account_meta::CompressedAccountMeta,
388388
pub data: CompressedAccountVariant,

sdk-libs/sdk/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ name = "light_sdk"
1414
default = ["borsh"]
1515
idl-build = ["anchor-lang/idl-build"]
1616
anchor = [
17+
"anchor-lang",
1718
"light-compressed-account/anchor",
1819
"light-sdk-types/anchor",
1920
]

sdk-libs/sdk/src/compressible/compress_account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use crate::{
1515
AnchorDeserialize, AnchorSerialize, LightDiscriminator,
1616
};
1717

18-
#[cfg(feature = "anchor")]
1918
/// Helper function to compress a PDA and reclaim rent.
2019
///
2120
/// 1. closes onchain PDA
@@ -35,6 +34,7 @@ use crate::{
3534
/// * `rent_recipient` - The account to receive the PDA's rent
3635
/// * `compression_delay` - The number of slots to wait before compression is
3736
/// allowed
37+
#[cfg(feature = "anchor")]
3838
pub fn compress_account<'info, A>(
3939
solana_account: &mut Account<'info, A>,
4040
compressed_account_meta: &CompressedAccountMeta,

sdk-libs/sdk/src/compressible/compress_account_on_init.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ use crate::{
1919
AnchorDeserialize, AnchorSerialize, LightDiscriminator,
2020
};
2121

22-
#[cfg(feature = "anchor")]
2322
/// Wrapper to process a single onchain PDA for compression into a new
2423
/// compressed account. Calls `process_accounts_for_compression_on_init` with
2524
/// single-element slices and invokes the CPI.
25+
#[cfg(feature = "anchor")]
2626
#[allow(clippy::too_many_arguments)]
2727
pub fn compress_account_on_init<'info, A>(
2828
solana_account: &mut Account<'info, A>,
@@ -67,7 +67,6 @@ where
6767
Ok(())
6868
}
6969

70-
#[cfg(feature = "anchor")]
7170
/// Helper function to process multiple onchain PDAs for compression into new
7271
/// compressed accounts.
7372
///
@@ -89,6 +88,7 @@ where
8988
/// # Returns
9089
/// * `Ok(Vec<CompressedAccountInfo>)` - CompressedAccountInfo for CPI batching
9190
/// * `Err(LightSdkError)` if there was an error
91+
#[cfg(feature = "anchor")]
9292
#[allow(clippy::too_many_arguments)]
9393
pub fn prepare_accounts_for_compression_on_init<'info, A>(
9494
solana_accounts: &mut [&mut Account<'info, A>],

sdk-libs/sdk/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ pub mod utils;
121121

122122
pub use account::Size;
123123
#[cfg(feature = "anchor")]
124-
use anchor_lang::{AnchorDeserialize, AnchorSerialize};
124+
pub use anchor_lang::{AnchorDeserialize, AnchorSerialize};
125125
#[cfg(not(feature = "anchor"))]
126-
use borsh::{BorshDeserialize as AnchorDeserialize, BorshSerialize as AnchorSerialize};
126+
pub use borsh::{BorshDeserialize as AnchorDeserialize, BorshSerialize as AnchorSerialize};
127127
pub use light_account_checks::{self, discriminator::Discriminator as LightDiscriminator};
128128
pub use light_hasher;
129129
pub use light_sdk_macros::{
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
use anchor_lang::Discriminator;
2-
use light_sdk::LightDiscriminator;
3-
use anchor_compressible::UserRecord;
4-
1+
#[cfg(feature = "anchor")]
52
#[test]
63
fn test_discriminator() {
4+
use anchor_compressible::UserRecord;
5+
use anchor_lang::Discriminator;
6+
use light_sdk::LightDiscriminator;
77
let light_discriminator = UserRecord::LIGHT_DISCRIMINATOR;
88
println!("light discriminator: {:?}", light_discriminator);
99

10-
1110
let anchor_discriminator = UserRecord::LIGHT_DISCRIMINATOR;
1211

1312
println!("Anchor discriminator: {:?}", anchor_discriminator);
1413
println!("Match: {}", light_discriminator == anchor_discriminator);
1514

1615
assert_eq!(light_discriminator, anchor_discriminator);
17-
}
16+
}

sdk-tests/native-compressible/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ use light_macros::pubkey;
33
use light_sdk::{
44
account::Size,
55
compressible::{CompressionInfo, HasCompressionInfo},
6+
cpi::CpiSigner,
7+
derive_light_cpi_signer,
68
error::LightSdkError,
79
LightDiscriminator, LightHasher,
810
};
9-
use light_sdk::{cpi::CpiSigner, derive_light_cpi_signer};
1011
use solana_program::{
1112
account_info::AccountInfo, entrypoint, program_error::ProgramError, pubkey::Pubkey,
1213
};
@@ -104,7 +105,6 @@ pub struct MyPdaAccount {
104105
pub data: [u8; 31],
105106
}
106107

107-
108108
// Implement the HasCompressionInfo trait
109109
impl HasCompressionInfo for MyPdaAccount {
110110
fn compression_info(&self) -> &CompressionInfo {

0 commit comments

Comments
 (0)