feature: add new token program feature (backport #18780) (#18803)

* 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

(cherry picked from commit 51f3b9aa7c)

# Conflicts:
#	Cargo.lock
#	account-decoder/Cargo.toml
#	accounts-cluster-bench/Cargo.toml
#	programs/bpf/Cargo.lock
#	rpc/Cargo.toml
#	sdk/src/feature_set.rs
#	tokens/Cargo.toml
#	transaction-status/Cargo.toml

* Fix merge issues

* Re-generate lock files

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
This commit is contained in:
mergify[bot]
2021-07-21 15:05:45 +00:00
committed by GitHub
parent 1cdcabf7cf
commit 7427dafc36
18 changed files with 125 additions and 176 deletions

View File

@@ -5168,8 +5168,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)
@@ -5302,13 +5302,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),
);
@@ -11761,7 +11761,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);
@@ -11791,7 +11791,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");
}
/*