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: periphery deployments #311

Merged
merged 24 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8068700
feat(contracts): rm wrong eigenlayer submodule
mempirate Oct 23, 2024
fc2e9f5
forge install: eigenlayer-contracts
mempirate Oct 23, 2024
c98bdfc
feat(contracts): rm wrong symbiotic submodule
mempirate Oct 23, 2024
d6ad4ee
forge install: core
mempirate Oct 23, 2024
f72732a
test(contracts): fix Symbiotic tests with correct version
mempirate Oct 23, 2024
160a6c5
feat(contracts): create BoltEigenLayerMiddlewareV2
mempirate Oct 23, 2024
71c787c
forge install: eigenlayer-middleware
mempirate Oct 23, 2024
333d8dd
feat(contracts): implement IServiceManager
mempirate Oct 23, 2024
d70980c
feat(contracts): tests for BoltEigenLayerMiddlewareV2
mempirate Oct 23, 2024
0edb796
feat(contracts): vault deploy script (wip)
mempirate Oct 23, 2024
4e14a16
feat(contracts): vault deploy script (wip)
mempirate Oct 23, 2024
3c1bb7e
feat(contracts): update Symbiotic deployments (https://docs.symbiotic…
mempirate Oct 23, 2024
1c1ec6e
feat(contracts/script): update script
mempirate Oct 23, 2024
ba501fb
feat(contracts/script): deploy vaults script
mempirate Oct 24, 2024
2cecc7e
feat(contracts/script): update supported vaults script
mempirate Oct 24, 2024
3313126
docs(contracts): nit
mempirate Oct 24, 2024
35c53b0
feat(contracts): upgrade script
mempirate Oct 24, 2024
0eb29b8
docs(contracts): verifying storage layout on upgrades
mempirate Oct 24, 2024
8a5831d
docs(contracts): verifying storage layout on upgrades
mempirate Oct 24, 2024
e0790a5
chore: deploy el middleware upgrade
merklefruit Oct 24, 2024
c66d80a
fix: save el middleware address in deployments
merklefruit Oct 24, 2024
f4b7a30
fix: initialize v2
merklefruit Oct 24, 2024
8df4a6c
chore: update titles
merklefruit Oct 24, 2024
650628a
Merge pull request #314 from chainbound/nico/chore/el-upgrade
merklefruit Oct 24, 2024
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
15 changes: 9 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
[submodule "bolt-contracts/lib/openzeppelin-contracts"]
path = bolt-contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "bolt-contracts/lib/core"]
path = bolt-contracts/lib/core
url = https://github.com/symbioticfi/core
[submodule "bolt-contracts/lib/eigenlayer-contracts"]
path = bolt-contracts/lib/eigenlayer-contracts
url = https://github.com/layr-labs/eigenlayer-contracts
[submodule "bolt-contracts/lib/openzeppelin-contracts-upgradeable"]
path = bolt-contracts/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "bolt-contracts/lib/openzeppelin-foundry-upgrades"]
path = bolt-contracts/lib/openzeppelin-foundry-upgrades
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades
[submodule "bolt-contracts/lib/eigenlayer-contracts"]
path = bolt-contracts/lib/eigenlayer-contracts
url = https://github.com/layr-labs/eigenlayer-contracts
[submodule "bolt-contracts/lib/core"]
path = bolt-contracts/lib/core
url = https://github.com/symbioticfi/core
[submodule "bolt-contracts/lib/eigenlayer-middleware"]
path = bolt-contracts/lib/eigenlayer-middleware
url = https://github.com/layr-labs/eigenlayer-middleware
23 changes: 15 additions & 8 deletions bolt-contracts/config/holesky/deployments.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
{
"bolt": {
"validators": "0x47D2DC1DE1eFEFA5e6944402f2eda3981D36a9c8"
"validators": "0x47D2DC1DE1eFEFA5e6944402f2eda3981D36a9c8",
"parameters": "0x20d1cf3A5BD5928dB3118b2CfEF54FDF9fda5c12",
"manager": "0x440202829b493F9FF43E730EB5e8379EEa3678CF"
},
"symbiotic": {
"network": "0xb017002D8024d8c8870A5CECeFCc63887650D2a4",
"operatorRegistry": "0xAdFC41729fF447974cE27DdFa358A0f2096c3F39",
"networkOptInService": "0xF5AFc9FA3Ca63a07E529DDbB6eae55C665cCa83E",
"vaultFactory": "0x18C659a269a7172eF78BBC19Fe47ad2237Be0590",
"networkRegistry": "0xac5acD8A105C8305fb980734a5AD920b5920106A",
"networkMiddlewareService": "0x683F470440964E353b389391CdDDf8df381C282f",
"operatorRegistry": "0x6F75a4ffF97326A00e52662d82EA4FdE86a2C548",
"networkOptInService": "0x58973d16FFA900D11fC22e5e2B6840d9f7e13401",
"vaultFactory": "0x407A039D94948484D356eFB765b3c74382A050B4",
"vaultConfigurator": "0xD2191FE92987171691d552C219b8caEf186eb9cA",
"networkRegistry": "0x7d03b7343BF8d5cEC7C0C27ecE084a20113D15C9",
"networkMiddlewareService": "0x62a1ddfD86b4c1636759d9286D3A0EC722D086e3",
"middleware": "0x04f40d9CaE475E5BaA462acE53E5c58A0DD8D8e8",
"supportedVaults": [
"0x1df2fbfcD600ADd561013f44B2D055E2e974f605",
"0xf427d00c34609053d97167352061DD2F0F27F853"
"0xc79c533a77691641d52ebD5e87E51dCbCaeb0D78",
"0xe5708788c90e971f73D928b7c5A8FD09137010e0",
"0x11c5b9A9cd8269580aDDbeE38857eE451c1CFacd",
"0xC56Ba584929c6f381744fA2d7a028fA927817f2b",
"0xcDdeFfcD2bA579B8801af1d603812fF64c301462",
"0x91e84e12Bb65576C0a6614c5E6EbbB2eA595E10f"
]
},
"eigenLayer": {
Expand Down
26 changes: 26 additions & 0 deletions bolt-contracts/config/holesky/vaults.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x8d09a4502Cc8Cf1547aD300E066060D043f6982D"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x94373a4919B3240D86eA41593D5eBa789FEF3848"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x8720095Fa5739Ab051799211B146a2EEE4Dd8B37"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0xe3C063B1BEe9de02eb28352b55D49D85514C67FF"
}
]
23 changes: 20 additions & 3 deletions bolt-contracts/docs/admin/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,28 @@ export ADMIN_PRIVATE_KEY=0x...

### Pre-deployment

Register a Symbiotic network for Bolt with the Symbiotic `NetworkRegistry`. The private key with which the script is run will determine the network address. This private key will also need to be used later.
- Register a Symbiotic network for Bolt with the Symbiotic `NetworkRegistry`. The private key with which the script is run will determine the network address. This private key will also need to be used later.

```bash
forge script script/holesky/admin/helpers/Symbiotic.s.sol --rpc-url $HOLESKY_RPC --private-key $NETWORK_PRIVATE_KEY --broadcast -vvvv --sig "run(string memory arg)" registerNetwork
```

Make sure `deployments.json` contains the correct address for the Symbiotic network.
Make sure [`deployments.json`](../../config/holesky/deployments.json) contains the correct address for the Symbiotic network.

- Deploy Bolt-specific Symbiotic Vaults. Vaults will be deployed from the [`vaults.json`](../../config/holesky/vaults.json) configuration file.

```bash
forge script script/holesky/admin/helpers/DeployVaults.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --verify --broadcast -vvvv
```

If vaults with the `(collateral, admin)` combination already exist, they won't be recreated. After these vaults have been created, copy their
addresses into the [`deployments.json`](../../config/holesky/deployments.json) file under `symbiotic.supportedVaults`.

### Deployment

Run the following script to deploy Bolt V1:
```bash
forge script script/holesky/admin/Deploy.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --broadcast -vvvv
forge script script/holesky/admin/Deploy.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --verify --broadcast -vvvv
```

This will deploy all the contracts. The address corresponding to the private key will be the system admin.
Expand All @@ -71,3 +80,11 @@ forge script script/holesky/admin/helpers/RegisterAVS.s.sol --rpc-url $HOLESKY_R
> [!IMPORTANT]
> After the `deployments.json` file has been fully updated with the correct contract addresses, push it to Github.


### Other Scripts

#### Modifying supported Symbiotic Vaults
This script will update supported vaults according to `deployments.json`, and remove any vaults that have been whitelisted but are no longer in the `symbiotic.supportedVaults` list.
```bash
forge script script/holesky/admin/helpers/UpdateSupportedVaults.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --broadcast -vvv
```
45 changes: 44 additions & 1 deletion bolt-contracts/docs/admin/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,47 @@ bytes memory initManager = abi.encodeCall(BoltManagerV2.initialize, (params));
Upgrades.upgradeProxy(proxy, "BoltManagerV2.sol", initManager, opts);
```

Before an upgrade, update the [`Upgrade.s.sol`](../script/holesky/Upgrade.s.sol) script to include the correct contracts, references and configurations.
Before an upgrade, update the [`Upgrade.s.sol`](../script/holesky/Upgrade.s.sol) script to include the correct contracts, references and configurations.

## Unsafe
In order to run an unsafe upgrade, set `Options.unsafeSkipAllChecks` to `true`:
```solidity
Options memory opts;
opts.unsafeSkipAllChecks = true;
```

## Verifying Storage Layout
You can verify storage layouts using `forge inspect`. Example:

```bash
forge inspect BoltSymbioticMiddlewareV2 storage-layout --pretty
```

This will output the following table:
| Name | Type | Slot | Offset | Bytes | Contract |
|------------------------|---------------------------------------|------|--------|-------|-----------------------------------------------------------------------|
| INSTANT_SLASHER_TYPE | uint256 | 0 | 0 | 32 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| VETO_SLASHER_TYPE | uint256 | 1 | 0 | 32 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| START_TIMESTAMP | uint48 | 2 | 0 | 6 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| parameters | contract IBoltParametersV1 | 2 | 6 | 20 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| manager | contract IBoltManagerV1 | 3 | 0 | 20 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| vaults | struct EnumerableMap.AddressToUintMap | 4 | 0 | 96 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| BOLT_SYMBIOTIC_NETWORK | address | 7 | 0 | 20 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| OPERATOR_REGISTRY | address | 8 | 0 | 20 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| VAULT_FACTORY | address | 9 | 0 | 20 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| OPERATOR_NET_OPTIN | address | 10 | 0 | 20 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| NAME_HASH | bytes32 | 11 | 0 | 32 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |
| __gap | uint256[38] | 12 | 0 | 1216 | src/contracts/BoltSymbioticMiddlewareV2.sol:BoltSymbioticMiddlewareV2 |

The last line indicating the `__gap` storage slot is what's most important. `__gap` has a total of 50 storage slots reserved. You **MUST** verify that the array length of `__gap`, in this case `38`, is equal to `50 - __gap.Slot`. In this case, the `Slot` column for `__gap` shows 12, so the layout is correct.

## Reinitializers
In case you need to reinitialize your contract, you'll need to create a reinitializer.

Let `x` = your version number. Add the following new initializer to the contract to be upgraded:

```solidity
function initializeVx() public reinitializer(x) { ... }
```

For more info, check out https://docs.openzeppelin.com/contracts/5.x/api/proxy#Initializable.
1 change: 1 addition & 0 deletions bolt-contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ remappings = [
"@relic/=lib/relic-sdk/packages/contracts",
"@symbiotic/=lib/core/src/",
"@eigenlayer/=lib/eigenlayer-contracts/",
"@eigenlayer-middleware/=lib/eigenlayer-middleware/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/",
Expand Down
2 changes: 1 addition & 1 deletion bolt-contracts/lib/core
Submodule core updated 90 files
+2 −2 README.md
+1 −1 package.json
+32 −2 script/deploy/Core.s.sol
+2 −2 script/deploy/OptInService.s.sol
+77 −42 script/deploy/Vault.s.sol
+134 −0 script/deploy/VaultTokenized.s.sol
+10 −0 specs/Vault.md
+8 −20 src/contracts/VaultConfigurator.sol
+1 −1 src/contracts/common/Entity.sol
+31 −4 src/contracts/common/Factory.sol
+17 −15 src/contracts/common/MigratableEntity.sol
+33 −15 src/contracts/common/MigratablesFactory.sol
+6 −1 src/contracts/common/StaticDelegateCallable.sol
+44 −22 src/contracts/delegator/BaseDelegator.sol
+12 −8 src/contracts/delegator/FullRestakeDelegator.sol
+14 −10 src/contracts/delegator/NetworkRestakeDelegator.sol
+155 −0 src/contracts/delegator/OperatorSpecificDelegator.sol
+75 −16 src/contracts/hints/DelegatorHints.sol
+2 −3 src/contracts/hints/Hints.sol
+2 −3 src/contracts/hints/OptInServiceHints.sol
+4 −7 src/contracts/hints/SlasherHints.sol
+3 −9 src/contracts/hints/VaultHints.sol
+16 −8 src/contracts/libraries/Checkpoints.sol
+2 −2 src/contracts/libraries/ERC4626Math.sol
+21 −0 src/contracts/libraries/LICENSE
+2 −2 src/contracts/libraries/Subnetwork.sol
+106 −15 src/contracts/service/OptInService.sol
+89 −13 src/contracts/slasher/BaseSlasher.sol
+22 −15 src/contracts/slasher/Slasher.sol
+53 −41 src/contracts/slasher/VetoSlasher.sol
+123 −56 src/contracts/vault/Vault.sol
+14 −4 src/contracts/vault/VaultStorage.sol
+111 −0 src/contracts/vault/VaultTokenized.sol
+2 −2 src/interfaces/IDelegatorFactory.sol
+2 −2 src/interfaces/INetworkRegistry.sol
+2 −2 src/interfaces/IOperatorRegistry.sol
+2 −2 src/interfaces/ISlasherFactory.sol
+3 −7 src/interfaces/IVaultConfigurator.sol
+2 −2 src/interfaces/IVaultFactory.sol
+21 −0 src/interfaces/LICENSE
+0 −99 src/interfaces/collateral/ICollateral.sol
+4 −2 src/interfaces/common/IEntity.sol
+32 −4 src/interfaces/common/IFactory.sol
+3 −3 src/interfaces/common/IMigratableEntity.sol
+3 −5 src/interfaces/common/IMigratableEntityProxy.sol
+31 −9 src/interfaces/common/IMigratablesFactory.sol
+2 −2 src/interfaces/common/IRegistry.sol
+12 −0 src/interfaces/common/IStaticDelegateCallable.sol
+24 −7 src/interfaces/delegator/IBaseDelegator.sol
+4 −3 src/interfaces/delegator/IDelegatorHook.sol
+2 −1 src/interfaces/delegator/IFullRestakeDelegator.sol
+2 −1 src/interfaces/delegator/INetworkRestakeDelegator.sol
+88 −0 src/interfaces/delegator/IOperatorSpecificDelegator.sol
+2 −2 src/interfaces/service/IMetadataService.sol
+2 −2 src/interfaces/service/INetworkMiddlewareService.sol
+50 −6 src/interfaces/service/IOptInService.sol
+45 −7 src/interfaces/slasher/IBaseSlasher.sol
+13 −0 src/interfaces/slasher/IBurner.sol
+25 −5 src/interfaces/slasher/ISlasher.sol
+26 −10 src/interfaces/slasher/IVetoSlasher.sol
+69 −18 src/interfaces/vault/IVault.sol
+16 −4 src/interfaces/vault/IVaultStorage.sol
+18 −0 src/interfaces/vault/IVaultTokenized.sol
+39 −26 test/DelegatorFactory.t.sol
+27 −0 test/POC.t.sol
+664 −0 test/POCBase.t.sol
+55 −27 test/SlasherFactory.t.sol
+40 −82 test/VaultConfigurator.t.sol
+39 −24 test/VaultFactory.t.sol
+3 −3 test/common/Entity.t.sol
+25 −5 test/common/Factory.t.sol
+7 −32 test/common/MigratableEntity.t.sol
+3 −3 test/common/MigratableEntityProxy.t.sol
+31 −10 test/common/MigratablesFactory.t.sol
+1 −1 test/common/Registry.t.sol
+290 −69 test/delegator/FullRestakeDelegator.t.sol
+317 −71 test/delegator/NetworkRestakeDelegator.t.sol
+1,691 −0 test/delegator/OperatorSpecificDelegator.t.sol
+626 −0 test/libraries/Checkpoints.t.sol
+32 −0 test/mocks/SimpleBurner.sol
+0 −99 test/mocks/SimpleCollateral.sol
+42 −4 test/mocks/SimpleFullRestakeDelegatorHook.sol
+1 −1 test/mocks/SimpleMigratableEntity.sol
+42 −4 test/mocks/SimpleNetworkRestakeDelegatorHook.sol
+20 −0 test/mocks/SimpleOperatorSpecificDelegatorHook.sol
+309 −6 test/service/OptInService.t.sol
+436 −50 test/slasher/Slasher.t.sol
+389 −144 test/slasher/VetoSlasher.t.sol
+774 −411 test/vault/Vault.t.sol
+3,102 −0 test/vault/VaultTokenized.t.sol
2 changes: 1 addition & 1 deletion bolt-contracts/lib/eigenlayer-contracts
Submodule eigenlayer-contracts updated 78 files
+51 −0 .github/workflows/deploy-local.yml
+1 −1 .github/workflows/format.yml
+0 −38 .github/workflows/run-deploy-scripts.yml
+43 −0 .github/workflows/storage-report.yml
+2 −0 .gitignore
+3 −0 Makefile
+4 −5 README.md
+ audits/M4 Mainnet (PEPE) - Certora - Aug 2024.pdf
+45 −0 bin/storage-report.sh
+26 −1 docs/core/RewardsCoordinator.md
+16 −0 docs/storage-report/AVSDirectory.md
+6 −0 docs/storage-report/AVSDirectoryStorage.md
+28 −0 docs/storage-report/BackingEigen.md
+24 −0 docs/storage-report/DelegationManager.md
+14 −0 docs/storage-report/DelegationManagerStorage.md
+30 −0 docs/storage-report/Eigen.md
+21 −0 docs/storage-report/EigenPod.md
+19 −0 docs/storage-report/EigenPodManager.md
+9 −0 docs/storage-report/EigenPodManagerStorage.md
+2 −0 docs/storage-report/EigenPodPausingConstants.md
+17 −0 docs/storage-report/EigenPodStorage.md
+12 −0 docs/storage-report/EigenStrategy.md
+5 −0 docs/storage-report/Pausable.md
+4 −0 docs/storage-report/PauserRegistry.md
+26 −0 docs/storage-report/RewardsCoordinator.md
+16 −0 docs/storage-report/RewardsCoordinatorStorage.md
+10 −0 docs/storage-report/Slasher.md
+10 −0 docs/storage-report/StrategyBase.md
+13 −0 docs/storage-report/StrategyBaseTVLLimits.md
+14 −0 docs/storage-report/StrategyFactory.md
+6 −0 docs/storage-report/StrategyFactoryStorage.md
+24 −0 docs/storage-report/StrategyManager.md
+14 −0 docs/storage-report/StrategyManagerStorage.md
+5 −0 docs/storage-report/UpgradeableSignatureCheckingUtils.md
+216 −1 pkg/bindings/IRewardsCoordinator/binding.go
+217 −2 pkg/bindings/RewardsCoordinator/binding.go
+247 −1 pkg/bindings/RewardsCoordinatorStorage/binding.go
+1 −0 script/.gitignore
+0 −48 script/configs/devnet/M1_deploy_devnet.config.json
+0 −44 script/configs/devnet/M2_deploy_from_scratch.anvil.config.json
+0 −58 script/configs/holesky/Deploy_RewardsCoordinator.holesky.config.json
+5 −0 script/configs/holesky/eigenlayer_addresses_preprod.config.json
+2 −1 script/configs/holesky/eigenlayer_addresses_testnet.config.json
+1 −0 script/configs/holesky/eigenlayer_preprod.config.json
+57 −0 script/configs/holesky/eigenlayer_testnet.config.json
+55 −0 script/configs/local/deploy_from_scratch.anvil.config.json
+0 −61 script/configs/mainnet/M1_deploy_mainnet.config.json
+0 −60 script/configs/mainnet/M2_deploy_from_scratch.mainnet.config.json
+0 −46 script/configs/mainnet/M2_mainnet_upgrade.config.json
+0 −79 script/configs/mainnet/Mainnet_current_deployment.config.json
+80 −0 script/configs/mainnet/mainnet-addresses.config.json
+51 −0 script/configs/mainnet/mainnet-config.config.json
+0 −75 script/configs/mainnet/v0.3.0-eigenlayer-addresses.config.json
+0 −57 script/configs/mainnet/v0.3.0-mainnet-rewards.config.json
+1 −1 script/deploy/holesky/Deploy_Preprod_RewardsCoordinator.s.sol
+38 −3 script/deploy/holesky/Deploy_Test_RewardsCoordinator.s.sol
+113 −0 script/deploy/holesky/longtail-preprod-upgrade.s.sol
+1 −1 script/deploy/holesky/v040-holesky-pepe.s.sol
+0 −69 script/deploy/holesky/v040-rc0-holesky-preprod-pepe.s.sol
+0 −58 script/deploy/holesky/v040-rc1-holesky-preprod-pepe.s.sol
+0 −58 script/deploy/holesky/v040-rc2-holesky-preprod-pepe.s.sol
+0 −58 script/deploy/holesky/v040-rc3-holesky-preprod-pepe.s.sol
+0 −79 script/deploy/holesky/v040-rc5-holesky-preprod-pepe.s.sol
+117 −0 script/deploy/holesky/v042-upgrade_testnet_rewardsCoordinator.s.sol
+35 −7 script/deploy/local/Deploy_From_Scratch.s.sol
+0 −509 script/deploy/mainnet/M1_Deploy.s.sol
+0 −327 script/deploy/mainnet/M2Deploy.s.sol
+36 −31 script/deploy/mainnet/v0.4.2-mainnet-pepe.s.sol
+4 −7 script/output/holesky/Deploy_RewardsCoordinator.holesky.config.json
+0 −40 script/output/mainnet/M1_deployment_mainnet_2023_6_9.json
+0 −35 script/output/mainnet/M2_mainnet_upgrade.output.json
+11 −11 script/utils/ExistingDeploymentParser.sol
+32 −0 src/contracts/core/RewardsCoordinator.sol
+10 −5 src/contracts/core/RewardsCoordinatorStorage.sol
+23 −3 src/contracts/interfaces/IRewardsCoordinator.sol
+7 −0 src/test/events/IRewardsCoordinatorEvents.sol
+1 −1 src/test/integration/IntegrationDeployer.t.sol
+216 −0 src/test/unit/RewardsCoordinatorUnit.t.sol
1 change: 1 addition & 0 deletions bolt-contracts/lib/eigenlayer-middleware
Submodule eigenlayer-middleware added at 48e0ae
109 changes: 107 additions & 2 deletions bolt-contracts/script/holesky/admin/Upgrade.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,124 @@ pragma solidity 0.8.25;
import {Script, console} from "forge-std/Script.sol";

import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import {Upgrades} from "@openzeppelin-foundry-upgrades/src/Upgrades.sol";
import {Upgrades, Options} from "@openzeppelin-foundry-upgrades/src/Upgrades.sol";

import {BoltParametersV1} from "../../../src/contracts/BoltParametersV1.sol";
import {BoltValidatorsV1} from "../../../src/contracts/BoltValidatorsV1.sol";
import {BoltManagerV1} from "../../../src/contracts/BoltManagerV1.sol";
import {BoltEigenLayerMiddlewareV1} from "../../../src/contracts/BoltEigenLayerMiddlewareV1.sol";
import {BoltEigenLayerMiddlewareV2} from "../../../src/contracts/BoltEigenLayerMiddlewareV2.sol";
import {BoltSymbioticMiddlewareV1} from "../../../src/contracts/BoltSymbioticMiddlewareV1.sol";
import {BoltSymbioticMiddlewareV2} from "../../../src/contracts/BoltSymbioticMiddlewareV2.sol";
import {BoltConfig} from "../../../src/lib/Config.sol";

contract UpgradeBolt is Script {
function run() public {
struct Deployments {
address boltManager;
address boltParameters;
address symbioticNetwork;
address symbioticOperatorRegistry;
address symbioticOperatorNetOptIn;
address symbioticVaultFactory;
address symbioticMiddleware;
address[] supportedVaults;
address eigenLayerAVSDirectory;
address eigenLayerDelegationManager;
address eigenLayerStrategyManager;
address eigenLayerMiddleware;
address[] supportedStrategies;
}

function upgradeSymbioticMiddleware() public {
address admin = msg.sender;
console.log("Upgrading Symbiotic middleware with admin", admin);
// TODO: Validate upgrades with Upgrades.validateUpgrade

Options memory opts;
opts.unsafeSkipAllChecks = true;
opts.referenceContract = "BoltSymbioticMiddlewareV1.sol";

string memory upgradeTo = "BoltSymbioticMiddlewareV2.sol";

Deployments memory deployments = _readDeployments();

bytes memory initSymbioticMiddleware = abi.encodeCall(
BoltSymbioticMiddlewareV2.initializeV2,
(
admin,
deployments.boltParameters,
deployments.boltManager,
deployments.symbioticNetwork,
deployments.symbioticOperatorRegistry,
deployments.symbioticOperatorNetOptIn,
deployments.symbioticVaultFactory
)
);

vm.startBroadcast(admin);

Upgrades.upgradeProxy(deployments.symbioticMiddleware, upgradeTo, initSymbioticMiddleware, opts);

vm.stopBroadcast();

console.log("BoltSymbioticMiddleware proxy upgraded from %s to %s", opts.referenceContract, upgradeTo);

// TODO: Upgrade contracts with Upgrades.upgradeProxy
}

function upgradeEigenLayerMiddleware() public {
address admin = msg.sender;
console.log("Upgrading EigenLayer middleware with admin", admin);
// TODO: Validate upgrades with Upgrades.validateUpgrade

Options memory opts;
opts.unsafeSkipAllChecks = true;
opts.referenceContract = "BoltEigenLayerMiddlewareV1.sol";

string memory upgradeTo = "BoltEigenLayerMiddlewareV2.sol";

Deployments memory deployments = _readDeployments();

bytes memory initEigenLayerMiddleware = abi.encodeCall(
BoltEigenLayerMiddlewareV2.initializeV2,
(
admin,
deployments.boltParameters,
deployments.boltManager,
deployments.eigenLayerAVSDirectory,
deployments.eigenLayerDelegationManager,
deployments.eigenLayerStrategyManager
)
);

vm.startBroadcast(admin);

Upgrades.upgradeProxy(deployments.eigenLayerMiddleware, upgradeTo, initEigenLayerMiddleware, opts);

vm.stopBroadcast();

console.log("BoltSymbioticMiddleware proxy upgraded from %s to %s", opts.referenceContract, upgradeTo);
}

function _readDeployments() public view returns (Deployments memory) {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/config/holesky/deployments.json");
string memory json = vm.readFile(path);

return Deployments({
boltParameters: vm.parseJsonAddress(json, ".bolt.parameters"),
boltManager: vm.parseJsonAddress(json, ".bolt.manager"),
symbioticNetwork: vm.parseJsonAddress(json, ".symbiotic.network"),
symbioticOperatorRegistry: vm.parseJsonAddress(json, ".symbiotic.operatorRegistry"),
symbioticOperatorNetOptIn: vm.parseJsonAddress(json, ".symbiotic.networkOptInService"),
symbioticVaultFactory: vm.parseJsonAddress(json, ".symbiotic.vaultFactory"),
supportedVaults: vm.parseJsonAddressArray(json, ".symbiotic.supportedVaults"),
symbioticMiddleware: vm.parseJsonAddress(json, ".symbiotic.middleware"),
eigenLayerAVSDirectory: vm.parseJsonAddress(json, ".eigenLayer.avsDirectory"),
eigenLayerDelegationManager: vm.parseJsonAddress(json, ".eigenLayer.delegationManager"),
eigenLayerStrategyManager: vm.parseJsonAddress(json, ".eigenLayer.strategyManager"),
eigenLayerMiddleware: vm.parseJsonAddress(json, ".eigenLayer.middleware"),
supportedStrategies: vm.parseJsonAddressArray(json, ".eigenLayer.supportedStrategies")
});
}
}
Loading
Loading