Skip to content

Commit 1fb3c93

Browse files
authored
Merge pull request #228 from Lay3rLabs/poa-mirror
Add support for POA middleware mirror deployments
2 parents 89fa0dd + 3437180 commit 1fb3c93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+487
-395
lines changed

.gitmodules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
path = contracts/lib/eigenlayer-middleware
66
url = https://github.com/Lay3rLabs/eigenlayer-middleware
77
# This commit hash (3ea829d52c4a8cb1d26c9a6ac4807b87c70a1f47) corresponds to wavs-1.4 branch (based on tag v1.4.0-testnet-holesky)
8-
branch = 3ea829d52c4a8cb1d26c9a6ac4807b87c70a1f47
8+
branch = 3ea829d52c4a8cb1d26c9a6ac4807b87c70a1f47
9+
[submodule "contracts/lib/poa-middleware"]
10+
path = contracts/lib/poa-middleware
11+
url = https://github.com/Lay3rLabs/poa-middleware.git

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,23 @@ docker run --rm --network host -v ./.nodes:/root/.nodes \
351351
wavs-middleware -m mirror deploy
352352
```
353353

354+
For **POA (Proof of Authority)** deployments, set `IS_POA=true` and set `WAVS_SERVICE_MANAGER_ADDRESS` to the `POAStakeRegistry` address:
355+
356+
```bash
357+
docker run --rm --network host -v ./.nodes:/root/.nodes \
358+
-e IS_POA=true \
359+
-e WAVS_SERVICE_MANAGER_ADDRESS=${POA_STAKE_REGISTRY_ADDRESS} \
360+
wavs-middleware -m mirror deploy
361+
```
362+
354363
| Environment Variable | Required | Default | Source | Description |
355364
| ------------------------------ | --------------------- | ----------------------------- | ------------ | --------------------------------------------- |
356365
| `DEPLOY_ENV` | for non-default value | `LOCAL` | `.env` | Deployment environment (`LOCAL` or `TESTNET`) |
357366
| `WAVS_SERVICE_MANAGER_ADDRESS` | if not mounted | From `.nodes/avs_deploy.json` | Volume | Service manager contract address |
358367
| `FUNDED_KEY` | if not mounted | From `.nodes/deployer` | Volume | Deployer private key |
359368
| `SOURCE_RPC_URL` | for non-default value | `http://localhost:8545` | Command line | RPC URL for source chain |
360369
| `MIRROR_RPC_URL` | for non-default value | `http://localhost:8546` | Command line | RPC URL for mirror chain |
370+
| `IS_POA` | for POA deployments | `false` | Command line | Set to `true` for POA stake registries |
361371

362372
### List Mirror Operators
363373

@@ -598,20 +608,17 @@ sequenceDiagram
598608
- `execute_transaction`: Run a transaction and handle errors
599609
- `stop_impersonating`: Stop impersonating an account (LOCAL only)
600610

601-
### Instructions on getting Holesky ETH
602-
603-
To get Holesky ETH for running on testnet:
604-
605-
1. PoW Mining Faucet:
611+
### Instructions on getting Sepolia ETH
606612

607-
- Go to https://holesky-faucet.pk910.de/
608-
- Connect your wallet
609-
- Mine blocks in your browser to earn ETH
610-
- Rewards based on mining time/hashrate
611-
- No external requirements
613+
To get Sepolia ETH for running on testnet:
612614

613-
2. Alchemy Faucet (Alternative):
614-
- Visit https://www.alchemy.com/faucets/holesky
615+
1. Alchemy Faucet:
616+
- Visit https://www.alchemy.com/faucets/ethereum-sepolia
615617
- Requires mainnet ETH balance to use
616618
- Connect wallet and verify ownership
617619
- Request funds (limits apply)
620+
621+
2. Google Cloud Faucet:
622+
- Visit https://cloud.google.com/application/web3/faucet/ethereum/sepolia
623+
- No requirements
624+
- Request funds (limits apply)

contracts/foundry.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ optimizer = true
1111
optimizer_runs = 100
1212
# Higher number optimizes for frequent contract calls, lower number optimizes for deployment cost
1313

14+
[profile.ci]
15+
via-ir = false
16+
1417
[profile.bls]
1518
src = "src/eigenlayer/bls"
1619
test = "test/eigenlayer/bls"

contracts/lib/poa-middleware

Submodule poa-middleware added at 095670e

contracts/remappings.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
@openzeppelin/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/lib/openzeppelin-contracts-v4.9.0/
55
@openzeppelin-upgrades/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/
66
forge-std/=lib/forge-std/src/
7+
@poa-middleware/=lib/poa-middleware/contracts/

contracts/script/eigenlayer/bls/WavsMiddlewareDeployer.s.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ contract WavsMiddlewareDeployer is Script {
121121
}
122122
if (
123123
address(registryCoordinator.serviceManager())
124-
!= wavsMiddlewareDeployment.wavsServiceManager
124+
!= wavsMiddlewareDeployment.wavsServiceManager
125125
|| address(registryCoordinator.stakeRegistry())
126126
!= wavsMiddlewareDeployment.stakeRegistry
127127
|| address(registryCoordinator.blsApkRegistry())
@@ -130,7 +130,8 @@ contract WavsMiddlewareDeployer is Script {
130130
!= wavsMiddlewareDeployment.indexRegistry
131131
|| address(registryCoordinator.socketRegistry())
132132
!= wavsMiddlewareDeployment.socketRegistry
133-
|| address(registryCoordinator.allocationManager()) != coreDeployment.allocationManager
133+
|| address(registryCoordinator.allocationManager())
134+
!= coreDeployment.allocationManager
134135
|| address(registryCoordinator.pauserRegistry())
135136
!= wavsMiddlewareDeployment.pauserRegistry
136137
) {

contracts/script/eigenlayer/bls/utils/BLSKeyGenerator.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
pragma solidity ^0.8.27;
33

44
import {BN254} from "@eigenlayer-middleware/src/libraries/BN254.sol";
5-
import {ISlashingRegistryCoordinator} from
6-
"@eigenlayer-middleware/src/interfaces/ISlashingRegistryCoordinator.sol";
5+
import {
6+
ISlashingRegistryCoordinator
7+
} from "@eigenlayer-middleware/src/interfaces/ISlashingRegistryCoordinator.sol";
78
import {IBLSApkRegistryTypes} from "@eigenlayer-middleware/src/interfaces/IBLSApkRegistry.sol";
89
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
910
import {BN256G2} from "@eigenlayer-middleware/test/utils/BN256G2.sol";
@@ -55,9 +56,7 @@ library BLSKeyGenerator {
5556
BN254.G1Point memory signature = BN254.scalar_mul(pubkeyRegistrationMessageHash, privateKey);
5657

5758
params = IBLSApkRegistryTypes.PubkeyRegistrationParams({
58-
pubkeyRegistrationSignature: signature,
59-
pubkeyG1: pubkeyG1,
60-
pubkeyG2: pubkeyG2
59+
pubkeyRegistrationSignature: signature, pubkeyG1: pubkeyG1, pubkeyG2: pubkeyG2
6160
});
6261
}
6362
}

contracts/script/eigenlayer/bls/utils/UpgradeableProxyLib.sol

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ library UpgradeableProxyLib {
4848
* @param proxy The proxy address.
4949
* @param impl The implementation address.
5050
*/
51-
function upgrade(address proxy, address impl) internal {
51+
function upgrade(
52+
address proxy,
53+
address impl
54+
) internal {
5255
ProxyAdmin admin = getProxyAdmin(proxy);
5356
admin.upgrade(ITransparentUpgradeableProxy(payable(proxy)), impl);
5457
}
@@ -59,7 +62,11 @@ library UpgradeableProxyLib {
5962
* @param impl The implementation address.
6063
* @param initData The initialization data.
6164
*/
62-
function upgradeAndCall(address proxy, address impl, bytes memory initData) internal {
65+
function upgradeAndCall(
66+
address proxy,
67+
address impl,
68+
bytes memory initData
69+
) internal {
6370
ProxyAdmin admin = getProxyAdmin(proxy);
6471
admin.upgradeAndCall(ITransparentUpgradeableProxy(payable(proxy)), impl, initData);
6572
}

contracts/script/eigenlayer/bls/utils/WavsMiddlewareDeploymentLib.sol

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import {BLSApkRegistry} from "@eigenlayer-middleware/src/BLSApkRegistry.sol";
1010
import {IndexRegistry} from "@eigenlayer-middleware/src/IndexRegistry.sol";
1111
import {SocketRegistry} from "@eigenlayer-middleware/src/SocketRegistry.sol";
1212
import {RegistryCoordinator} from "@eigenlayer-middleware/src/RegistryCoordinator.sol";
13-
import {SlashingRegistryCoordinator} from
14-
"@eigenlayer-middleware/src/SlashingRegistryCoordinator.sol";
13+
import {
14+
SlashingRegistryCoordinator
15+
} from "@eigenlayer-middleware/src/SlashingRegistryCoordinator.sol";
1516
import {InstantSlasher} from "@eigenlayer-middleware/src/slashers/InstantSlasher.sol";
1617
import {OperatorStateRetriever} from "@eigenlayer-middleware/src/OperatorStateRetriever.sol";
1718

@@ -23,8 +24,9 @@ import {IBLSApkRegistry} from "@eigenlayer-middleware/src/interfaces/IBLSApkRegi
2324
import {IIndexRegistry} from "@eigenlayer-middleware/src/interfaces/IIndexRegistry.sol";
2425
import {ISocketRegistry} from "@eigenlayer-middleware/src/interfaces/ISocketRegistry.sol";
2526
import {IServiceManager} from "@eigenlayer-middleware/src/interfaces/IServiceManager.sol";
26-
import {IRegistryCoordinatorTypes} from
27-
"@eigenlayer-middleware/src/interfaces/IRegistryCoordinator.sol";
27+
import {
28+
IRegistryCoordinatorTypes
29+
} from "@eigenlayer-middleware/src/interfaces/IRegistryCoordinator.sol";
2830
import {
2931
ISlashingRegistryCoordinator,
3032
ISlashingRegistryCoordinatorTypes
@@ -232,9 +234,7 @@ library WavsMiddlewareDeploymentLib {
232234
ISlashingRegistryCoordinator(deployment.registryCoordinator);
233235
slashingRegistryCoordinator.createSlashableStakeQuorum(
234236
ISlashingRegistryCoordinatorTypes.OperatorSetParam({
235-
maxOperatorCount: 10_000,
236-
kickBIPsOfOperatorStake: 10_500,
237-
kickBIPsOfTotalStake: 100
237+
maxOperatorCount: 10_000, kickBIPsOfOperatorStake: 10_500, kickBIPsOfTotalStake: 100
238238
}),
239239
minimumWeight,
240240
strategyParams,
@@ -278,8 +278,7 @@ library WavsMiddlewareDeploymentLib {
278278
new IStakeRegistryTypes.StrategyParams[](strategyCount);
279279
for (uint256 i; i < strategyCount; ++i) {
280280
strategyParams[i] = IStakeRegistryTypes.StrategyParams({
281-
strategy: IStrategy(strategies[i]),
282-
multiplier: multipliers[i]
281+
strategy: IStrategy(strategies[i]), multiplier: multipliers[i]
283282
});
284283
}
285284

contracts/script/eigenlayer/bls/utils/WavsRegisterOperatorLib.sol

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,19 @@ library WavsRegisterOperatorLib {
8080
opSetIds[0] = 0;
8181

8282
BN254.G1Point memory pubkeyRegistrationMessageHash = ISlashingRegistryCoordinator(
83-
WavsServiceManager(serviceManagerAddress).getRegistryCoordinator()
84-
).pubkeyRegistrationMessageHash(operatorAddr);
83+
WavsServiceManager(serviceManagerAddress).getRegistryCoordinator()
84+
).pubkeyRegistrationMessageHash(operatorAddr);
8585

8686
IBLSApkRegistryTypes.PubkeyRegistrationParams memory blsParams =
8787
BLSKeyGenerator.generateBLSParams(pubkeyRegistrationMessageHash, operatorKey);
8888

8989
bytes memory data = abi.encode(
9090
ISlashingRegistryCoordinatorTypes.RegistrationType.NORMAL, "Mock Socket", blsParams
9191
);
92-
IAllocationManagerTypes.RegisterParams memory params = IAllocationManagerTypes
93-
.RegisterParams({avs: serviceManagerAddress, operatorSetIds: opSetIds, data: data});
92+
IAllocationManagerTypes.RegisterParams memory params =
93+
IAllocationManagerTypes.RegisterParams({
94+
avs: serviceManagerAddress, operatorSetIds: opSetIds, data: data
95+
});
9496

9597
allocationManager.registerForOperatorSets(operatorAddr, params);
9698

0 commit comments

Comments
 (0)