spl-token: New program feature flag (#21354)

* spl-token: Add feature flag for new release

* Remove all spl token version declarations
This commit is contained in:
Jon Cinque
2021-11-21 14:27:03 +01:00
committed by GitHub
parent 2ed7e3af89
commit 02bc4e3fc1
23 changed files with 229 additions and 245 deletions

View File

@@ -4,7 +4,7 @@ use crate::{
bucket_map_holder::{Age, BucketMapHolder},
contains::Contains,
in_mem_accounts_index::{InMemAccountsIndex, InsertNewEntryResults},
inline_spl_token_v2_0::{self, SPL_TOKEN_ACCOUNT_MINT_OFFSET, SPL_TOKEN_ACCOUNT_OWNER_OFFSET},
inline_spl_token::{self, SPL_TOKEN_ACCOUNT_MINT_OFFSET, SPL_TOKEN_ACCOUNT_OWNER_OFFSET},
pubkey_bins::PubkeyBinCalculator24,
secondary_index::*,
};
@@ -1556,8 +1556,8 @@ impl<T: IndexValue> AccountsIndex<T> {
// 2) When the fetch from storage occurs, it will return AccountSharedData::Default
// (as persisted tombstone for snapshots). This will then ultimately be
// filtered out by post-scan filters, like in `get_filtered_spl_token_accounts_by_owner()`.
if *account_owner == inline_spl_token_v2_0::id()
&& account_data.len() == inline_spl_token_v2_0::state::Account::get_packed_len()
if *account_owner == inline_spl_token::id()
&& account_data.len() == inline_spl_token::state::Account::get_packed_len()
{
if account_indexes.contains(&AccountIndex::SplTokenOwner) {
let owner_key = Pubkey::new(
@@ -3696,7 +3696,7 @@ pub mod tests {
let index_key = Pubkey::new_unique();
let account_key = Pubkey::new_unique();
let mut account_data = vec![0; inline_spl_token_v2_0::state::Account::get_packed_len()];
let mut account_data = vec![0; inline_spl_token::state::Account::get_packed_len()];
account_data[key_start..key_end].clone_from_slice(&(index_key.to_bytes()));
// Insert slots into secondary index
@@ -3705,7 +3705,7 @@ pub mod tests {
*slot,
&account_key,
// Make sure these accounts are added to secondary index
&inline_spl_token_v2_0::id(),
&inline_spl_token::id(),
&account_data,
secondary_indexes,
true,
@@ -3871,7 +3871,7 @@ pub mod tests {
let mut secondary_indexes = secondary_indexes.clone();
let account_key = Pubkey::new_unique();
let index_key = Pubkey::new_unique();
let mut account_data = vec![0; inline_spl_token_v2_0::state::Account::get_packed_len()];
let mut account_data = vec![0; inline_spl_token::state::Account::get_packed_len()];
account_data[key_start..key_end].clone_from_slice(&(index_key.to_bytes()));
// Wrong program id
@@ -3892,7 +3892,7 @@ pub mod tests {
index.upsert(
0,
&account_key,
&inline_spl_token_v2_0::id(),
&inline_spl_token::id(),
&account_data[1..],
&secondary_indexes,
true,
@@ -3908,7 +3908,7 @@ pub mod tests {
for _ in 0..2 {
index.update_secondary_indexes(
&account_key,
&inline_spl_token_v2_0::id(),
&inline_spl_token::id(),
&account_data,
&secondary_indexes,
);
@@ -3927,7 +3927,7 @@ pub mod tests {
secondary_index.reverse_index.clear();
index.update_secondary_indexes(
&account_key,
&inline_spl_token_v2_0::id(),
&inline_spl_token::id(),
&account_data,
&secondary_indexes,
);
@@ -3944,7 +3944,7 @@ pub mod tests {
secondary_index.reverse_index.clear();
index.update_secondary_indexes(
&account_key,
&inline_spl_token_v2_0::id(),
&inline_spl_token::id(),
&account_data,
&secondary_indexes,
);
@@ -4001,10 +4001,10 @@ pub mod tests {
let secondary_key1 = Pubkey::new_unique();
let secondary_key2 = Pubkey::new_unique();
let slot = 1;
let mut account_data1 = vec![0; inline_spl_token_v2_0::state::Account::get_packed_len()];
let mut account_data1 = vec![0; inline_spl_token::state::Account::get_packed_len()];
account_data1[index_key_start..index_key_end]
.clone_from_slice(&(secondary_key1.to_bytes()));
let mut account_data2 = vec![0; inline_spl_token_v2_0::state::Account::get_packed_len()];
let mut account_data2 = vec![0; inline_spl_token::state::Account::get_packed_len()];
account_data2[index_key_start..index_key_end]
.clone_from_slice(&(secondary_key2.to_bytes()));
@@ -4012,7 +4012,7 @@ pub mod tests {
index.upsert(
slot,
&account_key,
&inline_spl_token_v2_0::id(),
&inline_spl_token::id(),
&account_data1,
secondary_indexes,
true,
@@ -4024,7 +4024,7 @@ pub mod tests {
index.upsert(
slot,
&account_key,
&inline_spl_token_v2_0::id(),
&inline_spl_token::id(),
&account_data2,
secondary_indexes,
true,
@@ -4044,7 +4044,7 @@ pub mod tests {
index.upsert(
later_slot,
&account_key,
&inline_spl_token_v2_0::id(),
&inline_spl_token::id(),
&account_data1,
secondary_indexes,
true,