8000 feat: upgrade on forking by arwer13 · Pull Request #978 · lidofinance/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: upgrade on forking #978

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 76 commits into
base: feat/vaults
Choose a base branch
from
Open

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                                                 215       5  97.67%   818-830, 971-972
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/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                                            82       1  98.78%   321
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/BLS.sol                                               27       3  88.89%   275, 342, 369
contracts/0.8.25/lib/BeaconTypes.sol                                        0       0  100.00%
contracts/0.8.25/lib/GIndex.sol                                            33      18  45.45%   23, 35, 56, 64-71, 80, 87-102
contracts/0.8.25/lib/SSZ.sol                                               21       7  66.67%   62-164, 354
contracts/0.8.25/upgrade/OmnibusBase.sol                                   12      12  0.00%    35-89
contracts/0.8.25/upgrade/V3Addresses.sol                                   41      41  0.00%    112-170
contracts/0.8.25/upgrade/V3Template.sol                                   117     117  0.00%    175-442
contracts/0.8.25/upgrade/V3VoteScript.sol                                  17      17  0.00%    60-163
contracts/0.8.25/upgrade/calls_script_builder.sol                           5       5  0.00%    12-25
contracts/0.8.25/upgrade/interfaces/IAragonVoting.sol                       0       0  100.00%
contracts/0.8.25/upgrade/interfaces/IForwarder.sol                          0       0  100.00%
contracts/0.8.25/upgrade/interfaces/IOssifiableProxy.sol                    0       0  100.00%
contracts/0.8.25/upgrade/interfaces/IVoting.sol                             0       0  100.00%
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/OperatorGrid.sol                                  141       0  100.00%
contracts/0.8.25/vaults/PinnedBeaconProxy.sol                               5       0  100.00%
contracts/0.8.25/vaults/StakingVault.sol                                  162       0  100.00%
contracts/0.8.25/vaults/VaultFactory.sol                                   25       4  84.00%   92-97
contracts/0.8.25/vaults/VaultHub.sol                                      204      23  88.73%   143, 336, 339, 341, 393-411, 474, 481, 517-519, 646-647
contracts/0.8.25/vaults/dashboard/Dashboard.sol                           105      24  77.14%   231, 335-371, 399-400, 519, 569-575
contracts/0.8.25/vaults/dashboard/NodeOperatorFee.sol                      41       0  100.00%
contracts/0.8.25/vaults/dashboard/Permissions.sol                          46       6  86.96%   345-358, 411
contracts/0.8.25/vaults/interfaces/IPredepositGuarantee.sol                 0       0  100.00%
contracts/0.8.25/vaults/interfaces/IStakingVault.sol                        0       0  100.00%
contracts/0.8.25/vaults/lib/PinnedBeaconUtils.sol                           6       0  100.00%
contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol           16       1  93.75%   213
contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol      153       0  100.00%
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       0  100.00%
contracts/0.8.9/lib/UnstructuredRefStorage.sol                              2       0  100.00%
contracts/0.8.9/oracle/AccountingOracle.sol                               172       2  98.84%   127-128
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               216       1  99.54%   859
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                                                                    4255     314  92.62%

Diff against master

Filename                                                                Stmts    Miss  Cover
--------------------------------------------------------------------  -------  ------  --------
contracts/0.4.24/Lido.sol                                                  +3      +5  -2.33%
contracts/0.4.24/StETH.sol                                                 +7       0  +100.00%
contracts/0.8.25/Accounting.sol                                           +82      +1  +98.78%
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/BLS.sol                                              +27      +3  +88.89%
contracts/0.8.25/lib/BeaconTypes.sol                                        0       0  +100.00%
contracts/0.8.25/lib/GIndex.sol                                           +33     +18  +45.45%
contracts/0.8.25/lib/SSZ.sol                                              +21      +7  +66.67%
contracts/0.8.25/upgrade/OmnibusBase.sol                                  +12     +12  +100.00%
contracts/0.8.25/upgrade/V3Addresses.so
10000
l                                  +41     +41  +100.00%
contracts/0.8.25/upgrade/V3Template.sol                                  +117    +117  +100.00%
contracts/0.8.25/upgrade/V3VoteScript.sol                                 +17     +17  +100.00%
contracts/0.8.25/upgrade/calls_script_builder.sol                          +5      +5  +100.00%
contracts/0.8.25/upgrade/interfaces/IAragonVoting.sol                       0       0  +100.00%
contracts/0.8.25/upgrade/interfaces/IForwarder.sol                          0       0  +100.00%
contracts/0.8.25/upgrade/interfaces/IOssifiableProxy.sol                    0       0  +100.00%
contracts/0.8.25/upgrade/interfaces/IVoting.sol                             0       0  +100.00%
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/OperatorGrid.sol                                 +141       0  +100.00%
contracts/0.8.25/vaults/PinnedBeaconProxy.sol                              +5       0  +100.00%
contracts/0.8.25/vaults/StakingVault.sol                                 +162       0  +100.00%
contracts/0.8.25/vaults/VaultFactory.sol                                  +25      +4  +84.00%
contracts/0.8.25/vaults/VaultHub.sol                                     +204     +23  +88.73%
contracts/0.8.25/vaults/dashboard/Dashboard.sol                          +105     +24  +77.14%
contracts/0.8.25/vaults/dashboard/NodeOperatorFee.sol                     +41       0  +100.00%
contracts/0.8.25/vaults/dashboard/Permissions.sol                         +46      +6  +86.96%
contracts/0.8.25/vaults/interfaces/IPredepositGuarantee.sol                 0       0  +100.00%
contracts/0.8.25/vaults/interfaces/IStakingVault.sol                        0       0  +100.00%
contracts/0.8.25/vaults/lib/PinnedBeaconUtils.sol                          +6       0  +100.00%
contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol          +16      +1  +93.75%
contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol     +153       0  +100.00%
contracts/0.8.9/Burner.sol                                                +10       0  +100.00%
contracts/0.8.9/LidoLocator.sol                                            +4       0  +100.00%
contracts/0.8.9/oracle/AccountingOracle.sol                               -18       0  -0.11%
contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol               -16      +1  -0.46%
contracts/common/utils/PausableUntil.sol                                  +29       0  +100.00%
TOTAL                                                                   +1311    +285  -6.42%

Results for commit: fd8584d

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

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 read roles in constructor to immutables

}

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

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 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?

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


_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 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

@tamtamchik tamtamchik added the vaults Lido stVaults related changes label Mar 19, 2025
@TheDZhon TheDZhon mentioned this pull request May 6, 2025
27 tasks
Comment on lines 43 to 53
function getEVMScript() public view returns (bytes memory) {
CallsScriptBuilder.Context memory scriptBuilder = CallsScriptBuilder.create();
VoteItem[] memory voteItems = this.getVoteItems();

uint256 voteItemsCount = voteItems.length;
for (uint256 i = 0; i < voteItemsCount; i++) {
scriptBuilder.addCall(voteItems[i].call.to, voteItems[i].call.data);
}

return scriptBuilder.getResult();
}

Check warning

Code scanning / Slither

Unused return Medium

Comment on lines 43 to 53
function getEVMScript() public view returns (bytes memory) {
CallsScriptBuilder.Context memory scriptBuilder = CallsScriptBuilder.create();
VoteItem[] memory voteItems = this.getVoteItems();

uint256 voteItemsCount = voteItems.length;
for (uint256 i = 0; i < voteItemsCount; i++) {
scriptBuilder.addCall(voteItems[i].call.to, voteItems[i].call.data);
}

return scriptBuilder.getResult();
}

Check warning

Code scanning / Slither

Public variable read in external context Warning

The function OmnibusBase.getEVMScript() reads voteItems = this.getVoteItems() with this which adds an extra STATICCALL.
Comment on lines 434 to 439
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

//
// -------- Pre-upgrade old contracts --------
//
address public immutable OLD_LOCATOR_IMPLEMENTATION;
Copy link
Member

Choose a reason for hiding this comment

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

Visual distinction between parameters and derived addresses may be helpful

Copy link
Contributor

Choose a reason for hiding this comment

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

wdym, @folkyatina ?

Copy link
Member

Choose a reason for hiding this comment

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

Part of immutables are directly passed as a constructor parameters, but part are fetched from other places. I'd appreciate if they're being treat differently.

function implementation() external view returns (address);
}

interface IVaultFactory {
Copy link
Member

Choose a reason for hiding this comment

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

Use contracts directly instead of interface where possible

//
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
// Burner
bytes32 public immutable REQUEST_BURN_SHARES_ROLE;
Copy link
Member

Choose a reason for hiding this comment

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

Disclaimer, why roles are immutable


/// @param _addresses V3Addresses contract address
constructor(address _addresses) {
ADDRESSES = V3Addresses(_addresses);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe, inherit Template from V3Addresses instead of deploying it as a separate address

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, would rather inherit

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.

👏 some small nitpicks and questions

uint256 oldBurnerShares = _sharesOf(_oldBurner);
if (oldBurnerShares > 0) {
_transferShares(_oldBurner, burner, oldBurnerShares);
_emitTransferEvents(_oldBurner, burner, oldBurnerShares, oldBurnerShares);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
_emitTransferEvents(_oldBurner, burner, oldBurnerShares, oldBurnerShares);
_emitTransferEvents(_oldBurner, burner, oldBurnerBalance, oldBurnerShares);

*/
function finalizeUpgrade_v3() external {
function finalizeUpgrade_v3(address _oldBurner, address[4] _contractsWithBurnerAllowances) external {
D7AE
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure if we need to hardcode exactly four addresses as the array length, tho

return scriptBuilder.getResult();
}

function getNewVoteCallBytecode(string memory description) external view returns (bytes memory newVoteBytecode) {
Copy link
Contributor

Choose a reason for hiding this comment

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

probably let's document this func 🤔

// New non-proxy contracts
address vaultFactory;

// New fancy proxy contracts
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// New fancy proxy contracts
// New fancy proxy and blueprint contracts

//
// -------- Pre-upgrade old contracts --------
//
address public immutable OLD_LOCATOR_IMPLEMENTATION;
Copy link
Contributor

Choose a reason for hiding this comment

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

wdym, @folkyatina ?


/// @notice Must be called after LidoLocator is upgraded
function startUpgrade() external {
if (msg.sender != ADDRESSES.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.

probably will be an agent here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

set it to agent for now

Comment on lines 229 to 231
if (ILidoWithFinalizeUpgrade(ADDRESSES.LIDO()).getTotalShares() != initialTotalShares || ILidoWithFinalizeUpgrade(ADDRESSES.LIDO()).getTotalPooledEther() != initialTotalPooledEther) {
revert TotalSharesOrPooledEtherChanged();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why not inside _assertPostUpgradeState?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean it's too early here, bc later we call at least one finalizer 🤔


/// @title V3VoteScript
/// @notice Script for upgrading Lido protocol components
contract V3VoteScript is OmnibusBase {
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to discuss and decide what we will do with:

  • new ET plugs
  • initial parameters, caps, and limits

description: "11. Call UpgradeTemplateV3.finishUpgrade",
call: _votingCall(address(params.upgradeTemplate), abi.encodeCall(ITemplateV3.finishUpgrade, ()))
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
assert(index == VOTE_ITEMS_COUNT);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

library CallsScriptBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

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

would be great to add some docs and references

Copy link
Member
@tamtamchik tamtamchik left a comment

Choose a reason for hiding this comment

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

Question: do we need to think about 0.8.25/upgrade as a base launcher for all the future upgrades? And maybe design them to be audited once for all the future upgrades?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe move to scripts/utils?

import path from "path";

export function readUpgradeParameters() {
const filePath = path.join(__dirname, "upgrade-parameters-mainnet.json");
Copy link
Member

Choose a reason for hiding this comment

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

We'll first need to upgrade the hoodi testnet. Instead of hardcoding, we can add an optional parameter that will override any hardcode and use whatever is specified in it.

}

const { contracts, signers } = await discover();
// TODO: revisit this when Pectra is live
Copy link
Member

Choose a reason for hiding this comment

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

Looks like with the latest HardHat 2.24.0 we can remove this logic, since it's already Pectra

getSigner: async (signer: Signer, balance?: bigint) => getSigner(signer, balance, signers),
getEvents: (receipt: ContractTransactionReceipt, eventName: string, extraInterfaces: Interface[] = []) =>
findEventsWithInterfaces(receipt, eventName, [...interfaces, ...extraInterfaces]),
} as ProtocolContext;

await provision(context);
if (isScratch) {
Copy link
Member

Choose a reason for hiding this comment

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

❤️

} as ProtocolContracts;

log.debug("Contracts discovered", {
"Locator": locator.address,
"Lido": foundationContracts.lido.address,
"Accounting": foundationContracts.accounting.address,
"Accounting": foundationContracts.accounting && foundationContracts.accounting.address,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Accounting": foundationContracts.accounting && foundationContracts.accounting.address,
"Accounting": foundationContracts.accounting?.address,

Copy link
Member

Choose a reason for hiding this comment

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

And so on, just more readable. Just a polishing, not a blocker.

agentAddress: state[Sk.appAgent].proxy.address,
votingAddress: state[Sk.appVoting].proxy.address,
easyTrackAddress: state["easyTrackEVMScriptExecutor"].address,
stakingVaultFactory: state[Sk.stakingVaultFactory] && state[Sk.stakingVaultFactory].address,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
stakingVaultFactory: state[Sk.stakingVaultFactory] && state[Sk.stakingVaultFactory].address,
stakingVaultFactory: state[Sk.stakingVaultFactory]?.address,

and so on...

Copy link
Member

Choose a reason for hiding this comment

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

Maybe move to contracts/common/interfaces?

Copy link
Member
@tamtamchik tamtamchik left a comment

Choose a reason for hiding this comment

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

Tremendous work! ❤️

pragma solidity 0.8.25;

library CallsScriptBuilder {
bytes4 internal constant SPEC_ID = 0x00000001;
Copy link
Member

Choose a reason for hiding this comment

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

Add some documentation?


/// @notice Must be called after LidoLocator is upgraded
function startUpgrade() external {
if (msg.sender != AGENT) revert OnlyVotingCanUpgrade();
Copy link
Member

Choose a reason for hiding this comment

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

So Agent or Voting? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

set agent for now, easy to change in case

/**
* initializer for the Lido version "3"
*/
function _initialize_v3() internal {
_setContractVersion(3);
Copy link
Member

Choose a reason for hiding this comment

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

Why twice? (see initialize)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because one setContractVersion(3) is for upgrade and one for scratch deployment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there was common _initialize_v3 before but after refactoring not much left to it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solidity Smart contract code changes vaults Lido stVaults related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0