Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
84 changes: 84 additions & 0 deletions contracts/script/deploy/certverifier/CertVerifierDeployer.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// SPDX-License-Identifier: MIT
pragma solidity =0.8.12;

import {EigenDACertVerifier} from "src/core/EigenDACertVerifier.sol";
import {RegistryCoordinator} from "lib/eigenlayer-middleware/src/RegistryCoordinator.sol";
import {IRegistryCoordinator} from "lib/eigenlayer-middleware/src/interfaces/IRegistryCoordinator.sol";
import {OperatorStateRetriever} from "lib/eigenlayer-middleware/src/OperatorStateRetriever.sol";
import {EigenDAServiceManager} from "src/core/EigenDAServiceManager.sol";
import {IEigenDAServiceManager} from "src/interfaces/IEigenDAServiceManager.sol";
import {EigenDAThresholdRegistry} from "src/core/EigenDAThresholdRegistry.sol";
import {IEigenDAThresholdRegistry} from "src/interfaces/IEigenDAThresholdRegistry.sol";
import {IEigenDABatchMetadataStorage} from "src/interfaces/IEigenDABatchMetadataStorage.sol";
import {IEigenDASignatureVerifier} from "src/interfaces/IEigenDASignatureVerifier.sol";
import {EigenDARelayRegistry} from "src/core/EigenDARelayRegistry.sol";
import {IEigenDARelayRegistry} from "src/interfaces/IEigenDARelayRegistry.sol";
import "forge-std/Test.sol";
import "forge-std/Script.sol";
import "forge-std/StdJson.sol";
import "src/interfaces/IEigenDAStructs.sol";

//forge script script/deploy/certverifier/CertVerifierDeployer.s.sol:CertVerifierDeployer --sig "run(string)" <config.json> --rpc-url $RPC --private-key $PRIVATE_KEY -vvvv --etherscan-api-key $ETHERSCAN_API_KEY --verify --broadcast
contract CertVerifierDeployer is Script, Test {

address eigenDACertVerifier;

address eigenDAServiceManager;
address eigenDAThresholdRegistry;
address eigenDARelayRegistry;
address registryCoordinator ;
address operatorStateRetriever;

SecurityThresholds defaultSecurityThresholds;
bytes quorumNumbersRequired;

function run(string memory json) external {

string memory path = string.concat("./script/deploy/certverifier/config/", json);
string memory data = vm.readFile(path);

bytes memory raw = stdJson.parseRaw(data, ".eigenDAServiceManager");
eigenDAServiceManager = abi.decode(raw, (address));

raw = stdJson.parseRaw(data, ".eigenDAThresholdRegistry");
eigenDAThresholdRegistry = abi.decode(raw, (address));

raw = stdJson.parseRaw(data, ".eigenDARelayRegistry");
eigenDARelayRegistry = abi.decode(raw, (address));

raw = stdJson.parseRaw(data, ".registryCoordinator");
registryCoordinator = abi.decode(raw, (address));

raw = stdJson.parseRaw(data, ".operatorStateRetriever");
operatorStateRetriever = abi.decode(raw, (address));

raw = stdJson.parseRaw(data, ".defaultSecurityThresholds");
defaultSecurityThresholds = abi.decode(raw, (SecurityThresholds));

raw = stdJson.parseRaw(data, ".quorumNumbersRequired");
quorumNumbersRequired = abi.decode(raw, (bytes));

vm.startBroadcast();

eigenDACertVerifier = address(
new EigenDACertVerifier(
IEigenDAThresholdRegistry(eigenDAThresholdRegistry),
IEigenDABatchMetadataStorage(eigenDAServiceManager),
IEigenDASignatureVerifier(eigenDAServiceManager),
IEigenDARelayRegistry(eigenDARelayRegistry),
OperatorStateRetriever(operatorStateRetriever),
IRegistryCoordinator(registryCoordinator),
defaultSecurityThresholds,
quorumNumbersRequired
));

vm.stopBroadcast();

console.log("Deployed new EigenDACertVerifier at address: ", eigenDACertVerifier);

string memory outputPath = "script/deploy/certverifier/output/certverifier_deployment_data.json";
string memory parent_object = "parent object";
string memory finalJson = vm.serializeAddress(parent_object, "eigenDACertVerifier", address(eigenDACertVerifier));
vm.writeJson(finalJson, outputPath);
}
}
42 changes: 42 additions & 0 deletions contracts/script/deploy/certverifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## EigenDA Cert Verfier Deployer

This script can be used to deploy an EigenDACertVerifier contract with specified security thresholds and quorum numbers required

### Config

To set up the deployment, a config json should be placed in the `config/` folder with the following structure:

```json
{
"eigenDAServiceManager": "0x...",
"eigenDAThresholdRegistry": "0x...",
"eigenDARelayRegistry": "0x...",
"registryCoordinator": "0x...",
"operatorStateRetriever": "0x...",

"defaultSecurityThresholds": {
"0_confirmationThreshold": 55,
"1_adversaryThreshold": 33
},

"quorumNumbersRequired": "0x0001"
}
```

Two sample configs are provided in the `config/` folder for preprod and testnet environments.

### Deployment

To deploy the contract, run the following command passing in the path to the config file and appropriate keys

```bash
forge script script/deploy/certverifier/CertVerifierDeployer.s.sol:CertVerifierDeployer --sig "run(string)" <config.json> --rpc-url $RPC --private-key $PRIVATE_KEY -vvvv --etherscan-api-key $ETHERSCAN_API_KEY --verify --broadcast
```

The deployment will output the address of the deployed contract to a json file in the `output/` folder named `certverifier_deployment_data.json`

```json
{
"eigenDACertVerifier": "0x..."
}
```
14 changes: 14 additions & 0 deletions contracts/script/deploy/certverifier/config/preprod.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"eigenDAServiceManager": "0x54A03db2784E3D0aCC08344D05385d0b62d4F432",
"eigenDAThresholdRegistry": "0x41AEE4A23770045e9977CC9f964d3380D6Ff9e4E",
"eigenDARelayRegistry": "0xca1ca181fCb3c4192D320569c6eB4b5161B80328",
"registryCoordinator": "0x2c61EA360D6500b58E7f481541A36B443Bc858c6",
"operatorStateRetriever": "0x93545e3b9013CcaBc31E80898fef7569a4024C0C",

"defaultSecurityThresholds": {
"0_confirmationThreshold": 55,
"1_adversaryThreshold": 33
},

"quorumNumbersRequired": "0x0001"
}
14 changes: 14 additions & 0 deletions contracts/script/deploy/certverifier/config/testnet.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"eigenDAServiceManager": "0xD4A7E1Bd8015057293f0D0A557088c286942e84b",
"eigenDAThresholdRegistry": "0x76d131CFBD900dA12f859a363Fb952eEDD1d1Ec1",
"eigenDARelayRegistry": "0xaC8C6C7Ee7572975454E2f0b5c720f9E74989254",
"registryCoordinator": "0x53012C69A189cfA2D9d29eb6F19B32e0A2EA3490",
"operatorStateRetriever": "0x5322F480c6a14aBA6491974fa0fbF2A925C71B94",

"defaultSecurityThresholds": {
"0_confirmationThreshold": 55,
"1_adversaryThreshold": 33
},

"quorumNumbersRequired": "0x0001"
}
Loading