From 8f2cd371b91e30e187dbb565c9fcc9528945edf4 Mon Sep 17 00:00:00 2001 From: Aleksei Potapkin Date: Wed, 10 Dec 2025 19:49:43 +0200 Subject: [PATCH 1/3] test: add deposit withdrawal steps --- .../vaults/scenario/happy-path.integration.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/integration/vaults/scenario/happy-path.integration.ts b/test/integration/vaults/scenario/happy-path.integration.ts index 322c15cf2..a8c72414a 100644 --- a/test/integration/vaults/scenario/happy-path.integration.ts +++ b/test/integration/vaults/scenario/happy-path.integration.ts @@ -423,6 +423,26 @@ describe("Scenario: Staking Vaults Happy Path", () => { expect(reportEvents.length).to.equal(1n); expect(await vaultHub.locked(stakingVaultAddress)).to.equal(0); + expect(await vaultHub.isVaultConnected(stakingVaultAddress)).to.equal(false); + }); + + it("Should allow to transfer the StakingVault ownership to the owner", async () => { + const { vaultHub } = ctx.contracts; + + await expect(dashboard.connect(owner).abandonDashboard(owner)) + .to.emit(stakingVault, "OwnershipTransferred") + .withArgs(vaultHub, dashboard) + .to.emit(stakingVault, "OwnershipTransferStarted") + .withArgs(dashboard, owner); + await expect(stakingVault.connect(owner).acceptOwnership()) + .to.emit(stakingVault, "OwnershipTransferred") + .withArgs(dashboard, owner); + }); + + it("Should allow to withdraw the deposit from the vault", async () => { + const withdrawTx = await stakingVault.connect(owner).withdraw(owner, VAULT_CONNECTION_DEPOSIT); + await expect(withdrawTx).to.emit(stakingVault, "EtherWithdrawn").withArgs(owner, VAULT_CONNECTION_DEPOSIT); + await expect(withdrawTx).changeEtherBalance(owner, VAULT_CONNECTION_DEPOSIT); }); async function isSoleRoleMember(account: HardhatEthersSigner, role: string) { From 3abb1d3e4cc4f7f6a13b7d8ae92500433f2411ea Mon Sep 17 00:00:00 2001 From: Aleksei Potapkin Date: Wed, 10 Dec 2025 19:51:06 +0200 Subject: [PATCH 2/3] test: add more checks --- test/integration/vaults/scenario/happy-path.integration.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/integration/vaults/scenario/happy-path.integration.ts b/test/integration/vaults/scenario/happy-path.integration.ts index a8c72414a..a2ff8d725 100644 --- a/test/integration/vaults/scenario/happy-path.integration.ts +++ b/test/integration/vaults/scenario/happy-path.integration.ts @@ -434,9 +434,12 @@ describe("Scenario: Staking Vaults Happy Path", () => { .withArgs(vaultHub, dashboard) .to.emit(stakingVault, "OwnershipTransferStarted") .withArgs(dashboard, owner); + expect(await stakingVault.pendingOwner()).to.equal(owner); + await expect(stakingVault.connect(owner).acceptOwnership()) .to.emit(stakingVault, "OwnershipTransferred") .withArgs(dashboard, owner); + expect(await stakingVault.owner()).to.equal(owner); }); it("Should allow to withdraw the deposit from the vault", async () => { From 5ced1f34b5ebf6227eae859d73aeaa52bc5ccde2 Mon Sep 17 00:00:00 2001 From: Aleksei Potapkin Date: Thu, 11 Dec 2025 14:04:53 +0200 Subject: [PATCH 3/3] test: unpause PDG only in tests that need it --- lib/protocol/context.ts | 2 -- test/integration/vaults/disconnected.integration.ts | 5 +++++ test/integration/vaults/gate-seal-pause.integration.ts | 5 +++++ test/integration/vaults/pdg.integration.ts | 3 +++ test/integration/vaults/scenario/happy-path.integration.ts | 2 ++ .../vaults/scenario/node-operator.happy-path.integration.ts | 2 ++ test/integration/vaults/scenario/pdg-deposit.integration.ts | 2 ++ 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/protocol/context.ts b/lib/protocol/context.ts index e06e8a978..811a34068 100644 --- a/lib/protocol/context.ts +++ b/lib/protocol/context.ts @@ -5,7 +5,6 @@ import { getMode } from "hardhat.helpers"; import { deployScratchProtocol, deployUpgrade, ether, findEventsWithInterfaces, impersonate, log } from "lib"; import { discover } from "./discover"; -import { ensurePredepositGuaranteeUnpaused } from "./helpers"; import { provision } from "./provision"; import { ProtocolContext, ProtocolContextFlags, ProtocolSigners, Signer } from "./types"; @@ -88,7 +87,6 @@ export const getProtocolContext = async (skipV3Contracts: boolean = false): Prom await provision(context); } else { await ensureVaultsShareLimit(context); - await ensurePredepositGuaranteeUnpaused(context); } return context; diff --git a/test/integration/vaults/disconnected.integration.ts b/test/integration/vaults/disconnected.integration.ts index 3a9af0f21..5092f271c 100644 --- a/test/integration/vaults/disconnected.integration.ts +++ b/test/integration/vaults/disconnected.integration.ts @@ -22,6 +22,7 @@ import { } from "lib"; import { createVaultWithDashboard, + ensurePredepositGuaranteeUnpaused, getProtocolContext, getPubkeys, mockProof, @@ -273,6 +274,10 @@ describe("Integration: Actions with vault disconnected from hub", () => { }); describe("Deposits", () => { + before(async () => { + await ensurePredepositGuaranteeUnpaused(ctx); + }); + beforeEach(async () => { await stakingVault.connect(owner).fund({ value: ether("2048") }); }); diff --git a/test/integration/vaults/gate-seal-pause.integration.ts b/test/integration/vaults/gate-seal-pause.integration.ts index fe4828681..69833d9a6 100644 --- a/test/integration/vaults/gate-seal-pause.integration.ts +++ b/test/integration/vaults/gate-seal-pause.integration.ts @@ -23,6 +23,7 @@ const IGateSeal_ABI = [ import { ether, generateValidator } from "lib"; import { createVaultWithDashboard, + ensurePredepositGuaranteeUnpaused, generatePredepositData, getProtocolContext, ProtocolContext, @@ -122,6 +123,7 @@ describe("Integration: GateSeal pause functionality for VaultHub and PredepositG }); it("GateSeal can pause PredepositGuarantee", async function () { + await ensurePredepositGuaranteeUnpaused(ctx); if (ctx.isScratch) { this.skip(); } @@ -164,6 +166,7 @@ describe("Integration: GateSeal pause functionality for VaultHub and PredepositG }); it("GateSeal can pause both VaultHub and PredepositGuarantee simultaneously", async function () { + await ensurePredepositGuaranteeUnpaused(ctx); if (ctx.isScratch) { this.skip(); } @@ -215,6 +218,7 @@ describe("Integration: GateSeal pause functionality for VaultHub and PredepositG }); it("Operations resume after RESUME_ROLE holder resumes the contracts", async function () { + await ensurePredepositGuaranteeUnpaused(ctx); if (ctx.isScratch) { this.skip(); } @@ -277,6 +281,7 @@ describe("Integration: GateSeal pause functionality for VaultHub and PredepositG }); it("Cannot seal when PredepositGuarantee is already paused", async function () { + await ensurePredepositGuaranteeUnpaused(ctx); if (ctx.isScratch) { this.skip(); } diff --git a/test/integration/vaults/pdg.integration.ts b/test/integration/vaults/pdg.integration.ts index a105e737b..299f9632d 100644 --- a/test/integration/vaults/pdg.integration.ts +++ b/test/integration/vaults/pdg.integration.ts @@ -9,6 +9,7 @@ import { Dashboard, DepositContract, StakingVault } from "typechain-types"; import { ether, generateValidator, PDGPolicy, toGwei, toLittleEndian64 } from "lib"; import { createVaultWithDashboard, + ensurePredepositGuaranteeUnpaused, generatePredepositData, getProtocolContext, mockProof, @@ -37,6 +38,8 @@ describe("Integration: Predeposit Guarantee core functionality", () => { originalSnapshot = await Snapshot.take(); + await ensurePredepositGuaranteeUnpaused(ctx); + await setupLidoForVaults(ctx); [owner, nodeOperator, stranger] = await ethers.getSigners(); diff --git a/test/integration/vaults/scenario/happy-path.integration.ts b/test/integration/vaults/scenario/happy-path.integration.ts index a2ff8d725..85e39d69e 100644 --- a/test/integration/vaults/scenario/happy-path.integration.ts +++ b/test/integration/vaults/scenario/happy-path.integration.ts @@ -21,6 +21,7 @@ import { import { TOTAL_BASIS_POINTS } from "lib/constants"; import { calculateLockedValue, + ensurePredepositGuaranteeUnpaused, getProtocolContext, getReportTimeElapsed, OracleReportParams, @@ -76,6 +77,7 @@ describe("Scenario: Staking Vaults Happy Path", () => { const { depositSecurityModule } = ctx.contracts; depositContract = await depositSecurityModule.DEPOSIT_CONTRACT(); + await ensurePredepositGuaranteeUnpaused(ctx); await setupLidoForVaults(ctx); // add ETH to NO for PDG deposit + gas diff --git a/test/integration/vaults/scenario/node-operator.happy-path.integration.ts b/test/integration/vaults/scenario/node-operator.happy-path.integration.ts index bb881ebc6..66b3cc6f6 100644 --- a/test/integration/vaults/scenario/node-operator.happy-path.integration.ts +++ b/test/integration/vaults/scenario/node-operator.happy-path.integration.ts @@ -35,6 +35,7 @@ import { TOTAL_BASIS_POINTS } from "lib/constants"; import { mEqual } from "lib/promise"; import { createVaultProxyWithoutConnectingToVaultHub, + ensurePredepositGuaranteeUnpaused, getProtocolContext, getReportTimeElapsed, ProtocolContext, @@ -191,6 +192,7 @@ resetState( agent = await ctx.getSigner("agent"); await setupLidoForVaults(ctx); + await ensurePredepositGuaranteeUnpaused(ctx); await setBalance(nodeOperator.address, ether("100")); slot = await predepositGuarantee.PIVOT_SLOT(); diff --git a/test/integration/vaults/scenario/pdg-deposit.integration.ts b/test/integration/vaults/scenario/pdg-deposit.integration.ts index 8b0075a62..2eb3e39da 100644 --- a/test/integration/vaults/scenario/pdg-deposit.integration.ts +++ b/test/integration/vaults/scenario/pdg-deposit.integration.ts @@ -19,6 +19,7 @@ import { } from "lib"; import { createVaultWithDashboard, + ensurePredepositGuaranteeUnpaused, getProtocolContext, mockProof, ProtocolContext, @@ -48,6 +49,7 @@ describe("Scenario: Predeposit Guarantee happy path and frontrunning", () => { originalSnapshot = await Snapshot.take(); + await ensurePredepositGuaranteeUnpaused(ctx); await setupLidoForVaults(ctx); [owner, nodeOperator, guarantor, depositor, stranger] = await ethers.getSigners();