Skip to content
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

Feat/upgrade on forking #978

Open
wants to merge 24 commits into
base: feat/vaults
Choose a base branch
from
Open

Feat/upgrade on forking #978

wants to merge 24 commits into from

Conversation

arwer13
Copy link
Contributor

@arwer13 arwer13 commented Mar 10, 2025

No description provided.

@arwer13 arwer13 requested a review from a team as a code owner March 10, 2025 20:34
Copy link

github-actions bot commented Mar 10, 2025

badge

Hardhat Unit Tests Coverage Summary

Filename                                                                Stmts    Miss  Cover    Missing
--------------------------------------------------------------------  -------  ------  -------  -----------------------------------------------------------------------------------------------------------
contracts/0.4.24/Lido.sol                                                 222       7  96.85%   785, 790, 833-845, 994-995
contracts/0.4.24/StETH.sol                                                 79       0  100.00%
contracts/0.4.24/StETHPermit.sol                                           15       0  100.00%
contracts/0.4.24/lib/Packed64x4.sol                                         5       0  100.00%
contracts/0.4.24/lib/SigningKeys.sol                                       36       0  100.00%
contracts/0.4.24/lib/StakeLimitUtils.sol                                   37       0  100.00%
contracts/0.4.24/nos/NodeOperatorsRegistry.sol                            512       0  100.00%
contracts/0.4.24/oracle/LegacyOracle.sol                                   72       0  100.00%
contracts/0.4.24/utils/Pausable.sol                                         9       0  100.00%
contracts/0.4.24/utils/Versioned.sol                                        5       0  100.00%
contracts/0.6.12/WstETH.sol                                                17       0  100.00%
contracts/0.8.25/Accounting.sol                                            83       5  93.98%   118-121, 340, 368
contracts/0.8.25/interfaces/IDepositContract.sol                            0       0  100.00%
contracts/0.8.25/interfaces/ILido.sol                                       0       0  100.00%
contracts/0.8.25/interfaces/IOracleReportSanityChecker.sol                  0       0  100.00%
contracts/0.8.25/interfaces/IPostTokenRebaseReceiver.sol                    0       0  100.00%
contracts/0.8.25/interfaces/IStakingRouter.sol                              0       0  100.00%
contracts/0.8.25/interfaces/IWithdrawalQueue.sol                            0       0  100.00%
contracts/0.8.25/lib/GIndex.sol                                            33      18  45.45%   22, 34, 55, 63-70, 79, 86-101
contracts/0.8.25/lib/SSZ.sol                                               16      11  31.25%   31-100, 222-235
contracts/0.8.25/utils/AccessControlConfirmable.sol                        30       0  100.00%
contracts/0.8.25/utils/PausableUntilWithRoles.sol                           3       0  100.00%
contracts/0.8.25/vaults/Dashboard.sol                                      87       1  98.85%   380
contracts/0.8.25/vaults/Delegation.sol                                     40       0  100.00%
contracts/0.8.25/vaults/Permissions.sol                                    33       1  96.97%   267
contracts/0.8.25/vaults/StakingVault.sol                                  121       0  100.00%
contracts/0.8.25/vaults/VaultFactory.sol                                   46       0  100.00%
contracts/0.8.25/vaults/VaultHub.sol                                      173      45  73.99%   96, 282, 323-378, 457-467, 502-532, 545-554, 560-575
contracts/0.8.25/vaults/interfaces/IStakingVault.sol                        0       0  100.00%
contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol           11       1  90.91%   180
contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol      149      64  57.05%   150-151, 170-179, 238-244, 258-270, 294, 314, 362, 372, 377, 381, 421-501, 513, 528-547, 577, 588, 593, 596
contracts/0.8.4/WithdrawalsManagerProxy.sol                                61       0  100.00%
contracts/0.8.9/BeaconChainDepositor.sol                                   21       2  90.48%   48, 51
contracts/0.8.9/Burner.sol                                                 81       0  100.00%
contracts/0.8.9/DepositSecurityModule.sol                                 128       0  100.00%
contracts/0.8.9/EIP712StETH.sol                                            16       0  100.00%
contracts/0.8.9/LidoExecutionLayerRewardsVault.sol                         16       0  100.00%
contracts/0.8.9/LidoLocator.sol                                            22       0  100.00%
contracts/0.8.9/OracleDaemonConfig.sol                                     28       0  100.00%
contracts/0.8.9/StakingRouter.sol                                         316       0  100.00%
contracts/0.8.9/WithdrawalQueue.sol                                        88       0  100.00%
contracts/0.8.9/WithdrawalQueueBase.sol                                   146       0  100.00%
contracts/0.8.9/WithdrawalQueueERC721.sol                                  89       0  100.00%
contracts/0.8.9/WithdrawalVault.sol                                        21       0  100.00%
contracts/0.8.9/lib/Math.sol                                                4       0  100.00%
contracts/0.8.9/lib/PositiveTokenRebaseLimiter.sol                         22      22  0.00%    88-172
contracts/0.8.9/lib/UnstructuredRefStorage.sol                              2       0  100.00%
contracts/0.8.9/oracle/AccountingOracle.sol                               190       2  98.95%   154-155
contracts/0.8.9/oracle/BaseOracle.sol                                      89       1  98.88%   397
contracts/0.8.9/oracle/HashConsensus.sol                                  263       1  99.62%   1005
contracts/0.8.9/oracle/ValidatorsExitBusOracle.sol                         91       2  97.80%   138, 315
contracts/0.8.9/proxy/OssifiableProxy.sol                                  17       0  100.00%
contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol               217      50  76.96%   198, 235, 276-289, 309-327, 416-444, 498, 561-564, 572, 581, 589, 700, 705-750, 805
contracts/0.8.9/utils/DummyEmptyContract.sol                                0       0  100.00%
contracts/0.8.9/utils/PausableUntil.sol                                    31       0  100.00%
contracts/0.8.9/utils/Versioned.sol                                        11       0  100.00%
contracts/0.8.9/utils/access/AccessControl.sol                             23       0  100.00%
contracts/0.8.9/utils/access/AccessControlEnumerable.sol                    9       0  100.00%
contracts/common/utils/PausableUntil.sol                                   29       0  100.00%
contracts/testnets/sepolia/SepoliaDepositAdapter.sol                       21      21  0.00%    49-100
TOTAL                                                                    3886     254  93.46%

Diff against master

Filename                                                                Stmts    Miss  Cover
--------------------------------------------------------------------  -------  ------  --------
contracts/0.4.24/Lido.sol                                                 +10      +7  -3.15%
contracts/0.4.24/StETH.sol                                                 +7       0  +100.00%
contracts/0.8.25/Accounting.sol                                           +83      +5  +93.98%
contracts/0.8.25/interfaces/IDepositContract.sol                            0       0  +100.00%
contracts/0.8.25/interfaces/ILido.sol                                       0       0  +100.00%
contracts/0.8.25/interfaces/IOracleReportSanityChecker.sol                  0       0  +100.00%
contracts/0.8.25/interfaces/IPostTokenRebaseReceiver.sol                    0       0  +100.00%
contracts/0.8.25/interfaces/IStakingRouter.sol                              0       0  +100.00%
contracts/0.8.25/interfaces/IWithdrawalQueue.sol                            0       0  +100.00%
contracts/0.8.25/lib/GIndex.sol                                           +33     +18  +45.45%
contracts/0.8.25/lib/SSZ.sol                                              +16     +11  +31.25%
contracts/0.8.25/utils/AccessControlConfirmable.sol                       +30       0  +100.00%
contracts/0.8.25/utils/PausableUntilWithRoles.sol                          +3       0  +100.00%
contracts/0.8.25/vaults/Dashboard.sol                                     +87      +1  +98.85%
contracts/0.8.25/vaults/Delegation.sol                                    +40       0  +100.00%
contracts/0.8.25/vaults/Permissions.sol                                   +33      +1  +96.97%
contracts/0.8.25/vaults/StakingVault.sol                                 +121       0  +100.00%
contracts/0.8.25/vaults/VaultFactory.sol                                  +46       0  +100.00%
contracts/0.8.25/vaults/VaultHub.sol                                     +173     +45  +73.99%
contracts/0.8.25/vaults/interfaces/IStakingVault.sol                        0       0  +100.00%
contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol          +11      +1  +90.91%
contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol     +149     +64  +57.05%
contracts/0.8.9/Burner.sol                                                +10       0  +100.00%
contracts/0.8.9/LidoLocator.sol                                            +4       0  +100.00%
contracts/0.8.9/lib/PositiveTokenRebaseLimiter.sol                          0     +22  -100.00%
contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol               -15     +50  -23.04%
contracts/common/utils/PausableUntil.sol                                  +29       0  +100.00%
TOTAL                                                                    +870    +225  -5.58%

Results for commit: 47fb019

Minimum allowed coverage is 90%

♻️ This comment has been updated with latest results

@arwer13 arwer13 requested a review from a team as a code owner March 11, 2025 17:47
Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

run: cp deployed-mainnet.json deployed-mainnet-upgrade.json

- name: Run upgrade
run: ./scripts/dao-upgrade.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 let's think about the granular approach:

  • pre-deployment
  • deployed but pre-vote
  • vote started
  • vote finished not enacted
  • vote finished and enacted

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall have entry point from dao-ops to run arbitrary evm scripts (later-later)

@@ -1,3 +1,9 @@
{
"steps": []
"steps": [
"upgrade/steps/0100-deploy-contracts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we re-use scratch?
seems not but would need to sync both

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 Testnet and Mainnet both together?

bytes32 internal constant DEFAULT_ADMIN_ROLE = 0x00;
// Burner
bytes32 internal constant REQUEST_BURN_SHARES_ROLE = keccak256("REQUEST_BURN_SHARES_ROLE");
bytes32 internal constant REQUEST_BURN_MY_STETH_ROLE = keccak256("REQUEST_BURN_MY_STETH_ROLE");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheDZhon need to redo ACL for Burner

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double check that Burner isn't cached somewhere

}

function _finishUpgrade() internal {
if (msg.sender != _voting) revert OnlyVotingCanUpgrade();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 after DG here should be Agent (not for this particular line)

_assertSingleOZRoleHolder(_withdrawalVault, DEFAULT_ADMIN_ROLE, _agent);
_assertSingleOZRoleHolder(_withdrawalVault, ADD_FULL_WITHDRAWAL_REQUEST_ROLE, _validatorsExitBusOracle);

// VaultHub
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here will be PDG too

  • probably two new gate seals

* The initialization is moved from the constructor to be able to set the shares burnt counters
* to the up-to-date values from the old Burner upon the upgrade.
*/
function initialize(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️

  • we have to migrate the whole state, the most important is about *BurnRequested
  • transfer stETH back here ⚠️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's pass the prev burner address

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 should be a part of the finalizeUpgrade_Vx for Lido

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be a proxy?

Comment on lines +436 to +441
function _assertAragonAppImplementation(IAragonAppRepo repo, address implementation) internal view {
(, address actualImplementation, ) = repo.getLatest();
if (actualImplementation != implementation) {
revert IncorrectAragonAppImplementation(address(repo), implementation);
}
}

Check warning

Code scanning / Slither

Unused return Medium

Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Great structure!

Some notes about burner, withdrawal vault, and beacon 👀

Some code style enforcement would probably help

_setContractVersion(3);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's check oldBurner != newBurner


_initialize_v3();
_initialize_v3(_oldBurner);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ add other approves and revoke old ones for other contracts (e.g. NOR, CSM, etc.)

address predepositGuarantee;

// New non-proxy contracts
address burner;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make it a proxy, 7201 storage (a separate PR)

address voting;
address nodeOperatorsRegistry;
address simpleDvt;
address wstETH;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably can remove it bc new locator has it, for old one the workaround is retrieve through WQ

// New non-aragon implementations
address accountingOracleImplementation;
address newLocatorImplementation;
address withdrawalVaultImplementation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ should detach it

//
event UpgradeFinished();

struct UpgradeTemplateV3Params {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ we don't check a beacon anyhow atm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants