Repository: solana-labs/solana-program-library
Pull request #6898 (2024-06-24 09:30:30)

build(deps): bump strum from 0.26.2 to 0.26.3
Bumps [strum](https://github.com/Peternator7/strum) from 0.26.2 to 0.26.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/Peternator7/strum/releases">strum's releases</a>.</em></p>
<blockquote>
<h2>v0.26.3</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix typos &amp; misspellings in docs by <a href="https://github.com/5-pebbles"><code>@​5-pebbles</code></a> in <a href="https://redirect.github.com/Peternator7/strum/pull/347">Peternator7/strum#347</a></li>
<li>Update <code>heck</code> requirement by <a href="https://github.com/smoelius"><code>@​smoelius</code></a> in <a href="https://redirect.github.com/Peternator7/strum/pull/346">Peternator7/strum#346</a></li>
<li>Fix broken links by <a href="https://github.com/rainbowatcher"><code>@​rainbowatcher</code></a> in <a href="https://redirect.github.com/Peternator7/strum/pull/350">Peternator7/strum#350</a></li>
<li>Interpolate unnamed enum variant fields in to_string attribute by <a href="https://github.com/gin-ahirsch"><code>@​gin-ahirsch</code></a> in <a href="https://redirect.github.com/Peternator7/strum/pull/345">Peternator7/strum#345</a></li>
<li>add hyperlinks to documentation and clarify derive macros by <a href="https://github.com/lolbinarycat"><code>@​lolbinarycat</code></a> in <a href="https://redirect.github.com/Peternator7/strum/pull/355">Peternator7/strum#355</a></li>
<li>Use fully qualified syntax for calling <code>get</code> on an <code>EnumIter</code>, eliminating ambiguities by <a href="https://github.com/bluurryy"><code>@​bluurryy</code></a> in <a href="https://redirect.github.com/Peternator7/strum/pull/357">Peternator7/strum#357</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/5-pebbles"><code>@​5-pebbles</code></a> made their first contribution in <a href="https://redirect.github.com/Peternator7/strum/pull/347">Peternator7/strum#347</a></li>
<li><a href="https://github.com/rainbowatcher"><code>@​rainbowatcher</code></a> made their first contribution in <a href="https://redirect.github.com/Peternator7/strum/pull/350">Peternator7/strum#350</a></li>
<li><a href="https://github.com/gin-ahirsch"><code>@​gin-ahirsch</code></a> made their first contribution in <a href="https://redirect.github.com/Peternator7/strum/pull/345">Peternator7/strum#345</a></li>
<li><a href="https://github.com/lolbinarycat"><code>@​lolbinarycat</code></a> made their first contribution in <a href="https://redirect.github.com/Peternator7/strum/pull/355">Peternator7/strum#355</a></li>
<li><a href="https://github.com/bluurryy"><code>@​bluurryy</code></a> made their first contribution in <a href="https://redirect.github.com/Peternator7/strum/pull/357">Peternator7/strum#357</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/Peternator7/strum/compare/v0.26.2...v0.26.3">https://github.com/Peternator7/strum/compare/v0.26.2...v0.26.3</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/Peternator7/strum/blob/master/CHANGELOG.md">strum's changelog</a>.</em></p>
<blockquote>
<h2>0.26.3 (strum_macros)</h2>
<ul>
<li><a href="https://redirect.github.com/Peternator7/strum/pull/344">#344</a>: Hide <code>EnumTable</code> because it's going to be deprecated in the next
version.</li>
<li><a href="https://redirect.github.com/Peternator7/strum/pull/357">#357</a>: Fixes an incompatiblity with <code>itertools</code> by using the fully
qualified name rather than the inherent method.</li>
<li><a href="https://redirect.github.com/Peternator7/strum/pull/345">#345</a>: Allows unnamed tuple like variants to use their variants in
string interpolation. <code>#[strum(to_string = &quot;Field 0: {0}, Field 1: {1})&quot;)]</code> will now work for tuple variants</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/Peternator7/strum/commit/c89286fc2a4916ee61133aaa8d63fce83f6fc39e"><code>c89286f</code></a> Update changelog &amp; strum_macros version</li>
<li><a href="https://github.com/Peternator7/strum/commit/0c85c16e12e80dd49e75117e7c94f697d0ad06d0"><code>0c85c16</code></a> Use associated function syntax for calling <code>get</code> on an <code>EnumIter</code>, eliminatin...</li>
<li><a href="https://github.com/Peternator7/strum/commit/9689d7bb55bad0269c3fc9679a7434670139b12b"><code>9689d7b</code></a> add hyperlinks to documentation and clarify derive macros (<a href="https://redirect.github.com/Peternator7/strum/issues/355">#355</a>)</li>
<li><a href="https://github.com/Peternator7/strum/commit/186d29f6a1691b6356a2d85d66f8904b9a5d3140"><code>186d29f</code></a> Interpolate unnamed enum variant fields in to_string attribute (<a href="https://redirect.github.com/Peternator7/strum/issues/345">#345</a>)</li>
<li><a href="https://github.com/Peternator7/strum/commit/410062e122e001e6c3725cdc91483a0d4de5ca31"><code>410062e</code></a> Fix broken links (<a href="https://redirect.github.com/Peternator7/strum/issues/350">#350</a>)</li>
<li><a href="https://github.com/Peternator7/strum/commit/1e46337eb2ec71caccf2fc35929e2f0cbedbb3c2"><code>1e46337</code></a> Update <code>heck</code> requirement (<a href="https://redirect.github.com/Peternator7/strum/issues/346">#346</a>)</li>
<li><a href="https://github.com/Peternator7/strum/commit/f5fce032ed381a334e81676bd2c391353c265476"><code>f5fce03</code></a> Fix typos &amp; misspellings in docs (<a href="https://redirect.github.com/Peternator7/strum/issues/347">#347</a>)</li>
<li>See full diff in <a href="https://github.com/Peternator7/strum/compare/v0.26.2...v0.26.3">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=strum&package-manager=cargo&previous-version=0.26.2&new-version=0.26.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index c3a99960f..e47840269 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7645,7 +7645,7 @@ dependencies = [
  "spl-token-client",
  "spl-token-group-interface 0.2.3",
  "spl-token-metadata-interface 0.3.3",
- "strum 0.26.2",
+ "strum 0.26.3",
  "strum_macros 0.26.4",
  "tempfile",
  "tokio",
@@ -7916,7 +7916,7 @@ dependencies = [
  "spl-token-client",
  "spl-transfer-hook-example",
  "spl-transfer-hook-interface 0.6.3",
- "strum 0.26.2",
+ "strum 0.26.3",
  "strum_macros 0.26.4",
  "tokio",
 ]
@@ -8063,9 +8063,9 @@ dependencies = [
 
 [[package]]
 name = "strum"
-version = "0.26.2"
+version = "0.26.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29"
+checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
 
 [[package]]
 name = "strum_macros"
diff --git a/token/program-2022/src/extension/transfer_fee/instruction.rs b/token/program-2022/src/extension/transfer_fee/instruction.rs
index 7b634f435..f0cad6d22 100644
--- a/token/program-2022/src/extension/transfer_fee/instruction.rs
+++ b/token/program-2022/src/extension/transfer_fee/instruction.rs
@@ -50,14 +50,17 @@ pub enum TransferFeeInstruction {
     },
     /// Transfer, providing expected mint information and fees
     ///
+    /// This instruction succeeds if the mint has no configured transfer fee
+    /// and the provided fee is 0. This allows applications to use
+    /// `TransferCheckedWithFee` with any mint.
+    ///
     /// Accounts expected by this instruction:
     ///
     ///   * Single owner/delegate
-    ///   0. `[writable]` The source account. Must include the
+    ///   0. `[writable]` The source account. May include the
     ///      `TransferFeeAmount` extension.
-    ///   1. `[]` The token mint. Must include the `TransferFeeConfig`
-    ///      extension.
-    ///   2. `[writable]` The destination account. Must include the
+    ///   1. `[]` The token mint. May include the `TransferFeeConfig` extension.
+    ///   2. `[writable]` The destination account. May include the
     ///      `TransferFeeAmount` extension.
     ///   3. `[signer]` The source account's owner/delegate.
     ///
@@ -73,8 +76,8 @@ pub enum TransferFeeInstruction {
         /// Expected number of base 10 digits to the right of the decimal place.
         decimals: u8,
         /// Expected fee assessed on this transfer, calculated off-chain based
-        /// on the transfer_fee_basis_points and maximum_fee of the
-        /// mint.
+        /// on the transfer_fee_basis_points and maximum_fee of the mint. May
+        /// be 0 for a mint without a configured transfer fee.
         fee: u64,
     },
     /// Transfer all withheld tokens in the mint to an account. Signed by the
diff --git a/token/program-2022/src/lib.rs b/token/program-2022/src/lib.rs
index 74f827f67..7561c6b5d 100644
--- a/token/program-2022/src/lib.rs
+++ b/token/program-2022/src/lib.rs
@@ -25,11 +25,7 @@ mod entrypoint;
 // Export current sdk types for downstream users building with a different sdk
 // version
 use solana_program::{
-    entrypoint::ProgramResult,
-    program_error::ProgramError,
-    program_memory::sol_memcmp,
-    pubkey::{Pubkey, PUBKEY_BYTES},
-    system_program,
+    entrypoint::ProgramResult, program_error::ProgramError, pubkey::Pubkey, system_program,
 };
 pub use {solana_program, solana_zk_token_sdk};
 
@@ -132,9 +128,3 @@ pub fn check_system_program_account(system_program_id: &Pubkey) -> ProgramResult
     }
     Ok(())
 }
-
-/// Checks two pubkeys for equality in a computationally cheap way using
-/// `sol_memcmp`
-pub fn cmp_pubkeys(a: &Pubkey, b: &Pubkey) -> bool {
-    sol_memcmp(a.as_ref(), b.as_ref(), PUBKEY_BYTES) == 0
-}
diff --git a/token/program-2022/src/processor.rs b/token/program-2022/src/processor.rs
index 469b29f7f..88d8c1178 100644
--- a/token/program-2022/src/processor.rs
+++ b/token/program-2022/src/processor.rs
@@ -2,7 +2,7 @@
 
 use {
     crate::{
-        check_program_account, cmp_pubkeys,
+        check_program_account,
         error::TokenError,
         extension::{
             confidential_transfer::{self, ConfidentialTransferAccount, ConfidentialTransferMint},
@@ -192,7 +192,7 @@ impl Processor {
         account.base.delegate = PodCOption::none();
         account.base.delegated_amount = 0.into();
         account.base.state = starting_state.into();
-        if cmp_pubkeys(mint_info.key, &native_mint::id()) {
+        if mint_info.key == &native_mint::id() {
             let rent_exempt_reserve = rent.minimum_balance(new_account_info_data_len);
             account.base.is_native = PodCOption::some(rent_exempt_reserve.into());
             account.base.amount = new_account_info
@@ -296,6 +296,9 @@ impl Processor {
         let expected_mint_info = if let Some(expected_decimals) = expected_decimals {
             Some((next_account_info(account_info_iter)?, expected_decimals))
         } else {
+            // Transfer must not be called with an expected fee but no mint,
+            // otherwise it's a programmer error.
+            assert!(expected_fee.is_none());
             None
         };
 
@@ -321,7 +324,7 @@ impl Processor {
         }
         let (fee, maybe_permanent_delegate, maybe_transfer_hook_program_id) =
             if let Some((mint_info, expected_decimals)) = expected_mint_info {
-                if !cmp_pubkeys(&source_account.base.mint, mint_info.key) {
+                if &source_account.base.mint != mint_info.key {
                     return Err(TokenError::MintMismatch.into());
                 }
 
@@ -377,24 +380,34 @@ impl Processor {
             }
         }
 
-        let self_transfer = cmp_pubkeys(source_account_info.key, destination_account_info.key);
-        match (source_account.base.delegate, maybe_permanent_delegate) {
-            (_, Some(ref delegate)) if cmp_pubkeys(authority_info.key, delegate) => {
-                Self::validate_owner(
-                    program_id,
-                    delegate,
-                    authority_info,
-                    authority_info_data_len,
-                    account_info_iter.as_slice(),
-                )?
+        let self_transfer = source_account_info.key == destination_account_info.key;
+        if let Ok(cpi_guard) = source_account.get_extension::<CpiGuard>() {
+            // Blocks all cases where the authority has signed if CPI Guard is
+            // enabled, including:
+            // * the account is delegated to the owner
+            // * the account owner is the permanent delegate
+            if *authority_info.key == source_account.base.owner
+                && cpi_guard.lock_cpi.into()
+                && in_cpi()
+            {
+                return Err(TokenError::CpiGuardTransferBlocked.into());
             }
+        }
+        match (source_account.base.delegate, maybe_permanent_delegate) {
+            (_, Some(ref delegate)) if authority_info.key == delegate => Self::validate_owner(
+                program_id,
+                delegate,
+                authority_info,
+                authority_info_data_len,
+                account_info_iter.as_slice(),
+            )?,
             (
                 PodCOption {
                     option: PodCOption::<Pubkey>::SOME,
                     value: delegate,
                 },
                 _,
-            ) if cmp_pubkeys(authority_info.key, &delegate) => {
+            ) if authority_info.key == &delegate => {
                 Self::validate_owner(
                     program_id,
                     &delegate,
@@ -402,15 +415,6 @@ impl Processor {
                     authority_info_data_len,
                     account_info_iter.as_slice(),
                 )?;
-                if let Ok(cpi_guard) = source_account.get_extension::<CpiGuard>() {
-                    // If delegated to self, don't allow a transfer with CPI Guard
-                    if delegate == source_account.base.owner
-                        && cpi_guard.lock_cpi.into()
-                        && in_cpi()
-                    {
-                        return Err(TokenError::CpiGuardTransferBlocked.into());
-                    }
-                }
                 let delegated_amount = u64::from(source_account.base.delegated_amount);
                 if delegated_amount < amount {
                     return Err(TokenError::InsufficientFunds.into());
@@ -433,12 +437,6 @@ impl Processor {
                     authority_info_data_len,
                     account_info_iter.as_slice(),
                 )?;
-
-                if let Ok(cpi_guard) = source_account.get_extension::<CpiGuard>() {
-                    if cpi_guard.lock_cpi.into() && in_cpi() {
-                        return Err(TokenError::CpiGuardTransferBlocked.into());
-                    }
-                }
             }
         }
 
@@ -462,7 +460,7 @@ impl Processor {
         if destination_account.base.is_frozen() {
             return Err(TokenError::AccountFrozen.into());
         }
-        if !cmp_pubkeys(&source_account.base.mint, &destination_account.base.mint) {
+        if source_account.base.mint != destination_account.base.mint {
             return Err(TokenError::MintMismatch.into());
         }
 
@@ -570,7 +568,7 @@ impl Processor {
         }
 
         if let Some((mint_info, expected_decimals)) = expected_mint_info {
-            if !cmp_pubkeys(&source_account.base.mint, mint_info.key) {
+            if &source_account.base.mint != mint_info.key {
                 return Err(TokenError::MintMismatch.into());
             }
 
@@ -621,7 +619,7 @@ impl Processor {
                 PodCOption {
                     option: PodCOption::<Pubkey>::SOME,
                     value: delegate,
-                } if cmp_pubkeys(authority_info.key, delegate) => delegate,
+                } if authority_info.key == delegate => delegate,
                 _ => &source_account.base.owner,
             },
             authority_info,
@@ -936,7 +934,7 @@ impl Processor {
         if destination_account.base.is_native() {
             return Err(TokenError::NativeNotSupported.into());
         }
-        if !cmp_pubkeys(mint_info.key, &destination_account.base.mint) {
+        if mint_info.key != &destination_account.base.mint {
             return Err(TokenError::MintMismatch.into());
         }
 
@@ -1032,27 +1030,38 @@ impl Processor {
         }
         let maybe_permanent_delegate = get_permanent_delegate(&mint);
 
+        if let Ok(cpi_guard) = source_account.get_extension::<CpiGuard>() {
+            // Blocks all cases where the authority has signed if CPI Guard is
+            // enabled, including:
+            // * the account is delegated to the owner
+            // * the account owner is the permanent delegate
+            if *authority_info.key == source_account.base.owner
+                && cpi_guard.lock_cpi.into()
+                && in_cpi()
+            {
+                return Err(TokenError::CpiGuardBurnBlocked.into());
+            }
+        }
+
         if !source_account
             .base
             .is_owned_by_system_program_or_incinerator()
         {
             match (&source_account.base.delegate, maybe_permanent_delegate) {
-                (_, Some(ref delegate)) if cmp_pubkeys(authority_info.key, delegate) => {
-                    Self::validate_owner(
-                        program_id,
-                        delegate,
-                        authority_info,
-                        authority_info_data_len,
-                        account_info_iter.as_slice(),
-                    )?
-                }
+                (_, Some(ref delegate)) if authority_info.key == delegate => Self::validate_owner(
+                    program_id,
+                    delegate,
+                    authority_info,
+                    authority_info_data_len,
+                    account_info_iter.as_slice(),
+                )?,
                 (
                     PodCOption {
                         option: PodCOption::<Pubkey>::SOME,
                         value: delegate,
                     },
                     _,
-                ) if cmp_pubkeys(authority_info.key, delegate) => {
+                ) if authority_info.key == delegate => {
                     Self::validate_owner(
                         program_id,
                         delegate,
@@ -1081,12 +1090,6 @@ impl Processor {
                         authority_info_data_len,
                         account_info_iter.as_slice(),
                     )?;
-
-                    if let Ok(cpi_guard) = source_account.get_extension::<CpiGuard>() {
-                        if cpi_guard.lock_cpi.into() && in_cpi() {
-                            return Err(TokenError::CpiGuardBurnBlocked.into());
-                        }
-                    }
                 }
             }
         }
@@ -1117,7 +1120,7 @@ impl Processor {
         let authority_info = next_account_info(account_info_iter)?;
         let authority_info_data_len = authority_info.data_len();
 
-        if cmp_pubkeys(source_account_info.key, destination_account_info.key) {
+        if source_account_info.key == destination_account_info.key {
             return Err(ProgramError::InvalidAccountData);
         }
 
@@ -1141,7 +1144,7 @@ impl Processor {
                 if let Ok(cpi_guard) = source_account.get_extension::<CpiGuard>() {
                     if cpi_guard.lock_cpi.into()
                         && in_cpi()
-                        && !cmp_pubkeys(destination_account_info.key, &source_account.base.owner)
+                        && destination_account_info.key != &source_account.base.owner
                     {
                         return Err(TokenError::CpiGuardCloseAccountBlocked.into());
                     }
@@ -1227,7 +1230,7 @@ impl Processor {
         if source_account.base.is_native() {
             return Err(TokenError::NativeNotSupported.into());
         }
-        if !cmp_pubkeys(mint_info.key, &source_account.base.mint) {
+        if mint_info.key != &source_account.base.mint {
             return Err(TokenError::MintMismatch.into());
         }
 
@@ -1805,12 +1808,11 @@ impl Processor {
         owner_account_data_len: usize,
         signers: &[AccountInfo],
     ) -> ProgramResult {
-        if !cmp_pubkeys(expected_owner, owner_account_info.key) {
+        if expected_owner != owner_account_info.key {
             return Err(TokenError::OwnerMismatch.into());
         }
 
-        if cmp_pubkeys(program_id, owner_account_info.owner)
-            && owner_account_data_len == PodMultisig::SIZE_OF
+        if program_id == owner_account_info.owner && owner_account_data_len == PodMultisig::SIZE_OF
         {
             let multisig_data = &owner_account_info.data.borrow();
             let multisig = pod_from_bytes::<PodMultisig>(multisig_data)?;
@@ -1818,7 +1820,7 @@ impl Processor {
             let mut matched = [false; MAX_SIGNERS];
             for signer in signers.iter() {
                 for (position, key) in multisig.signers[0..multisig.n as usize].iter().enumerate() {
-                    if cmp_pubkeys(key, signer.key) && !matched[position] {
+                    if key == signer.key && !matched[position] {
                         if !signer.is_signer {
                             return Err(ProgramError::MissingRequiredSignature);
                         }


Test patch:
diff --git a/token/program-2022-test/tests/cpi_guard.rs b/token/program-2022-test/tests/cpi_guard.rs
index 5a6591afb..16b3ab754 100644
--- a/token/program-2022-test/tests/cpi_guard.rs
+++ b/token/program-2022-test/tests/cpi_guard.rs
@@ -420,6 +420,27 @@ async fn test_cpi_guard_burn() {
         let alice_state = token_obj.get_account_info(&alice.pubkey()).await.unwrap();
         assert_eq!(alice_state.base.amount, amount);
 
+        // delegate-auth cpi burn by self does not work
+        token_obj
+            .approve(
+                &alice.pubkey(),
+                &alice.pubkey(),
+                &alice.pubkey(),
+                1,
+                &[&alice],
+            )
+            .await
+            .unwrap();
+
+        let error = token_obj
+            .process_ixs(&[mk_burn(alice.pubkey(), do_checked)], &[&alice])
+            .await
+            .unwrap_err();
+        assert_eq!(error, client_error(TokenError::CpiGuardBurnBlocked));
+
+        let alice_state = token_obj.get_account_info(&alice.pubkey()).await.unwrap();
+        assert_eq!(alice_state.base.amount, amount);
+
         // delegate-auth cpi burn with cpi guard works
         token_obj
             .approve(
diff --git a/token/program-2022/tests/assert_instruction_count.rs b/token/program-2022/tests/assert_instruction_count.rs
index a6f03699b..aae242c7a 100644
--- a/token/program-2022/tests/assert_instruction_count.rs
+++ b/token/program-2022/tests/assert_instruction_count.rs
@@ -22,7 +22,7 @@ const TRANSFER_AMOUNT: u64 = 1_000_000_000_000_000;
 #[tokio::test]
 async fn initialize_mint() {
     let mut pt = ProgramTest::new("spl_token_2022", id(), processor!(Processor::process));
-    pt.set_compute_max_units(5_000); // last known 1378
+    pt.set_compute_max_units(5_000); // last known 1401
     let (mut banks_client, payer, recent_blockhash) = pt.start().await;
 
     let owner_key = Pubkey::new_unique();
@@ -60,7 +60,7 @@ async fn initialize_mint() {
 #[tokio::test]
 async fn initialize_account() {
     let mut pt = ProgramTest::new("spl_token_2022", id(), processor!(Processor::process));
-    pt.set_compute_max_units(8_000); // last known 1783
+    pt.set_compute_max_units(8_000); // last known 1620
     let (mut banks_client, payer, recent_blockhash) = pt.start().await;
 
     let owner = Keypair::new();
@@ -112,7 +112,7 @@ async fn initialize_account() {
 #[tokio::test]
 async fn mint_to() {
     let mut pt = ProgramTest::new("spl_token_2022", id(), processor!(Processor::process));
-    pt.set_compute_max_units(8_000); // last known 1115
+    pt.set_compute_max_units(8_000); // last known 967
     let (mut banks_client, payer, recent_blockhash) = pt.start().await;
 
     let owner = Keypair::new();
@@ -161,7 +161,7 @@ async fn mint_to() {
 #[tokio::test]
 async fn transfer() {
     let mut pt = ProgramTest::new("spl_token_2022", id(), processor!(Processor::process));
-    pt.set_compute_max_units(8_000); // last known 1502
+    pt.set_compute_max_units(8_000); // last known 1222
     let (mut banks_client, payer, recent_blockhash) = pt.start().await;
 
     let owner = Keypair::new();
@@ -229,7 +229,7 @@ async fn transfer() {
 #[tokio::test]
 async fn transfer_checked() {
     let mut pt = ProgramTest::new("spl_token_2022", id(), processor!(Processor::process));
-    pt.set_compute_max_units(8_000); // last known 1849
+    pt.set_compute_max_units(8_000); // last known 1516
     let (mut banks_client, payer, recent_blockhash) = pt.start().await;
 
     let owner = Keypair::new();
@@ -299,7 +299,7 @@ async fn transfer_checked() {
 #[tokio::test]
 async fn burn() {
     let mut pt = ProgramTest::new("spl_token_2022", id(), processor!(Processor::process));
-    pt.set_compute_max_units(8_000); // last known 1226
+    pt.set_compute_max_units(8_000); // last known 1070
     let (mut banks_client, payer, recent_blockhash) = pt.start().await;
 
     let owner = Keypair::new();
@@ -356,7 +356,7 @@ async fn burn() {
 #[tokio::test]
 async fn close_account() {
     let mut pt = ProgramTest::new("spl_token_2022", id(), processor!(Processor::process));
-    pt.set_compute_max_units(8_000); // last known 1315
+    pt.set_compute_max_units(8_000); // last known 1111
     let (mut banks_client, payer, recent_blockhash) = pt.start().await;
 
     let owner = Keypair::new();