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 28 commits into
base: feat/vaults
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
42c64b6
feat: untangle Sanity Checker and Locator deployment
arwer13 Mar 7, 2025
3673df4
feat: untangle Delegation deployment and Locator upgrade
arwer13 Mar 8, 2025
ac5e23b
fix: integration tests are now runnable on fork after upgrade
arwer13 Mar 9, 2025
969dcf5
fix: upgrade initialization in Lido and AccountingOracle
arwer13 Mar 10, 2025
9f00310
feat: initial version of upgrade on forking (with template)
arwer13 Mar 10, 2025
9a18b10
fix: ci scratch integration tests (provisioning)
arwer13 Mar 11, 2025
c3840d5
feat: restore CI integration test
arwer13 Mar 11, 2025
2fa8d9a
fix: ci mainnet integration test
arwer13 Mar 11, 2025
ba9417a
feat: move burner burnt shares initialization to upgrade template
arwer13 Mar 11, 2025
ef7c242
fix: burner scratch deployment
arwer13 Mar 11, 2025
43814a5
feat: add Burner migration with stETH in Lido.finalizeUpgrade_v3
arwer13 Mar 14, 2025
67c7d88
fix: add workaround to fix forking forks (e.g. hardhat forking hardhat)
arwer13 Mar 14, 2025
23877f5
fix: ci but setting no chainId on hardhat-node
arwer13 Mar 14, 2025
ed61031
Merge 'feat/vaults' (pdg) into 'feat/ugprade-on-forking'
arwer13 Mar 14, 2025
d1bf561
feat(upgrade): separate mocking aragon voting into yarn command
arwer13 Mar 14, 2025
be49584
fix(tests): update burner migration unit tests
arwer13 Mar 17, 2025
7554864
feat(upgrade): little improvements here and there
arwer13 Mar 17, 2025
a3685a5
fix(upgrade): remove failed unnecessary test and uncomment checks
arwer13 Mar 18, 2025
863a3c0
feat(scratch): save aragon app repo addresses on scratch deploy
arwer13 Mar 18, 2025
df4508d
feat(upgrade): more burner allowance migration + more template checks
arwer13 Mar 19, 2025
8f21f92
feat(upgrade): remove upgrade template from coverage report
arwer13 Mar 19, 2025
896bd55
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 Mar 20, 2025
1167c03
feat(upgrade): remove WithdrawalVault upgrade from upgrade
arwer13 Mar 20, 2025
47fb019
chore: update .vscode settings.json cSpell.words
arwer13 Mar 20, 2025
57074e0
chore: update .gitignore to include vscode snippets
arwer13 Mar 24, 2025
bf8c893
Merge feat/vaults into feat/upgrade-on-forking
arwer13 Mar 26, 2025
1d0144a
fix: a few integration tests on forking update
arwer13 Mar 26, 2025
d1a589c
Merge branch 'feat/vaults' into feat/upgrade-on-forking
arwer13 Mar 26, 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
Prev Previous commit
Next Next commit
Merge 'feat/vaults' (pdg) into 'feat/ugprade-on-forking'
arwer13 committed Mar 14, 2025
commit ed610319abbd06b68eccd3df0f365cdd57078d94
1 change: 0 additions & 1 deletion lib/protocol/networks.ts
Original file line number Diff line number Diff line change
@@ -110,7 +110,6 @@ async function getMainnetForkNetworkConfig(): Promise<ProtocolNetworkConfig> {
return new ProtocolNetworkConfig(getPrefixedEnv("MAINNET", defaultEnv), defaults, "mainnet-fork");
}


async function getForkingNetworkConfig(): Promise<ProtocolNetworkConfig> {
const state = readNetworkState();

9 changes: 9 additions & 0 deletions scripts/scratch/steps/0090-deploy-non-aragon-contracts.ts
Original file line number Diff line number Diff line change
@@ -229,6 +229,15 @@ export async function main() {
oracleReportSanityCheckerArgs,
);

// Deploy PredepositGuarantee
const predepositGuarantee = await deployBehindOssifiableProxy(
Sk.predepositGuarantee,
"PredepositGuarantee",
proxyContractsOwner,
deployer,
[pdgDeployParams.gIndex, pdgDeployParams.gIndexAfterChange, pdgDeployParams.changeSlot],
);

// Update LidoLocator with valid implementation
const locatorConfig: string[] = [
accountingOracle.address,
1 change: 1 addition & 0 deletions scripts/scratch/steps/0150-transfer-roles.ts
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ export async function main() {
{ name: "OracleReportSanityChecker", address: state.oracleReportSanityChecker.address },
{ name: "VaultHub", address: state.vaultHub.proxy.address },
{ name: "WithdrawalVault", address: state.withdrawalVault.proxy.address },
{ name: "PredepositGuarantee", address: state.predepositGuarantee.proxy.address },
];

for (const contract of ozAdminTransfers) {
18 changes: 15 additions & 3 deletions scripts/upgrade/steps/0100-deploy-contracts.ts
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ export async function main() {
const vaultHubParams = parameters[Sk.vaultHub].deployParameters;
const depositContract = state.chainSpec.depositContractAddress;
const wethContract = parameters["delegation"].deployParameters.wethContract;
const pdgDeployParams = parameters[Sk.predepositGuarantee].deployParameters;

// TODO: maybe take the parameters from current sanity checker
const sanityCheckerParams = parameters[Sk.oracleReportSanityChecker].deployParameters;
@@ -44,12 +45,21 @@ export async function main() {

// Deploy VaultHub
const vaultHub = await deployBehindOssifiableProxy(Sk.vaultHub, "VaultHub", proxyContractsOwner, deployer, [
locatorAddress,
lidoAddress,
accounting.address,
vaultHubParams.connectedVaultsLimit,
vaultHubParams.relativeShareLimitBP,
]);

// Deploy PredepositGuarantee
const predepositGuarantee = await deployBehindOssifiableProxy(
Sk.predepositGuarantee,
"PredepositGuarantee",
proxyContractsOwner,
deployer,
[pdgDeployParams.gIndex, pdgDeployParams.gIndexAfterChange, pdgDeployParams.changeSlot],
);

// Deploy WithdrawalVault new implementation
await deployImplementation(Sk.withdrawalVault, "WithdrawalVault", deployer, [lidoAddress, treasuryAddress]);

@@ -115,6 +125,7 @@ export async function main() {
await locator.withdrawalVault(),
await locator.oracleDaemonConfig(),
accounting.address,
predepositGuarantee.address,
wstethAddress,
vaultHub.address,
];
@@ -123,6 +134,7 @@ export async function main() {
// Deploy StakingVault implementation contract
const stakingVaultImpl = await deployWithoutProxy(Sk.stakingVaultImpl, "StakingVault", deployer, [
vaultHub.address,
predepositGuarantee.address,
depositContract,
]);
const stakingVaultImplAddress = await stakingVaultImpl.getAddress();
@@ -143,9 +155,9 @@ export async function main() {
const beaconAddress = await beacon.getAddress();

// Deploy VaultFactory contract
const factory = await deployWithoutProxy(Sk.stakingVaultFactory, "VaultFactory", deployer, [
const vaultFactory = await deployWithoutProxy(Sk.stakingVaultFactory, "VaultFactory", deployer, [
beaconAddress,
delegationAddress,
]);
console.log("Factory address", await factory.getAddress());
console.log("VaultFactory address", await vaultFactory.getAddress());
}
13 changes: 12 additions & 1 deletion scripts/upgrade/steps/0200-initialize-contracts.ts
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?

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { keccak256 } from "ethers";
import { ethers } from "hardhat";

import { Burner, VaultHub } from "typechain-types";
import { Burner, PredepositGuarantee, VaultHub } from "typechain-types";

import { log } from "lib";
import { loadContract } from "lib/contract";
@@ -20,6 +20,7 @@ export async function main(): Promise<void> {
const stakingVaultBeaconAddress = state[Sk.stakingVaultBeacon].address;
const nodeOperatorsRegistryAddress = state[Sk.appNodeOperatorsRegistry].proxy.address;
const simpleDvtAddress = state[Sk.appSimpleDvt].proxy.address;
const predepositGuaranteeAddress = state[Sk.predepositGuarantee].proxy.address;

// Deploy BeaconProxy to get bytecode and add it to whitelist
const vaultBeaconProxy = await ethers.deployContract("BeaconProxy", [stakingVaultBeaconAddress, "0x"]);
@@ -67,4 +68,14 @@ export async function main(): Promise<void> {
await makeTx(burner, "grantRole", [requestBurnSharesRole, simpleDvtAddress], { from: deployer });
await makeTx(burner, "grantRole", [requestBurnSharesRole, accountingAddress], { from: deployer });
// NB: admin role is kept on deployer to transfer it to the upgrade template on the next steps

//
// PredepositGuarantee
//

const predepositGuarantee = await loadContract<PredepositGuarantee>(
"PredepositGuarantee",
predepositGuaranteeAddress,
);
await makeTx(predepositGuarantee, "initialize", [agentAddress], { from: deployer });
}
7 changes: 7 additions & 0 deletions scripts/upgrade/upgrade-parameters.json
Original file line number Diff line number Diff line change
@@ -27,6 +27,13 @@
"clBalanceOraclesErrorUpperBPLimit": 50
}
},
"predepositGuarantee": {
"deployParameters": {
"gIndex": "0x0000000000000000000000000000000000000000000000000096000000000028",
"gIndexAfterChange": "0x0000000000000000000000000000000000000000000000000096000000000028",
"changeSlot": 0
}
},
"delegation": {
"deployParameters": {
"wethContract": "0x94373a4919B3240D86eA41593D5eBa789FEF3848"
2 changes: 1 addition & 1 deletion test/0.8.25/vaults/vaultFactory.test.ts
Original file line number Diff line number Diff line change
@@ -88,8 +88,8 @@ describe("VaultFactory.sol", () => {

// Accounting
vaultHubImpl = await ethers.deployContract("VaultHub", [
locator,
steth,
ZeroAddress,
VAULTS_CONNECTED_VAULTS_LIMIT,
VAULTS_RELATIVE_SHARE_LIMIT_BP,
]);
2 changes: 1 addition & 1 deletion test/0.8.25/vaults/vaulthub/vaulthub.pausable.test.ts
Original file line number Diff line number Diff line change
@@ -29,8 +29,8 @@ describe("VaultHub.sol:pausableUntil", () => {
steth = await ethers.deployContract("StETH__HarnessForVaultHub", [user], { value: ether("1.0") });

const vaultHubImpl = await ethers.deployContract("VaultHub", [
locator,
steth,
ZeroAddress,
VAULTS_CONNECTED_VAULTS_LIMIT,
VAULTS_RELATIVE_SHARE_LIMIT_BP,
]);
3 changes: 0 additions & 3 deletions test/integration/vaults/happy-path.integration.ts
Original file line number Diff line number Diff line change
@@ -30,9 +30,6 @@ import {
import { bailOnFailure, Snapshot } from "test/suite";
import { CURATED_MODULE_ID, MAX_DEPOSIT, ONE_DAY, SIMPLE_DVT_MODULE_ID, ZERO_HASH } from "test/suite/constants";

const PUBKEY_LENGTH = 48n;
const SIGNATURE_LENGTH = 96n;

const VALIDATORS_PER_VAULT = 2n;
const VALIDATOR_DEPOSIT_SIZE = ether("32");
const VAULT_DEPOSIT = VALIDATOR_DEPOSIT_SIZE * VALIDATORS_PER_VAULT;

Unchanged files with check annotations Beta

// SPDX-License-Identifier: GPL-3.0
/* See contracts/COMPILERS.md */
pragma solidity 0.4.24;

Check warning on line 5 in contracts/0.4.24/lib/StakeLimitUtils.sol

GitHub Actions / Solhint

Found more than One contract per file. 3 contracts found!
import {UnstructuredStorage} from "@aragon/os/contracts/common/UnstructuredStorage.sol";
/* See contracts/COMPILERS.md */
pragma solidity 0.4.24;
import "@aragon/os/contracts/apps/AragonApp.sol";

Check warning on line 7 in contracts/0.4.24/oracle/LegacyOracle.sol

GitHub Actions / Solhint

global import of path @aragon/os/contracts/apps/AragonApp.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "../../common/interfaces/ILidoLocator.sol";

Check warning on line 9 in contracts/0.4.24/oracle/LegacyOracle.sol

GitHub Actions / Solhint

global import of path ../../common/interfaces/ILidoLocator.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "../utils/Versioned.sol";

Check warning on line 11 in contracts/0.4.24/oracle/LegacyOracle.sol

GitHub Actions / Solhint

global import of path ../utils/Versioned.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
interface IAccountingOracle {
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.4.24;
import "@aragon/os/contracts/common/UnstructuredStorage.sol";

Check warning on line 5 in contracts/0.4.24/utils/Versioned.sol

GitHub Actions / Solhint

global import of path @aragon/os/contracts/common/UnstructuredStorage.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
/**
* @title Adapted code of /contracts/0.8.9/utils/Versioned.sol
}
// Old upgraded non-proxy contracts
IBurner public immutable _oldBurner;

Check warning on line 136 in contracts/0.8.25/utils/UpgradeTemplateV3.sol

GitHub Actions / Solhint

Immutable variables name are set to be in capitalized SNAKE_CASE
IOracleReportSanityChecker public immutable _oldOracleReportSanityChecker;

Check warning on line 137 in contracts/0.8.25/utils/UpgradeTemplateV3.sol

GitHub Actions / Solhint

Immutable variables name are set to be in capitalized SNAKE_CASE
// New proxy contracts
IAccounting public immutable _accounting;

Check warning on line 140 in contracts/0.8.25/utils/UpgradeTemplateV3.sol

GitHub Actions / Solhint

Immutable variables name are set to be in capitalized SNAKE_CASE
IVaultHub public immutable _vaultHub;

Check warning on line 141 in contracts/0.8.25/utils/UpgradeTemplateV3.sol

GitHub Actions / Solhint

Immutable variables name are set to be in capitalized SNAKE_CASE
// New non-proxy contracts
IBurner public immutable _burner;

Check warning on line 144 in contracts/0.8.25/utils/UpgradeTemplateV3.sol

GitHub Actions / Solhint

Immutable variables name are set to be in capitalized SNAKE_CASE
IOracleReportSanityChecker public immutable _oracleReportSanityChecker;
// Existing proxies and contracts
//
// Structured storage
//
uint256 private _upgradeBlockNumber = UPGRADE_NOT_STARTED;

Check warning

Code scanning / Slither

State variables that could be declared constant Warning

bool public _isUpgradeFinished;
uint256 internal INITIAL_OLD_BURNER_STETH_BALANCE;
_assertSingleAragonAppImplementation(_aragonAppLidoRepo, _lidoImplementation);
}
function _assertSingleAragonAppImplementation(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

function _assertFinalACL() internal view {
address agent = _agent;
You are viewing a condensed version of this merge commit. You can view the full changes here.