Use default values from checked in env files

This commit is contained in:
Prathamesh Musale 2023-04-10 18:36:04 +05:30
parent c471e8dca8
commit c9b2bd1fee
7 changed files with 34 additions and 14 deletions

View File

@ -7,6 +7,8 @@ services:
fixturenet-optimism-contracts:
hostname: fixturenet-optimism-contracts
image: cerc/optimism-contracts:local
env_file:
- ../config/fixturenet-optimism/l1-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
L1_CHAIN_ID: ${L1_CHAIN_ID}
@ -17,7 +19,7 @@ services:
L1_PRIV_KEY_2: ${L1_PRIV_KEY_2}
# Waits for L1 endpoint to be up before running the script
command: |
"./wait-for-it.sh -h ${L1_HOST} -p ${L1_PORT} -s -t 60 -- ./run.sh"
"./wait-for-it.sh -h ${L1_HOST:-$${DEFAULT-L1_HOST}} -p ${L1_PORT:-$${DEFAULT-L1_PORT}} -s -t 60 -- ./run.sh"
volumes:
- ../config/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh
- ../container-build/cerc-optimism-contracts/hardhat-tasks/verify-contract-deployment.ts:/app/packages/contracts-bedrock/tasks/verify-contract-deployment.ts
@ -37,6 +39,8 @@ services:
depends_on:
fixturenet-optimism-contracts:
condition: service_completed_successfully
env_file:
- ../config/fixturenet-optimism/l1-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
L1_RPC: ${L1_RPC}
@ -76,6 +80,8 @@ services:
depends_on:
op-geth:
condition: service_healthy
env_file:
- ../config/fixturenet-optimism/l1-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
L1_RPC: ${L1_RPC}
@ -103,6 +109,8 @@ services:
condition: service_healthy
op-geth:
condition: service_healthy
env_file:
- ../config/fixturenet-optimism/l1-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
L1_RPC: ${L1_RPC}
@ -113,7 +121,7 @@ services:
entrypoint: ["sh", "-c"]
# Waits for L1 endpoint to be up before running the batcher
command: |
"/wait-for-it.sh -h ${L1_HOST} -p ${L1_PORT} -s -t 60 -- /run-op-batcher.sh"
"/wait-for-it.sh -h ${L1_HOST:-$${DEFAULT-L1_HOST}} -p ${L1_PORT:-$${DEFAULT-L1_PORT}} -s -t 60 -- /run-op-batcher.sh"
extra_hosts:
- "host.docker.internal:host-gateway"

View File

@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
L1_RPC="${L1_RPC:-${DEFAULT_L1_RPC}}"
# Check existing config if it exists
if [ -f /app/jwt.txt ] && [ -f /app/rollup.json ]; then
echo "Found existing L2 config, cross-checking with L1 deployment config"

View File

@ -1,14 +1,14 @@
# Change if pointing to an external L1 endpoint
# Defaults
# L1 endpoint
L1_CHAIN_ID=1212
L1_RPC="http://fixturenet-eth-geth-1:8545"
L1_HOST="fixturenet-eth-geth-1"
L1_PORT=8545
DEFAULT_L1_CHAIN_ID=1212
DEFAULT_L1_RPC="http://fixturenet-eth-geth-1:8545"
DEFAULT_L1_HOST="fixturenet-eth-geth-1"
DEFAULT_L1_PORT=8545
# Credentials for accounts on L1 to send balance to Optimism Proxy contract from
# (enables them to do transactions on L2)
L1_ADDRESS=
L1_PRIV_KEY=
L1_ADDRESS_2=
L1_PRIV_KEY_2=
DEFAULT_L1_ADDRESS=
DEFAULT_L1_PRIV_KEY=
DEFAULT_L1_ADDRESS_2=
DEFAULT_L1_PRIV_KEY_2=

View File

@ -4,6 +4,14 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
L1_CHAIN_ID="${L1_CHAIN_ID:-${DEFAULT_L1_CHAIN_ID}}"
L1_RPC="${L1_RPC:-${DEFAULT_L1_RPC}}"
L1_ADDRESS="${L1_ADDRESS:-${DEFAULT_L1_ADDRESS}}"
L1_PRIV_KEY="${L1_PRIV_KEY:-${DEFAULT_L1_PRIV_KEY}}"
L1_ADDRESS_2="${L1_ADDRESS_2:-${DEFAULT_L1_ADDRESS_2}}"
L1_PRIV_KEY_2="${L1_PRIV_KEY_2:-${DEFAULT_L1_PRIV_KEY_2}}"
echo "Using L1 RPC endpoint ${L1_RPC}"
IMPORT_1="import './verify-contract-deployment'"

View File

@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
L1_RPC="${L1_RPC:-${DEFAULT_L1_RPC}}"
# Get BACTHER_KEY from keys.json
BATCHER_KEY=$(jq -r '.Batcher.privateKey' /l2-accounts/keys.json | tr -d '"')

View File

@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
L1_RPC="${L1_RPC:-${DEFAULT_L1_RPC}}"
# Get SEQUENCER KEY from keys.json
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')

View File

@ -39,12 +39,10 @@ This should create the required docker images in the local image registry:
## Deploy
Create an env file to be used in the next step with contents from [l1-params.env](../../config/fixturenet-optimism/l1-params.env)
Deploy the stack:
```bash
laconic-so --stack fixturenet-optimism deploy --env-file <PATH_TO_ENV_FILE> up
laconic-so --stack fixturenet-optimism deploy up
```
The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to complete running as it: