Commit ff3fdc77 authored by smartcontracts's avatar smartcontracts Committed by GitHub

maint: move deployment scripts into a deploy folder (#10738)

parent 64f5ff55
......@@ -143,7 +143,7 @@ def devnet_l1_allocs(paths):
log.info('Generating L1 genesis allocs')
init_devnet_l1_deploy_config(paths)
fqn = 'scripts/Deploy.s.sol:Deploy'
fqn = 'scripts/deploy/Deploy.s.sol:Deploy'
run_command([
# We need to set the sender here to an account we know the private key of,
# because the sender ends up being the owner of the ProxyAdmin SAFE
......
......@@ -280,7 +280,7 @@ descriptions of the values.
```bash
DEPLOYMENT_OUTFILE=deployments/artifact.json \
DEPLOY_CONFIG_PATH=<PATH_TO_MY_DEPLOY_CONFIG> \
forge script scripts/Deploy.s.sol:Deploy \
forge script scripts/deploy/Deploy.s.sol:Deploy \
--broadcast --private-key $PRIVATE_KEY \
--rpc-url $ETH_RPC_URL
```
......@@ -339,11 +339,11 @@ While it has received initial review from core contributors, it is still undergo
### Execution
Before deploying the contracts, you can verify the state diff produced by the deploy script using the `runWithStateDiff()` function signature which produces the outputs inside [`snapshots/state-diff/`](./snapshots/state-diff).
Run the deployment with state diffs by executing: `forge script -vvv scripts/Deploy.s.sol:Deploy --sig 'runWithStateDiff()' --rpc-url $ETH_RPC_URL --broadcast --private-key $PRIVATE_KEY`.
Run the deployment with state diffs by executing: `forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --sig 'runWithStateDiff()' --rpc-url $ETH_RPC_URL --broadcast --private-key $PRIVATE_KEY`.
1. Set the env vars `ETH_RPC_URL`, `PRIVATE_KEY` and `ETHERSCAN_API_KEY` if contract verification is desired.
1. Set the `DEPLOY_CONFIG_PATH` env var to a path on the filesystem that points to a deploy config.
1. Deploy the contracts with `forge script -vvv scripts/Deploy.s.sol:Deploy --rpc-url $ETH_RPC_URL --broadcast --private-key $PRIVATE_KEY`
1. Deploy the contracts with `forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --rpc-url $ETH_RPC_URL --broadcast --private-key $PRIVATE_KEY`
Pass the `--verify` flag to verify the deployments automatically with Etherscan.
### Deploying a single contract
......
......@@ -19,7 +19,7 @@
"genesis": "forge script scripts/L2Genesis.s.sol:L2Genesis --sig 'runWithStateDump()'",
"coverage": "pnpm build:go-ffi && (forge coverage || (bash -c \"forge coverage 2>&1 | grep -q 'Stack too deep' && echo -e '\\033[1;33mWARNING\\033[0m: Coverage failed with stack too deep, so overriding and exiting successfully' && exit 0 || exit 1\"))",
"coverage:lcov": "pnpm build:go-ffi && (forge coverage --report lcov || (bash -c \"forge coverage --report lcov 2>&1 | grep -q 'Stack too deep' && echo -e '\\033[1;33mWARNING\\033[0m: Coverage failed with stack too deep, so overriding and exiting successfully' && exit 0 || exit 1\"))",
"deploy": "./scripts/deploy.sh",
"deploy": "./scripts/deploy/deploy.sh",
"gas-snapshot:no-build": "forge snapshot --match-contract GasBenchMark",
"statediff": "./scripts/statediff.sh && git diff --exit-code",
"gas-snapshot": "pnpm build:go-ffi && pnpm gas-snapshot:no-build",
......
......@@ -3,8 +3,8 @@ pragma solidity ^0.8.0;
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { DeployConfig } from "scripts/DeployConfig.s.sol";
import { Deployer } from "scripts/Deployer.sol";
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Deployer } from "scripts/deploy/Deployer.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { Constants } from "src/libraries/Constants.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
......
......@@ -3,11 +3,11 @@ pragma solidity 0.8.15;
import { Script } from "forge-std/Script.sol";
import { console2 as console } from "forge-std/console2.sol";
import { Deployer } from "scripts/Deployer.sol";
import { Deployer } from "scripts/deploy/Deployer.sol";
import { Config, OutputMode, OutputModeUtils, Fork, ForkUtils, LATEST_FORK } from "scripts/Config.sol";
import { Artifacts } from "scripts/Artifacts.s.sol";
import { DeployConfig } from "scripts/DeployConfig.s.sol";
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import { Preinstalls } from "src/libraries/Preinstalls.sol";
import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
......
......@@ -12,7 +12,7 @@ import { OwnerManager } from "safe-contracts/base/OwnerManager.sol";
import { GnosisSafeProxyFactory as SafeProxyFactory } from "safe-contracts/proxies/GnosisSafeProxyFactory.sol";
import { Enum as SafeOps } from "safe-contracts/common/Enum.sol";
import { Deployer } from "scripts/Deployer.sol";
import { Deployer } from "scripts/deploy/Deployer.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { AddressManager } from "src/legacy/AddressManager.sol";
......
......@@ -9,7 +9,7 @@ import { OwnerManager } from "safe-contracts/base/OwnerManager.sol";
import { ModuleManager } from "safe-contracts/base/ModuleManager.sol";
import { GuardManager } from "safe-contracts/base/GuardManager.sol";
import { Deployer } from "scripts/Deployer.sol";
import { Deployer } from "scripts/deploy/Deployer.sol";
import { LivenessGuard } from "src/Safe/LivenessGuard.sol";
import { LivenessModule } from "src/Safe/LivenessModule.sol";
......
......@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
import { Script } from "forge-std/Script.sol";
import { Artifacts } from "scripts/Artifacts.s.sol";
import { Config } from "scripts/Config.sol";
import { DeployConfig } from "scripts/DeployConfig.s.sol";
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Executables } from "scripts/Executables.sol";
import { console } from "forge-std/console.sol";
......
......@@ -7,9 +7,9 @@ if [ -n "${DEPLOY_VERIFY:-}" ]; then
fi
echo "> Deploying contracts"
forge script -vvv scripts/Deploy.s.sol:Deploy --rpc-url "$DEPLOY_ETH_RPC_URL" --broadcast --private-key "$DEPLOY_PRIVATE_KEY" $verify_flag
forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --rpc-url "$DEPLOY_ETH_RPC_URL" --broadcast --private-key "$DEPLOY_PRIVATE_KEY" $verify_flag
if [ -n "${DEPLOY_GENERATE_HARDHAT_ARTIFACTS:-}" ]; then
echo "> Generating hardhat artifacts"
forge script -vvv scripts/Deploy.s.sol:Deploy --sig 'sync()' --rpc-url "$DEPLOY_ETH_RPC_URL" --broadcast --private-key "$DEPLOY_PRIVATE_KEY"
forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --sig 'sync()' --rpc-url "$DEPLOY_ETH_RPC_URL" --broadcast --private-key "$DEPLOY_PRIVATE_KEY"
fi
......@@ -7,7 +7,7 @@ import { AnchorStateRegistry, IAnchorStateRegistry } from "src/dispute/AnchorSta
import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { StdAssertions } from "forge-std/StdAssertions.sol";
import "src/dispute/lib/Types.sol";
import "scripts/Deploy.s.sol";
import "scripts/deploy/Deploy.s.sol";
/// @notice Deploys the Fault Proof Alpha Chad contracts.
contract FPACOPS is Deploy, StdAssertions {
......
......@@ -2,4 +2,4 @@
set -euo pipefail
echo "> Deploying contracts to generate state diff (non-broadcast)"
forge script -vvv scripts/Deploy.s.sol:Deploy --sig 'runWithStateDiff()'
forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --sig 'runWithStateDiff()'
......@@ -8,7 +8,7 @@ import {
GuardianConfig,
DeputyGuardianModuleConfig,
LivenessModuleConfig
} from "scripts/DeployOwnership.s.sol";
} from "scripts/deploy/DeployOwnership.s.sol";
import { Test } from "forge-std/Test.sol";
import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol";
......
......@@ -2,7 +2,7 @@
pragma solidity 0.8.15;
import { FFIInterface } from "test/setup/FFIInterface.sol";
import { Deploy } from "scripts/Deploy.s.sol";
import { Deploy } from "scripts/deploy/Deploy.s.sol";
import { Test } from "forge-std/Test.sol";
/// @title InvariantTest
......
......@@ -111,7 +111,7 @@ These are the instructions to add a new proof to this project. If all functions
#### Make Kontrol aware of the new contract being tested
The `runKontrolDeployment` function of [`KontrolDeployment`](./deployment/KontrolDeployment.sol) partially reproduces the deployment process laid out in the `_run` function of [`Deploy.s.sol`](../../scripts/Deploy.s.sol). `runKontrolDeployment` has the `stateDiff` modifier to make use of [Foundry's state diff cheatcodes](https://book.getfoundry.sh/cheatcodes/start-state-diff-recording). Kontrol utilizes the JSON resulting from this modifier for two purposes:
The `runKontrolDeployment` function of [`KontrolDeployment`](./deployment/KontrolDeployment.sol) partially reproduces the deployment process laid out in the `_run` function of [`Deploy.s.sol`](../../scripts/deploy/Deploy.s.sol). `runKontrolDeployment` has the `stateDiff` modifier to make use of [Foundry's state diff cheatcodes](https://book.getfoundry.sh/cheatcodes/start-state-diff-recording). Kontrol utilizes the JSON resulting from this modifier for two purposes:
1. Load all the state updates generated by `runKontrolDeployment` as the initial configuration for all proofs, effectively offloading the computation of the deployment process to `forge` and thus improving performance.
2. Produce the [`DeploymentSummary`](./proofs/utils/DeploymentSummary.sol) script contract to test that the produced JSON contains correct updates.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Deploy } from "scripts/Deploy.s.sol";
import { Deploy } from "scripts/deploy/Deploy.s.sol";
contract KontrolDeployment is Deploy {
function runKontrolDeployment() public stateDiff {
......
"""
Description:
Unescapes the JSON produced by the stateDiff modifier
defined in contracts-bedrock/scripts/Deploy.s.sol
defined in contracts-bedrock/scripts/deploy/Deploy.s.sol
This script is used in ../make-summary-deployment.sh
Usage:
......
......@@ -53,7 +53,7 @@ if [ ! -f "snapshots/state-diff/Deploy.json" ]; then
touch snapshots/state-diff/Deploy.json;
fi
DEPLOY_SCRIPT="./scripts/Deploy.s.sol"
DEPLOY_SCRIPT="./scripts/deploy/Deploy.s.sol"
conditionally_start_docker
# Create a backup
......
......@@ -6,7 +6,7 @@ import { Setup } from "test/setup/Setup.sol";
import { Events } from "test/setup/Events.sol";
import { FFIInterface } from "test/setup/FFIInterface.sol";
import { Constants } from "src/libraries/Constants.sol";
import "scripts/DeployConfig.s.sol";
import "scripts/deploy/DeployConfig.s.sol";
/// @title CommonTest
/// @dev An extenstion to `Test` that sets up the optimism smart contracts.
......
......@@ -24,9 +24,9 @@ import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
import { DeployConfig } from "scripts/DeployConfig.s.sol";
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Deploy } from "scripts/deploy/Deploy.s.sol";
import { Fork, LATEST_FORK } from "scripts/Config.sol";
import { Deploy } from "scripts/Deploy.s.sol";
import { L2Genesis, L1Dependencies } from "scripts/L2Genesis.s.sol";
import { OutputMode, Fork, ForkUtils } from "scripts/Config.sol";
import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
......
......@@ -13,7 +13,7 @@ import { ForgeArtifacts } from "scripts/ForgeArtifacts.sol";
import { Process } from "scripts/libraries/Process.sol";
import "src/L1/ProtocolVersions.sol";
import "src/dispute/lib/Types.sol";
import "scripts/Deployer.sol";
import "scripts/deploy/Deployer.sol";
/// @title Initializer_Test
/// @dev Ensures that the `initialize()` function on contracts cannot be called more than
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment