forked from Layr-Labs/eigenlayer-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpgradeTest.t.sol
54 lines (42 loc) · 2.07 KB
/
UpgradeTest.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;
import "src/test/integration/IntegrationDeployer.t.sol";
import "src/test/integration/IntegrationChecks.t.sol";
import "src/test/integration/mocks/BeaconChainMock_Deneb.t.sol";
abstract contract UpgradeTest is IntegrationCheckUtils {
/// Only run upgrade tests on mainnet forks
function setUp() public virtual override {
if (!isForktest()) {
cheats.skip(true);
} else {
isUpgraded = false;
super.setUp();
// Use Deneb Beacon Chain Mock as Pectra state is not live on mainnet
beaconChain = BeaconChainMock(new BeaconChainMock_DenebForkable(eigenPodManager, BEACON_GENESIS_TIME));
}
}
/// Deploy current implementation contracts and upgrade existing proxies
function _upgradeEigenLayerContracts() public virtual {
require(forkType == MAINNET, "_upgradeEigenLayerContracts: somehow running upgrade test locally");
require(!isUpgraded, "_upgradeEigenLayerContracts: already performed upgrade");
emit log("_upgradeEigenLayerContracts: upgrading mainnet to slashing");
_upgradeMainnetContracts();
_handlePectraFork();
// Bump block.timestamp forward to allow verifyWC proofs for migrated pods
emit log("advancing block time to start of next epoch:");
beaconChain.advanceEpoch_NoRewards();
emit log("======");
isUpgraded = true;
emit log("_upgradeEigenLayerContracts: slashing upgrade complete");
}
// Set the fork timestamp sufficiently in the future to keep using Deneb proofs
// `Prooftra.t.sol` will handle the Deneb -> Pectra transition
function _handlePectraFork() internal {
// 1. Set proof timestamp setter to operations multisig
cheats.prank(eigenPodManager.owner());
eigenPodManager.setProofTimestampSetter(address(operationsMultisig));
// 2. Set Proof timestamp
cheats.prank(eigenPodManager.proofTimestampSetter());
eigenPodManager.setPectraForkTimestamp(type(uint64).max);
}
}