feature: add new token program feature (#18780)

* feature: add new token program feature

* Fixup test

* Update to spl-token v3.2.0

* Update Cargo.lock + fmt

* Update token program version in fetch-spl.sh

* Bump associated token program to 1.0.3

* Add aToken so
This commit is contained in:
Jon Cinque
2021-07-21 14:34:25 +02:00
committed by GitHub
parent bbd22f06f4
commit 51f3b9aa7c
17 changed files with 128 additions and 179 deletions

View File

@ -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)
@ -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),
);
@ -11782,7 +11782,7 @@ pub(crate) mod tests {
}
#[test]
fn test_spl_token_v2_self_transfer_fix() {
fn test_spl_token_v2_replacement() {
let (genesis_config, _mint_keypair) = create_genesis_config(0);
let mut bank = Bank::new(&genesis_config);
@ -11812,7 +11812,7 @@ pub(crate) mod tests {
let original_capitalization = bank.capitalization();
bank.apply_spl_token_v2_self_transfer_fix();
bank.apply_spl_token_v2_set_authority_fix();
// New token account is now empty
assert_eq!(

View File

@ -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");
}
/*