diff --git a/contracts/0.8.25/utils/Confirmations.sol b/contracts/0.8.25/utils/Confirmations.sol index 4d39d18e05..c4ff09e044 100644 --- a/contracts/0.8.25/utils/Confirmations.sol +++ b/contracts/0.8.25/utils/Confirmations.sol @@ -197,6 +197,7 @@ abstract contract Confirmations { /** * @dev Emitted when the confirmation expiry is set. + * @param sender msg.sender of the call * @param oldConfirmExpiry The old confirmation expiry. * @param newConfirmExpiry The new confirmation expiry. */ diff --git a/contracts/0.8.25/vaults/LazyOracle.sol b/contracts/0.8.25/vaults/LazyOracle.sol index c546f87ace..39bcc01561 100644 --- a/contracts/0.8.25/vaults/LazyOracle.sol +++ b/contracts/0.8.25/vaults/LazyOracle.sol @@ -149,7 +149,12 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { /// @param _quarantinePeriod the quarantine period, seconds /// @param _maxRewardRatioBP the max reward ratio, basis points /// @param _maxLidoFeeRatePerSecond the max Lido fee rate per second - function initialize(address _admin, uint256 _quarantinePeriod, uint256 _maxRewardRatioBP, uint256 _maxLidoFeeRatePerSecond) external initializer { + function initialize( + address _admin, + uint256 _quarantinePeriod, + uint256 _maxRewardRatioBP, + uint256 _maxLidoFeeRatePerSecond + ) external initializer { if (_admin == address(0)) revert AdminCannotBeZero(); _grantRole(DEFAULT_ADMIN_ROLE, _admin); @@ -161,7 +166,12 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { /// @return refSlot of the report /// @return treeRoot merkle root of the report /// @return reportCid IPFS CID for the report JSON file - function latestReportData() external view returns (uint256 timestamp, uint256 refSlot, bytes32 treeRoot, string memory reportCid) { + function latestReportData() external view returns ( + uint256 timestamp, + uint256 refSlot, + bytes32 treeRoot, + string memory reportCid + ) { Storage storage $ = _storage(); return ($.vaultsDataTimestamp, $.vaultsDataRefSlot, $.vaultsDataTreeRoot, $.vaultsDataReportCid); } @@ -238,28 +248,6 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { return _vaultInfo(_vault, _vaultHub()); } - function _vaultInfo(address _vault, VaultHub _vh) internal view returns (VaultInfo memory) { - IStakingVault vault = IStakingVault(_vault); - VaultHub.VaultConnection memory connection = _vh.vaultConnection(_vault); - VaultHub.VaultRecord memory record = _vh.vaultRecord(_vault); - return VaultInfo( - _vault, - vault.availableBalance() + vault.stagedBalance(), - record.inOutDelta.currentValue(), - vault.withdrawalCredentials(), - record.liabilityShares, - record.maxLiabilityShares, - _mintableStETH(_vault), - connection.shareLimit, - connection.reserveRatioBP, - connection.forcedRebalanceThresholdBP, - connection.infraFeeBP, - connection.liquidityFeeBP, - connection.reservationFeeBP, - _vh.isPendingDisconnect(_vault) - ); - } - /** * @notice batch method to mass check the validator stages in PredepositGuarantee contract * @param _pubkeys the array of validator's pubkeys to check @@ -305,14 +293,20 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { $.vaultsDataTreeRoot = _vaultsDataTreeRoot; $.vaultsDataReportCid = _vaultsDataReportCid; - emit VaultsReportDataUpdated(_vaultsDataTimestamp, _vaultsDataRefSlot, _vaultsDataTreeRoot, _vaultsDataReportCid); + emit VaultsReportDataUpdated( + _vaultsDataTimestamp, + _vaultsDataRefSlot, + _vaultsDataTreeRoot, + _vaultsDataReportCid + ); } /// @notice Permissionless update of the vault data /// @param _vault the address of the vault /// @param _totalValue the total value of the vault /// @param _cumulativeLidoFees the cumulative Lido fees accrued on the vault (nominated in ether) - /// @param _liabilityShares the liabilityShares of the vault + /// @param _liabilityShares the liabilityShares value of the vault (on the vaultsDataRefSlot) + /// @param _maxLiabilityShares the maxLiabilityShares value of the vault (on the vaultsDataRefSlot) /// @param _proof the proof of the reported data function updateVaultData( address _vault, @@ -374,18 +368,42 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { delete quarantines[_vault]; } + function _vaultInfo(address _vault, VaultHub _vh) internal view returns (VaultInfo memory) { + IStakingVault vault = IStakingVault(_vault); + VaultHub.VaultConnection memory connection = _vh.vaultConnection(_vault); + VaultHub.VaultRecord memory record = _vh.vaultRecord(_vault); + return VaultInfo( + _vault, + vault.availableBalance() + vault.stagedBalance(), + record.inOutDelta.currentValue(), + vault.withdrawalCredentials(), + record.liabilityShares, + record.maxLiabilityShares, + _mintableStETH(_vault, _vh), + connection.shareLimit, + connection.reserveRatioBP, + connection.forcedRebalanceThresholdBP, + connection.infraFeeBP, + connection.liquidityFeeBP, + connection.reservationFeeBP, + _vh.isPendingDisconnect(_vault) + ); + } + /// @notice handle sanity checks for the vault lazy report data /// @param _vault the address of the vault /// @param _totalValue the total value of the vault in refSlot /// @param _reportRefSlot the refSlot of the report /// @param _reportTimestamp the timestamp of the report /// @param _cumulativeLidoFees the cumulative Lido fees accrued on the vault (nominated in ether) + /// @param _liabilityShares the liabilityShares value of the vault (on the _reportRefSlot) + /// @param _maxLiabilityShares the maxLiabilityShares value of the vault (on the _reportRefSlot) /// @return totalValueWithoutQuarantine the smoothed total value of the vault after sanity checks /// @return inOutDeltaOnRefSlot the inOutDelta in the refSlot function _handleSanityChecks( address _vault, uint256 _totalValue, - uint48 _reportRefSlot, + uint256 _reportRefSlot, uint256 _reportTimestamp, uint256 _cumulativeLidoFees, uint256 _liabilityShares, @@ -393,18 +411,20 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { ) internal returns (uint256 totalValueWithoutQuarantine, int256 inOutDeltaOnRefSlot) { VaultHub vaultHub = _vaultHub(); VaultHub.VaultRecord memory record = vaultHub.vaultRecord(_vault); + uint48 previousReportTs = record.report.timestamp; // 0. Check if the report is already fresh enough - if (uint48(_reportTimestamp) <= record.report.timestamp) { + if (uint48(_reportTimestamp) <= previousReportTs) { revert VaultReportIsFreshEnough(); } // 1. Calculate inOutDelta in the refSlot int256 currentInOutDelta = record.inOutDelta.currentValue(); - inOutDeltaOnRefSlot = record.inOutDelta.getValueForRefSlot(_reportRefSlot); + inOutDeltaOnRefSlot = record.inOutDelta.getValueForRefSlot(uint48(_reportRefSlot)); // 2. Sanity check for total value increase - totalValueWithoutQuarantine = _processTotalValue(_vault, _totalValue, inOutDeltaOnRefSlot, record); + totalValueWithoutQuarantine = _processTotalValue( + _vault, _totalValue, inOutDeltaOnRefSlot, record, _reportTimestamp); // 3. Sanity check for dynamic total value underflow if (int256(totalValueWithoutQuarantine) + currentInOutDelta - inOutDeltaOnRefSlot < 0) { @@ -417,7 +437,7 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { revert CumulativeLidoFeesTooLow(_cumulativeLidoFees, previousCumulativeLidoFees); } - uint256 maxLidoFees = (_reportTimestamp - record.report.timestamp) * uint256(_storage().maxLidoFeeRatePerSecond); + uint256 maxLidoFees = (_reportTimestamp - previousReportTs) * uint256(_storage().maxLidoFeeRatePerSecond); if (_cumulativeLidoFees - previousCumulativeLidoFees > maxLidoFees) { revert CumulativeLidoFeesTooLarge(_cumulativeLidoFees - previousCumulativeLidoFees, maxLidoFees); } @@ -468,7 +488,8 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { address _vault, uint256 _reportedTotalValue, int256 _inOutDeltaOnRefSlot, - VaultHub.VaultRecord memory record + VaultHub.VaultRecord memory record, + uint256 _reportTimestamp ) internal returns (uint256 totalValueWithoutQuarantine) { if (_reportedTotalValue > MAX_SANE_TOTAL_VALUE) { revert TotalValueTooLarge(); @@ -493,7 +514,7 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { uint256 quarantineThreshold = onchainTotalValueOnRefSlot * (TOTAL_BASIS_POINTS + $.maxRewardRatioBP) / TOTAL_BASIS_POINTS; // 3. Determine current quarantine state - QuarantineState currentState = _determineQuarantineState(quarantine, quarantinedValue, $); + QuarantineState currentState = _determineQuarantineState(quarantine, quarantinedValue, _reportTimestamp); // Execute logic based on current state and conditions ---------------- @@ -505,7 +526,12 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { return _reportedTotalValue; } else { // Transition: NO_QUARANTINE → QUARANTINE_ACTIVE (start new quarantine) - _startNewQuarantine(_vault, quarantine, _reportedTotalValue - onchainTotalValueOnRefSlot, $.vaultsDataTimestamp); + _startNewQuarantine( + _vault, + quarantine, + _reportedTotalValue - onchainTotalValueOnRefSlot, + _reportTimestamp + ); return onchainTotalValueOnRefSlot; } } else if (currentState == QuarantineState.QUARANTINE_ACTIVE) { @@ -533,7 +559,7 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { } else { // Transition: QUARANTINE_EXPIRED → QUARANTINE_ACTIVE (release old, start new) emit QuarantineReleased(_vault, quarantinedValue); - _startNewQuarantine(_vault, quarantine, totalValueIncrease - quarantinedValue, $.vaultsDataTimestamp); + _startNewQuarantine(_vault, quarantine, totalValueIncrease - quarantinedValue, _reportTimestamp); return onchainTotalValueOnRefSlot + quarantinedValue; } } @@ -542,13 +568,13 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { function _determineQuarantineState( Quarantine storage _quarantine, uint256 _quarantinedValue, - Storage storage $ + uint256 _vaultsDataTimestamp ) internal view returns (QuarantineState) { if (_quarantinedValue == 0) { return QuarantineState.NO_QUARANTINE; } - bool isQuarantineExpired = ($.vaultsDataTimestamp - _quarantine.startTimestamp) >= $.quarantinePeriod; + bool isQuarantineExpired = (_vaultsDataTimestamp - _quarantine.startTimestamp) >= _storage().quarantinePeriod; return isQuarantineExpired ? QuarantineState.QUARANTINE_EXPIRED : QuarantineState.QUARANTINE_ACTIVE; } @@ -556,10 +582,10 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { address _vault, Quarantine storage _quarantine, uint256 _amountToQuarantine, - uint64 _currentTimestamp + uint256 _currentTimestamp ) internal { _quarantine.pendingTotalValueIncrease = uint128(_amountToQuarantine); - _quarantine.startTimestamp = _currentTimestamp; + _quarantine.startTimestamp = uint64(_currentTimestamp); emit QuarantineActivated(_vault, _amountToQuarantine); } @@ -575,9 +601,8 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable { emit SanityParamsUpdated(_quarantinePeriod, _maxRewardRatioBP, _maxLidoFeeRatePerSecond); } - function _mintableStETH(address _vault) internal view returns (uint256) { - VaultHub vaultHub = _vaultHub(); - uint256 mintableShares = vaultHub.totalMintingCapacityShares(_vault, 0 /* zero eth delta */); + function _mintableStETH(address _vault, VaultHub _vh) internal view returns (uint256) { + uint256 mintableShares = _vh.totalMintingCapacityShares(_vault, 0 /* zero eth delta */); return _getPooledEthBySharesRoundUp(mintableShares); } diff --git a/contracts/0.8.25/vaults/StakingVault.sol b/contracts/0.8.25/vaults/StakingVault.sol index 7f80bfb8bd..99fa8b2a2a 100644 --- a/contracts/0.8.25/vaults/StakingVault.sol +++ b/contracts/0.8.25/vaults/StakingVault.sol @@ -733,11 +733,6 @@ contract StakingVault is IStakingVault, Ownable2StepUpgradeable { */ error InsufficientValidatorWithdrawalFee(uint256 _passed, uint256 _required); - /** - * @notice Thrown when the vault is already ossified - */ - error VaultOssified(); - /** * @notice thrown when trying to recover ETH (via EIP-7528 address) using collectERC20 */ diff --git a/contracts/0.8.25/vaults/VaultHub.sol b/contracts/0.8.25/vaults/VaultHub.sol index 8ffe1f1a72..a8dd31f0bf 100644 --- a/contracts/0.8.25/vaults/VaultHub.sol +++ b/contracts/0.8.25/vaults/VaultHub.sol @@ -153,6 +153,8 @@ contract VaultHub is PausableUntilWithRoles { ILido public immutable LIDO; ILidoLocator public immutable LIDO_LOCATOR; + /// @dev it's cached as immutable to save the gas, but it's add some rigidity to the contract structure + /// and will require update of the VaultHub if HashConsensus changes IHashConsensus public immutable CONSENSUS_CONTRACT; /// @param _locator Lido Locator contract diff --git a/contracts/0.8.25/vaults/dashboard/NodeOperatorFee.sol b/contracts/0.8.25/vaults/dashboard/NodeOperatorFee.sol index 3ef9434261..7266c24e80 100644 --- a/contracts/0.8.25/vaults/dashboard/NodeOperatorFee.sol +++ b/contracts/0.8.25/vaults/dashboard/NodeOperatorFee.sol @@ -57,7 +57,7 @@ contract NodeOperatorFee is Permissions { */ bytes32 public constant NODE_OPERATOR_PROVE_UNKNOWN_VALIDATOR_ROLE = keccak256("vaults.NodeOperatorFee.ProveUnknownValidatorsRole"); - + /** * @notice If the accrued fee exceeds this BP of the total value, it is considered abnormally high. * An abnormally high fee can only be disbursed by `DEFAULT_ADMIN_ROLE`. @@ -74,7 +74,7 @@ contract NodeOperatorFee is Permissions { * Since these assumptions are highly conservative, in practice the operator * would need to disburse even less frequently before approaching the threshold. */ - uint256 constant internal ABNORMALLY_HIGH_FEE_THRESHOLD_BP = 1_00; + uint256 constant internal ABNORMALLY_HIGH_FEE_THRESHOLD_BP = 1_00; // ==================== Packed Storage Slot 1 ==================== /** @@ -320,7 +320,7 @@ contract NodeOperatorFee is Permissions { _setSettledGrowth(_newSettledGrowth); latestCorrectionTimestamp = uint64(block.timestamp); - emit CorrectionTimestampUpdated(latestCorrectionTimestamp); + emit CorrectionTimestampUpdated(block.timestamp); } /** @@ -350,10 +350,10 @@ contract NodeOperatorFee is Permissions { function _setFeeRate(uint256 _newFeeRate) internal { if (_newFeeRate > TOTAL_BASIS_POINTS) revert FeeValueExceed100Percent(); - uint16 oldFeeRate = feeRate; - uint16 newFeeRate = _newFeeRate.toUint16(); + uint256 oldFeeRate = feeRate; + uint256 newFeeRate = _newFeeRate; - feeRate = newFeeRate; + feeRate = uint16(newFeeRate); emit FeeRateSet(msg.sender, oldFeeRate, newFeeRate); } @@ -371,13 +371,15 @@ contract NodeOperatorFee is Permissions { /** * @dev Emitted when the node operator fee is set. + * @param sender the address of the sender * @param oldFeeRate The old node operator fee rate. * @param newFeeRate The new node operator fee rate. */ - event FeeRateSet(address indexed sender, uint64 oldFeeRate, uint64 newFeeRate); + event FeeRateSet(address indexed sender, uint256 oldFeeRate, uint256 newFeeRate); /** * @dev Emitted when the node operator fee is disbursed. + * @param sender the address of the sender * @param fee the amount of disbursed fee. */ event FeeDisbursed(address indexed sender, uint256 fee); @@ -401,7 +403,7 @@ contract NodeOperatorFee is Permissions { * @dev Emitted when the settled growth is corrected. * @param timestamp new correction timestamp */ - event CorrectionTimestampUpdated(uint64 timestamp); + event CorrectionTimestampUpdated(uint256 timestamp); // ==================== Errors ==================== diff --git a/contracts/0.8.25/vaults/dashboard/Permissions.sol b/contracts/0.8.25/vaults/dashboard/Permissions.sol index 1cf316ea0b..d8c616bc7c 100644 --- a/contracts/0.8.25/vaults/dashboard/Permissions.sol +++ b/contracts/0.8.25/vaults/dashboard/Permissions.sol @@ -93,12 +93,6 @@ abstract contract Permissions is AccessControlConfirmable { /// @dev 0x25482e7dc9e29f6da5bd70b6d19d17bbf44021da51ba0664a9f430c94a09c674 bytes32 public constant VAULT_CONFIGURATION_ROLE = keccak256("vaults.Permissions.VaultConfiguration"); - /** - * @notice Address of the implementation contract - * @dev Used to prevent initialization in the implementation - */ - address private immutable _SELF; - VaultHub public immutable VAULT_HUB; ILidoLocator public immutable LIDO_LOCATOR; @@ -111,7 +105,8 @@ abstract contract Permissions is AccessControlConfirmable { _requireNotZero(_vaultHub); _requireNotZero(_lidoLocator); - _SELF = address(this); + initialized = true; + // @dev vaultHub is cached as immutable to save gas for main operations VAULT_HUB = VaultHub(payable(_vaultHub)); LIDO_LOCATOR = ILidoLocator(_lidoLocator); @@ -123,7 +118,6 @@ abstract contract Permissions is AccessControlConfirmable { */ modifier initializer() { if (initialized) revert AlreadyInitialized(); - if (address(this) == _SELF) revert NonProxyCallsForbidden(); initialized = true; _; @@ -175,7 +169,7 @@ abstract contract Permissions is AccessControlConfirmable { * @dev If an account is not a member of a role, doesn't revert, emits no events. */ function revokeRoles(RoleAssignment[] calldata _assignments) external { - if (_assignments.length == 0) revert ZeroArgument(); + _requireNotZero(_assignments.length); for (uint256 i = 0; i < _assignments.length; i++) { revokeRole(_assignments[i].role, _assignments[i].account); @@ -373,11 +367,6 @@ abstract contract Permissions is AccessControlConfirmable { */ event Initialized(); - /** - * @notice Error when direct calls to the implementation are forbidden - */ - error NonProxyCallsForbidden(); - /** * @notice Error when the contract is already initialized. */ diff --git a/contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol b/contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol index ffddaa0a1e..51feaf330c 100644 --- a/contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol +++ b/contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol @@ -127,7 +127,7 @@ abstract contract CLProofVerifier { * @param _gIFirstValidatorPrev packed(general index | depth in Merkle tree, see GIndex.sol) GIndex of first validator in CL state tree * @param _gIFirstValidatorCurr packed GIndex of first validator after fork changes tree structure * @param _pivotSlot slot of the fork that alters first validator GIndex - * @dev if no fork changes are known, _gIFirstValidatorPrev = _gIFirstValidatorCurr and _changeSlot = 0 + * @dev if no fork changes are known, _gIFirstValidatorPrev = _gIFirstValidatorCurr and _pivotSlot = 0 */ constructor(GIndex _gIFirstValidatorPrev, GIndex _gIFirstValidatorCurr, uint64 _pivotSlot) { GI_FIRST_VALIDATOR_PREV = _gIFirstValidatorPrev; @@ -217,7 +217,6 @@ abstract contract CLProofVerifier { return abi.decode(data, (bytes32)); } - error InvalidTimestamp(); error InvalidSlot(); error RootNotFound(); } diff --git a/contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol b/contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol index 4377642aba..deec8458b0 100644 --- a/contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol +++ b/contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol @@ -147,15 +147,15 @@ contract PredepositGuarantee is IPredepositGuarantee, CLProofVerifier, PausableU * @param _genesisForkVersion genesis fork version for the current chain * @param _gIFirstValidator packed(general index + depth in tree, see GIndex.sol) GIndex of first validator in CL state tree * @param _gIFirstValidatorAfterChange packed GIndex of first validator after fork changes tree structure - * @param _changeSlot slot of the fork that alters first validator GIndex - * @dev if no fork changes are known, _gIFirstValidatorAfterChange = _gIFirstValidator and _changeSlot = 0 + * @param _pivotSlot slot of the fork that alters first validator GIndex + * @dev if no fork changes are known, _gIFirstValidatorAfterChange = _gIFirstValidator and _pivotSlot = 0 */ constructor( bytes4 _genesisForkVersion, GIndex _gIFirstValidator, GIndex _gIFirstValidatorAfterChange, - uint64 _changeSlot - ) CLProofVerifier(_gIFirstValidator, _gIFirstValidatorAfterChange, _changeSlot) { + uint64 _pivotSlot + ) CLProofVerifier(_gIFirstValidator, _gIFirstValidatorAfterChange, _pivotSlot) { DEPOSIT_DOMAIN = BLS12_381.computeDepositDomain(_genesisForkVersion); _disableInitializers(); _pauseUntil(PAUSE_INFINITELY); @@ -807,7 +807,7 @@ contract PredepositGuarantee is IPredepositGuarantee, CLProofVerifier, PausableU if (amount == 0) revert ZeroArgument("msg.value"); if (amount % PREDEPOSIT_AMOUNT != 0) revert ValueNotMultipleOfPredepositAmount(amount); - _storage().nodeOperatorBalance[_nodeOperator].total += uint128(amount); + _storage().nodeOperatorBalance[_nodeOperator].total += amount; emit BalanceToppedUp(_nodeOperator, msg.sender, amount); } diff --git a/contracts/common/lib/TriggerableWithdrawals.sol b/contracts/common/lib/TriggerableWithdrawals.sol index b20b7a2bf5..eb77aa6b7a 100644 --- a/contracts/common/lib/TriggerableWithdrawals.sol +++ b/contracts/common/lib/TriggerableWithdrawals.sol @@ -46,7 +46,7 @@ library TriggerableWithdrawals { bytes memory callData = new bytes(56); for (uint256 i = 0; i < keysCount; i++) { - _copyPubkeyToMemory(pubkeys, callData, i); + _copyAmountWithPubkeyToMemory(callData, 0, pubkeys, i); (bool success, ) = WITHDRAWAL_REQUEST.call{value: feePerRequest}(callData); @@ -126,8 +126,7 @@ library TriggerableWithdrawals { bytes memory callData = new bytes(56); for (uint256 i = 0; i < keysCount; i++) { - _copyPubkeyToMemory(pubkeys, callData, i); - _copyAmountToMemory(callData, amounts[i]); + _copyAmountWithPubkeyToMemory(callData, amounts[i], pubkeys, i); (bool success, ) = WITHDRAWAL_REQUEST.call{value: feePerRequest}(callData); @@ -155,15 +154,23 @@ library TriggerableWithdrawals { return abi.decode(feeData, (uint256)); } - function _copyPubkeyToMemory(bytes calldata pubkeys, bytes memory target, uint256 keyIndex) private pure { - assembly { - calldatacopy(add(target, 32), add(pubkeys.offset, mul(keyIndex, PUBLIC_KEY_LENGTH)), PUBLIC_KEY_LENGTH) - } - } - - function _copyAmountToMemory(bytes memory target, uint64 amount) private pure { + function _copyAmountWithPubkeyToMemory( + bytes memory target, + uint64 amount, + bytes calldata pubkeys, + uint256 keyIndex + ) private pure { assembly { - mstore(add(target, 80), shl(192, amount)) + // Write the amount first: + // mstore at [56..88) → uint64 lands in [80..88), zeroes [56..80) + mstore(add(target, 56), amount) + + // Then write the 48-byte pubkey into [32..80), overwriting the zeros above. + calldatacopy( + add(target, 32), + add(pubkeys.offset, mul(keyIndex, PUBLIC_KEY_LENGTH)), + PUBLIC_KEY_LENGTH + ) } } diff --git a/test/0.8.25/vaults/contracts/PredepositGuarantee__HarnessForFactory.sol b/test/0.8.25/vaults/contracts/PredepositGuarantee__HarnessForFactory.sol index 323d81729d..94c4992492 100644 --- a/test/0.8.25/vaults/contracts/PredepositGuarantee__HarnessForFactory.sol +++ b/test/0.8.25/vaults/contracts/PredepositGuarantee__HarnessForFactory.sol @@ -11,6 +11,6 @@ contract PredepositGuarantee__HarnessForFactory is PredepositGuarantee { bytes4 _genesisForkVersion, GIndex _gIFirstValidator, GIndex _gIFirstValidatorAfterChange, - uint64 _changeSlot - ) PredepositGuarantee(_genesisForkVersion, _gIFirstValidator, _gIFirstValidatorAfterChange, _changeSlot) {} + uint64 _pivotSlot + ) PredepositGuarantee(_genesisForkVersion, _gIFirstValidator, _gIFirstValidatorAfterChange, _pivotSlot) {} } diff --git a/test/0.8.25/vaults/dashboard/dashboard.test.ts b/test/0.8.25/vaults/dashboard/dashboard.test.ts index 542097c12d..92cdeb52a0 100644 --- a/test/0.8.25/vaults/dashboard/dashboard.test.ts +++ b/test/0.8.25/vaults/dashboard/dashboard.test.ts @@ -296,7 +296,7 @@ describe("Dashboard.sol", () => { it("reverts if called on the implementation", async () => { await expect( dashboardImpl.initialize(vaultOwner, nodeOperator, nodeOperator, nodeOperatorFeeBP, confirmExpiry), - ).to.be.revertedWithCustomError(dashboardImpl, "NonProxyCallsForbidden"); + ).to.be.revertedWithCustomError(dashboardImpl, "AlreadyInitialized"); }); }); diff --git a/test/0.8.25/vaults/nodeOperatorFee/nodeOperatorFee.test.ts b/test/0.8.25/vaults/nodeOperatorFee/nodeOperatorFee.test.ts index 6cb02deac7..4f3b758fe3 100644 --- a/test/0.8.25/vaults/nodeOperatorFee/nodeOperatorFee.test.ts +++ b/test/0.8.25/vaults/nodeOperatorFee/nodeOperatorFee.test.ts @@ -128,7 +128,7 @@ describe("NodeOperatorFee.sol", () => { await expect( nodeOperatorFeeImpl_.initialize(vaultOwner, nodeOperatorManager, 0n, days(7n)), - ).to.be.revertedWithCustomError(nodeOperatorFeeImpl_, "NonProxyCallsForbidden"); + ).to.be.revertedWithCustomError(nodeOperatorFeeImpl_, "AlreadyInitialized"); }); }); diff --git a/test/0.8.25/vaults/permissions/permissions.test.ts b/test/0.8.25/vaults/permissions/permissions.test.ts index 162ffb05aa..feb075d0ee 100644 --- a/test/0.8.25/vaults/permissions/permissions.test.ts +++ b/test/0.8.25/vaults/permissions/permissions.test.ts @@ -240,7 +240,7 @@ describe("Permissions", () => { const newImplementation = await ethers.deployContract("Permissions__Harness", [vaultHub, lidoLocator]); await expect(newImplementation.initialize(defaultAdmin, days(7n))).to.be.revertedWithCustomError( permissions, - "NonProxyCallsForbidden", + "AlreadyInitialized", ); }); diff --git a/test/0.8.25/vaults/predepositGuarantee/contracts/CLProofVerifier__harness.sol b/test/0.8.25/vaults/predepositGuarantee/contracts/CLProofVerifier__harness.sol index 9041ad0a50..abf7238323 100644 --- a/test/0.8.25/vaults/predepositGuarantee/contracts/CLProofVerifier__harness.sol +++ b/test/0.8.25/vaults/predepositGuarantee/contracts/CLProofVerifier__harness.sol @@ -11,8 +11,8 @@ contract CLProofVerifier__Harness is CLProofVerifier { constructor( GIndex _gIFirstValidator, GIndex _gIFirstValidatorAfterChange, - uint64 _changeSlot - ) CLProofVerifier(_gIFirstValidator, _gIFirstValidatorAfterChange, _changeSlot) {} + uint64 _pivotSlot + ) CLProofVerifier(_gIFirstValidator, _gIFirstValidatorAfterChange, _pivotSlot) {} function TEST_validatePubKeyWCProof( IPredepositGuarantee.ValidatorWitness calldata _witness, diff --git a/test/0.8.9/contracts/StakingModule__MockForTriggerableWithdrawals.sol b/test/0.8.9/contracts/StakingModule__MockForTriggerableWithdrawals.sol index 0fb2cfc8bb..d2b740af0c 100644 --- a/test/0.8.9/contracts/StakingModule__MockForTriggerableWithdrawals.sol +++ b/test/0.8.9/contracts/StakingModule__MockForTriggerableWithdrawals.sol @@ -35,10 +35,10 @@ contract StakingModule__MockForTriggerableWithdrawals is IStakingModule { } function isValidatorExitDelayPenaltyApplicable( - uint256 _nodeOperatorId, - uint256 _proofSlotTimestamp, - bytes calldata _publicKey, - uint256 _eligibleToExitInSec + uint256, + uint256, + bytes calldata, + uint256 ) external pure override returns (bool) { return false; // Default value for testing } @@ -94,11 +94,11 @@ contract StakingModule__MockForTriggerableWithdrawals is IStakingModule { return (0, 0, 0, 0, 0, 0, 0, 0); } - function getNodeOperatorsCount() external view override returns (uint256) { + function getNodeOperatorsCount() external pure override returns (uint256) { return 1; } - function getActiveNodeOperatorsCount() external view override returns (uint256) { + function getActiveNodeOperatorsCount() external pure override returns (uint256) { return 1; } diff --git a/test/0.8.9/contracts/TriggerableWithdrawalsGateway__Harness.sol b/test/0.8.9/contracts/TriggerableWithdrawalsGateway__Harness.sol index 051bc9f80a..626a166174 100644 --- a/test/0.8.9/contracts/TriggerableWithdrawalsGateway__Harness.sol +++ b/test/0.8.9/contracts/TriggerableWithdrawalsGateway__Harness.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.9; import {TriggerableWithdrawalsGateway} from "contracts/0.8.9/TriggerableWithdrawalsGateway.sol"; diff --git a/test/0.8.9/contracts/TriggerableWithdrawalsGateway__MockForVEB.sol b/test/0.8.9/contracts/TriggerableWithdrawalsGateway__MockForVEB.sol index aac5007d8f..c1d2b4d7b4 100644 --- a/test/0.8.9/contracts/TriggerableWithdrawalsGateway__MockForVEB.sol +++ b/test/0.8.9/contracts/TriggerableWithdrawalsGateway__MockForVEB.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.9; contract TriggerableWithdrawalsGateway__MockForVEB {