From 748f8c92d8caa9681df5e138918c2428556b6e27 Mon Sep 17 00:00:00 2001 From: Yuri Tkachenko Date: Wed, 5 Feb 2025 08:11:26 +0000 Subject: [PATCH] chore: fix tests and linter --- contracts/0.8.25/vaults/Dashboard.sol | 18 +++++++++--------- contracts/0.8.25/vaults/VaultHub.sol | 5 ++--- .../vaults/delegation/delegation.test.ts | 3 +++ .../vaults/staking-vault/stakingVault.test.ts | 4 +--- .../vaulthub/vaulthub.forcewithdrawals.test.ts | 2 +- .../vaults-happy-path.integration.ts | 1 + 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/contracts/0.8.25/vaults/Dashboard.sol b/contracts/0.8.25/vaults/Dashboard.sol index 241f25072..807a42ac1 100644 --- a/contracts/0.8.25/vaults/Dashboard.sol +++ b/contracts/0.8.25/vaults/Dashboard.sol @@ -456,28 +456,28 @@ contract Dashboard is Permissions { /** * @notice Requests validators exit for the given validator public keys. - * @param _validatorPublicKeys The public keys of the validators to request exit for. + * @param _pubkeys The public keys of the validators to request exit for. * @dev This only emits an event requesting the exit, it does not actually initiate the exit. */ - function requestValidatorExit(bytes calldata _validatorPublicKeys) external { - _requestValidatorExit(_validatorPublicKeys); + function requestValidatorExit(bytes calldata _pubkeys) external { + _requestValidatorExit(_pubkeys); } /** * @notice Initiates a full validator withdrawal for the given validator public keys. - * @param _validatorPublicKeys The public keys of the validators to initiate withdrawal for. + * @param _pubkeys The public keys of the validators to initiate withdrawal for. */ - function initiateFullValidatorWithdrawal(bytes calldata _validatorPublicKeys) external payable { - _initiateFullValidatorWithdrawal(_validatorPublicKeys); + function initiateFullValidatorWithdrawal(bytes calldata _pubkeys) external payable { + _initiateFullValidatorWithdrawal(_pubkeys); } /** * @notice Initiates a partial validator withdrawal for the given validator public keys and amounts. - * @param _validatorPublicKeys The public keys of the validators to initiate withdrawal for. + * @param _pubkeys The public keys of the validators to initiate withdrawal for. * @param _amounts The amounts of the validators to initiate withdrawal for. */ - function initiatePartialValidatorWithdrawal(bytes calldata _validatorPublicKeys, uint64[] calldata _amounts) external payable { - _initiatePartialValidatorWithdrawal(_validatorPublicKeys, _amounts); + function initiatePartialValidatorWithdrawal(bytes calldata _pubkeys, uint64[] calldata _amounts) external payable { + _initiatePartialValidatorWithdrawal(_pubkeys, _amounts); } // ==================== Role Management Functions ==================== diff --git a/contracts/0.8.25/vaults/VaultHub.sol b/contracts/0.8.25/vaults/VaultHub.sol index 974660226..3069b0909 100644 --- a/contracts/0.8.25/vaults/VaultHub.sol +++ b/contracts/0.8.25/vaults/VaultHub.sol @@ -4,7 +4,6 @@ // See contracts/COMPILERS.md pragma solidity 0.8.25; -import {IBeacon} from "@openzeppelin/contracts-v5.2/proxy/beacon/IBeacon.sol"; import {OwnableUpgradeable} from "contracts/openzeppelin/5.2/upgradeable/access/OwnableUpgradeable.sol"; import {IStakingVault} from "./interfaces/IStakingVault.sol"; @@ -350,7 +349,7 @@ abstract contract VaultHub is PausableUntilWithRoles { IStakingVault(_vault).forceValidatorWithdrawal{value: msg.value}(_pubkeys); - emit ForceValidatorWithdrawalRequested(_vault, _pubkeys); + emit VaultForceWithdrawalInitiated(_vault, _pubkeys); } function _disconnect(address _vault) internal { @@ -528,7 +527,7 @@ abstract contract VaultHub is PausableUntilWithRoles { event BurnedSharesOnVault(address indexed vault, uint256 amountOfShares); event VaultRebalanced(address indexed vault, uint256 sharesBurned); event VaultProxyCodehashAdded(bytes32 indexed codehash); - event ForceValidatorWithdrawalRequested(address indexed vault, bytes pubkeys); + event VaultForceWithdrawalInitiated(address indexed vault, bytes pubkeys); error StETHMintFailed(address vault); error AlreadyBalanced(address vault, uint256 mintedShares, uint256 rebalancingThresholdInShares); diff --git a/test/0.8.25/vaults/delegation/delegation.test.ts b/test/0.8.25/vaults/delegation/delegation.test.ts index 7b4651a2b..b523fd503 100644 --- a/test/0.8.25/vaults/delegation/delegation.test.ts +++ b/test/0.8.25/vaults/delegation/delegation.test.ts @@ -35,6 +35,7 @@ describe("Delegation.sol", () => { let depositPauser: HardhatEthersSigner; let depositResumer: HardhatEthersSigner; let exitRequester: HardhatEthersSigner; + let withdrawalInitiator: HardhatEthersSigner; let disconnecter: HardhatEthersSigner; let curator: HardhatEthersSigner; let nodeOperatorManager: HardhatEthersSigner; @@ -71,6 +72,7 @@ describe("Delegation.sol", () => { depositPauser, depositResumer, exitRequester, + withdrawalInitiator, disconnecter, curator, nodeOperatorManager, @@ -113,6 +115,7 @@ describe("Delegation.sol", () => { depositPauser, depositResumer, exitRequester, + withdrawalInitiator, disconnecter, curator, nodeOperatorManager, diff --git a/test/0.8.25/vaults/staking-vault/stakingVault.test.ts b/test/0.8.25/vaults/staking-vault/stakingVault.test.ts index fde9ef4f4..6c11f9949 100644 --- a/test/0.8.25/vaults/staking-vault/stakingVault.test.ts +++ b/test/0.8.25/vaults/staking-vault/stakingVault.test.ts @@ -703,9 +703,7 @@ describe("StakingVault.sol", () => { await expect(stakingVault.connect(vaultHubSigner).forceValidatorWithdrawal(SAMPLE_PUBKEY, { value: fee })) .to.emit(stakingVault, "FullWithdrawalInitiated") - .withArgs(vaultHubSigner, SAMPLE_PUBKEY) - .and.to.emit(stakingVault, "ForceValidatorWithdrawal") - .withArgs(SAMPLE_PUBKEY); + .withArgs(vaultHubSigner, SAMPLE_PUBKEY); }); }); diff --git a/test/0.8.25/vaults/vaulthub/vaulthub.forcewithdrawals.test.ts b/test/0.8.25/vaults/vaulthub/vaulthub.forcewithdrawals.test.ts index 7196bd66b..740f420c2 100644 --- a/test/0.8.25/vaults/vaulthub/vaulthub.forcewithdrawals.test.ts +++ b/test/0.8.25/vaults/vaulthub/vaulthub.forcewithdrawals.test.ts @@ -137,7 +137,7 @@ describe("VaultHub.sol:forceWithdrawals", () => { it("initiates force validator withdrawal", async () => { await expect(vaultHub.forceValidatorWithdrawal(vaultAddress, SAMPLE_PUBKEY, { value: FEE })) - .to.emit(vaultHub, "ForceValidatorWithdrawalRequested") + .to.emit(vaultHub, "VaultForceWithdrawalInitiated") .withArgs(vaultAddress, SAMPLE_PUBKEY); }); }); diff --git a/test/integration/vaults-happy-path.integration.ts b/test/integration/vaults-happy-path.integration.ts index 59df58cb4..8662db794 100644 --- a/test/integration/vaults-happy-path.integration.ts +++ b/test/integration/vaults-happy-path.integration.ts @@ -168,6 +168,7 @@ describe("Scenario: Staking Vaults Happy Path", () => { depositPauser: curator, depositResumer: curator, exitRequester: curator, + withdrawalInitiator: curator, disconnecter: curator, nodeOperatorManager: nodeOperator, nodeOperatorFeeClaimer: nodeOperator,