Skip to content

Commit

Permalink
feat: integration into local devnet
Browse files Browse the repository at this point in the history
  • Loading branch information
eddort committed Dec 18, 2024
1 parent 8280530 commit 0ed3c7c
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 5 deletions.
21 changes: 20 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ deploy_script_name := if chain == "mainnet" {
"DeployMainnet"
} else if chain == "holesky" {
"DeployHolesky"
} else if chain == "local-devnet" {
"DeployLocalDevNet"
} else {
error("Unsupported chain " + chain)
}
Expand All @@ -14,6 +16,8 @@ deploy_implementations_script_name := if chain == "mainnet" {
"DeployImplementationsMainnet"
} else if chain == "holesky" {
"DeployImplementationsHolesky"
} else if chain == "local-devnet" {
"DeployImplementationsLocalDevNet"
} else {
error("Unsupported chain " + chain)
}
Expand All @@ -22,6 +26,8 @@ deploy_config_path := if chain == "mainnet" {
"artifacts/mainnet/deploy-mainnet.json"
} else if chain == "holesky" {
"artifacts/holesky/deploy-holesky.json"
} else if chain == "local-devnet" {
"artifacts/local-devnet/deploy-local-devnet.json"
} else {
error("Unsupported chain " + chain)
}
Expand Down Expand Up @@ -141,9 +147,19 @@ deploy-prod *args:
cp ./broadcast/{{deploy_script_name}}.s.sol/`cast chain-id --rpc-url=$RPC_URL`/run-latest.json \
./artifacts/latest/transactions.json

deploy-local-devnet *args:
just _warn "The current `tput bold`chain={{chain}}`tput sgr0` with the following rpc url: $RPC_URL"
ARTIFACTS_DIR=./artifacts/latest/ just _deploy-prod-devnet {{args}}

cp ./broadcast/{{deploy_script_name}}.s.sol/`cast chain-id --rpc-url=$RPC_URL`/run-latest.json \
./artifacts/latest/transactions.json

[confirm("You are about to broadcast deployment transactions to the network. Are you sure?")]
_deploy-prod-confirm *args:
just _deploy-prod --broadcast --verify {{args}}
just _deploy-prod --broadcast {{args}}

_deploy-prod-devnet *args:
just _deploy-prod --broadcast {{args}}

deploy-prod-dry *args:
just _deploy-prod {{args}}
Expand All @@ -152,6 +168,9 @@ verify-prod *args:
just _warn "Pass --chain=your_chain manually. e.g. --chain=holesky for testnet deployment"
forge script {{deploy_script_path}} --sig="run(string)" --rpc-url ${RPC_URL} --verify {{args}} --unlocked -- `git rev-parse HEAD`

verify-devnet *args:
forge script {{deploy_script_path}} --rpc-url ${RPC_URL} --verify --verifier custom --chain ${DEVNET_CHAIN_ID} {{args}} -- `git rev-parse HEAD`

_deploy-prod *args:
forge script {{deploy_script_path}} --sig="run(string)" --force --rpc-url ${RPC_URL} {{args}} -- `git rev-parse HEAD`

Expand Down
14 changes: 10 additions & 4 deletions script/DeployBase.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct DeployParams {
address sealingCommittee;
uint256 sealDuration;
uint256 sealExpiryTimestamp;
bool gateSealEnabled;
// Testnet stuff
address secondAdminAddress;
}
Expand Down Expand Up @@ -259,11 +260,16 @@ abstract contract DeployBase is Script {
_avgPerfLeewayBP: config.avgPerfLeewayBP
});

address gateSeal = _deployGateSeal();
address gateSeal = address(0);

if (config.gateSealEnabled) {
gateSeal = _deployGateSeal();

csm.grantRole(csm.PAUSE_ROLE(), gateSeal);
oracle.grantRole(oracle.PAUSE_ROLE(), gateSeal);
accounting.grantRole(accounting.PAUSE_ROLE(), gateSeal);
}

csm.grantRole(csm.PAUSE_ROLE(), gateSeal);
oracle.grantRole(oracle.PAUSE_ROLE(), gateSeal);
accounting.grantRole(accounting.PAUSE_ROLE(), gateSeal);
accounting.grantRole(
accounting.SET_BOND_CURVE_ROLE(),
config.setResetBondCurveAddress
Expand Down
2 changes: 2 additions & 0 deletions script/DeployHolesky.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ contract DeployHolesky is DeployBase {
config.earlyAdoptionBondCurve[4] = 8.5 ether;
config.earlyAdoptionBondCurve[5] = 10 ether;
// GateSeal
config.gateSealEnabled = true;

config.gateSealFactory = 0x1134F7077055b0B3559BE52AfeF9aA22A0E1eEC2;
config.sealingCommittee = 0xc4DAB3a3ef68C6DFd8614a870D64D475bA44F164; // Dev team EOA
config.sealDuration = 6 days;
Expand Down
46 changes: 46 additions & 0 deletions script/DeployImplementationsLocalDevNet.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-FileCopyrightText: 2024 Lido <[email protected]>
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.24;

import { DeployBase } from "./DeployBase.s.sol";
import { GIndex } from "../src/lib/GIndex.sol";
import { DeployImplementationsBase } from "./DeployImplementationsBase.s.sol";
import { DeployLocalDevNet } from "./DeployLocalDevNet.s.sol";
import { HashConsensus } from "../src/lib/base-oracle/HashConsensus.sol";
import { CSModule } from "../src/CSModule.sol";
import { CSAccounting } from "../src/CSAccounting.sol";
import { CSFeeDistributor } from "../src/CSFeeDistributor.sol";
import { CSFeeOracle } from "../src/CSFeeOracle.sol";
import { CSVerifier } from "../src/CSVerifier.sol";
import { CSEarlyAdoption } from "../src/CSEarlyAdoption.sol";
import { DeploymentHelpers } from "../test/helpers/Fixtures.sol";

contract DeployImplementationsLocalDevNet is
DeployImplementationsBase,
DeployLocalDevNet,
DeploymentHelpers
{
function deploy(
string memory deploymentConfigPath,
string memory _gitRef
) external {
gitRef = _gitRef;
string memory deploymentConfigContent = vm.readFile(
deploymentConfigPath
);
DeploymentConfig memory deploymentConfig = parseDeploymentConfig(
deploymentConfigContent
);

csm = CSModule(deploymentConfig.csm);
earlyAdoption = CSEarlyAdoption(deploymentConfig.earlyAdoption);
accounting = CSAccounting(deploymentConfig.accounting);
oracle = CSFeeOracle(deploymentConfig.oracle);
feeDistributor = CSFeeDistributor(deploymentConfig.feeDistributor);
hashConsensus = HashConsensus(deploymentConfig.hashConsensus);
gateSeal = deploymentConfig.gateSeal;

_deploy();
}
}
92 changes: 92 additions & 0 deletions script/DeployLocalDevNet.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// SPDX-FileCopyrightText: 2024 Lido <[email protected]>
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.24;

import { DeployBase } from "./DeployBase.s.sol";
import { GIndex } from "../src/lib/GIndex.sol";

contract DeployLocalDevNet is DeployBase {
constructor() DeployBase("local-devnet", 32382) {
// Lido addresses
config.lidoLocatorAddress = vm.envAddress("CSM_LOCATOR_ADDRESS");
config.aragonAgent = vm.envAddress("CSM_ARAGON_AGENT_ADDRESS");
config
.easyTrackEVMScriptExecutor = vm.envAddress("EVM_SCRIPT_EXECUTOR_ADDRESS");
config.proxyAdmin = vm.envAddress("CSM_FIRST_ADMIN_ADDRESS"); // Dev team EOA

// Oracle
config.secondsPerSlot = 12;
config.slotsPerEpoch = 32;
config.clGenesisTime = vm.envUint("DEVNET_GENESIS_TIME");
config.oracleReportEpochsPerFrame = 225 * 7; // 7 days
config.fastLaneLengthSlots = 0;
config.consensusVersion = 1;
config.avgPerfLeewayBP = 500;
config.oracleMembers = new address[](2);
config.oracleMembers[0] = vm.envAddress("CSM_ORACLE_1_ADDRESS");
config.oracleMembers[1] = vm.envAddress("CSM_ORACLE_2_ADDRESS");
config.hashConsensusQuorum = 2;
// Verifier
// NOTE: Deneb fork gIndexes. Should be updated according to `config.verifierSupportedEpoch` fork epoch if needed
config.gIFirstWithdrawal = GIndex.wrap(
0x0000000000000000000000000000000000000000000000000000000000e1c004
);
config.gIFirstValidator = GIndex.wrap(
0x0000000000000000000000000000000000000000000000000056000000000028
);
config.gIHistoricalSummaries = GIndex.wrap(
0x0000000000000000000000000000000000000000000000000000000000003b00
);

config.verifierSupportedEpoch = 29696;
// Accounting
config.maxCurveLength = 10;
config.bondCurve = new uint256[](6);
// 2 -> 1.9 -> 1.8 -> 1.7 -> 1.6 -> 1.5
config.bondCurve[0] = 2 ether;
config.bondCurve[1] = 3.9 ether;
config.bondCurve[2] = 5.7 ether;
config.bondCurve[3] = 7.4 ether;
config.bondCurve[4] = 9 ether;
config.bondCurve[5] = 10.5 ether;

config.minBondLockPeriod = 0;
config.maxBondLockPeriod = 365 days;
config.bondLockPeriod = 8 weeks;
config
.setResetBondCurveAddress = vm.envAddress("CSM_FIRST_ADMIN_ADDRESS"); // Dev team EOA
// Module
config.moduleType = "community-onchain-v1";
config.minSlashingPenaltyQuotient = 32;
config.elRewardsStealingAdditionalFine = 0.1 ether;
config.maxKeysPerOperatorEA = 10;
config.maxKeyRemovalCharge = 0.1 ether;
config.keyRemovalCharge = 0.05 ether;
config
.elRewardsStealingReporter = vm.envAddress("CSM_FIRST_ADMIN_ADDRESS"); // Dev team EOA
config
.chargePenaltyRecipient = vm.envAddress("CSM_LOCATOR_TREASURY_ADDRESS"); // locator.treasury()
// EarlyAdoption
config
.earlyAdoptionTreeRoot = 0xc9a9c1576cf4f3213ad9075b72a1f1b147914a252ad927fa4ca3460ff0723ca9;
config.earlyAdoptionBondCurve = new uint256[](6);
// 1.5 -> 1.9 -> 1.8 -> 1.7 -> 1.6 -> 1.5
config.earlyAdoptionBondCurve[0] = 1.5 ether;
config.earlyAdoptionBondCurve[1] = 3.4 ether;
config.earlyAdoptionBondCurve[2] = 5.2 ether;
config.earlyAdoptionBondCurve[3] = 6.9 ether;
config.earlyAdoptionBondCurve[4] = 8.5 ether;
config.earlyAdoptionBondCurve[5] = 10 ether;
// GateSeal
config.gateSealEnabled = false;

config.gateSealFactory = 0x1134F7077055b0B3559BE52AfeF9aA22A0E1eEC2;
config.sealingCommittee = 0xc4DAB3a3ef68C6DFd8614a870D64D475bA44F164; // Dev team EOA
config.sealDuration = 6 days;
config.sealExpiryTimestamp = block.timestamp + 365 days;

config.secondAdminAddress = vm.envAddress("CSM_SECOND_ADMIN_ADDRESS"); // Dev team EOA
_setUp();
}
}
2 changes: 2 additions & 0 deletions script/DeployMainnet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ contract DeployMainnet is DeployBase {
config.earlyAdoptionBondCurve[1] = 2.8 ether;

// GateSeal
config.gateSealEnabled = true;

config.gateSealFactory = 0x6C82877cAC5a7A739f16Ca0A89c0A328B8764A24;
config.sealingCommittee = 0xC52fC3081123073078698F1EAc2f1Dc7Bd71880f; // CSM Committee MS
config.sealDuration = 6 days;
Expand Down

0 comments on commit 0ed3c7c

Please sign in to comment.