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

Commit f7abf4a

Browse files
authored
token-2022: Remove reallocate and sibling-instruction features (#3213)
1 parent 773e2ee commit f7abf4a

File tree

3 files changed

+13
-34
lines changed

3 files changed

+13
-34
lines changed

token/program-2022/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ exclude = ["js/**"]
1212
no-entrypoint = []
1313
test-bpf = []
1414
# Remove these features once the underlying syscalls are released on all networks
15-
default = ["reallocate", "sibling-instruction", "zk-ops"]
16-
reallocate = []
17-
sibling-instruction = []
15+
default = ["zk-ops"]
1816
zk-ops = []
1917

2018
[dependencies]

token/program-2022/src/extension/memo_transfer/mod.rs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
use {
22
crate::{
3+
error::TokenError,
34
extension::{Extension, ExtensionType, StateWithExtensionsMut},
45
pod::PodBool,
56
state::Account,
67
},
78
bytemuck::{Pod, Zeroable},
8-
solana_program::program_error::ProgramError,
9-
};
10-
11-
// Remove feature once sibling instruction syscall is available on all networks
12-
#[cfg(feature = "sibling-instruction")]
13-
use {
14-
crate::error::TokenError,
15-
solana_program::{instruction::get_processed_sibling_instruction, pubkey::Pubkey},
9+
solana_program::{
10+
instruction::get_processed_sibling_instruction, program_error::ProgramError, pubkey::Pubkey,
11+
},
1612
};
1713

1814
/// Memo Transfer extension instructions
@@ -42,17 +38,14 @@ pub fn memo_required(account_state: &StateWithExtensionsMut<Account>) -> bool {
4238

4339
/// Check if the previous sibling instruction is a memo
4440
pub fn check_previous_sibling_instruction_is_memo() -> Result<(), ProgramError> {
45-
#[cfg(feature = "sibling-instruction")]
46-
{
47-
let is_memo_program = |program_id: &Pubkey| -> bool {
48-
program_id == &spl_memo::id() || program_id == &spl_memo::v1::id()
49-
};
50-
let previous_instruction = get_processed_sibling_instruction(0);
51-
match previous_instruction {
52-
Some(instruction) if is_memo_program(&instruction.program_id) => {}
53-
_ => {
54-
return Err(TokenError::NoMemo.into());
55-
}
41+
let is_memo_program = |program_id: &Pubkey| -> bool {
42+
program_id == &spl_memo::id() || program_id == &spl_memo::v1::id()
43+
};
44+
let previous_instruction = get_processed_sibling_instruction(0);
45+
match previous_instruction {
46+
Some(instruction) if is_memo_program(&instruction.program_id) => {}
47+
_ => {
48+
return Err(TokenError::NoMemo.into());
5649
}
5750
}
5851
Ok(())

token/program-2022/src/extension/reallocate.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#[cfg(feature = "reallocate")]
21
use {
32
crate::{
43
error::TokenError,
@@ -17,18 +16,7 @@ use {
1716
},
1817
};
1918

20-
/// Stub implementation to remove when reallocate is released on all networks
21-
#[cfg(not(feature = "reallocate"))]
22-
pub fn process_reallocate(
23-
_program_id: &solana_program::pubkey::Pubkey,
24-
_accounts: &[solana_program::account_info::AccountInfo],
25-
_new_extension_types: Vec<crate::extension::ExtensionType>,
26-
) -> solana_program::entrypoint::ProgramResult {
27-
Err(solana_program::program_error::ProgramError::InvalidInstructionData)
28-
}
29-
3019
/// Processes a [Reallocate](enum.TokenInstruction.html) instruction
31-
#[cfg(feature = "reallocate")]
3220
pub fn process_reallocate(
3321
program_id: &Pubkey,
3422
accounts: &[AccountInfo],

0 commit comments

Comments
 (0)