Repository: solana-labs/solana-program-library
Pull request #7068 (2024-07-29 10:48:46)

build(deps): bump @solana/web3.js from 1.95.1 to 1.95.2
Bumps [@solana/web3.js](https://github.com/solana-labs/solana-web3.js) from 1.95.1 to 1.95.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/solana-labs/solana-web3.js/releases"><code>@​solana/web3</code>.js's releases</a>.</em></p>
<blockquote>
<h2>v1.95.2</h2>
<h2><a href="https://github.com/solana-labs/solana-web3.js/compare/v1.95.1...v1.95.2">1.95.2</a> (2024-07-26)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>correct import for <code>getSetComputeUnitLimitInstruction</code> helper (<a href="https://redirect.github.com/solana-labs/solana-web3.js/issues/2992">#2992</a>) (<a href="https://github.com/solana-labs/solana-web3.js/commit/a61a73289bddd3c3426355627eaddff8f088dad6">a61a732</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/a61a73289bddd3c3426355627eaddff8f088dad6"><code>a61a732</code></a> fix: correct import for <code>getSetComputeUnitLimitInstruction</code> helper (<a href="https://redirect.github.com/solana-labs/solana-web3.js/issues/2992">#2992</a>)</li>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/f1dc13d37fba4170988f12a94351c3ae736950db"><code>f1dc13d</code></a> chore: bump pino from 9.3.1 to 9.3.2 (<a href="https://redirect.github.com/solana-labs/solana-web3.js/issues/2989">#2989</a>)</li>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/729ce0932cbca418a189f35211f36137fe8af7fd"><code>729ce09</code></a> chore: bump vite from 5.3.4 to 5.3.5 (<a href="https://redirect.github.com/solana-labs/solana-web3.js/issues/2990">#2990</a>)</li>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/c7f0f8fd39221437a54e063b8b1279b341a4e9a5"><code>c7f0f8f</code></a> chore: bump pino-pretty from 11.2.1 to 11.2.2 (<a href="https://redirect.github.com/solana-labs/solana-web3.js/issues/2988">#2988</a>)</li>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/a459675329a203de6e86b25f91b611ce08016dfb"><code>a459675</code></a> Increase timeout of test involving key generation because GitHub Actions runn...</li>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/2d2709e0e2d121e0b83084357c7e80fd502e8b85"><code>2d2709e</code></a> Use <code>lamports()</code> in deserialize transaction example (<a href="https://redirect.github.com/solana-labs/solana-web3.js/issues/2984">#2984</a>)</li>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/1ae2a805eb42ed72668dfa16d5390130c1624295"><code>1ae2a80</code></a> Remove <code>@types/prompts</code> from examples</li>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/e5e8c4a1221769e2f5bcb31a4c549907468cd160"><code>e5e8c4a</code></a> An example of how to use the new <code>@solana/web3.js</code> to deserialize and parse a...</li>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/44390790fafe5e0e0f04fb7ecfbe045c804158cb"><code>4439079</code></a> chore: bump <code>@​inquirer/core</code> from 9.0.4 to 9.0.5 (<a href="https://redirect.github.com/solana-labs/solana-web3.js/issues/2982">#2982</a>)</li>
<li><a href="https://github.com/solana-labs/solana-web3.js/commit/48f96cbfa34b83e80e3ecda46e59fb80e3108383"><code>48f96cb</code></a> chore: bump eslint-config-turbo from 2.0.7 to 2.0.9 (<a href="https://redirect.github.com/solana-labs/solana-web3.js/issues/2981">#2981</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/solana-labs/solana-web3.js/compare/v1.95.1...v1.95.2">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@solana/web3.js&package-manager=npm_and_yarn&previous-version=1.95.1&new-version=1.95.2)](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>

mergify[bot]: automerge label removed due to a CI failure

Patch:
diff --git a/account-compression/sdk/package.json b/account-compression/sdk/package.json
index a2df75441..6a3ce08a9 100644
--- a/account-compression/sdk/package.json
+++ b/account-compression/sdk/package.json
@@ -61,7 +61,7 @@
     "typescript-collections": "^1.3.3"
   },
   "peerDependencies": {
-    "@solana/web3.js": "^1.95.1"
+    "@solana/web3.js": "^1.95.2"
   },
   "devDependencies": {
     "@metaplex-foundation/rustbin": "^0.3.5",
diff --git a/memo/js/package.json b/memo/js/package.json
index eccd11807..0effcc339 100644
--- a/memo/js/package.json
+++ b/memo/js/package.json
@@ -46,13 +46,13 @@
         "deploy:docs": "npm run docs && gh-pages --dest memo/js --dist docs --dotfiles"
     },
     "peerDependencies": {
-        "@solana/web3.js": "^1.95.1"
+        "@solana/web3.js": "^1.95.2"
     },
     "dependencies": {
         "buffer": "^6.0.3"
     },
     "devDependencies": {
-        "@solana/web3.js": "^1.95.1",
+        "@solana/web3.js": "^1.95.2",
         "@types/chai": "^4.3.16",
         "@types/jest": "^29.5.12",
         "@types/node": "^22.0.0",
diff --git a/name-service/js/package.json b/name-service/js/package.json
index 5f86bb338..3499e7312 100644
--- a/name-service/js/package.json
+++ b/name-service/js/package.json
@@ -67,7 +67,7 @@
     "typescript": "^5.5.4"
   },
   "dependencies": {
-    "@solana/web3.js": "^1.95.1",
+    "@solana/web3.js": "^1.95.2",
     "bn.js": "^5.1.3",
     "borsh": "^2.0.0"
   }
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5f8a05821..1dafefa48 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -30,8 +30,8 @@ importers:
         specifier: ^0.4.1
         version: 0.4.1
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
       bn.js:
         specifier: ^5.2.1
         version: 5.2.1
@@ -198,8 +198,8 @@ importers:
         version: 6.0.3
     devDependencies:
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
       '@types/chai':
         specifier: ^4.3.16
         version: 4.3.16
@@ -267,8 +267,8 @@ importers:
   name-service/js:
     dependencies:
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
       bn.js:
         specifier: ^5.1.3
         version: 5.2.1
@@ -340,8 +340,8 @@ importers:
         specifier: 1.0.0
         version: link:../modern
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
     devDependencies:
       '@ava/typescript':
         specifier: ^5.0.0
@@ -406,10 +406,10 @@ importers:
         version: 4.0.1
       '@solana/spl-token':
         specifier: 0.4.6
-        version: 0.4.6(@solana/web3.js@1.95.1)(fastestsmallesttextencoderdecoder@1.0.22)
+        version: 0.4.6(@solana/web3.js@1.95.2)(fastestsmallesttextencoderdecoder@1.0.22)
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
       bn.js:
         specifier: ^5.2.0
         version: 5.2.1
@@ -506,8 +506,8 @@ importers:
         version: link:../../libraries/type-length-value/js
     devDependencies:
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
       '@types/chai':
         specifier: ^4.3.16
         version: 4.3.16
@@ -589,10 +589,10 @@ importers:
         version: 11.1.6(rollup@4.19.1)(tslib@2.6.3)(typescript@5.5.4)
       '@solana/spl-token':
         specifier: 0.4.6
-        version: 0.4.6(@solana/web3.js@1.95.1)(fastestsmallesttextencoderdecoder@1.0.22)
+        version: 0.4.6(@solana/web3.js@1.95.2)(fastestsmallesttextencoderdecoder@1.0.22)
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
       '@types/eslint':
         specifier: ^8.56.7
         version: 8.56.7
@@ -649,8 +649,8 @@ importers:
         version: link:../../libraries/type-length-value/js
     devDependencies:
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
       '@types/chai':
         specifier: ^4.3.16
         version: 4.3.16
@@ -717,10 +717,10 @@ importers:
     devDependencies:
       '@solana/spl-token':
         specifier: 0.4.6
-        version: 0.4.6(@solana/web3.js@1.95.1)(fastestsmallesttextencoderdecoder@1.0.22)
+        version: 0.4.6(@solana/web3.js@1.95.2)(fastestsmallesttextencoderdecoder@1.0.22)
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
       '@types/bn.js':
         specifier: ^5.1.0
         version: 5.1.5
@@ -783,7 +783,7 @@ importers:
         version: link:../../token-group/js
       '@solana/spl-token-metadata':
         specifier: ^0.1.3
-        version: 0.1.4(@solana/web3.js@1.95.1)(fastestsmallesttextencoderdecoder@1.0.22)
+        version: 0.1.4(@solana/web3.js@1.95.2)(fastestsmallesttextencoderdecoder@1.0.22)
       buffer:
         specifier: ^6.0.3
         version: 6.0.3
@@ -795,8 +795,8 @@ importers:
         specifier: 0.2.4
         version: link:../../memo/js
       '@solana/web3.js':
-        specifier: ^1.95.1
-        version: 1.95.1
+        specifier: ^1.95.2
+        version: 1.95.2
       '@types/chai':
         specifier: ^4.3.16
         version: 4.3.16
@@ -1227,8 +1227,8 @@ packages:
     resolution: {integrity: sha512-+P/vPdORawvg3A9Wj02iquxb4T0C5m4P6aZBVYysKl4Amk+r6aMPZkUhilBkD6E4Nuxnoajv3CFykUfkGE0n5g==}
     engines: {node: '>=11'}
     dependencies:
-      '@coral-xyz/borsh': 0.27.0(@solana/web3.js@1.95.1)
-      '@solana/web3.js': 1.95.1
+      '@coral-xyz/borsh': 0.27.0(@solana/web3.js@1.95.2)
+      '@solana/web3.js': 1.95.2
       base64-js: 1.5.1
       bn.js: 5.2.1
       bs58: 4.0.1
@@ -1248,13 +1248,13 @@ packages:
       - utf-8-validate
     dev: true
 
-  /@coral-xyz/borsh@0.27.0(@solana/web3.js@1.95.1):
+  /@coral-xyz/borsh@0.27.0(@solana/web3.js@1.95.2):
     resolution: {integrity: sha512-tJKzhLukghTWPLy+n8K8iJKgBq1yLT/AxaNd10yJrX8mI56ao5+OFAKAqW/h0i79KCvb4BK0VGO5ECmmolFz9A==}
     engines: {node: '>=10'}
     peerDependencies:
       '@solana/web3.js': ^1.68.0
     dependencies:
-      '@solana/web3.js': 1.95.1
+      '@solana/web3.js': 1.95.2
       bn.js: 5.2.1
       buffer-layout: 1.2.2
     dev: true
@@ -1848,7 +1848,7 @@ packages:
     resolution: {integrity: sha512-tgyEl6dvtLln8XX81JyBvWjIiEcjTkUwZbrM5dIobTmoqMuGewSyk9CClno8qsMsFdB5T3jC91Rjeqmu/6xk2g==}
     dependencies:
       '@metaplex-foundation/beet': 0.7.2
-      '@solana/web3.js': 1.95.1
+      '@solana/web3.js': 1.95.2
       bs58: 5.0.0
       debug: 4.3.6
     transitivePeerDependencies:
@@ -1862,7 +1862,7 @@ packages:
     resolution: {integrity: sha512-/6o32FNUtwK8tjhotrvU/vorP7umBuRFvBZrC6XCk51aKidBHe5LPVPA5AjGPbV3oftMfRuXPNd9yAGeEqeCDQ==}
     dependencies:
       '@metaplex-foundation/beet': 0.7.2
-      '@solana/web3.js': 1.95.1
+      '@solana/web3.js': 1.95.2
       bs58: 5.0.0
       debug: 4.3.4
     transitivePeerDependencies:
@@ -1900,7 +1900,7 @@ packages:
       '@metaplex-foundation/beet': 0.7.2
       '@metaplex-foundation/beet-solana': 0.3.1
       '@metaplex-foundation/rustbin': 0.3.5
-      '@solana/web3.js': 1.95.1
+      '@solana/web3.js': 1.95.2
       ansi-colors: 4.1.3
       camelcase: 6.3.0
       debug: 4.3.4
@@ -2337,7 +2337,7 @@ packages:
     engines: {node: '>= 10'}
     dependencies:
       '@solana/buffer-layout': 4.0.1
-      '@solana/web3.js': 1.95.1
+      '@solana/web3.js': 1.95.2
       bigint-buffer: 1.1.5
       bignumber.js: 9.1.2
     transitivePeerDependencies:
@@ -2569,7 +2569,7 @@ packages:
       ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
     dev: false
 
-  /@solana/spl-token-group@0.0.4(@solana/web3.js@1.95.1)(fastestsmallesttextencoderdecoder@1.0.22):
+  /@solana/spl-token-group@0.0.4(@solana/web3.js@1.95.2)(fastestsmallesttextencoderdecoder@1.0.22):
     resolution: {integrity: sha512-7+80nrEMdUKlK37V6kOe024+T7J4nNss0F8LQ9OOPYdWCCfJmsGUzVx2W3oeizZR4IHM6N4yC9v1Xqwc3BTPWw==}
     engines: {node: '>=16'}
     peerDependencies:
@@ -2577,11 +2577,11 @@ packages:
     dependencies:
       '@solana/codecs': 2.0.0-preview.2(fastestsmallesttextencoderdecoder@1.0.22)
       '@solana/spl-type-length-value': 0.1.0
-      '@solana/web3.js': 1.95.1
+      '@solana/web3.js': 1.95.2
     transitivePeerDependencies:
       - fastestsmallesttextencoderdecoder
 
-  /@solana/spl-token-metadata@0.1.4(@solana/web3.js@1.95.1)(fastestsmallesttextencoderdecoder@1.0.22):
+  /@solana/spl-token-metadata@0.1.4(@solana/web3.js@1.95.2)(fastestsmallesttextencoderdecoder@1.0.22):
     resolution: {integrity: sha512-N3gZ8DlW6NWDV28+vCCDJoTqaCZiF/jDUnk3o8GRkAFzHObiR60Bs1gXHBa8zCPdvOwiG6Z3dg5pg7+RW6XNsQ==}
     engines: {node: '>=16'}
     peerDependencies:
@@ -2589,11 +2589,11 @@ packages:
     dependencies:
       '@solana/codecs': 2.0.0-preview.2(fastestsmallesttextencoderdecoder@1.0.22)
       '@solana/spl-type-length-value': 0.1.0
-      '@solana/web3.js': 1.95.1
+      '@solana/web3.js': 1.95.2
     transitivePeerDependencies:
       - fastestsmallesttextencoderdecoder
 
-  /@solana/spl-token@0.4.6(@solana/web3.js@1.95.1)(fastestsmallesttextencoderdecoder@1.0.22):
+  /@solana/spl-token@0.4.6(@solana/web3.js@1.95.2)(fastestsmallesttextencoderdecoder@1.0.22):
     resolution: {integrity: sha512-1nCnUqfHVtdguFciVWaY/RKcQz1IF4b31jnKgAmjU9QVN1q7dRUkTEWJZgTYIEtsULjVnC9jRqlhgGN39WbKKA==}
     engines: {node: '>=16'}
     peerDependencies:
@@ -2601,9 +2601,9 @@ packages:
     dependencies:
       '@solana/buffer-layout': 4.0.1
       '@solana/buffer-layout-utils': 0.2.0
-      '@solana/spl-token-group': 0.0.4(@solana/web3.js@1.95.1)(fastestsmallesttextencoderdecoder@1.0.22)
-      '@solana/spl-token-metadata': 0.1.4(@solana/web3.js@1.95.1)(fastestsmallesttextencoderdecoder@1.0.22)
-      '@solana/web3.js': 1.95.1
+      '@solana/spl-token-group': 0.0.4(@solana/web3.js@1.95.2)(fastestsmallesttextencoderdecoder@1.0.22)
+      '@solana/spl-token-metadata': 0.1.4(@solana/web3.js@1.95.2)(fastestsmallesttextencoderdecoder@1.0.22)
+      '@solana/web3.js': 1.95.2
       buffer: 6.0.3
     transitivePeerDependencies:
       - bufferutil
@@ -2625,8 +2625,8 @@ packages:
       '@solana/keys': 2.0.0-experimental.21e994f
     dev: false
 
-  /@solana/web3.js@1.95.1:
-    resolution: {integrity: sha512-mRX/AjV6QbiOXpWcy5Rz1ZWEH2lVkwO7T0pcv9t97ACpv3/i3tPiqXwk0JIZgSR3wOSTiT26JfygnJH2ulS6dQ==}
+  /@solana/web3.js@1.95.2:
+    resolution: {integrity: sha512-SjlHp0G4qhuhkQQc+YXdGkI8EerCqwxvgytMgBpzMUQTafrkNant3e7pgilBGgjy/iM40ICvWBLgASTPMrQU7w==}
     dependencies:
       '@babel/runtime': 7.24.8
       '@noble/curves': 1.4.2
@@ -7741,7 +7741,7 @@ packages:
     resolution: {integrity: sha512-TS6vYoO/9YJZng7oiLOVyuz8V7yLow5Hp4SLYWW71XM3702v+z9f1fvUBKudRfa4dfpta4tRNufApSiBIALxJQ==}
     engines: {node: '>= 10'}
     dependencies:
-      '@solana/web3.js': 1.95.1
+      '@solana/web3.js': 1.95.2
       bs58: 4.0.1
     optionalDependencies:
       solana-bankrun-darwin-arm64: 0.2.0
diff --git a/single-pool/js/packages/classic/package.json b/single-pool/js/packages/classic/package.json
index 173b35f42..ffd97bdb0 100644
--- a/single-pool/js/packages/classic/package.json
+++ b/single-pool/js/packages/classic/package.json
@@ -30,7 +30,7 @@
     "typescript": "^5.5.4"
   },
   "dependencies": {
-    "@solana/web3.js": "^1.95.1",
+    "@solana/web3.js": "^1.95.2",
     "@solana/addresses": "=2.0.0-experimental.21e994f",
     "@solana/spl-single-pool": "1.0.0"
   },
diff --git a/stake-pool/cli/src/main.rs b/stake-pool/cli/src/main.rs
index 3c8e4af58..a777d8f6e 100644
--- a/stake-pool/cli/src/main.rs
+++ b/stake-pool/cli/src/main.rs
@@ -2,9 +2,6 @@
 mod client;
 mod output;
 
-// use instruction::create_associated_token_account once ATA 1.0.5 is released
-#[allow(deprecated)]
-use spl_associated_token_account::create_associated_token_account;
 use {
     crate::{
         client::*,
@@ -46,7 +43,9 @@ use {
         system_instruction,
         transaction::Transaction,
     },
-    spl_associated_token_account::get_associated_token_address,
+    spl_associated_token_account::{
+        get_associated_token_address, instruction::create_associated_token_account,
+    },
     spl_stake_pool::{
         self, find_stake_program_address, find_transient_stake_program_address,
         find_withdraw_authority_program_address,
@@ -298,6 +297,290 @@ fn new_stake_account(
     stake_receiver_keypair
 }
 
+fn setup_reserve_stake_account(
+    config: &Config,
+    reserve_keypair: &Keypair,
+    reserve_stake_balance: u64,
+    withdraw_authority: &Pubkey,
+) -> CommandResult {
+    let reserve_account_info = config.rpc_client.get_account(&reserve_keypair.pubkey());
+    if let Ok(account) = reserve_account_info {
+        if account.owner == stake::program::id() {
+            if account.data.iter().any(|&x| x != 0) {
+                println!(
+                    "Reserve stake account {} already exists and is initialized",
+                    reserve_keypair.pubkey()
+                );
+                return Ok(());
+            } else {
+                let instructions = vec![stake::instruction::initialize(
+                    &reserve_keypair.pubkey(),
+                    &stake::state::Authorized {
+                        staker: *withdraw_authority,
+                        withdrawer: *withdraw_authority,
+                    },
+                    &stake::state::Lockup::default(),
+                )];
+                let signers = vec![config.fee_payer.as_ref()];
+                let transaction =
+                    checked_transaction_with_signers(config, &instructions, &signers)?;
+                println!(
+                    "Initializing existing reserve stake account {}",
+                    reserve_keypair.pubkey()
+                );
+                send_transaction(config, transaction)?;
+                return Ok(());
+            }
+        }
+    }
+
+    let instructions = vec![
+        system_instruction::create_account(
+            &config.fee_payer.pubkey(),
+            &reserve_keypair.pubkey(),
+            reserve_stake_balance,
+            STAKE_STATE_LEN as u64,
+            &stake::program::id(),
+        ),
+        stake::instruction::initialize(
+            &reserve_keypair.pubkey(),
+            &stake::state::Authorized {
+                staker: *withdraw_authority,
+                withdrawer: *withdraw_authority,
+            },
+            &stake::state::Lockup::default(),
+        ),
+    ];
+
+    let signers = vec![config.fee_payer.as_ref(), reserve_keypair];
+    let transaction = checked_transaction_with_signers(config, &instructions, &signers)?;
+
+    println!(
+        "Creating and initializing reserve stake account {}",
+        reserve_keypair.pubkey()
+    );
+    send_transaction(config, transaction)?;
+    Ok(())
+}
+
+fn setup_mint_account(
+    config: &Config,
+    mint_keypair: &Keypair,
+    mint_account_balance: u64,
+    withdraw_authority: &Pubkey,
+    default_decimals: u8,
+) -> CommandResult {
+    let mint_account_info = config.rpc_client.get_account(&mint_keypair.pubkey());
+    if let Ok(account) = mint_account_info {
+        if account.owner == spl_token::id() {
+            if account.data.iter().any(|&x| x != 0) {
+                println!(
+                    "Mint account {} already exists and is initialized",
+                    mint_keypair.pubkey()
+                );
+                return Ok(());
+            } else {
+                let instructions = vec![spl_token::instruction::initialize_mint(
+                    &spl_token::id(),
+                    &mint_keypair.pubkey(),
+                    withdraw_authority,
+                    None,
+                    default_decimals,
+                )?];
+                let signers = vec![config.fee_payer.as_ref()];
+                let transaction =
+                    checked_transaction_with_signers(config, &instructions, &signers)?;
+                println!(
+                    "Initializing existing mint account {}",
+                    mint_keypair.pubkey()
+                );
+                send_transaction(config, transaction)?;
+                return Ok(());
+            }
+        }
+    }
+
+    let instructions = vec![
+        system_instruction::create_account(
+            &config.fee_payer.pubkey(),
+            &mint_keypair.pubkey(),
+            mint_account_balance,
+            spl_token::state::Mint::LEN as u64,
+            &spl_token::id(),
+        ),
+        spl_token::instruction::initialize_mint(
+            &spl_token::id(),
+            &mint_keypair.pubkey(),
+            withdraw_authority,
+            None,
+            default_decimals,
+        )?,
+    ];
+
+    let signers = vec![config.fee_payer.as_ref(), mint_keypair];
+    let transaction = checked_transaction_with_signers(config, &instructions, &signers)?;
+
+    println!(
+        "Creating and initializing mint account {}",
+        mint_keypair.pubkey()
+    );
+    send_transaction(config, transaction)?;
+    Ok(())
+}
+
+fn setup_pool_fee_account(
+    config: &Config,
+    mint_pubkey: &Pubkey,
+    total_rent_free_balances: &mut u64,
+) -> CommandResult {
+    let pool_fee_account = get_associated_token_address(&config.manager.pubkey(), mint_pubkey);
+    let pool_fee_account_info = config.rpc_client.get_account(&pool_fee_account);
+    if let Ok(account) = pool_fee_account_info {
+        if account.owner == spl_token::id() {
+            println!("Pool fee account {} already exists", pool_fee_account);
+            return Ok(());
+        }
+    }
+    // Create pool fee account
+    let mut instructions = vec![];
+    add_associated_token_account(
+        config,
+        mint_pubkey,
+        &config.manager.pubkey(),
+        &mut instructions,
+        total_rent_free_balances,
+    );
+
+    println!("Creating pool fee collection account {}", pool_fee_account);
+
+    let signers = vec![config.fee_payer.as_ref()];
+    let transaction = checked_transaction_with_signers(config, &instructions, &signers)?;
+
+    send_transaction(config, transaction)?;
+    Ok(())
+}
+
+#[allow(clippy::too_many_arguments)]
+fn setup_and_initialize_validator_list_with_stake_pool(
+    config: &Config,
+    stake_pool_keypair: &Keypair,
+    validator_list_keypair: &Keypair,
+    reserve_keypair: &Keypair,
+    mint_keypair: &Keypair,
+    pool_fee_account: &Pubkey,
+    deposit_authority: Option<Keypair>,
+    epoch_fee: Fee,
+    withdrawal_fee: Fee,
+    deposit_fee: Fee,
+    referral_fee: u8,
+    max_validators: u32,
+    withdraw_authority: &Pubkey,
+    validator_list_balance: u64,
+    validator_list_size: usize,
+) -> CommandResult {
+    let stake_pool_account_info = config.rpc_client.get_account(&stake_pool_keypair.pubkey());
+    let validator_list_account_info = config
+        .rpc_client
+        .get_account(&validator_list_keypair.pubkey());
+
+    let stake_pool_account_lamports = config
+        .rpc_client
+        .get_minimum_balance_for_rent_exemption(get_packed_len::<StakePool>())?;
+
+    let mut instructions = vec![];
+    let mut signers = vec![config.fee_payer.as_ref(), config.manager.as_ref()];
+
+    if let Ok(account) = validator_list_account_info {
+        if account.owner == spl_stake_pool::id() {
+            if account.data.iter().all(|&x| x == 0) {
+                println!(
+                    "Validator list account {} already exists and is ready to be initialized",
+                    validator_list_keypair.pubkey()
+                );
+            } else {
+                println!(
+                    "Validator list account {} already exists and is initialized",
+                    validator_list_keypair.pubkey()
+                );
+                return Ok(());
+            }
+        }
+    } else {
+        instructions.push(system_instruction::create_account(
+            &config.fee_payer.pubkey(),
+            &validator_list_keypair.pubkey(),
+            validator_list_balance,
+            validator_list_size as u64,
+            &spl_stake_pool::id(),
+        ));
+        signers.push(validator_list_keypair);
+    }
+
+    if let Ok(account) = stake_pool_account_info {
+        if account.owner == spl_stake_pool::id() {
+            if account.data.iter().all(|&x| x == 0) {
+                println!(
+                    "Stake pool account {} already exists but is not initialized",
+                    stake_pool_keypair.pubkey()
+                );
+            } else {
+                println!(
+                    "Stake pool account {} already exists and is initialized",
+                    stake_pool_keypair.pubkey()
+                );
+                return Ok(());
+            }
+        }
+    } else {
+        instructions.push(system_instruction::create_account(
+            &config.fee_payer.pubkey(),
+            &stake_pool_keypair.pubkey(),
+            stake_pool_account_lamports,
+            get_packed_len::<StakePool>() as u64,
+            &spl_stake_pool::id(),
+        ));
+    }
+    instructions.push(spl_stake_pool::instruction::initialize(
+        &spl_stake_pool::id(),
+        &stake_pool_keypair.pubkey(),
+        &config.manager.pubkey(),
+        &config.staker.pubkey(),
+        withdraw_authority,
+        &validator_list_keypair.pubkey(),
+        &reserve_keypair.pubkey(),
+        &mint_keypair.pubkey(),
+        pool_fee_account,
+        &spl_token::id(),
+        deposit_authority.as_ref().map(|x| x.pubkey()),
+        epoch_fee,
+        withdrawal_fee,
+        deposit_fee,
+        referral_fee,
+        max_validators,
+    ));
+    signers.push(stake_pool_keypair);
+
+    if let Some(ref deposit_auth) = deposit_authority {
+        signers.push(deposit_auth);
+        println!(
+            "Deposits will be restricted to {} only, this can be changed using the set-funding-authority command.",
+            deposit_auth.pubkey()
+        );
+    }
+
+    unique_signers!(signers);
+    let transaction = checked_transaction_with_signers(config, &instructions, &signers)?;
+
+    println!(
+        "Setting up and initializing stake pool account {} with validator list {}",
+        stake_pool_keypair.pubkey(),
+        validator_list_keypair.pubkey()
+    );
+    send_transaction(config, transaction)?;
+
+    Ok(())
+}
+
 #[allow(clippy::too_many_arguments)]
 fn command_create_pool(
     config: &Config,
@@ -316,14 +599,10 @@ fn command_create_pool(
     if !unsafe_fees {
         check_stake_pool_fees(&epoch_fee, &withdrawal_fee, &deposit_fee)?;
     }
-    let reserve_keypair = reserve_keypair.unwrap_or_else(Keypair::new);
-    println!("Creating reserve stake {}", reserve_keypair.pubkey());
 
+    let reserve_keypair = reserve_keypair.unwrap_or_else(Keypair::new);
     let mint_keypair = mint_keypair.unwrap_or_else(Keypair::new);
-    println!("Creating mint {}", mint_keypair.pubkey());
-
     let stake_pool_keypair = stake_pool_keypair.unwrap_or_else(Keypair::new);
-
     let validator_list_keypair = validator_list_keypair.unwrap_or_else(Keypair::new);
 
     let reserve_stake_balance = config
@@ -362,131 +641,45 @@ fn command_create_pool(
         println!("Stake pool withdraw authority {}", withdraw_authority);
     }
 
-    let mut setup_instructions = vec![
-        // Account for the stake pool reserve
-        system_instruction::create_account(
-            &config.fee_payer.pubkey(),
-            &reserve_keypair.pubkey(),
-            reserve_stake_balance,
-            STAKE_STATE_LEN as u64,
-            &stake::program::id(),
-        ),
-        stake::instruction::initialize(
-            &reserve_keypair.pubkey(),
-            &stake::state::Authorized {
-                staker: withdraw_authority,
-                withdrawer: withdraw_authority,
-            },
-            &stake::state::Lockup::default(),
-        ),
-        // Account for the stake pool mint
-        system_instruction::create_account(
-            &config.fee_payer.pubkey(),
-            &mint_keypair.pubkey(),
-            mint_account_balance,
-            spl_token::state::Mint::LEN as u64,
-            &spl_token::id(),
-        ),
-        // Initialize pool token mint account
-        spl_token::instruction::initialize_mint(
-            &spl_token::id(),
-            &mint_keypair.pubkey(),
-            &withdraw_authority,
-            None,
-            default_decimals,
-        )?,
-    ];
-
-    let pool_fee_account = add_associated_token_account(
+    setup_reserve_stake_account(
+        config,
+        &reserve_keypair,
+        reserve_stake_balance,
+        &withdraw_authority,
+    )?;
+    setup_mint_account(
+        config,
+        &mint_keypair,
+        mint_account_balance,
+        &withdraw_authority,
+        default_decimals,
+    )?;
+    setup_pool_fee_account(
         config,
         &mint_keypair.pubkey(),
-        &config.manager.pubkey(),
-        &mut setup_instructions,
         &mut total_rent_free_balances,
-    );
-    println!("Creating pool fee collection account {}", pool_fee_account);
-
-    let initialize_instructions = &[
-        // Validator stake account list storage
-        system_instruction::create_account(
-            &config.fee_payer.pubkey(),
-            &validator_list_keypair.pubkey(),
-            validator_list_balance,
-            validator_list_size as u64,
-            &spl_stake_pool::id(),
-        ),
-        // Account for the stake pool
-        system_instruction::create_account(
-            &config.fee_payer.pubkey(),
-            &stake_pool_keypair.pubkey(),
-            stake_pool_account_lamports,
-            get_packed_len::<StakePool>() as u64,
-            &spl_stake_pool::id(),
-        ),
-        // Initialize stake pool
-        spl_stake_pool::instruction::initialize(
-            &spl_stake_pool::id(),
-            &stake_pool_keypair.pubkey(),
-            &config.manager.pubkey(),
-            &config.staker.pubkey(),
-            &withdraw_authority,
-            &validator_list_keypair.pubkey(),
-            &reserve_keypair.pubkey(),
-            &mint_keypair.pubkey(),
-            &pool_fee_account,
-            &spl_token::id(),
-            deposit_authority.as_ref().map(|x| x.pubkey()),
-            epoch_fee,
-            withdrawal_fee,
-            deposit_fee,
-            referral_fee,
-            max_validators,
-        ),
-    ];
-
-    {
-        let mut setup_signers = vec![config.fee_payer.as_ref(), &mint_keypair, &reserve_keypair];
-        unique_signers!(setup_signers);
-
-        let setup_transaction =
-            checked_transaction_with_signers(config, &setup_instructions, &setup_signers)?;
-
-        println!(
-            "Setting up required accounts for stake pool: reserve stake {} and mint {}",
-            reserve_keypair.pubkey(),
-            mint_keypair.pubkey()
-        );
-        send_transaction(config, setup_transaction)?;
-    }
+    )?;
 
-    {
-        let mut initialize_signers = vec![
-            config.fee_payer.as_ref(),
-            &stake_pool_keypair,
-            &validator_list_keypair,
-            config.manager.as_ref(),
-        ];
-        let initialize_transaction = if let Some(deposit_authority) = deposit_authority {
-            println!(
-                "Deposits will be restricted to {} only, this can be changed using the set-funding-authority command.",
-                deposit_authority.pubkey()
-            );
-            let mut initialize_signers = initialize_signers.clone();
-            initialize_signers.push(&deposit_authority);
-            unique_signers!(initialize_signers);
-            checked_transaction_with_signers(config, initialize_instructions, &initialize_signers)?
-        } else {
-            unique_signers!(initialize_signers);
-            checked_transaction_with_signers(config, initialize_instructions, &initialize_signers)?
-        };
+    let pool_fee_account =
+        get_associated_token_address(&config.manager.pubkey(), &mint_keypair.pubkey());
 
-        println!(
-            "Creating stake pool {} with validator list {}",
-            stake_pool_keypair.pubkey(),
-            validator_list_keypair.pubkey()
-        );
-        send_transaction(config, initialize_transaction)?;
-    }
+    setup_and_initialize_validator_list_with_stake_pool(
+        config,
+        &stake_pool_keypair,
+        &validator_list_keypair,
+        &reserve_keypair,
+        &mint_keypair,
+        &pool_fee_account,
+        deposit_authority,
+        epoch_fee,
+        withdrawal_fee,
+        deposit_fee,
+        referral_fee,
+        max_validators,
+        &withdraw_authority,
+        validator_list_balance,
+        validator_list_size,
+    )?;
 
     Ok(())
 }
@@ -775,11 +968,11 @@ fn add_associated_token_account(
             .get_minimum_balance_for_rent_exemption(spl_token::state::Account::LEN)
             .unwrap();
 
-        #[allow(deprecated)]
         instructions.push(create_associated_token_account(
             &config.fee_payer.pubkey(),
             owner,
             mint,
+            &spl_token::id(),
         ));
 
         *rent_free_balances += min_account_balance;
diff --git a/stake-pool/js/package.json b/stake-pool/js/package.json
index 064afa8cf..7e791d4bd 100644
--- a/stake-pool/js/package.json
+++ b/stake-pool/js/package.json
@@ -45,7 +45,7 @@
   "dependencies": {
     "@solana/buffer-layout": "^4.0.1",
     "@solana/spl-token": "0.4.6",
-    "@solana/web3.js": "^1.95.1",
+    "@solana/web3.js": "^1.95.2",
     "bn.js": "^5.2.0",
     "buffer": "^6.0.3",
     "buffer-layout": "^1.2.2",
diff --git a/stake-pool/js/src/index.ts b/stake-pool/js/src/index.ts
index 27b75f2fd..a3f31d4b8 100644
--- a/stake-pool/js/src/index.ts
+++ b/stake-pool/js/src/index.ts
@@ -72,17 +72,6 @@ export interface StakePoolAccounts {
   validatorList: ValidatorListAccount | undefined;
 }
 
-interface RedelegateProps {
-  connection: Connection;
-  stakePoolAddress: PublicKey;
-  sourceVoteAccount: PublicKey;
-  destinationVoteAccount: PublicKey;
-  sourceTransientStakeSeed: number | BN;
-  destinationTransientStakeSeed: number | BN;
-  ephemeralStakeSeed: number | BN;
-  lamports: number | BN;
-}
-
 /**
  * Retrieves and deserializes a StakePool account using a web3js connection and the stake pool address.
  * @param connection: An active web3js connection.
@@ -1160,86 +1149,6 @@ export async function stakePoolInfo(connection: Connection, stakePoolAddress: Pu
   };
 }
 
-/**
- * Creates instructions required to redelegate stake.
- */
-export async function redelegate(props: RedelegateProps) {
-  const {
-    connection,
-    stakePoolAddress,
-    sourceVoteAccount,
-    sourceTransientStakeSeed,
-    destinationVoteAccount,
-    destinationTransientStakeSeed,
-    ephemeralStakeSeed,
-    lamports,
-  } = props;
-  const stakePool = await getStakePoolAccount(connection, stakePoolAddress);
-
-  const stakePoolWithdrawAuthority = await findWithdrawAuthorityProgramAddress(
-    STAKE_POOL_PROGRAM_ID,
-    stakePoolAddress,
-  );
-
-  const sourceValidatorStake = await findStakeProgramAddress(
-    STAKE_POOL_PROGRAM_ID,
-    sourceVoteAccount,
-    stakePoolAddress,
-  );
-
-  const sourceTransientStake = await findTransientStakeProgramAddress(
-    STAKE_POOL_PROGRAM_ID,
-    sourceVoteAccount,
-    stakePoolAddress,
-    new BN(sourceTransientStakeSeed),
-  );
-
-  const destinationValidatorStake = await findStakeProgramAddress(
-    STAKE_POOL_PROGRAM_ID,
-    destinationVoteAccount,
-    stakePoolAddress,
-  );
-
-  const destinationTransientStake = await findTransientStakeProgramAddress(
-    STAKE_POOL_PROGRAM_ID,
-    destinationVoteAccount,
-    stakePoolAddress,
-    new BN(destinationTransientStakeSeed),
-  );
-
-  const ephemeralStake = await findEphemeralStakeProgramAddress(
-    STAKE_POOL_PROGRAM_ID,
-    stakePoolAddress,
-    new BN(ephemeralStakeSeed),
-  );
-
-  const instructions: TransactionInstruction[] = [];
-
-  instructions.push(
-    StakePoolInstruction.redelegate({
-      stakePool: stakePool.pubkey,
-      staker: stakePool.account.data.staker,
-      validatorList: stakePool.account.data.validatorList,
-      reserveStake: stakePool.account.data.reserveStake,
-      stakePoolWithdrawAuthority,
-      ephemeralStake,
-      ephemeralStakeSeed,
-      sourceValidatorStake,
-      sourceTransientStake,
-      sourceTransientStakeSeed,
-      destinationValidatorStake,
-      destinationTransientStake,
-      destinationTransientStakeSeed,
-      validator: destinationVoteAccount,
-      lamports,
-    }),
-  );
-
-  return {
-    instructions,
-  };
-}
-
 /**
  * Creates instructions required to create pool token metadata.
  */
diff --git a/stake-pool/js/src/instructions.ts b/stake-pool/js/src/instructions.ts
index 970d67363..e792dd126 100644
--- a/stake-pool/js/src/instructions.ts
+++ b/stake-pool/js/src/instructions.ts
@@ -11,7 +11,6 @@ import {
 import * as BufferLayout from '@solana/buffer-layout';
 import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
 import { InstructionType, encodeData, decodeData } from './utils';
-import BN from 'bn.js';
 import {
   METADATA_MAX_NAME_LENGTH,
   METADATA_MAX_SYMBOL_LENGTH,
@@ -175,19 +174,7 @@ export const STAKE_POOL_INSTRUCTION_LAYOUTS: {
   },
   Redelegate: {
     index: 22,
-    layout: BufferLayout.struct<any>([
-      BufferLayout.u8('instruction'),
-      /// Amount of lamports to redelegate
-      BufferLayout.ns64('lamports'),
-      /// Seed used to create source transient stake account
-      BufferLayout.ns64('sourceTransientStakeSeed'),
-      /// Seed used to create destination ephemeral account.
-      BufferLayout.ns64('ephemeralStakeSeed'),
-      /// Seed used to create destination transient stake account. If there is
-      /// already transient stake, this must match the current seed, otherwise
-      /// it can be anything
-      BufferLayout.ns64('destinationTransientStakeSeed'),
-    ]),
+    layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),
   },
 });
 
@@ -340,30 +327,6 @@ export type DepositSolParams = {
   lamports: number;
 };
 
-export type RedelegateParams = {
-  stakePool: PublicKey;
-  staker: PublicKey;
-  stakePoolWithdrawAuthority: PublicKey;
-  validatorList: PublicKey;
-  reserveStake: PublicKey;
-  sourceValidatorStake: PublicKey;
-  sourceTransientStake: PublicKey;
-  ephemeralStake: PublicKey;
-  destinationTransientStake: PublicKey;
-  destinationValidatorStake: PublicKey;
-  validator: PublicKey;
-  // Amount of lamports to redelegate
-  lamports: number | BN;
-  // Seed used to create source transient stake account
-  sourceTransientStakeSeed: number | BN;
-  // Seed used to create destination ephemeral account
-  ephemeralStakeSeed: number | BN;
-  // Seed used to create destination transient stake account. If there is
-  // already transient stake, this must match the current seed, otherwise
-  // it can be anything
-  destinationTransientStakeSeed: number | BN;
-};
-
 export type CreateTokenMetadataParams = {
   stakePool: PublicKey;
   manager: PublicKey;
@@ -984,62 +947,6 @@ export class StakePoolInstruction {
     });
   }
 
-  /**
-   * Creates `Redelegate` instruction (rebalance from one validator account to another)
-   * @param params
-   */
-  static redelegate(params: RedelegateParams): TransactionInstruction {
-    const {
-      stakePool,
-      staker,
-      stakePoolWithdrawAuthority,
-      validatorList,
-      reserveStake,
-      sourceValidatorStake,
-      sourceTransientStake,
-      ephemeralStake,
-      destinationTransientStake,
-      destinationValidatorStake,
-      validator,
-      lamports,
-      sourceTransientStakeSeed,
-      ephemeralStakeSeed,
-      destinationTransientStakeSeed,
-    } = params;
-
-    const keys = [
-      { pubkey: stakePool, isSigner: false, isWritable: false },
-      { pubkey: staker, isSigner: true, isWritable: false },
-      { pubkey: stakePoolWithdrawAuthority, isSigner: false, isWritable: false },
-      { pubkey: validatorList, isSigner: false, isWritable: true },
-      { pubkey: reserveStake, isSigner: false, isWritable: true },
-      { pubkey: sourceValidatorStake, isSigner: false, isWritable: true },
-      { pubkey: sourceTransientStake, isSigner: false, isWritable: true },
-      { pubkey: ephemeralStake, isSigner: false, isWritable: true },
-      { pubkey: destinationTransientStake, isSigner: false, isWritable: true },
-      { pubkey: destinationValidatorStake, isSigner: false, isWritable: false },
-      { pubkey: validator, isSigner: false, isWritable: false },
-      { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },
-      { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },
-      { pubkey: STAKE_CONFIG_ID, isSigner: false, isWritable: false },
-      { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
-      { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },
-    ];
-
-    const data = encodeData(STAKE_POOL_INSTRUCTION_LAYOUTS.Redelegate, {
-      lamports,
-      sourceTransientStakeSeed,
-      ephemeralStakeSeed,
-      destinationTransientStakeSeed,
-    });
-
-    return new TransactionInstruction({
-      programId: STAKE_POOL_PROGRAM_ID,
-      keys,
-      data,
-    });
-  }
-
   /**
    * Creates an instruction to create metadata
    * using the mpl token metadata program for the pool token
diff --git a/stake-pool/program/src/instruction.rs b/stake-pool/program/src/instruction.rs
index 313afd930..5b370a938 100644
--- a/stake-pool/program/src/instruction.rs
+++ b/stake-pool/program/src/instruction.rs
@@ -1,5 +1,8 @@
 //! Instruction types
 
+// Remove the following `allow` when `Redelegate` is removed, required to avoid
+// warnings from uses of deprecated types during trait derivations.
+#![allow(deprecated)]
 #![allow(clippy::too_many_arguments)]
 
 use {
@@ -599,6 +602,10 @@ pub enum StakePoolInstruction {
     /// 13. `[]` Stake Config sysvar
     /// 14. `[]` System program
     /// 15. `[]` Stake program
+    #[deprecated(
+        since = "2.0.0",
+        note = "The stake redelegate instruction used in this will not be enabled."
+    )]
     Redelegate {
         /// Amount of lamports to redelegate
         #[allow(dead_code)] // but it's not
@@ -1051,6 +1058,10 @@ pub fn increase_additional_validator_stake(
 
 /// Creates `Redelegate` instruction (rebalance from one validator account to
 /// another)
+#[deprecated(
+    since = "2.0.0",
+    note = "The stake redelegate instruction used in this will not be enabled."
+)]
 pub fn redelegate(
     program_id: &Pubkey,
     stake_pool: &Pubkey,
diff --git a/stake-pool/program/src/processor.rs b/stake-pool/program/src/processor.rs
index 893346ebc..24887f26f 100644
--- a/stake-pool/program/src/processor.rs
+++ b/stake-pool/program/src/processor.rs
@@ -308,35 +308,6 @@ fn check_validator_stake_account(
     Ok(())
 }
 
-/// Checks if a transient stake account is valid, which means that it's usable
-/// by the pool and delegated to the expected validator. These conditions can be
-/// violated if a validator was force destaked during a cluster restart.
-fn check_transient_stake_account(
-    stake_account_info: &AccountInfo,
-    program_id: &Pubkey,
-    stake_pool: &Pubkey,
-    withdraw_authority: &Pubkey,
-    vote_account_address: &Pubkey,
-    seed: u64,
-    lockup: &stake::state::Lockup,
-) -> Result<(), ProgramError> {
-    check_account_owner(stake_account_info, &stake::program::id())?;
-    check_transient_stake_address(
-        program_id,
-        stake_pool,
-        stake_account_info.key,
-        vote_account_address,
-        seed,
-    )?;
-    check_stake_state(
-        stake_account_info,
-        withdraw_authority,
-        vote_account_address,
-        lockup,
-    )?;
-    Ok(())
-}
-
 /// Create a stake account on a PDA without transferring lamports
 fn create_stake_account(
     stake_account_info: AccountInfo<'_>,
@@ -592,41 +563,6 @@ impl Processor {
         )
     }
 
-    /// Issue stake::instruction::redelegate instruction to redelegate stake
-    #[allow(clippy::too_many_arguments)]
-    fn stake_redelegate<'a>(
-        stake_pool: &Pubkey,
-        source_account: AccountInfo<'a>,
-        authority: AccountInfo<'a>,
-        authority_type: &[u8],
-        bump_seed: u8,
-        destination_account: AccountInfo<'a>,
-        vote_account: AccountInfo<'a>,
-        stake_config: AccountInfo<'a>,
-    ) -> Result<(), ProgramError> {
-        let authority_signature_seeds = [stake_pool.as_ref(), authority_type, &[bump_seed]];
-        let signers = &[&authority_signature_seeds[..]];
-
-        let redelegate_instruction = &stake::instruction::redelegate(
-            source_account.key,
-            authority.key,
-            vote_account.key,
-            destination_account.key,
-        )[2];
-
-        invoke_signed(
-            redelegate_instruction,
-            &[
-                source_account,
-                destination_account,
-                vote_account,
-                stake_config,
-                authority,
-            ],
-            signers,
-        )
-    }
-
     /// Issue a spl_token `Burn` instruction.
     #[allow(clippy::too_many_arguments)]
     fn token_burn<'a>(
@@ -1842,346 +1778,6 @@ impl Processor {
         Ok(())
     }
 
-    /// Processes `Redelegate` instruction.
-    #[inline(never)] // needed due to stack size violation
-    fn process_redelegate(
-        program_id: &Pubkey,
-        accounts: &[AccountInfo],
-        lamports: u64,
-        source_transient_stake_seed: u64,
-        ephemeral_stake_seed: u64,
-        destination_transient_stake_seed: u64,
-    ) -> ProgramResult {
-        let account_info_iter = &mut accounts.iter();
-        let stake_pool_info = next_account_info(account_info_iter)?;
-        let staker_info = next_account_info(account_info_iter)?;
-        let withdraw_authority_info = next_account_info(account_info_iter)?;
-        let validator_list_info = next_account_info(account_info_iter)?;
-        let reserve_stake_info = next_account_info(account_info_iter)?;
-        let source_validator_stake_account_info = next_account_info(account_info_iter)?;
-        let source_transient_stake_account_info = next_account_info(account_info_iter)?;
-        let ephemeral_stake_account_info = next_account_info(account_info_iter)?;
-        let destination_transient_stake_account_info = next_account_info(account_info_iter)?;
-        let destination_validator_stake_account_info = next_account_info(account_info_iter)?;
-        let validator_vote_account_info = next_account_info(account_info_iter)?;
-        let clock_info = next_account_info(account_info_iter)?;
-        let clock = &Clock::from_account_info(clock_info)?;
-        let stake_history_info = next_account_info(account_info_iter)?;
-        let stake_config_info = next_account_info(account_info_iter)?;
-        let system_program_info = next_account_info(account_info_iter)?;
-        let stake_program_info = next_account_info(account_info_iter)?;
-
-        check_system_program(system_program_info.key)?;
-        check_stake_program(stake_program_info.key)?;
-        check_account_owner(stake_pool_info, program_id)?;
-
-        let stake_pool = try_from_slice_unchecked::<StakePool>(&stake_pool_info.data.borrow())?;
-        if !stake_pool.is_valid() {
-            msg!("Expected valid stake pool");
-            return Err(StakePoolError::InvalidState.into());
-        }
-
-        stake_pool.check_authority_withdraw(
-            withdraw_authority_info.key,
-            program_id,
-            stake_pool_info.key,
-        )?;
-        stake_pool.check_staker(staker_info)?;
-
-        if stake_pool.last_update_epoch < clock.epoch {
-            return Err(StakePoolError::StakeListAndPoolOutOfDate.into());
-        }
-
-        stake_pool.check_validator_list(validator_list_info)?;
-        check_account_owner(validator_list_info, program_id)?;
-        stake_pool.check_reserve_stake(reserve_stake_info)?;
-
-        let mut validator_list_data = validator_list_info.data.borrow_mut();
-        let (header, mut validator_list) =
-            ValidatorListHeader::deserialize_vec(&mut validator_list_data)?;
-        if !header.is_valid() {
-            return Err(StakePoolError::InvalidState.into());
-        }
-
-        let rent = Rent::get()?;
-        let stake_space = std::mem::size_of::<stake::state::StakeStateV2>();
-        let stake_rent = rent.minimum_balance(stake_space);
-        let stake_minimum_delegation = stake::tools::get_minimum_delegation()?;
-        let current_minimum_delegation = minimum_delegation(stake_minimum_delegation);
-
-        // check that we're redelegating enough
-        {
-            // redelegation requires that the source account maintains rent exemption and
-            // that the destination account has rent-exemption and minimum
-            // delegation
-            let minimum_redelegation_lamports =
-                current_minimum_delegation.saturating_add(stake_rent);
-            if lamports < minimum_redelegation_lamports {
-                msg!(
-                    "Need more than {} lamports for redelegated stake and transient stake to meet minimum delegation requirement, {} provided",
-                    minimum_redelegation_lamports,
-                    lamports
-                );
-                return Err(ProgramError::Custom(
-                    stake::instruction::StakeError::InsufficientDelegation as u32,
-                ));
-            }
-
-            // check that we're not draining the source account
-            let current_minimum_lamports = stake_rent.saturating_add(current_minimum_delegation);
-            if source_validator_stake_account_info
-                .lamports()
-                .saturating_sub(lamports)
-                < current_minimum_lamports
-            {
-                let max_split_amount = source_validator_stake_account_info
-                    .lamports()
-                    .saturating_sub(current_minimum_lamports);
-                msg!(
-                    "Source stake does not have {} lamports for redelegation, must be {} at most",
-                    lamports,
-                    max_split_amount,
-                );
-                return Err(ProgramError::InsufficientFunds);
-            }
-        }
-
-        // check source account state
-        let (_, stake) = get_stake_state(source_validator_stake_account_info)?;
-        let vote_account_address = stake.delegation.voter_pubkey;
-        {
-            let maybe_validator_stake_info =
-                validator_list.find_mut::<ValidatorStakeInfo, _>(|x| {
-                    ValidatorStakeInfo::memcmp_pubkey(x, &vote_account_address)
-                });
-            if maybe_validator_stake_info.is_none() {
-                msg!(
-                    "Source vote account {} not found in stake pool",
-                    vote_account_address
-                );
-                return Err(StakePoolError::ValidatorNotFound.into());
-            }
-            let validator_stake_info = maybe_validator_stake_info.unwrap();
-            check_validator_stake_address(
-                program_id,
-                stake_pool_info.key,
-                source_validator_stake_account_info.key,
-                &vote_account_address,
-                NonZeroU32::new(validator_stake_info.validator_seed_suffix.into()),
-            )?;
-            if u64::from(validator_stake_info.transient_stake_lamports) > 0 {
-                return Err(StakePoolError::TransientAccountInUse.into());
-            }
-            if validator_stake_info.status != StakeStatus::Active.into() {
-                msg!("Validator is marked for removal and no longer allows redelegation");
-                return Err(StakePoolError::ValidatorNotFound.into());
-            }
-            validator_stake_info.active_stake_lamports =
-                u64::from(validator_stake_info.active_stake_lamports)
-                    .checked_sub(lamports)
-                    .ok_or(StakePoolError::CalculationFailure)?
-                    .into();
-            validator_stake_info.transient_stake_lamports = stake_rent.into();
-            validator_stake_info.transient_seed_suffix = source_transient_stake_seed.into();
-        }
-
-        // split from source, into source transient
-        {
-            // check transient account
-            let source_transient_stake_bump_seed = check_transient_stake_address(
-                program_id,
-                stake_pool_info.key,
-                source_transient_stake_account_info.key,
-                &vote_account_address,
-                source_transient_stake_seed,
-            )?;
-            let source_transient_stake_account_signer_seeds: &[&[_]] = &[
-                TRANSIENT_STAKE_SEED_PREFIX,
-                vote_account_address.as_ref(),
-                stake_pool_info.key.as_ref(),
-                &source_transient_stake_seed.to_le_bytes(),
-                &[source_transient_stake_bump_seed],
-            ];
-
-            create_stake_account(
-                source_transient_stake_account_info.clone(),
-                source_transient_stake_account_signer_seeds,
-                stake_space,
-            )?;
-
-            // if needed, pre-fund the rent-exempt reserve from the reserve stake
-            let required_lamports_for_rent_exemption =
-                stake_rent.saturating_sub(source_transient_stake_account_info.lamports());
-            if required_lamports_for_rent_exemption > 0 {
-                if required_lamports_for_rent_exemption >= reserve_stake_info.lamports() {
-                    return Err(StakePoolError::ReserveDepleted.into());
-                }
-                Self::stake_withdraw(
-                    stake_pool_info.key,
-                    reserve_stake_info.clone(),
-                    withdraw_authority_info.clone(),
-                    AUTHORITY_WITHDRAW,
-                    stake_pool.stake_withdraw_bump_seed,
-                    source_transient_stake_account_info.clone(),
-                    clock_info.clone(),
-                    stake_history_info.clone(),
-                    required_lamports_for_rent_exemption,
-                )?;
-            }
-            Self::stake_split(
-                stake_pool_info.key,
-                source_validator_stake_account_info.clone(),
-                withdraw_authority_info.clone(),
-                AUTHORITY_WITHDRAW,
-                stake_pool.stake_withdraw_bump_seed,
-                lamports,
-                source_transient_stake_account_info.clone(),
-            )?;
-        }
-
-        // redelegate from source transient to ephemeral
-        {
-            let ephemeral_stake_bump_seed = check_ephemeral_stake_address(
-                program_id,
-                stake_pool_info.key,
-                ephemeral_stake_account_info.key,
-                ephemeral_stake_seed,
-            )?;
-            let ephemeral_stake_account_signer_seeds: &[&[_]] = &[
-                EPHEMERAL_STAKE_SEED_PREFIX,
-                stake_pool_info.key.as_ref(),
-                &ephemeral_stake_seed.to_le_bytes(),
-                &[ephemeral_stake_bump_seed],
-            ];
-            create_stake_account(
-                ephemeral_stake_account_info.clone(),
-                ephemeral_stake_account_signer_seeds,
-                stake_space,
-            )?;
-            Self::stake_redelegate(
-                stake_pool_info.key,
-                source_transient_stake_account_info.clone(),
-                withdraw_authority_info.clone(),
-                AUTHORITY_WITHDRAW,
-                stake_pool.stake_withdraw_bump_seed,
-                ephemeral_stake_account_info.clone(),
-                validator_vote_account_info.clone(),
-                stake_config_info.clone(),
-            )?;
-        }
-
-        {
-            // check destination stake and transient stake accounts
-            let vote_account_address = validator_vote_account_info.key;
-            let maybe_validator_stake_info =
-                validator_list.find_mut::<ValidatorStakeInfo, _>(|x| {
-                    ValidatorStakeInfo::memcmp_pubkey(x, vote_account_address)
-                });
-            if maybe_validator_stake_info.is_none() {
-                msg!(
-                    "Destination vote account {} not found in stake pool",
-                    vote_account_address
-                );
-                return Err(StakePoolError::ValidatorNotFound.into());
-            }
-            let validator_stake_info = maybe_validator_stake_info.unwrap();
-            check_validator_stake_account(
-                destination_validator_stake_account_info,
-                program_id,
-                stake_pool_info.key,
-                withdraw_authority_info.key,
-                vote_account_address,
-                validator_stake_info.validator_seed_suffix.into(),
-                &stake_pool.lockup,
-            )?;
-            if validator_stake_info.status != StakeStatus::Active.into() {
-                msg!(
-                    "Destination validator is marked for removal and no longer allows redelegation"
-                );
-                return Err(StakePoolError::ValidatorNotFound.into());
-            }
-            let transient_account_exists =
-                u64::from(validator_stake_info.transient_stake_lamports) > 0;
-            validator_stake_info.transient_stake_lamports =
-                u64::from(validator_stake_info.transient_stake_lamports)
-                    .checked_add(lamports)
-                    .ok_or(StakePoolError::CalculationFailure)?
-                    .into();
-
-            if transient_account_exists {
-                // if transient stake exists, make sure it's the right one and that it's
-                // usable by the pool
-                if u64::from(validator_stake_info.transient_seed_suffix)
-                    != destination_transient_stake_seed
-                {
-                    msg!("Provided seed {} does not match current seed {} for transient stake account",
-                        destination_transient_stake_seed,
-                        u64::from(validator_stake_info.transient_seed_suffix)
-                    );
-                    return Err(StakePoolError::InvalidStakeAccountAddress.into());
-                }
-                check_transient_stake_account(
-                    destination_transient_stake_account_info,
-                    program_id,
-                    stake_pool_info.key,
-                    withdraw_authority_info.key,
-                    vote_account_address,
-                    destination_transient_stake_seed,
-                    &stake_pool.lockup,
-                )?;
-                check_if_stake_activating(
-                    destination_transient_stake_account_info,
-                    vote_account_address,
-                    clock.epoch,
-                )?;
-                Self::stake_merge(
-                    stake_pool_info.key,
-                    ephemeral_stake_account_info.clone(),
-                    withdraw_authority_info.clone(),
-                    AUTHORITY_WITHDRAW,
-                    stake_pool.stake_withdraw_bump_seed,
-                    destination_transient_stake_account_info.clone(),
-                    clock_info.clone(),
-                    stake_history_info.clone(),
-                )?;
-            } else {
-                // otherwise, create the new account and split into it
-                let destination_transient_stake_bump_seed = check_transient_stake_address(
-                    program_id,
-                    stake_pool_info.key,
-                    destination_transient_stake_account_info.key,
-                    vote_account_address,
-                    destination_transient_stake_seed,
-                )?;
-                let destination_transient_stake_account_signer_seeds: &[&[_]] = &[
-                    TRANSIENT_STAKE_SEED_PREFIX,
-                    vote_account_address.as_ref(),
-                    stake_pool_info.key.as_ref(),
-                    &destination_transient_stake_seed.to_le_bytes(),
-                    &[destination_transient_stake_bump_seed],
-                ];
-                create_stake_account(
-                    destination_transient_stake_account_info.clone(),
-                    destination_transient_stake_account_signer_seeds,
-                    stake_space,
-                )?;
-                Self::stake_split(
-                    stake_pool_info.key,
-                    ephemeral_stake_account_info.clone(),
-                    withdraw_authority_info.clone(),
-                    AUTHORITY_WITHDRAW,
-                    stake_pool.stake_withdraw_bump_seed,
-                    lamports,
-                    destination_transient_stake_account_info.clone(),
-                )?;
-                validator_stake_info.transient_seed_suffix =
-                    destination_transient_stake_seed.into();
-            }
-        }
-
-        Ok(())
-    }
-
     /// Process `SetPreferredValidator` instruction
     #[inline(never)] // needed due to stack size violation
     fn process_set_preferred_validator(
@@ -4012,21 +3608,10 @@ impl Processor {
                 msg!("Instruction: UpdateTokenMetadata");
                 Self::process_update_pool_token_metadata(program_id, accounts, name, symbol, uri)
             }
-            StakePoolInstruction::Redelegate {
-                lamports,
-                source_transient_stake_seed,
-                ephemeral_stake_seed,
-                destination_transient_stake_seed,
-            } => {
-                msg!("Instruction: Redelegate");
-                Self::process_redelegate(
-                    program_id,
-                    accounts,
-                    lamports,
-                    source_transient_stake_seed,
-                    ephemeral_stake_seed,
-                    destination_transient_stake_seed,
-                )
+            #[allow(deprecated)]
+            StakePoolInstruction::Redelegate { .. } => {
+                msg!("Instruction: Redelegate will not be enabled");
+                Err(ProgramError::InvalidInstructionData)
             }
             StakePoolInstruction::DepositStakeWithSlippage {
                 minimum_pool_tokens_out,
diff --git a/token-group/js/package.json b/token-group/js/package.json
index 3789602af..f421c1efc 100644
--- a/token-group/js/package.json
+++ b/token-group/js/package.json
@@ -44,14 +44,14 @@
         "watch": "tsc --build --verbose --watch tsconfig.all.json"
     },
     "peerDependencies": {
-        "@solana/web3.js": "^1.95.1"
+        "@solana/web3.js": "^1.95.2"
     },
     "dependencies": {
         "@solana/codecs": "2.0.0-preview.4",
         "@solana/spl-type-length-value": "0.1.0"
     },
     "devDependencies": {
-        "@solana/web3.js": "^1.95.1",
+        "@solana/web3.js": "^1.95.2",
         "@types/chai": "^4.3.16",
         "@types/mocha": "^10.0.7",
         "@types/node": "^22.0.0",
diff --git a/token-lending/js/package.json b/token-lending/js/package.json
index 08c5beeda..0359a0374 100644
--- a/token-lending/js/package.json
+++ b/token-lending/js/package.json
@@ -45,7 +45,7 @@
         "@rollup/plugin-node-resolve": "^15.0.2",
         "@rollup/plugin-typescript": "^11.1.6",
         "@solana/spl-token": "0.4.6",
-        "@solana/web3.js": "^1.95.1",
+        "@solana/web3.js": "^1.95.2",
         "@types/eslint": "^8.56.7",
         "@types/eslint-plugin-prettier": "^3.1.0",
         "@types/node": "^22.0.0",
diff --git a/token-metadata/js/package.json b/token-metadata/js/package.json
index 12f68aec4..0af8410cf 100644
--- a/token-metadata/js/package.json
+++ b/token-metadata/js/package.json
@@ -44,14 +44,14 @@
         "watch": "tsc --build --verbose --watch tsconfig.all.json"
     },
     "peerDependencies": {
-        "@solana/web3.js": "^1.95.1"
+        "@solana/web3.js": "^1.95.2"
     },
     "dependencies": {
         "@solana/codecs": "2.0.0-preview.4",
         "@solana/spl-type-length-value": "0.1.0"
     },
     "devDependencies": {
-        "@solana/web3.js": "^1.95.1",
+        "@solana/web3.js": "^1.95.2",
         "@types/chai": "^4.3.16",
         "@types/mocha": "^10.0.7",
         "@types/node": "^22.0.0",
diff --git a/token-swap/js/package.json b/token-swap/js/package.json
index 27666f268..0c32cd1ee 100644
--- a/token-swap/js/package.json
+++ b/token-swap/js/package.json
@@ -48,11 +48,11 @@
     "@solana/buffer-layout-utils": "^0.2.0"
   },
   "peerDependencies": {
-    "@solana/web3.js": "^1.95.1"
+    "@solana/web3.js": "^1.95.2"
   },
   "devDependencies": {
     "@solana/spl-token": "0.4.6",
-    "@solana/web3.js": "^1.95.1",
+    "@solana/web3.js": "^1.95.2",
     "@types/bn.js": "^5.1.0",
     "@types/chai-as-promised": "^7.1.4",
     "@types/chai": "^4.3.16",
diff --git a/token/js/package.json b/token/js/package.json
index 5626f2b69..e803d9207 100644
--- a/token/js/package.json
+++ b/token/js/package.json
@@ -51,7 +51,7 @@
         "deploy:docs": "npm run docs && gh-pages --dest token/js --dist docs --dotfiles"
     },
     "peerDependencies": {
-        "@solana/web3.js": "^1.95.1"
+        "@solana/web3.js": "^1.95.2"
     },
     "dependencies": {
         "@solana/buffer-layout": "^4.0.0",
@@ -63,7 +63,7 @@
     "devDependencies": {
         "@solana/codecs-strings": "2.0.0-preview.4",
         "@solana/spl-memo": "0.2.4",
-        "@solana/web3.js": "^1.95.1",
+        "@solana/web3.js": "^1.95.2",
         "@types/chai-as-promised": "^7.1.4",
         "@types/chai": "^4.3.16",
         "@types/mocha": "^10.0.7",


Test patch:
diff --git a/stake-pool/js/test/instructions.test.ts b/stake-pool/js/test/instructions.test.ts
index 490e777fb..c3e9b7c99 100644
--- a/stake-pool/js/test/instructions.test.ts
+++ b/stake-pool/js/test/instructions.test.ts
@@ -27,7 +27,6 @@ import {
   depositSol,
   withdrawSol,
   withdrawStake,
-  redelegate,
   getStakeAccount,
   createPoolTokenMetadata,
   updatePoolTokenMetadata,
@@ -498,31 +497,6 @@ describe('StakePoolProgram', () => {
     });
   });
 
-  describe('redelegation', () => {
-    it('should call successfully', async () => {
-      const data = {
-        connection,
-        stakePoolAddress,
-        sourceVoteAccount: PublicKey.default,
-        sourceTransientStakeSeed: 10,
-        destinationVoteAccount: PublicKey.default,
-        destinationTransientStakeSeed: 20,
-        ephemeralStakeSeed: 100,
-        lamports: 100,
-      };
-      const res = await redelegate(data);
-
-      const decodedData = STAKE_POOL_INSTRUCTION_LAYOUTS.Redelegate.layout.decode(
-        res.instructions[0].data,
-      );
-
-      expect(decodedData.instruction).toBe(22);
-      expect(decodedData.lamports).toBe(data.lamports);
-      expect(decodedData.sourceTransientStakeSeed).toBe(data.sourceTransientStakeSeed);
-      expect(decodedData.destinationTransientStakeSeed).toBe(data.destinationTransientStakeSeed);
-      expect(decodedData.ephemeralStakeSeed).toBe(data.ephemeralStakeSeed);
-    });
-  });
   describe('createPoolTokenMetadata', () => {
     it('should create pool token metadata', async () => {
       connection.getAccountInfo = jest.fn(async (pubKey: PublicKey) => {
diff --git a/stake-pool/program/tests/helpers/mod.rs b/stake-pool/program/tests/helpers/mod.rs
index eb785ff63..89baa0215 100644
--- a/stake-pool/program/tests/helpers/mod.rs
+++ b/stake-pool/program/tests/helpers/mod.rs
@@ -1942,54 +1942,6 @@ impl StakePoolAccounts {
         }
     }
 
-    #[allow(clippy::too_many_arguments)]
-    pub async fn redelegate(
-        &self,
-        banks_client: &mut BanksClient,
-        payer: &Keypair,
-        recent_blockhash: &Hash,
-        source_validator_stake: &Pubkey,
-        source_transient_stake: &Pubkey,
-        ephemeral_stake: &Pubkey,
-        destination_transient_stake: &Pubkey,
-        destination_validator_stake: &Pubkey,
-        validator: &Pubkey,
-        lamports: u64,
-        source_transient_stake_seed: u64,
-        ephemeral_stake_seed: u64,
-        destination_transient_stake_seed: u64,
-    ) -> Option<TransportError> {
-        let transaction = Transaction::new_signed_with_payer(
-            &[instruction::redelegate(
-                &id(),
-                &self.stake_pool.pubkey(),
-                &self.staker.pubkey(),
-                &self.withdraw_authority,
-                &self.validator_list.pubkey(),
-                &self.reserve_stake.pubkey(),
-                source_validator_stake,
-                source_transient_stake,
-                ephemeral_stake,
-                destination_transient_stake,
-                destination_validator_stake,
-                validator,
-                lamports,
-                source_transient_stake_seed,
-                ephemeral_stake_seed,
-                destination_transient_stake_seed,
-            )],
-            Some(&payer.pubkey()),
-            &[payer, &self.staker],
-            *recent_blockhash,
-        );
-        #[allow(clippy::useless_conversion)] // Remove during upgrade to 1.10
-        banks_client
-            .process_transaction(transaction)
-            .await
-            .map_err(|e| e.into())
-            .err()
-    }
-
     pub async fn set_preferred_validator(
         &self,
         banks_client: &mut BanksClient,
diff --git a/stake-pool/program/tests/redelegate.rs b/stake-pool/program/tests/redelegate.rs
deleted file mode 100644
index 3256eef11..000000000
--- a/stake-pool/program/tests/redelegate.rs
+++ /dev/null
@@ -1,1213 +0,0 @@
-#![allow(clippy::arithmetic_side_effects)]
-#![cfg(feature = "test-sbf")]
-
-mod helpers;
-
-use {
-    bincode::deserialize,
-    helpers::*,
-    solana_program::{
-        clock::Epoch, hash::Hash, instruction::InstructionError, pubkey::Pubkey, stake,
-    },
-    solana_program_test::*,
-    solana_sdk::{
-        signature::{Keypair, Signer},
-        stake::instruction::StakeError,
-        transaction::{Transaction, TransactionError},
-    },
-    spl_stake_pool::{
-        error::StakePoolError, find_ephemeral_stake_program_address,
-        find_transient_stake_program_address, id, instruction, MINIMUM_RESERVE_LAMPORTS,
-    },
-};
-
-async fn setup(
-    do_warp: bool,
-) -> (
-    ProgramTestContext,
-    Hash,
-    StakePoolAccounts,
-    ValidatorStakeAccount,
-    ValidatorStakeAccount,
-    u64,
-    u64,
-) {
-    let mut context = program_test().start_with_context().await;
-    let rent = context.banks_client.get_rent().await.unwrap();
-    let stake_rent = rent.minimum_balance(std::mem::size_of::<stake::state::StakeStateV2>());
-    let current_minimum_delegation = stake_pool_get_minimum_delegation(
-        &mut context.banks_client,
-        &context.payer,
-        &context.last_blockhash,
-    )
-    .await;
-
-    let stake_pool_accounts = StakePoolAccounts::default();
-    stake_pool_accounts
-        .initialize_stake_pool(
-            &mut context.banks_client,
-            &context.payer,
-            &context.last_blockhash,
-            MINIMUM_RESERVE_LAMPORTS + current_minimum_delegation + stake_rent * 2,
-        )
-        .await
-        .unwrap();
-
-    let source_validator_stake = simple_add_validator_to_pool(
-        &mut context.banks_client,
-        &context.payer,
-        &context.last_blockhash,
-        &stake_pool_accounts,
-        None,
-    )
-    .await;
-
-    let destination_validator_stake = simple_add_validator_to_pool(
-        &mut context.banks_client,
-        &context.payer,
-        &context.last_blockhash,
-        &stake_pool_accounts,
-        None,
-    )
-    .await;
-
-    let minimum_redelegate_lamports = current_minimum_delegation + stake_rent;
-    simple_deposit_stake(
-        &mut context.banks_client,
-        &context.payer,
-        &context.last_blockhash,
-        &stake_pool_accounts,
-        &source_validator_stake,
-        minimum_redelegate_lamports,
-    )
-    .await
-    .unwrap();
-
-    let mut slot = 1;
-    if do_warp {
-        slot += context.genesis_config().epoch_schedule.first_normal_slot;
-        context.warp_to_slot(slot).unwrap();
-        stake_pool_accounts
-            .update_all(
-                &mut context.banks_client,
-                &context.payer,
-                &context.last_blockhash,
-                false,
-            )
-            .await;
-    }
-
-    let last_blockhash = context
-        .banks_client
-        .get_new_latest_blockhash(&context.last_blockhash)
-        .await
-        .unwrap();
-
-    (
-        context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        minimum_redelegate_lamports,
-        slot,
-    )
-}
-
-#[tokio::test]
-async fn success() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        mut slot,
-    ) = setup(true).await;
-
-    // Save validator stake
-    let pre_validator_stake_account = get_account(
-        &mut context.banks_client,
-        &source_validator_stake.stake_account,
-    )
-    .await;
-
-    // Save validator stake
-    let pre_destination_validator_stake_account = get_account(
-        &mut context.banks_client,
-        &destination_validator_stake.stake_account,
-    )
-    .await;
-
-    // Check no transient stake
-    let transient_account = context
-        .banks_client
-        .get_account(source_validator_stake.transient_stake_account)
-        .await
-        .unwrap();
-    assert!(transient_account.is_none());
-
-    let ephemeral_stake_seed = 100;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )
-        .await;
-    assert!(error.is_none(), "{:?}", error);
-
-    // Check validator stake account balance
-    let validator_stake_account = get_account(
-        &mut context.banks_client,
-        &source_validator_stake.stake_account,
-    )
-    .await;
-    let validator_stake_state =
-        deserialize::<stake::state::StakeStateV2>(&validator_stake_account.data).unwrap();
-    assert_eq!(
-        pre_validator_stake_account.lamports - redelegate_lamports,
-        validator_stake_account.lamports
-    );
-    assert_eq!(
-        validator_stake_state
-            .delegation()
-            .unwrap()
-            .deactivation_epoch,
-        Epoch::MAX
-    );
-
-    // Check source transient stake account state and balance
-    let rent = context.banks_client.get_rent().await.unwrap();
-    let stake_rent = rent.minimum_balance(std::mem::size_of::<stake::state::StakeStateV2>());
-
-    let source_transient_stake_account = get_account(
-        &mut context.banks_client,
-        &source_validator_stake.transient_stake_account,
-    )
-    .await;
-    let transient_stake_state =
-        deserialize::<stake::state::StakeStateV2>(&source_transient_stake_account.data).unwrap();
-    assert_eq!(source_transient_stake_account.lamports, stake_rent);
-    let transient_delegation = transient_stake_state.delegation().unwrap();
-    assert_ne!(transient_delegation.deactivation_epoch, Epoch::MAX);
-    assert_eq!(transient_delegation.stake, redelegate_lamports);
-
-    // Check reserve stake
-    let current_minimum_delegation = stake_pool_get_minimum_delegation(
-        &mut context.banks_client,
-        &context.payer,
-        &last_blockhash,
-    )
-    .await;
-    let reserve_lamports = MINIMUM_RESERVE_LAMPORTS + current_minimum_delegation + stake_rent * 2;
-    let reserve_stake_account = get_account(
-        &mut context.banks_client,
-        &stake_pool_accounts.reserve_stake.pubkey(),
-    )
-    .await;
-    assert_eq!(reserve_stake_account.lamports, reserve_lamports);
-
-    // Check ephemeral account doesn't exist
-    let maybe_account = context
-        .banks_client
-        .get_account(ephemeral_stake)
-        .await
-        .unwrap();
-    assert!(maybe_account.is_none());
-
-    // Check destination transient stake account
-    let destination_transient_stake_account = get_account(
-        &mut context.banks_client,
-        &destination_validator_stake.transient_stake_account,
-    )
-    .await;
-    let transient_stake_state =
-        deserialize::<stake::state::StakeStateV2>(&destination_transient_stake_account.data)
-            .unwrap();
-    assert_eq!(
-        destination_transient_stake_account.lamports,
-        redelegate_lamports
-    );
-    let transient_delegation = transient_stake_state.delegation().unwrap();
-    assert_eq!(transient_delegation.deactivation_epoch, Epoch::MAX);
-    assert_ne!(transient_delegation.activation_epoch, Epoch::MAX);
-    assert_eq!(transient_delegation.stake, redelegate_lamports - stake_rent);
-
-    // Check validator list
-    let validator_list = stake_pool_accounts
-        .get_validator_list(&mut context.banks_client)
-        .await;
-    let source_item = validator_list
-        .find(&source_validator_stake.vote.pubkey())
-        .unwrap();
-    assert_eq!(
-        u64::from(source_item.active_stake_lamports),
-        validator_stake_account.lamports
-    );
-    assert_eq!(
-        u64::from(source_item.transient_stake_lamports),
-        source_transient_stake_account.lamports
-    );
-    assert_eq!(
-        u64::from(source_item.transient_seed_suffix),
-        source_validator_stake.transient_stake_seed
-    );
-
-    let destination_item = validator_list
-        .find(&destination_validator_stake.vote.pubkey())
-        .unwrap();
-    assert_eq!(
-        u64::from(destination_item.transient_stake_lamports),
-        destination_transient_stake_account.lamports
-    );
-    assert_eq!(
-        u64::from(destination_item.transient_seed_suffix),
-        destination_validator_stake.transient_stake_seed
-    );
-
-    // Warp forward and merge all
-    let slots_per_epoch = context.genesis_config().epoch_schedule.slots_per_epoch;
-    slot += slots_per_epoch;
-    context.warp_to_slot(slot).unwrap();
-    stake_pool_accounts
-        .update_all(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            false,
-        )
-        .await;
-
-    // Check transient accounts are gone
-    let maybe_account = context
-        .banks_client
-        .get_account(destination_validator_stake.transient_stake_account)
-        .await
-        .unwrap();
-    assert!(maybe_account.is_none());
-    let maybe_account = context
-        .banks_client
-        .get_account(source_validator_stake.transient_stake_account)
-        .await
-        .unwrap();
-    assert!(maybe_account.is_none());
-
-    // Check validator list
-    let validator_list = stake_pool_accounts
-        .get_validator_list(&mut context.banks_client)
-        .await;
-    let source_item = validator_list
-        .find(&source_validator_stake.vote.pubkey())
-        .unwrap();
-    assert_eq!(
-        u64::from(source_item.active_stake_lamports),
-        validator_stake_account.lamports
-    );
-    assert_eq!(u64::from(source_item.transient_stake_lamports), 0);
-
-    let destination_item = validator_list
-        .find(&destination_validator_stake.vote.pubkey())
-        .unwrap();
-    assert_eq!(u64::from(destination_item.transient_stake_lamports), 0);
-    assert_eq!(
-        u64::from(destination_item.active_stake_lamports),
-        pre_destination_validator_stake_account.lamports + redelegate_lamports - stake_rent
-    );
-    let post_destination_validator_stake_account = get_account(
-        &mut context.banks_client,
-        &destination_validator_stake.stake_account,
-    )
-    .await;
-    assert_eq!(
-        post_destination_validator_stake_account.lamports,
-        pre_destination_validator_stake_account.lamports + redelegate_lamports - stake_rent
-    );
-
-    // Check reserve stake, which has claimed back all rent-exempt reserves
-    let reserve_stake_account = get_account(
-        &mut context.banks_client,
-        &stake_pool_accounts.reserve_stake.pubkey(),
-    )
-    .await;
-    assert_eq!(
-        reserve_stake_account.lamports,
-        reserve_lamports + stake_rent * 2
-    );
-}
-
-#[tokio::test]
-async fn success_with_increasing_stake() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        mut slot,
-    ) = setup(true).await;
-
-    // Save validator stake
-    let pre_validator_stake_account = get_account(
-        &mut context.banks_client,
-        &destination_validator_stake.stake_account,
-    )
-    .await;
-
-    let current_minimum_delegation = stake_pool_get_minimum_delegation(
-        &mut context.banks_client,
-        &context.payer,
-        &last_blockhash,
-    )
-    .await;
-    let rent = context.banks_client.get_rent().await.unwrap();
-    let stake_rent = rent.minimum_balance(std::mem::size_of::<stake::state::StakeStateV2>());
-
-    let error = stake_pool_accounts
-        .increase_validator_stake(
-            &mut context.banks_client,
-            &context.payer,
-            &context.last_blockhash,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            current_minimum_delegation,
-            destination_validator_stake.transient_stake_seed,
-        )
-        .await;
-    assert!(error.is_none(), "{:?}", error);
-
-    let validator_list = stake_pool_accounts
-        .get_validator_list(&mut context.banks_client)
-        .await;
-    let destination_item = validator_list
-        .find(&destination_validator_stake.vote.pubkey())
-        .unwrap();
-    assert_eq!(
-        u64::from(destination_item.transient_stake_lamports),
-        current_minimum_delegation + stake_rent
-    );
-    let pre_transient_stake_account = get_account(
-        &mut context.banks_client,
-        &destination_validator_stake.transient_stake_account,
-    )
-    .await;
-    assert_eq!(
-        pre_transient_stake_account.lamports,
-        current_minimum_delegation + stake_rent
-    );
-
-    let ephemeral_stake_seed = 10;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-
-    // fail with incorrect transient stake derivation
-    let wrong_transient_stake_seed = destination_validator_stake
-        .transient_stake_seed
-        .wrapping_add(1);
-    let (wrong_transient_stake_account, _) = find_transient_stake_program_address(
-        &id(),
-        &destination_validator_stake.vote.pubkey(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        wrong_transient_stake_seed,
-    );
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &wrong_transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            wrong_transient_stake_seed,
-        )
-        .await
-        .unwrap()
-        .unwrap();
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakePoolError::InvalidStakeAccountAddress as u32)
-        )
-    );
-
-    let last_blockhash = context
-        .banks_client
-        .get_new_latest_blockhash(&context.last_blockhash)
-        .await
-        .unwrap();
-
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )
-        .await;
-    assert!(error.is_none(), "{:?}", error);
-
-    // Check destination transient stake account
-    let destination_transient_stake_account = get_account(
-        &mut context.banks_client,
-        &destination_validator_stake.transient_stake_account,
-    )
-    .await;
-    let transient_stake_state =
-        deserialize::<stake::state::StakeStateV2>(&destination_transient_stake_account.data)
-            .unwrap();
-    assert_eq!(
-        destination_transient_stake_account.lamports,
-        redelegate_lamports + current_minimum_delegation + stake_rent
-    );
-
-    let transient_delegation = transient_stake_state.delegation().unwrap();
-    assert_eq!(transient_delegation.deactivation_epoch, Epoch::MAX);
-    assert_ne!(transient_delegation.activation_epoch, Epoch::MAX);
-    assert_eq!(
-        transient_delegation.stake,
-        redelegate_lamports + current_minimum_delegation
-    );
-
-    // Check reserve stake
-    let reserve_stake_account = get_account(
-        &mut context.banks_client,
-        &stake_pool_accounts.reserve_stake.pubkey(),
-    )
-    .await;
-    assert_eq!(reserve_stake_account.lamports, stake_rent);
-
-    // Check validator list
-    let validator_list = stake_pool_accounts
-        .get_validator_list(&mut context.banks_client)
-        .await;
-    let destination_item = validator_list
-        .find(&destination_validator_stake.vote.pubkey())
-        .unwrap();
-    assert_eq!(
-        u64::from(destination_item.transient_stake_lamports),
-        destination_transient_stake_account.lamports
-    );
-    assert_eq!(
-        u64::from(destination_item.transient_seed_suffix),
-        destination_validator_stake.transient_stake_seed
-    );
-
-    // Warp forward and merge all
-    let slots_per_epoch = context.genesis_config().epoch_schedule.slots_per_epoch;
-    slot += slots_per_epoch;
-    context.warp_to_slot(slot).unwrap();
-    stake_pool_accounts
-        .update_all(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            false,
-        )
-        .await;
-
-    // Check transient account is gone
-    let maybe_account = context
-        .banks_client
-        .get_account(destination_validator_stake.transient_stake_account)
-        .await
-        .unwrap();
-    assert!(maybe_account.is_none());
-
-    // Check validator list
-    let validator_list = stake_pool_accounts
-        .get_validator_list(&mut context.banks_client)
-        .await;
-    let destination_item = validator_list
-        .find(&destination_validator_stake.vote.pubkey())
-        .unwrap();
-    assert_eq!(u64::from(destination_item.transient_stake_lamports), 0);
-    // redelegate is smart enough to activate *everything*, so there's no
-    // rent-exemption worth of inactive stake!
-    assert_eq!(
-        u64::from(destination_item.active_stake_lamports),
-        pre_validator_stake_account.lamports + redelegate_lamports + current_minimum_delegation
-    );
-    let post_validator_stake_account = get_account(
-        &mut context.banks_client,
-        &destination_validator_stake.stake_account,
-    )
-    .await;
-    assert_eq!(
-        post_validator_stake_account.lamports,
-        pre_validator_stake_account.lamports + redelegate_lamports + current_minimum_delegation
-    );
-
-    // Check reserve has claimed back rent-exempt reserve from both transient
-    // accounts
-    let reserve_stake_account = get_account(
-        &mut context.banks_client,
-        &stake_pool_accounts.reserve_stake.pubkey(),
-    )
-    .await;
-    assert_eq!(reserve_stake_account.lamports, stake_rent * 3);
-}
-
-#[tokio::test]
-async fn fail_with_decreasing_stake() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        mut slot,
-    ) = setup(false).await;
-
-    let current_minimum_delegation = stake_pool_get_minimum_delegation(
-        &mut context.banks_client,
-        &context.payer,
-        &last_blockhash,
-    )
-    .await;
-    let rent = context.banks_client.get_rent().await.unwrap();
-    let stake_rent = rent.minimum_balance(std::mem::size_of::<stake::state::StakeStateV2>());
-    let minimum_decrease_lamports = current_minimum_delegation + stake_rent;
-
-    simple_deposit_stake(
-        &mut context.banks_client,
-        &context.payer,
-        &last_blockhash,
-        &stake_pool_accounts,
-        &destination_validator_stake,
-        redelegate_lamports,
-    )
-    .await
-    .unwrap();
-
-    slot += context.genesis_config().epoch_schedule.first_normal_slot;
-    context.warp_to_slot(slot).unwrap();
-    stake_pool_accounts
-        .update_all(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            false,
-        )
-        .await;
-
-    let last_blockhash = context
-        .banks_client
-        .get_new_latest_blockhash(&last_blockhash)
-        .await
-        .unwrap();
-
-    let error = stake_pool_accounts
-        .decrease_validator_stake_either(
-            &mut context.banks_client,
-            &context.payer,
-            &context.last_blockhash,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.transient_stake_account,
-            minimum_decrease_lamports,
-            destination_validator_stake.transient_stake_seed,
-            DecreaseInstruction::Reserve,
-        )
-        .await;
-    assert!(error.is_none(), "{:?}", error);
-
-    let ephemeral_stake_seed = 20;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )
-        .await
-        .unwrap()
-        .unwrap();
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakePoolError::WrongStakeStake as u32)
-        )
-    );
-}
-
-#[tokio::test]
-async fn fail_with_wrong_withdraw_authority() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        _,
-    ) = setup(true).await;
-
-    let ephemeral_stake_seed = 2;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-
-    let wrong_withdraw_authority = Pubkey::new_unique();
-    let transaction = Transaction::new_signed_with_payer(
-        &[instruction::redelegate(
-            &id(),
-            &stake_pool_accounts.stake_pool.pubkey(),
-            &stake_pool_accounts.staker.pubkey(),
-            &wrong_withdraw_authority,
-            &stake_pool_accounts.validator_list.pubkey(),
-            &stake_pool_accounts.reserve_stake.pubkey(),
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )],
-        Some(&context.payer.pubkey()),
-        &[&context.payer, &stake_pool_accounts.staker],
-        last_blockhash,
-    );
-    let error = context
-        .banks_client
-        .process_transaction(transaction)
-        .await
-        .err()
-        .unwrap()
-        .unwrap();
-
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakePoolError::InvalidProgramAddress as u32)
-        )
-    );
-}
-
-#[tokio::test]
-async fn fail_with_wrong_validator_list() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        _,
-    ) = setup(true).await;
-
-    let ephemeral_stake_seed = 2;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-
-    let wrong_validator_list = Pubkey::new_unique();
-    let transaction = Transaction::new_signed_with_payer(
-        &[instruction::redelegate(
-            &id(),
-            &stake_pool_accounts.stake_pool.pubkey(),
-            &stake_pool_accounts.staker.pubkey(),
-            &stake_pool_accounts.withdraw_authority,
-            &wrong_validator_list,
-            &stake_pool_accounts.reserve_stake.pubkey(),
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )],
-        Some(&context.payer.pubkey()),
-        &[&context.payer, &stake_pool_accounts.staker],
-        last_blockhash,
-    );
-    let error = context
-        .banks_client
-        .process_transaction(transaction)
-        .await
-        .err()
-        .unwrap()
-        .unwrap();
-
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakePoolError::InvalidValidatorStakeList as u32)
-        )
-    );
-}
-
-#[tokio::test]
-async fn fail_with_wrong_reserve() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        _,
-    ) = setup(true).await;
-
-    let ephemeral_stake_seed = 2;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-
-    let wrong_reserve = Keypair::new();
-    let transaction = Transaction::new_signed_with_payer(
-        &[instruction::redelegate(
-            &id(),
-            &stake_pool_accounts.stake_pool.pubkey(),
-            &stake_pool_accounts.staker.pubkey(),
-            &stake_pool_accounts.withdraw_authority,
-            &stake_pool_accounts.validator_list.pubkey(),
-            &wrong_reserve.pubkey(),
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )],
-        Some(&context.payer.pubkey()),
-        &[&context.payer, &stake_pool_accounts.staker],
-        last_blockhash,
-    );
-    let error = context
-        .banks_client
-        .process_transaction(transaction)
-        .await
-        .err()
-        .unwrap()
-        .unwrap();
-
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakePoolError::InvalidProgramAddress as u32)
-        )
-    );
-}
-
-#[tokio::test]
-async fn fail_with_wrong_staker() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        _,
-    ) = setup(true).await;
-
-    let ephemeral_stake_seed = 2;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-
-    let wrong_staker = Keypair::new();
-    let transaction = Transaction::new_signed_with_payer(
-        &[instruction::redelegate(
-            &id(),
-            &stake_pool_accounts.stake_pool.pubkey(),
-            &wrong_staker.pubkey(),
-            &stake_pool_accounts.withdraw_authority,
-            &stake_pool_accounts.validator_list.pubkey(),
-            &stake_pool_accounts.reserve_stake.pubkey(),
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )],
-        Some(&context.payer.pubkey()),
-        &[&context.payer, &wrong_staker],
-        last_blockhash,
-    );
-    let error = context
-        .banks_client
-        .process_transaction(transaction)
-        .await
-        .err()
-        .unwrap()
-        .unwrap();
-
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakePoolError::WrongStaker as u32)
-        )
-    );
-}
-
-#[tokio::test]
-async fn fail_with_unknown_validator() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        _,
-    ) = setup(true).await;
-
-    let unknown_validator_stake = create_unknown_validator_stake(
-        &mut context.banks_client,
-        &context.payer,
-        &last_blockhash,
-        &stake_pool_accounts.stake_pool.pubkey(),
-        redelegate_lamports,
-    )
-    .await;
-
-    let ephemeral_stake_seed = 42;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &unknown_validator_stake.transient_stake_account,
-            &unknown_validator_stake.stake_account,
-            &unknown_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            unknown_validator_stake.transient_stake_seed,
-        )
-        .await
-        .unwrap()
-        .unwrap();
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakePoolError::ValidatorNotFound as u32)
-        )
-    );
-
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &unknown_validator_stake.stake_account,
-            &unknown_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            unknown_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )
-        .await
-        .unwrap()
-        .unwrap();
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakePoolError::ValidatorNotFound as u32)
-        )
-    );
-}
-
-#[tokio::test]
-async fn fail_redelegate_twice() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        mut slot,
-    ) = setup(false).await;
-
-    simple_deposit_stake(
-        &mut context.banks_client,
-        &context.payer,
-        &last_blockhash,
-        &stake_pool_accounts,
-        &source_validator_stake,
-        redelegate_lamports,
-    )
-    .await
-    .unwrap();
-
-    slot += context.genesis_config().epoch_schedule.first_normal_slot;
-    context.warp_to_slot(slot).unwrap();
-    stake_pool_accounts
-        .update_all(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            false,
-        )
-        .await;
-
-    let last_blockhash = context
-        .banks_client
-        .get_new_latest_blockhash(&last_blockhash)
-        .await
-        .unwrap();
-
-    let ephemeral_stake_seed = 100;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )
-        .await;
-    assert!(error.is_none(), "{:?}", error);
-
-    let last_blockhash = context
-        .banks_client
-        .get_new_latest_blockhash(&last_blockhash)
-        .await
-        .unwrap();
-
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )
-        .await
-        .unwrap()
-        .unwrap();
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakePoolError::TransientAccountInUse as u32)
-        )
-    );
-}
-
-#[tokio::test]
-async fn fail_with_small_lamport_amount() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        redelegate_lamports,
-        _,
-    ) = setup(true).await;
-
-    let ephemeral_stake_seed = 7_000;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            redelegate_lamports - 1,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )
-        .await
-        .unwrap()
-        .unwrap();
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(
-            0,
-            InstructionError::Custom(StakeError::InsufficientDelegation as u32)
-        )
-    );
-}
-
-#[tokio::test]
-async fn fail_drain_source_account() {
-    let (
-        mut context,
-        last_blockhash,
-        stake_pool_accounts,
-        source_validator_stake,
-        destination_validator_stake,
-        _,
-        _,
-    ) = setup(true).await;
-
-    let validator_stake_account = get_account(
-        &mut context.banks_client,
-        &source_validator_stake.stake_account,
-    )
-    .await;
-
-    let ephemeral_stake_seed = 2;
-    let ephemeral_stake = find_ephemeral_stake_program_address(
-        &id(),
-        &stake_pool_accounts.stake_pool.pubkey(),
-        ephemeral_stake_seed,
-    )
-    .0;
-
-    let error = stake_pool_accounts
-        .redelegate(
-            &mut context.banks_client,
-            &context.payer,
-            &last_blockhash,
-            &source_validator_stake.stake_account,
-            &source_validator_stake.transient_stake_account,
-            &ephemeral_stake,
-            &destination_validator_stake.transient_stake_account,
-            &destination_validator_stake.stake_account,
-            &destination_validator_stake.vote.pubkey(),
-            validator_stake_account.lamports,
-            source_validator_stake.transient_stake_seed,
-            ephemeral_stake_seed,
-            destination_validator_stake.transient_stake_seed,
-        )
-        .await
-        .unwrap()
-        .unwrap();
-    assert_eq!(
-        error,
-        TransactionError::InstructionError(0, InstructionError::InsufficientFunds)
-    );
-}