Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 05bd8a6

Browse files
committed
remove ConfigureAccountWithRegistryInstructionData
1 parent 2c626e2 commit 05bd8a6

File tree

2 files changed

+10
-31
lines changed

2 files changed

+10
-31
lines changed

token/program-2022/src/extension/confidential_transfer/instruction.rs

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,9 @@ pub enum ConfidentialTransferInstruction {
486486
///
487487
/// If the token account is not large enough to include the new
488488
/// cconfidential transfer extension, then optionally reallocate the
489-
/// account to increase the data size.
489+
/// account to increase the data size. To reallocate, a payer account to
490+
/// fund the reallocation and the system account should be included in the
491+
/// instruction.
490492
///
491493
/// Accounts expected by this instruction:
492494
///
@@ -499,7 +501,7 @@ pub enum ConfidentialTransferInstruction {
499501
/// 4. `[]` (Optional) System program for reallocation funding
500502
///
501503
/// Data expected by this instruction:
502-
/// `ConfigureAccountWithRegistryInstructionData`
504+
/// None
503505
ConfigureAccountWithRegistry,
504506
}
505507

@@ -676,17 +678,6 @@ pub struct TransferWithFeeInstructionData {
676678
pub range_proof_instruction_offset: i8,
677679
}
678680

679-
/// Data expected by
680-
/// `ConfidentialTransferInstruction::ConfigureAccountWithRegistry`
681-
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
682-
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
683-
#[repr(C)]
684-
pub struct ConfigureAccountWithRegistryInstructionData {
685-
/// Reallocate token account if it is not large enough for the
686-
/// `ConfidentialTransfer` extension.
687-
pub reallocate_account: PodBool,
688-
}
689-
690681
/// Create a `InitializeMint` instruction
691682
pub fn initialize_mint(
692683
token_program_id: &Pubkey,
@@ -1756,21 +1747,16 @@ pub fn configure_account_with_registry(
17561747
AccountMeta::new_readonly(*mint, false),
17571748
AccountMeta::new_readonly(*elgamal_registry_account, false),
17581749
];
1759-
let reallocate_account = if let Some(payer) = payer {
1750+
if let Some(payer) = payer {
17601751
accounts.push(AccountMeta::new(*payer, true));
17611752
accounts.push(AccountMeta::new_readonly(system_program::id(), false));
1762-
true
1763-
} else {
1764-
false
1765-
};
1753+
}
17661754

17671755
Ok(encode_instruction(
17681756
token_program_id,
17691757
accounts,
17701758
TokenInstruction::ConfidentialTransferExtension,
17711759
ConfidentialTransferInstruction::ConfigureAccountWithRegistry,
1772-
&ConfigureAccountWithRegistryInstructionData {
1773-
reallocate_account: reallocate_account.into(),
1774-
},
1760+
&(),
17751761
))
17761762
}

token/program-2022/src/extension/confidential_transfer/processor.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ enum ElGamalPubkeySource<'a> {
107107
fn process_configure_account_with_registry(
108108
program_id: &Pubkey,
109109
accounts: &[AccountInfo],
110-
reallocate: bool,
111110
) -> ProgramResult {
112111
let account_info_iter = &mut accounts.iter();
113112
let token_account_info = next_account_info(account_info_iter)?;
@@ -116,8 +115,8 @@ fn process_configure_account_with_registry(
116115

117116
check_elgamal_registry_program_account(elgamal_registry_account.owner)?;
118117

119-
if reallocate {
120-
let payer_info = next_account_info(account_info_iter)?;
118+
// if a payer account for reallcation is provided, then reallocate
119+
if let Ok(payer_info) = next_account_info(account_info_iter) {
121120
let system_program_info = next_account_info(account_info_iter)?;
122121
reallocate_for_configure_account_with_registry(
123122
token_account_info,
@@ -1341,13 +1340,7 @@ pub(crate) fn process_instruction(
13411340
}
13421341
ConfidentialTransferInstruction::ConfigureAccountWithRegistry => {
13431342
msg!("ConfidentialTransferInstruction::ConfigureAccountWithRegistry");
1344-
let data =
1345-
decode_instruction_data::<ConfigureAccountWithRegistryInstructionData>(input)?;
1346-
process_configure_account_with_registry(
1347-
program_id,
1348-
accounts,
1349-
data.reallocate_account.into(),
1350-
)
1343+
process_configure_account_with_registry(program_id, accounts)
13511344
}
13521345
}
13531346
}

0 commit comments

Comments
 (0)