chore: cherry-pick non-token diffs onto main#1953
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
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. Comment |
|
thanks lets merge this one first #1946 |
| }; | ||
| } | ||
|
|
||
| pub fn get_light_cpi_signer_seeds(program_id: &Pubkey) -> (Vec<Vec<u8>>, Pubkey) { |
There was a problem hiding this comment.
this exists in a different way now
| fn get_packed_account_metas(&self) -> Result<Vec<AccountMeta>>; | ||
| } | ||
|
|
||
| impl CpiAccountsExt for CpiAccounts<'_, '_> { |
| /// 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( |
There was a problem hiding this comment.
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> { |
| 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()); |
| .iter() | ||
| .map(|x| x.pubkey()) | ||
| .collect::<Vec<T::Pubkey>>()) | ||
| } |
| } | ||
|
|
||
| impl<'a, T: AccountInfoTrait> CpiAccounts<'a, T> { | ||
| impl<'a, T: AccountInfoTrait + Clone> CpiAccounts<'a, T> { |
| 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"); |
There was a problem hiding this comment.
pick all changes from this file
| options: Option<GetCompressedTokenAccountsByOwnerOrDelegateOptions>, | ||
| config: Option<IndexerRpcConfig>, | ||
| ) -> Result<Response<ItemsWithCursor<TokenAccount>>, IndexerError> { | ||
| ) -> Result<Response<ItemsWithCursor<CompressedTokenAccount>>, IndexerError> { |
There was a problem hiding this comment.
pick TokenAccount -> CompressedTokenAccount
| message.account_keys[..num_required_signatures].to_vec() | ||
| ); | ||
| RpcError::CustomError(e.to_string()) | ||
| })?; |
| impl From<litesvm::error::LiteSVMError> for RpcError { | ||
| fn from(e: litesvm::error::LiteSVMError) -> Self { | ||
| RpcError::LiteSvmError(e.to_string()) | ||
| } |
There was a problem hiding this comment.
don't pick we need these changes
| next_tree_info: None, | ||
| tree_type: TreeType::StateV2, | ||
| }, | ||
| ]; |
| account.merkle_context.tree | ||
| ); | ||
| IndexerError::InvalidResponseData | ||
| })?; |
| tree_pubkey.to_string() | ||
| ); | ||
| IndexerError::InvalidResponseData | ||
| })?; |
| tree_type: TreeType::StateV2, | ||
| next_tree_info: None, | ||
| }, | ||
| ); |
| tree_type: TreeType::StateV2, | ||
| next_tree_info: None, | ||
| }, | ||
| ); |
| /// --upgradeable-program <your_program_id> <your_program_path> ~/.config/solana/id.json" | ||
| /// | ||
| /// ``` | ||
| pub const LOOKUP_TABLE_ADDRESS: Pubkey = pubkey!("9NYFyEqPkyXUhkerbGHXUXkvb4qpzeEdHuGpgbgpH1NJ"); |
| #[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()) | ||
| } | ||
| } | ||
|
|
| 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; | ||
| } |
There was a problem hiding this comment.
don't pick already on main
No description provided.