Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions forester-utils/src/instructions/claim.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use light_ctoken_interface::COMPRESSED_TOKEN_PROGRAM_ID;
use light_ctoken_interface::CTOKEN_PROGRAM_ID;
use solana_instruction::{AccountMeta, Instruction};
use solana_pubkey::Pubkey;

Expand All @@ -13,7 +13,7 @@ use solana_pubkey::Pubkey;
pub fn derive_pool_pda(compression_authority: &Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(
&[b"pool", compression_authority.as_ref()],
&Pubkey::from(COMPRESSED_TOKEN_PROGRAM_ID),
&Pubkey::from(CTOKEN_PROGRAM_ID),
)
}

Expand Down Expand Up @@ -49,7 +49,7 @@ pub fn claim(
}

Instruction {
program_id: Pubkey::from(COMPRESSED_TOKEN_PROGRAM_ID),
program_id: Pubkey::from(CTOKEN_PROGRAM_ID),
accounts,
data: instruction_data,
}
Expand Down
4 changes: 2 additions & 2 deletions forester-utils/src/instructions/withdraw_funding_pool.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use light_ctoken_interface::COMPRESSED_TOKEN_PROGRAM_ID;
use light_ctoken_interface::CTOKEN_PROGRAM_ID;
use solana_instruction::{AccountMeta, Instruction};
use solana_pubkey::Pubkey;

Expand Down Expand Up @@ -37,7 +37,7 @@ pub fn withdraw_funding_pool(
];

Instruction {
program_id: Pubkey::from(COMPRESSED_TOKEN_PROGRAM_ID),
program_id: Pubkey::from(CTOKEN_PROGRAM_ID),
accounts,
data: instruction_data,
}
Expand Down
6 changes: 3 additions & 3 deletions forester/src/compressible/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use base64::{engine::general_purpose, Engine as _};
use borsh::BorshDeserialize;
use light_ctoken_interface::{
state::{extensions::ExtensionStruct, CToken},
COMPRESSED_TOKEN_PROGRAM_ID, COMPRESSIBLE_TOKEN_ACCOUNT_SIZE,
COMPRESSIBLE_TOKEN_ACCOUNT_SIZE, CTOKEN_PROGRAM_ID,
};
use serde_json::json;
use solana_sdk::pubkey::Pubkey;
Expand Down Expand Up @@ -191,7 +191,7 @@ async fn bootstrap_with_v2_api(
mut shutdown_rx: oneshot::Receiver<()>,
) -> Result<()> {
let client = reqwest::Client::new();
let program_id = Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID);
let program_id = Pubkey::new_from_array(CTOKEN_PROGRAM_ID);

let mut total_fetched = 0;
let mut total_inserted = 0;
Expand Down Expand Up @@ -314,7 +314,7 @@ async fn bootstrap_with_standard_api(
mut shutdown_rx: oneshot::Receiver<()>,
) -> Result<()> {
let client = reqwest::Client::new();
let program_id = Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID);
let program_id = Pubkey::new_from_array(CTOKEN_PROGRAM_ID);

let payload = json!({
"jsonrpc": "2.0",
Expand Down
4 changes: 2 additions & 2 deletions forester/src/compressible/compressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anchor_lang::{InstructionData, ToAccountMetas};
use forester_utils::rpc_pool::SolanaRpcPool;
use light_client::rpc::Rpc;
use light_compressible::config::CompressibleConfig;
use light_ctoken_interface::COMPRESSED_TOKEN_PROGRAM_ID;
use light_ctoken_interface::CTOKEN_PROGRAM_ID;
use light_ctoken_sdk::compressed_token::compress_and_close::CompressAndCloseAccounts as CTokenAccounts;
use light_registry::{
accounts::CompressAndCloseContext, compressible::compressed_token::CompressAndCloseIndices,
Expand Down Expand Up @@ -60,7 +60,7 @@ impl<R: Rpc> Compressor<R> {
registered_forester_pda: Pubkey,
) -> Result<Signature> {
let registry_program_id = Pubkey::from_str(REGISTRY_PROGRAM_ID_STR)?;
let compressed_token_program_id = Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID);
let compressed_token_program_id = Pubkey::new_from_array(CTOKEN_PROGRAM_ID);

// Derive compression_authority PDA deterministically (version = 1)
let compression_authority_seeds = CompressibleConfig::get_compression_authority_seeds(1);
Expand Down
4 changes: 2 additions & 2 deletions forester/src/compressible/subscriber.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{str::FromStr, sync::Arc};

use futures::StreamExt;
use light_ctoken_interface::{COMPRESSED_TOKEN_PROGRAM_ID, COMPRESSIBLE_TOKEN_ACCOUNT_SIZE};
use light_ctoken_interface::{COMPRESSIBLE_TOKEN_ACCOUNT_SIZE, CTOKEN_PROGRAM_ID};
use solana_account_decoder::UiAccountEncoding;
use solana_client::{
nonblocking::pubsub_client::PubsubClient,
Expand Down Expand Up @@ -44,7 +44,7 @@ impl AccountSubscriber {
.await
.map_err(|e| anyhow::anyhow!("Failed to connect to WebSocket: {}", e))?;

let program_id = Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID);
let program_id = Pubkey::new_from_array(CTOKEN_PROGRAM_ID);

// Subscribe to compressed token program accounts with filter for compressible account size
let (mut subscription, unsubscribe) = pubsub_client
Expand Down
4 changes: 2 additions & 2 deletions forester/tests/test_compressible_ctoken.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ async fn test_compressible_ctoken_compression() {
// Create mint
let mint_seed = Keypair::new();
let address_tree = rpc.get_address_tree_v2().tree;
let mint = Pubkey::from(create_compressed_mint::derive_compressed_mint_address(
let mint = Pubkey::from(create_compressed_mint::derive_cmint_compressed_address(
&mint_seed.pubkey(),
&address_tree,
));
Expand Down Expand Up @@ -369,7 +369,7 @@ async fn test_compressible_ctoken_bootstrap() {
// Create mint
let mint_seed = Keypair::new();
let address_tree = rpc.get_address_tree_v2().tree;
let mint = Pubkey::from(create_compressed_mint::derive_compressed_mint_address(
let mint = Pubkey::from(create_compressed_mint::derive_cmint_compressed_address(
&mint_seed.pubkey(),
&address_tree,
));
Expand Down
2 changes: 1 addition & 1 deletion program-libs/ctoken-interface/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use light_macros::pubkey_array;
use crate::state::CompressionInfo;

pub const CPI_AUTHORITY: [u8; 32] = pubkey_array!("GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy");
pub const COMPRESSED_TOKEN_PROGRAM_ID: [u8; 32] =
pub const CTOKEN_PROGRAM_ID: [u8; 32] =
pubkey_array!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m");

/// Account size constants
Expand Down
1 change: 1 addition & 0 deletions program-tests/compressed-token-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ light-ctoken-sdk = { workspace = true }
spl-token-2022 = { workspace = true }
spl-pod = { workspace = true }
light-zero-copy = { workspace = true , features = ["std", "derive", "mut"]}
light-compressed-token-types = { workspace = true }
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async fn test_spl_sdk_compatible_account_lifecycle() -> Result<(), RpcError> {
let destination_pubkey = destination_keypair.pubkey();

// Close account using SPL SDK compatible instruction
let close_account_ix = CloseAccount::new(
let close_account_ix = CloseCTokenAccount::new(
light_compressed_token::ID,
token_account_pubkey,
destination_pubkey,
Expand Down Expand Up @@ -272,7 +272,7 @@ async fn test_compressible_account_with_compression_authority_lifecycle() {
.unwrap();

// Close compressible account using owner
let close_account_ix = CloseAccount::new(
let close_account_ix = CloseCTokenAccount::new(
light_compressed_token::ID,
token_account_pubkey,
destination.pubkey(), // destination for user funds
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use light_ctoken_sdk::ctoken::{CloseAccount, CompressibleParams, CreateAssociatedTokenAccount};
use light_ctoken_sdk::ctoken::{
CloseCTokenAccount, CompressibleParams, CreateAssociatedTokenAccount,
};
use light_test_utils::assert_create_token_account::assert_create_associated_token_account;

use super::shared::*;
Expand Down Expand Up @@ -111,7 +113,7 @@ async fn test_associated_token_account_operations() {
.unwrap();

// Close compressible ATA
let close_account_ix = CloseAccount::new(
let close_account_ix = CloseCTokenAccount::new(
light_compressed_token::ID,
compressible_ata_pubkey,
destination.pubkey(), // destination for user funds
Expand Down
8 changes: 4 additions & 4 deletions program-tests/compressed-token-test/tests/ctoken/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pub use light_compressible::rent::{RentConfig, SLOTS_PER_EPOCH};
pub use light_ctoken_interface::COMPRESSIBLE_TOKEN_ACCOUNT_SIZE;
pub use light_ctoken_sdk::ctoken::{
derive_ctoken_ata, CloseAccount, CompressibleParams, CreateAssociatedTokenAccount,
derive_ctoken_ata, CloseCTokenAccount, CompressibleParams, CreateAssociatedTokenAccount,
CreateCTokenAccount,
};
pub use light_program_test::{
Expand Down Expand Up @@ -320,7 +320,7 @@ pub async fn close_and_assert_token_account(
panic!("Compressible account must have compressible extension");
};

CloseAccount {
CloseCTokenAccount {
token_program: light_compressed_token::ID,
account: token_account_pubkey,
destination,
Expand All @@ -330,7 +330,7 @@ pub async fn close_and_assert_token_account(
.instruction()
.unwrap()
} else {
CloseAccount {
CloseCTokenAccount {
token_program: light_compressed_token::ID,
account: token_account_pubkey,
destination,
Expand Down Expand Up @@ -378,7 +378,7 @@ pub async fn close_and_assert_token_account_fails(
let payer_pubkey = context.payer.pubkey();
let token_account_pubkey = context.token_account_keypair.pubkey();

let close_ix = CloseAccount {
let close_ix = CloseCTokenAccount {
token_program: light_compressed_token::ID,
account: token_account_pubkey,
destination,
Expand Down
24 changes: 12 additions & 12 deletions program-tests/compressed-token-test/tests/mint/cpi_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ use light_ctoken_interface::{
MintActionCompressedInstructionData,
},
state::CompressedMintMetadata,
CMINT_ADDRESS_TREE, COMPRESSED_TOKEN_PROGRAM_ID,
CMINT_ADDRESS_TREE, CTOKEN_PROGRAM_ID,
};
use light_ctoken_sdk::compressed_token::{
create_compressed_mint::{derive_compressed_mint_address, find_spl_mint_address},
create_compressed_mint::{derive_cmint_compressed_address, find_cmint_address},
mint_action::{
get_mint_action_instruction_account_metas_cpi_write, MintActionMetaConfig,
MintActionMetaConfigCpiWrite,
Expand Down Expand Up @@ -67,8 +67,8 @@ async fn test_setup() -> TestSetup {

// Derive addresses
let compressed_mint_address =
derive_compressed_mint_address(&mint_seed.pubkey(), &address_tree);
let (spl_mint_pda, _) = find_spl_mint_address(&mint_seed.pubkey());
derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree);
let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey());

// 3. Build compressed mint inputs
let compressed_mint_inputs = CompressedMintWithContext {
Expand Down Expand Up @@ -158,7 +158,7 @@ async fn test_write_to_cpi_context_create_mint() {

// Build compressed token instruction
let ctoken_instruction = Instruction {
program_id: Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID),
program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID),
accounts: account_metas,
data: data.clone(),
};
Expand All @@ -170,7 +170,7 @@ async fn test_write_to_cpi_context_create_mint() {
let wrapper_instruction = Instruction {
program_id: WRAPPER_PROGRAM_ID,
accounts: vec![AccountMeta::new_readonly(
Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID),
Pubkey::new_from_array(CTOKEN_PROGRAM_ID),
false,
)]
.into_iter()
Expand Down Expand Up @@ -279,7 +279,7 @@ async fn test_write_to_cpi_context_invalid_address_tree() {

// Build compressed token instruction
let ctoken_instruction = Instruction {
program_id: Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID),
program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID),
accounts: account_metas,
data: data.clone(),
};
Expand All @@ -291,7 +291,7 @@ async fn test_write_to_cpi_context_invalid_address_tree() {
let wrapper_instruction = Instruction {
program_id: WRAPPER_PROGRAM_ID,
accounts: vec![AccountMeta::new_readonly(
Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID),
Pubkey::new_from_array(CTOKEN_PROGRAM_ID),
false,
)]
.into_iter()
Expand Down Expand Up @@ -371,7 +371,7 @@ async fn test_write_to_cpi_context_invalid_compressed_address() {

// Build compressed token instruction
let ctoken_instruction = Instruction {
program_id: Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID),
program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID),
accounts: account_metas,
data: data.clone(),
};
Expand All @@ -383,7 +383,7 @@ async fn test_write_to_cpi_context_invalid_compressed_address() {
let wrapper_instruction = Instruction {
program_id: WRAPPER_PROGRAM_ID,
accounts: vec![AccountMeta::new_readonly(
Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID),
Pubkey::new_from_array(CTOKEN_PROGRAM_ID),
false,
)]
.into_iter()
Expand Down Expand Up @@ -466,7 +466,7 @@ async fn test_execute_cpi_context_invalid_tree_index() {

// Build compressed token instruction
let execute_instruction = Instruction {
program_id: Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID),
program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID),
accounts: account_metas,
data: data.clone(),
};
Expand All @@ -478,7 +478,7 @@ async fn test_execute_cpi_context_invalid_tree_index() {
let execute_wrapper_instruction = Instruction {
program_id: WRAPPER_PROGRAM_ID,
accounts: vec![AccountMeta::new_readonly(
Pubkey::new_from_array(COMPRESSED_TOKEN_PROGRAM_ID),
Pubkey::new_from_array(CTOKEN_PROGRAM_ID),
false,
)]
.into_iter()
Expand Down
6 changes: 3 additions & 3 deletions program-tests/compressed-token-test/tests/mint/edge_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use light_ctoken_interface::state::{
};
use light_ctoken_sdk::{
compressed_token::create_compressed_mint::{
derive_compressed_mint_address, find_spl_mint_address,
derive_cmint_compressed_address, find_cmint_address,
},
ctoken::{CompressibleParams, CreateAssociatedTokenAccount},
};
Expand Down Expand Up @@ -46,10 +46,10 @@ async fn functional_all_in_one_instruction() {
let address_tree_pubkey = rpc.get_address_tree_v2().tree;
// Derive compressed mint address for verification
let compressed_mint_address =
derive_compressed_mint_address(&mint_seed.pubkey(), &address_tree_pubkey);
derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey);

// Find mint PDA for the rest of the test
let (spl_mint_pda, _) = find_spl_mint_address(&mint_seed.pubkey());
let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey());
// 1. Create compressed mint with both authorities
{
create_mint(
Expand Down
16 changes: 8 additions & 8 deletions program-tests/compressed-token-test/tests/mint/failing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use light_client::indexer::Indexer;
use light_ctoken_interface::state::{extensions::AdditionalMetadata, CompressedMint};
use light_ctoken_sdk::{
compressed_token::create_compressed_mint::{
derive_compressed_mint_address, find_spl_mint_address,
derive_cmint_compressed_address, find_cmint_address,
},
ctoken::{CompressibleParams, CreateAssociatedTokenAccount},
};
Expand Down Expand Up @@ -60,10 +60,10 @@ async fn functional_and_failing_tests() {
let address_tree_pubkey = rpc.get_address_tree_v2().tree;
// Derive compressed mint address for verification
let compressed_mint_address =
derive_compressed_mint_address(&mint_seed.pubkey(), &address_tree_pubkey);
derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey);

// Find mint PDA for the rest of the test
let (spl_mint_pda, _) = find_spl_mint_address(&mint_seed.pubkey());
let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey());
// 1. Create compressed mint with both authorities
{
create_mint(
Expand Down Expand Up @@ -816,10 +816,10 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() {
CompressedMintWithContext, MintActionCompressedInstructionData, MintToCTokenAction,
},
state::TokenDataVersion,
COMPRESSED_TOKEN_PROGRAM_ID,
CTOKEN_PROGRAM_ID,
};
use light_ctoken_sdk::compressed_token::{
create_compressed_mint::derive_compressed_mint_address, mint_action::MintActionMetaConfig,
create_compressed_mint::derive_cmint_compressed_address, mint_action::MintActionMetaConfig,
};

let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None))
Expand All @@ -839,8 +839,8 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() {

let address_tree_pubkey = rpc.get_address_tree_v2().tree;
let compressed_mint_address =
derive_compressed_mint_address(&mint_seed.pubkey(), &address_tree_pubkey);
let (spl_mint_pda, _) = find_spl_mint_address(&mint_seed.pubkey());
derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey);
let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey());

// 1. Create compressed mint
light_token_client::actions::create_mint(
Expand Down Expand Up @@ -942,7 +942,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() {

// Build final instruction
let ix = Instruction {
program_id: COMPRESSED_TOKEN_PROGRAM_ID.into(),
program_id: CTOKEN_PROGRAM_ID.into(),
accounts: account_metas,
data,
};
Expand Down
Loading
Loading