Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
path = contracts/lib/eigenlayer-middleware
url = https://github.com/Lay3rLabs/eigenlayer-middleware
# This commit hash (3ea829d52c4a8cb1d26c9a6ac4807b87c70a1f47) corresponds to wavs-1.4 branch (based on tag v1.4.0-testnet-holesky)
branch = 3ea829d52c4a8cb1d26c9a6ac4807b87c70a1f47
branch = 3ea829d52c4a8cb1d26c9a6ac4807b87c70a1f47
[submodule "contracts/lib/poa-middleware"]
path = contracts/lib/poa-middleware
url = https://github.com/Lay3rLabs/poa-middleware.git
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,22 @@ docker run --rm --network host -v ./.nodes:/root/.nodes \
wavs-middleware -m mirror deploy
```

For **POA (Proof of Authority)** deployments where the source chain uses a POA stake registry, set the `IS_POA` environment variable:

```bash
docker run --rm --network host -v ./.nodes:/root/.nodes \
-e IS_POA=true \
wavs-middleware -m mirror deploy
```

| Environment Variable | Required | Default | Source | Description |
| ------------------------------ | --------------------- | ----------------------------- | ------------ | --------------------------------------------- |
| `DEPLOY_ENV` | for non-default value | `LOCAL` | `.env` | Deployment environment (`LOCAL` or `TESTNET`) |
| `WAVS_SERVICE_MANAGER_ADDRESS` | if not mounted | From `.nodes/avs_deploy.json` | Volume | Service manager contract address |
| `FUNDED_KEY` | if not mounted | From `.nodes/deployer` | Volume | Deployer private key |
| `SOURCE_RPC_URL` | for non-default value | `http://localhost:8545` | Command line | RPC URL for source chain |
| `MIRROR_RPC_URL` | for non-default value | `http://localhost:8546` | Command line | RPC URL for mirror chain |
| `IS_POA` | for POA deployments | `false` | Command line | Set to `true` for POA stake registries |

### List Mirror Operators

Expand Down Expand Up @@ -598,20 +607,17 @@ sequenceDiagram
- `execute_transaction`: Run a transaction and handle errors
- `stop_impersonating`: Stop impersonating an account (LOCAL only)

### Instructions on getting Holesky ETH

To get Holesky ETH for running on testnet:

1. PoW Mining Faucet:
### Instructions on getting Sepolia ETH

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

2. Alchemy Faucet (Alternative):
- Visit https://www.alchemy.com/faucets/holesky
1. Alchemy Faucet:
- Visit https://www.alchemy.com/faucets/ethereum-sepolia
- Requires mainnet ETH balance to use
- Connect wallet and verify ownership
- Request funds (limits apply)

2. Google Cloud Faucet:
- Visit https://cloud.google.com/application/web3/faucet/ethereum/sepolia
- No requirements
- Request funds (limits apply)
3 changes: 3 additions & 0 deletions contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ optimizer = true
optimizer_runs = 100
# Higher number optimizes for frequent contract calls, lower number optimizes for deployment cost

[profile.ci]
via-ir = false

[profile.bls]
src = "src/eigenlayer/bls"
test = "test/eigenlayer/bls"
Expand Down
1 change: 1 addition & 0 deletions contracts/lib/poa-middleware
Submodule poa-middleware added at 095670
1 change: 1 addition & 0 deletions contracts/remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
@openzeppelin/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/lib/openzeppelin-contracts-v4.9.0/
@openzeppelin-upgrades/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/
forge-std/=lib/forge-std/src/
@poa-middleware/=lib/poa-middleware/contracts/
5 changes: 3 additions & 2 deletions contracts/script/eigenlayer/bls/WavsMiddlewareDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ contract WavsMiddlewareDeployer is Script {
}
if (
address(registryCoordinator.serviceManager())
!= wavsMiddlewareDeployment.wavsServiceManager
!= wavsMiddlewareDeployment.wavsServiceManager
|| address(registryCoordinator.stakeRegistry())
!= wavsMiddlewareDeployment.stakeRegistry
|| address(registryCoordinator.blsApkRegistry())
Expand All @@ -130,7 +130,8 @@ contract WavsMiddlewareDeployer is Script {
!= wavsMiddlewareDeployment.indexRegistry
|| address(registryCoordinator.socketRegistry())
!= wavsMiddlewareDeployment.socketRegistry
|| address(registryCoordinator.allocationManager()) != coreDeployment.allocationManager
|| address(registryCoordinator.allocationManager())
!= coreDeployment.allocationManager
|| address(registryCoordinator.pauserRegistry())
!= wavsMiddlewareDeployment.pauserRegistry
) {
Expand Down
9 changes: 4 additions & 5 deletions contracts/script/eigenlayer/bls/utils/BLSKeyGenerator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
pragma solidity ^0.8.27;

import {BN254} from "@eigenlayer-middleware/src/libraries/BN254.sol";
import {ISlashingRegistryCoordinator} from
"@eigenlayer-middleware/src/interfaces/ISlashingRegistryCoordinator.sol";
import {
ISlashingRegistryCoordinator
} from "@eigenlayer-middleware/src/interfaces/ISlashingRegistryCoordinator.sol";
import {IBLSApkRegistryTypes} from "@eigenlayer-middleware/src/interfaces/IBLSApkRegistry.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {BN256G2} from "@eigenlayer-middleware/test/utils/BN256G2.sol";
Expand Down Expand Up @@ -55,9 +56,7 @@ library BLSKeyGenerator {
BN254.G1Point memory signature = BN254.scalar_mul(pubkeyRegistrationMessageHash, privateKey);

params = IBLSApkRegistryTypes.PubkeyRegistrationParams({
pubkeyRegistrationSignature: signature,
pubkeyG1: pubkeyG1,
pubkeyG2: pubkeyG2
pubkeyRegistrationSignature: signature, pubkeyG1: pubkeyG1, pubkeyG2: pubkeyG2
});
}
}
11 changes: 9 additions & 2 deletions contracts/script/eigenlayer/bls/utils/UpgradeableProxyLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ library UpgradeableProxyLib {
* @param proxy The proxy address.
* @param impl The implementation address.
*/
function upgrade(address proxy, address impl) internal {
function upgrade(
address proxy,
address impl
) internal {
ProxyAdmin admin = getProxyAdmin(proxy);
admin.upgrade(ITransparentUpgradeableProxy(payable(proxy)), impl);
}
Expand All @@ -59,7 +62,11 @@ library UpgradeableProxyLib {
* @param impl The implementation address.
* @param initData The initialization data.
*/
function upgradeAndCall(address proxy, address impl, bytes memory initData) internal {
function upgradeAndCall(
address proxy,
address impl,
bytes memory initData
) internal {
ProxyAdmin admin = getProxyAdmin(proxy);
admin.upgradeAndCall(ITransparentUpgradeableProxy(payable(proxy)), impl, initData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import {BLSApkRegistry} from "@eigenlayer-middleware/src/BLSApkRegistry.sol";
import {IndexRegistry} from "@eigenlayer-middleware/src/IndexRegistry.sol";
import {SocketRegistry} from "@eigenlayer-middleware/src/SocketRegistry.sol";
import {RegistryCoordinator} from "@eigenlayer-middleware/src/RegistryCoordinator.sol";
import {SlashingRegistryCoordinator} from
"@eigenlayer-middleware/src/SlashingRegistryCoordinator.sol";
import {
SlashingRegistryCoordinator
} from "@eigenlayer-middleware/src/SlashingRegistryCoordinator.sol";
import {InstantSlasher} from "@eigenlayer-middleware/src/slashers/InstantSlasher.sol";
import {OperatorStateRetriever} from "@eigenlayer-middleware/src/OperatorStateRetriever.sol";

Expand All @@ -23,8 +24,9 @@ import {IBLSApkRegistry} from "@eigenlayer-middleware/src/interfaces/IBLSApkRegi
import {IIndexRegistry} from "@eigenlayer-middleware/src/interfaces/IIndexRegistry.sol";
import {ISocketRegistry} from "@eigenlayer-middleware/src/interfaces/ISocketRegistry.sol";
import {IServiceManager} from "@eigenlayer-middleware/src/interfaces/IServiceManager.sol";
import {IRegistryCoordinatorTypes} from
"@eigenlayer-middleware/src/interfaces/IRegistryCoordinator.sol";
import {
IRegistryCoordinatorTypes
} from "@eigenlayer-middleware/src/interfaces/IRegistryCoordinator.sol";
import {
ISlashingRegistryCoordinator,
ISlashingRegistryCoordinatorTypes
Expand Down Expand Up @@ -232,9 +234,7 @@ library WavsMiddlewareDeploymentLib {
ISlashingRegistryCoordinator(deployment.registryCoordinator);
slashingRegistryCoordinator.createSlashableStakeQuorum(
ISlashingRegistryCoordinatorTypes.OperatorSetParam({
maxOperatorCount: 10_000,
kickBIPsOfOperatorStake: 10_500,
kickBIPsOfTotalStake: 100
maxOperatorCount: 10_000, kickBIPsOfOperatorStake: 10_500, kickBIPsOfTotalStake: 100
}),
minimumWeight,
strategyParams,
Expand Down Expand Up @@ -278,8 +278,7 @@ library WavsMiddlewareDeploymentLib {
new IStakeRegistryTypes.StrategyParams[](strategyCount);
for (uint256 i; i < strategyCount; ++i) {
strategyParams[i] = IStakeRegistryTypes.StrategyParams({
strategy: IStrategy(strategies[i]),
multiplier: multipliers[i]
strategy: IStrategy(strategies[i]), multiplier: multipliers[i]
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,19 @@ library WavsRegisterOperatorLib {
opSetIds[0] = 0;

BN254.G1Point memory pubkeyRegistrationMessageHash = ISlashingRegistryCoordinator(
WavsServiceManager(serviceManagerAddress).getRegistryCoordinator()
).pubkeyRegistrationMessageHash(operatorAddr);
WavsServiceManager(serviceManagerAddress).getRegistryCoordinator()
).pubkeyRegistrationMessageHash(operatorAddr);

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

bytes memory data = abi.encode(
ISlashingRegistryCoordinatorTypes.RegistrationType.NORMAL, "Mock Socket", blsParams
);
IAllocationManagerTypes.RegisterParams memory params = IAllocationManagerTypes
.RegisterParams({avs: serviceManagerAddress, operatorSetIds: opSetIds, data: data});
IAllocationManagerTypes.RegisterParams memory params =
IAllocationManagerTypes.RegisterParams({
avs: serviceManagerAddress, operatorSetIds: opSetIds, data: data
});

allocationManager.registerForOperatorSets(operatorAddr, params);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
pragma solidity ^0.8.27;

import {Script} from "forge-std/Script.sol";
import {IECDSAStakeRegistryTypes} from
"@eigenlayer-middleware/src/interfaces/IECDSAStakeRegistry.sol";
import {
IECDSAStakeRegistryTypes
} from "@eigenlayer-middleware/src/interfaces/IECDSAStakeRegistry.sol";

import {WavsMiddlewareDeploymentLib} from "./utils/WavsMiddlewareDeploymentLib.sol";
import {ReadCoreLib} from "./utils/ReadCoreLib.sol";
Expand Down
5 changes: 3 additions & 2 deletions contracts/script/eigenlayer/ecdsa/WavsMirrorDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ pragma solidity ^0.8.27;

import {Script} from "forge-std/Script.sol";
import {console2} from "forge-std/Test.sol";
import {IECDSAStakeRegistryTypes} from
"@eigenlayer-middleware/src/interfaces/IECDSAStakeRegistry.sol";
import {
IECDSAStakeRegistryTypes
} from "@eigenlayer-middleware/src/interfaces/IECDSAStakeRegistry.sol";

import {WavsMirrorDeploymentLib} from "./utils/WavsMirrorDeploymentLib.sol";
import {UpgradeableProxyLib} from "./utils/UpgradeableProxyLib.sol";
Expand Down
11 changes: 8 additions & 3 deletions contracts/script/eigenlayer/ecdsa/WavsMirrorPrepareDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
pragma solidity ^0.8.27;

import {Script} from "forge-std/Script.sol";
import {IECDSAStakeRegistryTypes} from
"@eigenlayer-middleware/src/interfaces/IECDSAStakeRegistry.sol";
import {
IECDSAStakeRegistryTypes
} from "@eigenlayer-middleware/src/interfaces/IECDSAStakeRegistry.sol";

import {WavsMirrorDeploymentLib} from "./utils/WavsMirrorDeploymentLib.sol";
import {UpgradeableProxyLib} from "./utils/UpgradeableProxyLib.sol";
Expand All @@ -19,15 +20,19 @@ contract WavsMirrorPrepareDeploy is Script, IECDSAStakeRegistryTypes {

/// @notice The environment variable for the WAVS service manager contract address.
string public constant ENV_SERVICE_MANAGER = "WAVS_SERVICE_MANAGER_ADDRESS";
/// @notice The environment variable to indicate POA deployment.
string public constant ENV_IS_POA = "IS_POA";

string private configFile;
address private serviceManagerAddress;
bool private isPOA;

/// @notice The setup function for the script.
function setUp() public virtual {
// read env vars
configFile = "./deployments/wavs-mirror-config.json";
serviceManagerAddress = vm.envAddress(ENV_SERVICE_MANAGER);
isPOA = vm.envOr(ENV_IS_POA, false);
}

/// @notice The run function for the script.
Expand All @@ -36,7 +41,7 @@ contract WavsMirrorPrepareDeploy is Script, IECDSAStakeRegistryTypes {

// Pass in the configuration as a file, load it
WavsMirrorDeploymentLib.InitialConfiguration memory configuration =
WavsMirrorDeploymentLib.loadConfigurationFromChain(serviceManagerAddress);
WavsMirrorDeploymentLib.loadConfigurationFromChain(serviceManagerAddress, isPOA);

// write the configuration to a file
WavsMirrorDeploymentLib.writeConfiguration(configFile, configuration);
Expand Down
11 changes: 9 additions & 2 deletions contracts/script/eigenlayer/ecdsa/utils/UpgradeableProxyLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ library UpgradeableProxyLib {
* @param proxy The proxy address.
* @param impl The implementation address.
*/
function upgrade(address proxy, address impl) internal {
function upgrade(
address proxy,
address impl
) internal {
ProxyAdmin admin = getProxyAdmin(proxy);
admin.upgrade(ITransparentUpgradeableProxy(payable(proxy)), impl);
}
Expand All @@ -59,7 +62,11 @@ library UpgradeableProxyLib {
* @param impl The implementation address.
* @param initData The initialization data.
*/
function upgradeAndCall(address proxy, address impl, bytes memory initData) internal {
function upgradeAndCall(
address proxy,
address impl,
bytes memory initData
) internal {
ProxyAdmin admin = getProxyAdmin(proxy);
admin.upgradeAndCall(ITransparentUpgradeableProxy(payable(proxy)), impl, initData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import {UpgradeableProxyLib} from "./UpgradeableProxyLib.sol";
import {WavsServiceManager} from "src/eigenlayer/ecdsa/WavsServiceManager.sol";
import {ReadCoreLib} from "./ReadCoreLib.sol";
import {WavsAVSRegistrar} from "src/eigenlayer/ecdsa/WavsAVSRegistrar.sol";
import {WavsOperatorUpdateHandler} from
"src/eigenlayer/ecdsa/handlers/WavsOperatorUpdateHandler.sol";
import {
WavsOperatorUpdateHandler
} from "src/eigenlayer/ecdsa/handlers/WavsOperatorUpdateHandler.sol";

/**
* @title WavsMiddlewareDeploymentLib
Expand Down Expand Up @@ -165,8 +166,10 @@ library WavsMiddlewareDeploymentLib {
// If op set only allows one strategy, why do we need 12 registered with multipliers in the quorum?
// Suggestion - use same both for opset and for initialize. But which one (or both)?
// ECDSAStakeRegistry.initialize, (result.WavsServiceManager, 100, quorum) // TODO: dynamically update threshold (?)
IAllocationManagerTypes.CreateSetParams memory opSetParams = IAllocationManagerTypes
.CreateSetParams({operatorSetId: 0, strategies: new IStrategy[](1)});
IAllocationManagerTypes.CreateSetParams memory opSetParams =
IAllocationManagerTypes.CreateSetParams({
operatorSetId: 0, strategies: new IStrategy[](1)
});
opSetParams.strategies[0] = IStrategy(deployment.strategy);
IAllocationManagerTypes.CreateSetParams[] memory opSetParamsArray =
new IAllocationManagerTypes.CreateSetParams[](1);
Expand Down Expand Up @@ -203,8 +206,7 @@ library WavsMiddlewareDeploymentLib {
for (uint256 i = 0; i < size; ++i) {
totalMultiplier += multipliers[i];
quorum.strategies[i] = IECDSAStakeRegistryTypes.StrategyParams({
strategy: IStrategy(strategies[i]),
multiplier: multipliers[i]
strategy: IStrategy(strategies[i]), multiplier: multipliers[i]
});
}
if (totalMultiplier != 10_000) {
Expand Down
Loading
Loading