8000 feat: Cumulative post-testnet 2 updates by tamtamchik · Pull Request #1189 · lidofinance/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Cumulative post-testnet 2 updates #1189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: feat/vaults
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9291405
fix: remove unused imports
arwer13 Jun 17, 2025
2d6a207
fix: decrease shareLimit in default tier
tamtamchik Jun 18, 2025
0a335f2
fix: update accounting simulate result
tamtamchik Jun 18, 2025
5621118
feat: add inout delta and vaults count getters back
vp4242 Jun 18, 2025
6639580
fix(LazyOracle): update implementation
tamtamchik Jun 18, 2025
6858579
Merge pull request #1187 from lidofinance/fix/nitpicks
arwer13 Jun 19, 2025
70c9590
refactor: use abs imports in all TW upgrade contracts
arwer13 Jun 19, 2025
c7372de
refactor: make imports abs and move a few interfaces to common
arwer13 Jun 19, 2025
ddaa2cb
fix: optimize permissions modifier
Jeday Jun 20, 2025
53305de
Merge branch 'feat/vaults' into feat/testnet-2
tamtamchik Jun 20, 2025
acb5c86
feat(V3VoteScript): dont update Lido app repo version
arwer13 Jun 25, 2025
5eaa9f8
Merge pull request #1196 from lidofinance/refactor/abs-contract-imports
arwer13 Jun 25, 2025
8738cc3
refactor(WithdrawalsManagerProxy): disable some solhint rules
arwer13 Jun 25, 2025
ee42490
Merge 'feat/triggerable-exits' into 'feat/vaults'
arwer13 Jun 25, 2025
12f4b4e
Merge pull request #1209 from lidofinance/feat/no-lido-app-version-up…
arwer13 Jun 25, 2025
d29e838
Merge pull request #1210 from lidofinance/feat/merge-tw-branch
arwer13 Jun 25, 2025
97f9c0b
Merge pull request #1199 from lidofinance/fix/permissions-micro-optim…
folkyatina Jul 2, 2025
46ae313
chore: make autofill roles a separate function
folkyatina Jul 2, 2025
83b0dc9
test: fix autofillRoles helper
folkyatina Jul 2, 2025
6cbe5e2
test: add tests for report freshness issue
folkyatina Jul 2, 2025
1d20f81
chore: disable test that is fixed in #1215
folkyatina Jul 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions contracts/0.4.24/nos/NodeOperatorsRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import {AragonApp} from "@aragon/os/contracts/apps/AragonApp.sol";
import {SafeMath} from "@aragon/os/contracts/lib/math/SafeMath.sol";
import {UnstructuredStorage} from "@aragon/os/contracts/common/UnstructuredStorage.sol";

import {Math256} from "../../common/lib/Math256.sol";
import {MinFirstAllocationStrategy} from "../../common/lib/MinFirstAllocationStrategy.sol";
import {ILidoLocator} from "../../common/interfaces/ILidoLocator.sol";
import {Math256} from "contracts/common/lib/Math256.sol";
import {MinFirstAllocationStrategy} from "contracts/common/lib/MinFirstAllocationStrategy.sol";
import {ILidoLocator} from "contracts/common/interfaces/ILidoLocator.sol";

import {SigningKeys} from "../lib/SigningKeys.sol";
import {Packed64x4} from "../lib/Packed64x4.sol";
import {Versioned} from "../utils/Versioned.sol";
Expand Down
9 changes: 8 additions & 1 deletion contracts/0.8.25/vaults/LazyOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {Math256} from "contracts/common/lib/Math256.sol";
import {ILazyOracle} from "contracts/common/interfaces/ILazyOracle.sol";
import {ILidoLocator} from "contracts/common/interfaces/ILidoLocator.sol";
import {ILido} from "contracts/common/interfaces/ILido.sol";
import {IHashConsensus} from "contracts/common/interfaces/IHashConsensus.sol";

import {VaultHub} from "./VaultHub.sol";
import {OperatorGrid} from "./OperatorGrid.sol";
Expand Down Expand Up @@ -95,6 +94,7 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable {
address vault;
uint96 vaultIndex;
uint256 balance;
int256 inOutDelta;
bytes32 withdrawalCredentials;
uint256 liabilityShares;
uint256 mintableStETH;
Expand Down Expand Up @@ -177,6 +177,12 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable {
});
}

/// @notice returns the number of vaults connected to the VaultHub
/// @return the number of vaults connected to the VaultHub
function vaultsCount() external view returns (uint256) {
return _vaultHub().vaultsCount();
}

/// @notice returns batch of vaults info
/// @param _offset in the vaults list [0, vaultsCount)
/// @param _limit maximum number of vaults to return
Expand All @@ -201,6 +207,7 @@ contract LazyOracle is ILazyOracle, AccessControlEnumerableUpgradeable {
vaultAddress,
connection.vaultIndex,
address(vault).balance,
vaultHub.inOutDeltaAsOfLastRefSlot(vaultAddress),
vault.withdrawalCredentials(),
record.liabilityShares,
_mintableStETH(vaultAddress),
Expand Down
21 changes: 15 additions & 6 deletions contracts/0.8.25/vaults/dashboard/Permissions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,10 @@ abstract contract Permissions is AccessControlConfirmable {
* @param _role The role to check.
*/
modifier onlyRoleMemberOrAdmin(bytes32 _role) {
if (hasRole(_role, msg.sender) || hasRole(getRoleAdmin(_role), msg.sender)) {
_;
} else {
if (!(hasRole(_role, msg.sender) || hasRole(getRoleAdmin(_role), msg.sender))) {
revert AccessControlUnauthorizedAccount(msg.sender, _role);
}
_;
}

/**
Expand Down Expand Up @@ -271,7 +270,9 @@ abstract contract Permissions is AccessControlConfirmable {
* @dev Checks the REQUEST_VALIDATOR_EXIT_ROLE and requests validator exit on the StakingVault.
* @dev The zero check for _pubkeys is performed in the StakingVault contract.
*/
function _requestValidatorExit(bytes calldata _pubkeys) internal onlyRoleMemberOrAdmin(REQUEST_VALIDATOR_EXIT_ROLE) {
function _requestValidatorExit(
bytes calldata _pubkeys
) internal onlyRoleMemberOrAdmin(REQUEST_VALIDATOR_EXIT_ROLE) {
VAULT_HUB.requestValidatorExit(address(_stakingVault()), _pubkeys);
}

Expand All @@ -284,7 +285,12 @@ abstract contract Permissions is AccessControlConfirmable {
uint64[] calldata _amounts,
address _refundRecipient
) internal onlyRoleMemberOrAdmin(TRIGGER_VALIDATOR_WITHDRAWAL_ROLE) {
VAULT_HUB.triggerValidatorWithdrawals{value: msg.value}(address(_stakingVault()), _pubkeys, _amounts, _refundRecipient);
VAULT_HUB.triggerValidatorWithdrawals{value: msg.value}(
address(_stakingVault()),
_pubkeys,
_amounts,
_refundRecipient
);
}

/**
Expand Down Expand Up @@ -357,7 +363,10 @@ abstract contract Permissions is AccessControlConfirmable {
* @param _requestedShareLimit The requested share limit.
* @return bool Whether the tier change was confirmed.
*/
function _changeTier(uint256 _tierId, uint256 _requestedShareLimit) internal onlyRoleMemberOrAdmin(CHANGE_TIER_ROLE) returns (bool) {
function _changeTier(
uint256 _tierId,
uint256 _requestedShareLimit
) internal onlyRoleMemberOrAdmin(CHANGE_TIER_ROLE) returns (bool) {
return _operatorGrid().changeTier(address(_stakingVault()), _tierId, _requestedShareLimit);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
pragma solidity 0.8.25;

import {GIndex} from "contracts/common/lib/GIndex.sol";
import {SSZ} from "contracts/common/lib/SSZ.sol";
import {BLS12_381} from "contracts/common/lib/BLS.sol";
import {PausableUntilWithRoles} from "contracts/0.8.25/utils/PausableUntilWithRoles.sol";

Expand Down
7 changes: 7 additions & 0 deletions contracts/0.8.9/Accounting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ contract Accounting {
/// @notice amount of CL ether that is not rewards earned during this report period
/// the sum of CL balance on the previous report and the amount of fresh deposits since then
uint256 principalClBalance;
/// @notice total number of stETH shares before the report is applied
uint256 preTotalShares;
/// @notice amount of ether under the protocol before the report is applied
uint256 preTotalPooledEther;
/// @notice total number of internal (not backed by vaults) stETH shares after the report is applied
uint256 postInternalShares;
/// @notice amount of ether under the protocol after the report is applied
Expand Down Expand Up @@ -166,6 +170,9 @@ contract Accounting {
ReportValues calldata _report,
uint256 _withdrawalsShareRate
) internal view returns (CalculatedValues memory update) {
update.preTotalShares = _pre.totalShares;
update.preTotalPooledEther = _pre.totalPooledEther;

update.rewardDistribution = _getStakingRewardsDistribution(_contracts.stakingRouter);

if (_withdrawalsShareRate != 0) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/0.8.9/LidoLocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;

import {ILidoLocator} from "../common/interfaces/ILidoLocator.sol";
import {ILidoLocator} from "contracts/common/interfaces/ILidoLocator.sol";

/**
* @title LidoLocator
Expand Down
10 changes: 4 additions & 6 deletions contracts/0.8.9/StakingRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;

import {AccessControlEnumerable} from "./utils/access/AccessControlEnumerable.sol";
import {MinFirstAllocationStrategy} from "contracts/common/lib/MinFirstAllocationStrategy.sol";
import {Math256} from "contracts/common/lib/Math256.sol";

import {AccessControlEnumerable} from "./utils/access/AccessControlEnumerable.sol";
import {IStakingModule} from "./interfaces/IStakingModule.sol";

import {Math256} from "../common/lib/Math256.sol";
import {UnstructuredStorage} from "./lib/UnstructuredStorage.sol";
import {MinFirstAllocationStrategy} from "../common/lib/MinFirstAllocationStrategy.sol";

import {BeaconChainDepositor} from "./BeaconChainDepositor.sol";
import {Versioned} from "./utils/Versioned.sol";
import {BeaconChainDepositor} from "./BeaconChainDepositor.sol";

contract StakingRouter is AccessControlEnumerable, BeaconChainDepositor, Versioned {
using UnstructuredStorage for bytes32;
Expand Down
3 changes: 2 additions & 1 deletion contracts/0.8.9/TriggerableWithdrawalsGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;

import {ILidoLocator} from "contracts/common/interfaces/ILidoLocator.sol";

import {AccessControlEnumerable} from "./utils/access/AccessControlEnumerable.sol";
import {ILidoLocator} from "../common/interfaces/ILidoLocator.sol";
import {ExitRequestLimitData, ExitLimitUtilsStorage, ExitLimitUtils} from "./lib/ExitLimitUtils.sol";
import {PausableUntil} from "./utils/PausableUntil.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/0.8.9/oracle/ValidatorsExitBus.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;

import {ILidoLocator} from "contracts/common/interfaces/ILidoLocator.sol";
import {AccessControlEnumerable} from "../utils/access/AccessControlEnumerable.sol";
import {UnstructuredStorage} from "../lib/UnstructuredStorage.sol";
import {ILidoLocator} from "../../common/interfaces/ILidoLocator.sol";
import {Versioned} from "../utils/Versioned.sol";
import {ExitRequestLimitData, ExitLimitUtilsStorage, ExitLimitUtils} from "../lib/ExitLimitUtils.sol";
import {PausableUntil} from "../utils/PausableUntil.sol";
Expand Down
3 changes: 3 additions & 0 deletions contracts/0.8.9/proxy/WithdrawalsManagerProxy.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// SPDX-License-Identifier: MIT

// See contracts/COMPILERS.md
pragma solidity 0.8.9;

Check warning on line 4 in contracts/0.8.9/proxy/WithdrawalsManagerProxy.sol

View workflow job for this annotation

GitHub Actions / Solhint

Found more than One contract per file. 6 contracts found!

// These rules are disabled because the contract is taken mostly as it is deployed (and unchangeable) on the Mainnet
// solhint-disable one-contract-per-file
// solhint-disable gas-custom-errors

////////////////////////////////////////////////////////////////////////////////////////////////////
/// PART: WithdrawalsManagerStub.sol ///////////////////////////////////////////////////////////////
Expand Down
13 changes: 0 additions & 13 deletions contracts/common/interfaces/IStakingRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@
pragma solidity >=0.5.0;

interface IStakingRouter {
function getStakingRewardsDistribution()
external
view
returns (
address[] memory recipients,
uint256[] memory stakingModuleIds,
uint96[] memory stakingModuleFees,
uint96 totalFee,
uint256 precisionPoints
);

function reportRewardsMinted(uint256[] calldata _stakingModuleIds, uint256[] calldata _totalShares) external;

function reportValidatorExitDelay(
uint256 _moduleId,
uint256 _nodeOperatorId,
Expand Down
35 changes: 10 additions & 25 deletions contracts/upgrade/V3VoteScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import {IOssifiableProxy} from "contracts/common/interfaces/IOssifiableProxy.sol
import {OmnibusBase} from "./utils/OmnibusBase.sol";
import {V3Template} from "./V3Template.sol";

interface IRepo {
function newVersion(uint16[3] calldata _newSemanticVersion, address _contractAddress, bytes calldata _contentURI) external;
}

interface IKernel {
function setApp(bytes32 _namespace, bytes32 _appId, address _app) external;
function APP_BASES_NAMESPACE() external view returns (bytes32);
Expand All @@ -28,14 +24,13 @@ contract V3VoteScript is OmnibusBase {

struct ScriptParams {
address upgradeTemplate;
uint16[3] lidoAppNewVersion;
bytes32 lidoAppId;
}

//
// Constants
//
uint256 public constant VOTE_ITEMS_COUNT = 12;
uint256 public constant VOTE_ITEMS_COUNT = 11;

//
// Immutables
Expand Down Expand Up @@ -71,19 +66,9 @@ contract V3VoteScript is OmnibusBase {
call: _forwardCall(TEMPLATE.AGENT(), TEMPLATE.LOCATOR(), abi.encodeCall(IOssifiableProxy.proxy__upgradeTo, (TEMPLATE.NEW_LOCATOR_IMPL())))
});

// Update Lido version in Lido App Repo
voteItems[index++] = VoteItem({
description: "3. Update Lido version in Lido App Repo",
call: _votingCall(TEMPLATE.ARAGON_APP_LIDO_REPO(), abi.encodeCall(IRepo.newVersion, (
params.lidoAppNewVersion,
TEMPLATE.NEW_LIDO_IMPL(),
"0x"
)))
});

// Set Lido implementation in Kernel
voteItems[index++] = VoteItem({
description: "4. Set Lido implementation in Kernel",
description: "3. Set Lido implementation in Kernel",
call: _votingCall(
TEMPLATE.KERNEL(),
abi.encodeCall(IKernel.setApp, (IKernel(TEMPLATE.KERNEL()).APP_BASES_NAMESPACE(), params.lidoAppId, TEMPLATE.NEW_LIDO_IMPL()))
Expand All @@ -93,7 +78,7 @@ contract V3VoteScript is OmnibusBase {
// Revoke REQUEST_BURN_SHARES_ROLE from Lido
bytes32 requestBurnSharesRole = IBurner(TEMPLATE.OLD_BURNER()).REQUEST_BURN_SHARES_ROLE();
voteItems[index++] = VoteItem({
description: "5. Revoke REQUEST_BURN_SHARES_ROLE from Lido",
description: "4. Revoke REQUEST_BURN_SHARES_ROLE from Lido",
call: _forwardCall(
TEMPLATE.AGENT(),
TEMPLATE.OLD_BURNER(),
Expand All @@ -103,7 +88,7 @@ contract V3VoteScript is OmnibusBase {

// Revoke REQUEST_BURN_SHARES_ROLE from Curated staking modules (NodeOperatorsRegistry)
voteItems[index++] = VoteItem({
description: "6. Revoke REQUEST_BURN_SHARES_ROLE from Curated staking module",
description: "5. Revoke REQUEST_BURN_SHARES_ROLE from Curated staking module",
call: _forwardCall(
TEMPLATE.AGENT(),
TEMPLATE.OLD_BURNER(),
Expand All @@ -113,7 +98,7 @@ contract V3VoteScript is OmnibusBase {

// Revoke REQUEST_BURN_SHARES_ROLE from SimpleDVT
voteItems[index++] = VoteItem({
description: "7. Revoke REQUEST_BURN_SHARES_ROLE from SimpleDVT",
description: "6. Revoke REQUEST_BURN_SHARES_ROLE from SimpleDVT",
call: _forwardCall(
TEMPLATE.AGENT(),
TEMPLATE.OLD_BURNER(),
Expand All @@ -123,7 +108,7 @@ contract V3VoteScript is OmnibusBase {

// Revoke REQUEST_BURN_SHARES_ROLE from CS Accounting
voteItems[index++] = VoteItem({
description: "8. Revoke REQUEST_BURN_SHARES_ROLE from Community Staking Accounting",
description: "7. Revoke REQUEST_BURN_SHARES_ROLE from Community Staking Accounting",
call: _forwardCall(
TEMPLATE.AGENT(),
TEMPLATE.OLD_BURNER(),
Expand All @@ -133,7 +118,7 @@ contract V3VoteScript is OmnibusBase {

// Upgrade AccountingOracle implementation
voteItems[index++] = VoteItem({
description: "9. Upgrade AccountingOracle implementation",
description: "8. Upgrade AccountingOracle implementation",
call: _forwardCall(
TEMPLATE.AGENT(),
TEMPLATE.ACCOUNTING_ORACLE(),
Expand All @@ -144,7 +129,7 @@ contract V3VoteScript is OmnibusBase {
// Revoke REPORT_REWARDS_MINTED_ROLE from Lido
bytes32 reportRewardsMintedRole = IStakingRouter(TEMPLATE.STAKING_ROUTER()).REPORT_REWARDS_MINTED_ROLE();
voteItems[index++] = VoteItem({
description: "10. Revoke REPORT_REWARDS_MINTED_ROLE from Lido",
description: "9. Revoke REPORT_REWARDS_MINTED_ROLE from Lido",
call: _forwardCall(
TEMPLATE.AGENT(),
TEMPLATE.STAKING_ROUTER(),
Expand All @@ -154,7 +139,7 @@ contract V3VoteScript is OmnibusBase {

// Grant REPORT_REWARDS_MINTED_ROLE to Accounting
voteItems[index++] = VoteItem({
description: "11. Grant REPORT_REWARDS_MINTED_ROLE to Accounting",
description: "10. Grant REPORT_REWARDS_MINTED_ROLE to Accounting",
call: _forwardCall(
TEMPLATE.AGENT(),
TEMPLATE.STAKING_ROUTER(),
Expand All @@ -164,7 +149,7 @@ contract V3VoteScript is OmnibusBase {

// Finish the upgrade process
voteItems[index++] = VoteItem({
description: "12. Call UpgradeTemplateV3.finishUpgrade",
description: "11. Call UpgradeTemplateV3.finishUpgrade",
call: _forwardCall(TEMPLATE.AGENT(), params.upgradeTemplate, abi.encodeCall(V3Template.finishUpgrade, ()))
});

Expand Down
6 changes: 3 additions & 3 deletions deployed-hoodi-vaults-testnet-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
< 10000 span class='blob-code-inner blob-code-marker ' data-code-marker=" "> },
"implementation": {
"contract": "contracts/0.8.9/Accounting.sol",
"address": "0xa833E5Bc6c38Ab06dfe2ef27947Abb26323538dD",
"address": "0xA125e823C724Ea94F5935554DA3e76b65631682F",
"constructorArgs": ["0xD7c1B80fA86965B48cCA3aDcCB08E1DAEa291980", "0x2C220A2a91602dd93bEAC7b3A1773cdADE369ba1"]
}
},
Expand Down Expand Up @@ -474,7 +474,7 @@
},
"implementation": {
"contract": "contracts/0.8.25/vaults/LazyOracle.sol",
"address": "0xf8886BEB7DA44Ba43bc1bA2AD8216a1901BcEeA6",
"address": "0x65c513a2EE3aadDb5F765bC6e16F33C12C5B8613",
"constructorArgs": ["0xD7c1B80fA86965B48cCA3aDcCB08E1DAEa291980"]
}
},
Expand Down Expand Up @@ -670,7 +670,7 @@
]
}
},
"scratchDeployGasUsed": "157280773",
"scratchDeployGasUsed": "161372708",
"simpleDvt": {
"deployParameters": {
"stakingModuleName": "SimpleDVT",
Expand Down
3 changes: 3 additions & 0 deletions lib/protocol/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ export { ensureDsmGuardians } from "./dsm";
export { norSdvtEnsureOperators } from "./nor-sdvt";
export { calcNodeOperatorRewards } from "./staking-module";
export {
autofillRoles,
createVaultProxy,
createVaultsReportTree,
createVaultWithDashboard,
generatePredepositData,
getPubkeys,
getProofAndDepositData,
reportVaultDataWithProof,
setupLidoForVaults,
VaultRoles,
Expand Down
Loading
Loading
0