Skip to content

chore: cherry-pick non-token diffs onto main#1953

Closed
SwenSchaeferjohann wants to merge 6 commits into
mainfrom
swen/selected-changes-no-ctoken
Closed

chore: cherry-pick non-token diffs onto main#1953
SwenSchaeferjohann wants to merge 6 commits into
mainfrom
swen/selected-changes-no-ctoken

Conversation

@SwenSchaeferjohann
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 1, 2025

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ai-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch swen/selected-changes-no-ctoken

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ananas-block
Copy link
Copy Markdown
Contributor

thanks lets merge this one first #1946
It contains a part of the changes of this pr already.

Comment thread sdk-libs/sdk/src/utils.rs
};
}

pub fn get_light_cpi_signer_seeds(program_id: &Pubkey) -> (Vec<Vec<u8>>, Pubkey) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this exists in a different way now

fn get_packed_account_metas(&self) -> Result<Vec<AccountMeta>>;
}

impl CpiAccountsExt for CpiAccounts<'_, '_> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check

/// account exists but is empty (data: [], data_hash: [0, 1, 1, 1, 1, 1, 1,
/// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/// 1]).
pub fn new_mut_without_data(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exists but with zeroed 32 bytes array

use crate::CpiSigner;
// TODO: move to ctoken types
#[derive(Clone, Debug)]
pub struct CpiContextWriteAccounts<'a, T: AccountInfoTrait + Clone> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exists

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exists

pub fn to_account_infos(&self) -> Vec<T> {
// Skip system light program
let refs = &self.account_infos()[1..];
let mut account_infos = Vec::with_capacity(1 + refs.len());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

.iter()
.map(|x| x.pubkey())
.collect::<Vec<T::Pubkey>>())
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

}

impl<'a, T: AccountInfoTrait> CpiAccounts<'a, T> {
impl<'a, T: AccountInfoTrait + Clone> CpiAccounts<'a, T> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

Comment on lines +17 to +22
pub const COMPRESSED_TOKEN_PROGRAM_ID: [u8; 32] =
pubkey_array!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m");

/// ID of the compressed token program CPI authority PDA.
pub const COMPRESSED_TOKEN_PROGRAM_CPI_AUTHORITY: [u8; 32] =
pubkey_array!("GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick all changes from this file

options: Option<GetCompressedTokenAccountsByOwnerOrDelegateOptions>,
config: Option<IndexerRpcConfig>,
) -> Result<Response<ItemsWithCursor<TokenAccount>>, IndexerError> {
) -> Result<Response<ItemsWithCursor<CompressedTokenAccount>>, IndexerError> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick TokenAccount -> CompressedTokenAccount

message.account_keys[..num_required_signatures].to_vec()
);
RpcError::CustomError(e.to_string())
})?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

impl From<litesvm::error::LiteSVMError> for RpcError {
fn from(e: litesvm::error::LiteSVMError) -> Self {
RpcError::LiteSvmError(e.to_string())
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't pick we need these changes

next_tree_info: None,
tree_type: TreeType::StateV2,
},
];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

account.merkle_context.tree
);
IndexerError::InvalidResponseData
})?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

tree_pubkey.to_string()
);
IndexerError::InvalidResponseData
})?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

tree_type: TreeType::StateV2,
next_tree_info: None,
},
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

tree_type: TreeType::StateV2,
next_tree_info: None,
},
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

/// --upgradeable-program <your_program_id> <your_program_path> ~/.config/solana/id.json"
///
/// ```
pub const LOOKUP_TABLE_ADDRESS: Pubkey = pubkey!("9NYFyEqPkyXUhkerbGHXUXkvb4qpzeEdHuGpgbgpH1NJ");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

Comment on lines +176 to +191
#[cfg(feature = "solana")]
#[cfg(not(feature = "anchor"))]
impl From<solana_pubkey::Pubkey> for Pubkey {
fn from(pubkey: solana_pubkey::Pubkey) -> Self {
Self::new_from_array(pubkey.to_bytes())
}
}

#[cfg(feature = "solana")]
#[cfg(not(feature = "anchor"))]
impl From<&solana_pubkey::Pubkey> for Pubkey {
fn from(pubkey: &solana_pubkey::Pubkey) -> Self {
Self::new_from_array(pubkey.to_bytes())
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pick

Comment on lines +16 to +45
export function deriveAddressV2(
seed: Uint8Array,
addressMerkleTreePubkey: Uint8Array,
programIdBytes: Uint8Array,
): Uint8Array {
const slices = [seed, addressMerkleTreePubkey, programIdBytes];

return hashVWithBumpSeed(slices);
}

export function hashVWithBumpSeed(bytes: Uint8Array[]): Uint8Array {
const HASH_TO_FIELD_SIZE_SEED = 255; // u8::MAX

const hasher = keccak_256.create();

// Hash all input bytes
for (const input of bytes) {
hasher.update(input);
}

// Add the bump seed (just like Rust version)
hasher.update(new Uint8Array([HASH_TO_FIELD_SIZE_SEED]));

const hash = hasher.digest();

// Truncate to BN254 field size (just like Rust version)
hash[0] = 0;

return hash;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't pick already on main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants