Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ananas-block committed Jun 30, 2024
1 parent 355f934 commit 1848b1b
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl GroupAccess for StateMerkleTreeAccount {
&self.metadata.access_metadata.owner
}

fn get_delegate(&self) -> &Pubkey {
fn get_program_owner(&self) -> &Pubkey {
&self.metadata.access_metadata.program_owner
}
}
Expand Down
3 changes: 1 addition & 2 deletions programs/account-compression/src/state/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use anchor_lang::prelude::*;
pub struct AccessMetadata {
/// Owner of the Merkle tree.
pub owner: Pubkey,
// TODO: clean up all mention of delegate
/// Delegate of the Merkle tree. This will be used for program owned Merkle trees.
/// Program owner of the Merkle tree. This will be used for program owned Merkle trees.
pub program_owner: Pubkey,
}

Expand Down
3 changes: 1 addition & 2 deletions programs/account-compression/src/state/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ impl GroupAccess for AddressMerkleTreeAccount {
fn get_owner(&self) -> &Pubkey {
&self.metadata.access_metadata.owner
}
// TODO: rename to get_program_owner
fn get_delegate(&self) -> &Pubkey {
fn get_program_owner(&self) -> &Pubkey {
&self.metadata.access_metadata.program_owner
}
}
Expand Down
1 change: 0 additions & 1 deletion programs/account-compression/src/state/merkle_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub struct MerkleTreeMetadata {
pub next_merkle_tree: Pubkey,
}

// TODO: unit test
impl MerkleTreeMetadata {
pub fn init(
&mut self,
Expand Down
3 changes: 1 addition & 2 deletions programs/account-compression/src/state/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pub fn check_queue_type(queue_type: &u64, expected_queue_type: &QueueType) -> Re
Ok(())
}
}
// TODO: unit test
impl QueueMetadata {
pub fn init(
&mut self,
Expand Down Expand Up @@ -96,7 +95,7 @@ impl GroupAccess for QueueAccount {
&self.metadata.access_metadata.owner
}

fn get_delegate(&self) -> &Pubkey {
fn get_program_owner(&self) -> &Pubkey {
&self.metadata.access_metadata.program_owner
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::constants::CPI_AUTHORITY_PDA_SEED;

pub trait GroupAccess {
fn get_owner(&self) -> &Pubkey;
fn get_delegate(&self) -> &Pubkey;
fn get_program_owner(&self) -> &Pubkey;
}

pub trait GroupAccounts<'info> {
Expand Down
32 changes: 0 additions & 32 deletions programs/system/src/invoke_cpi/verify_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,36 +288,4 @@ mod test {
Err(SystemProgramError::WriteAccessCheckFailed.into())
);
}

// #[test]
// fn test_check_program_owner_state_merkle_tree() {
// let authority = Pubkey::new_unique();
// let mut state_merkle_tree_account = StateMerkleTreeAccount::default();
// state_merkle_tree_account
// .metadata
// .access_metadata
// .program_owner = authority;
// let mut lamports = 0;
// let merkle_tree_pubkey = Pubkey::new_unique();
// let account_info = AccountInfo::new(
// &merkle_tree_pubkey,
// false,
// false,
// &mut lamports,
// &mut state_merkle_tree_account.try_into().unwrap(),
// &authority,
// false,
// 0,
// );

// assert_eq!(
// check_program_owner_state_merkle_tree(&account_info, &Some(authority)),
// Ok((0, None, 1))
// );

// assert_eq!(
// check_program_owner_state_merkle_tree(&account_info, &None),
// Err(SystemProgramError::InvalidMerkleTreeOwner.into())
// );
// }
}
5 changes: 0 additions & 5 deletions programs/system/src/sdk/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ pub trait SignerAccounts<'info> {
fn get_fee_payer(&self) -> &Signer<'info>;
fn get_authority(&self) -> &Signer<'info>;
}

// pub trait InvokeCpiAccounts<'info> {
// fn get_invoking_program(&self) -> &UncheckedAccount<'info>;
// fn get_cpi_context_account(&mut self) -> &mut Option<Account<'info, CpiContextAccount>>;
// }

0 comments on commit 1848b1b

Please sign in to comment.