Skip to content

Commit 8a77145

Browse files
committed
init: update script using op-deployer
1 parent 508c1d3 commit 8a77145

9 files changed

Lines changed: 50 additions & 293 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ reqenv "L1_RPC_URL"
1212
reqenv "L1_CHAIN_ID"
1313
reqenv "L2_CHAIN_ID"
1414

15-
echo "[1/5] : init environment variables"
15+
echo "[1/3] : init environment variables"
1616

1717
export IMPL_SALT=$(openssl rand -hex 32)
1818
export DEPLOYMENT_CONTEXT=$L2_CHAIN_ID

init/2_faucet.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eu
55
FAUCET_PRIVATE_KEY="$FAUCET_PRIVATE_KEY"
66
FAUCET_ADDRESS="$FAUCET_ADDRESS"
77

8-
echo "[2/5] : faucet eth to environment accounts"
8+
echo "[2/3] : faucet eth to environment accounts"
99
send_eth() {
1010
receiver_address="$1"
1111
amount_to_eth="$2"

init/3_config.jsonnet

Lines changed: 0 additions & 179 deletions
This file was deleted.

init/3_deploy.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
echo "[3/3] : generate config"
5+
6+
cd ~/optimism/op-deployer/bin
7+
8+
./op-deployer init --l1-chain-id $L1_CHAIN_ID --l2-chain-ids $L2_CHAIN_ID --workdir .op-deployer
9+
10+
sed -i \
11+
-e "s/baseFeeVaultRecipient = \".*\"/baseFeeVaultRecipient = \"$ADMIN_ADDRESS\"/" \
12+
-e "s/l1FeeVaultRecipient = \".*\"/l1FeeVaultRecipient = \"$ADMIN_ADDRESS\"/" \
13+
-e "s/sequencerFeeVaultRecipient = \".*\"/sequencerFeeVaultRecipient = \"$ADMIN_ADDRESS\"/" \
14+
-e "s/l2ProxyAdminOwner = \".*\"/l2ProxyAdminOwner = \"$ADMIN_ADDRESS\"/" \
15+
-e "s/systemConfigOwner = \".*\"/systemConfigOwner = \"$ADMIN_ADDRESS\"/" \
16+
-e "s/unsafeBlockSigner = \".*\"/unsafeBlockSigner = \"$ADMIN_ADDRESS\"/" \
17+
-e "s/batcher = \".*\"/batcher = \"$BATCHER_ADDRESS\"/" \
18+
-e "s/proposer = \".*\"/proposer = \"$PROPOSER_ADDRESS\"/" \
19+
.op-deployer/intent.toml
20+
21+
cp .op-deployer/intent.toml /config/intent.toml
22+
cp .op-deployer/state.json /config/state.json
23+
24+
./op-deployer apply --workdir .op-deployer --l1-rpc-url $L1_RPC_URL --private-key $ADMIN_PRIVATE_KEY
25+
./op-deployer inspect genesis --workdir .op-deployer $L2_CHAIN_ID > .op-deployer/genesis.json
26+
./op-deployer inspect rollup --workdir .op-deployer $L2_CHAIN_ID > .op-deployer/rollup.json
27+
28+
cp .op-deployer/genesis.json /config/genesis.json
29+
cp .op-deployer/rollup.json /config/rollup.json
30+
31+
32+
echo "[all process is done! check config files.]"

init/3_generate_config.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

init/4_deploy_contract.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

init/5_export_genesis.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

init/Dockerfile

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,32 @@ FROM debian
33
WORKDIR /app
44

55
# init system dependencies
6-
RUN apt-get -y update && apt-get install -y sudo jq wget curl gnupg git make bc ca-certificates jsonnet build-essential && \
6+
RUN apt-get -y update && apt-get install -y sudo jq wget curl gnupg git make bc ca-certificates build-essential && \
77
sudo rm -rf /var/lib/apt/lists
88

9-
# clone optimism repository
9+
ENV PATH="/root/.local/bin:/root/.local/share/mise/shims:/root/.local/share/mise/bin:$PATH"
10+
ENV MISE_DATA_DIR="/root/.local/share/mise"
11+
ENV MISE_DIR="/root/.mise"
1012
ENV OP_REPO=https://github.com/ethereum-optimism/optimism.git
1113
ENV OP_VERSION=${OP_VERSION:-v1.12.2}
14+
15+
# clone optimism repository
1216
RUN mkdir -p ~/optimism && cd ~/optimism && \
1317
git clone $OP_REPO --depth 1 --branch $OP_VERSION --single-branch . && \
14-
git switch -c $OP_VERSION
15-
16-
# install dependencies
17-
ENV PATH="/root/.local/bin:/root/.local/share/mise/shims:/root/.local/share/mise/bin:$PATH"
18-
ENV MISE_DATA_DIR="/root/.local/share/mise"
19-
ENV MISE_DIR="/root/.mise"
18+
git switch -c $OP_VERSION
2019

21-
RUN curl https://mise.run | sh && \
22-
cd ~/optimism && mise trust mise.toml && mise use -g foundry@1.0.0 && mise install
20+
# install op-deployer
21+
RUN cd ~/optimism && curl https://mise.run | sh && \
22+
mise trust mise.toml && mise use -g foundry@1.0.0 && mise install && \
23+
git submodule update --init --recursive --depth 1
2324

24-
# install op-node
25-
RUN cd ~/optimism && git submodule update --init --recursive --depth 1 && \
26-
go mod download && go mod tidy && \
27-
make -C op-node VERSION=$OP_VERSION op-node
25+
RUN cd ~/optimism/op-deployer && just build
2826

2927
COPY *.sh /script/
3028
RUN chmod +x /script/*.sh
3129

3230
ENTRYPOINT ["/bin/bash", "-c", \
3331
"chmod +x /script/*.sh && \
34-
source /script/1_init_environment.sh && \
32+
source /script/1_init.sh && \
3533
/script/2_faucet.sh && \
36-
/script/3_generate_config.sh && \
37-
/script/4_deploy_contract.sh && \
38-
/script/5_export_genesis.sh"]
34+
/script/3_deploy.sh"]

init/docker-compose.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ services:
66
pull_policy: always
77
volumes:
88
- ${CONFIG_DIR}:/config
9-
- ./1_init_environment.sh:/script/1_init_environment.sh
9+
- ./1_init.sh:/script/1_init.sh
1010
- ./2_faucet.sh:/script/2_faucet.sh
1111
- ./3_config.jsonnet:/script/3_config.jsonnet
12-
- ./3_generate_config.sh:/script/3_generate_config.sh
13-
- ./4_deploy_contract.sh:/script/4_deploy_contract.sh
14-
- ./5_export_genesis.sh:/script/5_export_genesis.sh
12+
- ./3_deploy.sh:/script/3_deploy.sh
1513
env_file:
1614
- ../common.env
1715
- ../envs/${CHAIN_ENV_FILE}

0 commit comments

Comments
 (0)