Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

feature: add new token program feature #18780

Merged
merged 7 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5238,8 +5238,8 @@ impl Bank {
self.rent_collector.rent.burn_percent = 50; // 50% rent burn
}

if new_feature_activations.contains(&feature_set::spl_token_v2_self_transfer_fix::id()) {
self.apply_spl_token_v2_self_transfer_fix();
if new_feature_activations.contains(&feature_set::spl_token_v2_set_authority_fix::id()) {
self.apply_spl_token_v2_set_authority_fix();
}
// Remove me after a while around v1.6
if !self.no_stake_rewrite.load(Relaxed)
Expand Down Expand Up @@ -5372,13 +5372,13 @@ impl Bank {
}
}

fn apply_spl_token_v2_self_transfer_fix(&mut self) {
fn apply_spl_token_v2_set_authority_fix(&mut self) {
if let Some(old_account) = self.get_account_with_fixed_root(&inline_spl_token_v2_0::id()) {
if let Some(new_account) =
self.get_account_with_fixed_root(&inline_spl_token_v2_0::new_token_program::id())
{
datapoint_info!(
"bank-apply_spl_token_v2_self_transfer_fix",
"bank-apply_spl_token_v2_set_authority_fix",
("slot", self.slot, i64),
);

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/inline_spl_token_v2_0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
solana_sdk::declare_id!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");

pub(crate) mod new_token_program {
solana_sdk::declare_id!("t31zsgDmRntje65uXV3LrnWaJtJJpMd4LyJxq2R2VrU");
solana_sdk::declare_id!("NToKV6K2hAz79S73NtC9vVWrAGn77mBduBn95xQFGSZ");
}

/*
Expand Down
5 changes: 5 additions & 0 deletions sdk/src/feature_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ pub mod tx_wide_compute_cap {
solana_sdk::declare_id!("5ekBxc8itEnPv4NzGJtr8BVVQLNMQuLMNQQj7pHoLNZ9");
}

pub mod spl_token_v2_set_authority_fix {
solana_sdk::declare_id!("FToKNBYyiF4ky9s8WsmLBXHCht17Ek7RXaLZGHzzQhJ1");
}

lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
Expand Down Expand Up @@ -238,6 +242,7 @@ lazy_static! {
(rent_for_sysvars::id(), "collect rent from accounts owned by sysvars"),
(libsecp256k1_0_5_upgrade_enabled::id(), "upgrade libsecp256k1 to v0.5.0"),
(tx_wide_compute_cap::id(), "Transaction wide compute cap"),
(spl_token_v2_set_authority_fix::id(), "spl-token set_authority fix"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()
Expand Down