Author SHA1 Message Date
roysc f4dec3520f Add op-node --log.level 2024-09-06 20:01:17 +08:00
roysc 96d05aee9c Enable granite 2024-09-06 20:01:17 +08:00
roysc c91620421d Configure rpc kind from env 2024-09-06 20:01:15 +08:00
roysc defe41869f Update readme 2024-09-06 20:00:14 +08:00
roysc 14642b1174 Config L1, L2 block time, set poll intervals 2024-09-06 20:00:12 +08:00
roysc e9131dc98f Fix docs 2024-09-06 19:59:14 +08:00
roysc 114963d57c Script clean up 2024-09-06 19:59:12 +08:00
roysc 189ae577c4 Exec services in containers
allows forwarding of signals
2024-09-06 19:58:08 +08:00
roysc 846655837f op-geth needs state.scheme=hash for archive 2024-09-06 19:58:08 +08:00
roysc 5ac0518c27 Fix L2 alloc state dump
runWithStateDump instead of runWithAllUpgrades
2024-09-06 19:58:08 +08:00
roysc 2939d549cd Use optimism contracts image 2024-09-06 19:58:08 +08:00
roysc 44ed6708d0 Optimism script update 2024-09-06 19:58:08 +08:00
roysc 2ba7045792 Add missing packages to images
op-plasma => op-alt-da
2024-09-06 19:58:08 +08:00
prathameshandAdw8 ab0e42a54b Add extra_hosts for l2 config generation service (#5)
Part of [Create bridge channel in go-nitro](https://www.notion.so/Create-bridge-channel-in-go-nitro-22ce80a0d8ae4edb80020a8f250ea270)

Co-authored-by: Adw8 <adwaitgharpure@gmail.com>
Reviewed-on: cerc-io/fixturenet-optimism-stack#5
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-04 14:04:26 +00:00
prathameshandAdw8 c5f97dda13 Add configuration for L1 beacon endpoint and funding amounts for Optimism accounts (#4)
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

Co-authored-by: Adw8 <adwaitgharpure@gmail.com>
Reviewed-on: cerc-io/fixturenet-optimism-stack#4
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-03 09:42:08 +00:00
prathameshandAdwait Gharpure 9ca108e877 Upgrade Optimism to latest release (#3)
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

- Updated Dockerfiles
- Added a separate service to generate L2 config files
  - Updated service dependency for `op-geth` and `op-node`
- Passed lighthouse beacon API endpoint to the `op-node` command
- Updated path for artifact generated by L1 contracts deployment

Co-authored-by: Adwait Gharpure <69599306+Adw8@users.noreply.github.com>
Reviewed-on: cerc-io/fixturenet-optimism-stack#3
2024-07-18 15:02:52 +00:00
nabarun 89b2a7d82c Upgrade foundry version for compatibility with geth v1.14 (#2)
Part of [Update Optimism stack to use Bedrock release](https://www.notion.so/Update-Optimism-stack-to-use-Bedrock-release-e44a490247724a6095a9fbc19fba3bcd)

- Upgrade foundry version after geth version was upgraded in `fixturenet-eth-stacks`
  - cerc-io/fixturenet-eth-stacks#7

Reviewed-on: cerc-io/fixturenet-optimism-stack#2
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2024-07-09 08:36:33 +00:00
prathamesh 002d334b98 Port over optimism stack and update to use latest releases (#1)
Part of [Update Optimism stack to use Bedrock release](https://www.notion.so/Update-Optimism-stack-to-use-Bedrock-release-e44a490247724a6095a9fbc19fba3bcd)
Requires [Add an option to allow unprotected txs in geth](cerc-io/fixturenet-eth-stacks#8)

- Port over existing `fixturenet-optimism` stack components from SO
- Use external [fixturenet-eth](https://git.vdb.to/cerc-io/fixturenet-eth-stacks/src/branch/main/stack-orchestrator/stacks/fixturenet-eth) stack for L1
- Use latest Optimism releases ([optimism@v1.7.4](https://github.com/ethereum-optimism/optimism/releases/tag/v1.7.4) and [op-geth@v1.101311.0](https://github.com/ethereum-optimism/op-geth/releases/tag/v1.101311.0))
- Update Optimism L1 contracts deployment script
- Update L2 genesis generation
- Remove override on L1 script to allow unprotected txs and unlock an account
  - `fixturenet-eth` stack itself now has an option to allow unprotected txs; the raw tx bytes for create2 proxy contract deployment from Optimism docs is not `EIP155` compatible
  - Use pk of funded account for txs instead of unlocking it
- Add updated instructions
- Use upstream [foundry](https://github.com/foundry-rs/foundry/pkgs/container/foundry/209507574?tag=nightly-267e14fab654d9ce955dce64c0eb09f01c8538ee) as base image for `cerc/optimism-contracts` container
  - Support for arm64/Apple Silicon to be handled in a follow-on PR

Reviewed-on: cerc-io/fixturenet-optimism-stack#1
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-05-07 04:18:02 +00:00
18 changed files with 194 additions and 105 deletions
+38 -9
View File
@@ -1,5 +1,3 @@
version: '3.7'
services:
# Generates and funds the accounts required when setting up the L2 chain (outputs to volume l2_accounts)
# Creates / updates the configuration for L1 contracts deployment
@@ -10,6 +8,7 @@ services:
hostname: fixturenet-optimism-contracts
env_file:
- ../config/fixturenet-optimism/l1-params.env
- ../config/fixturenet-optimism/l2-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_L1_CHAIN_ID: ${CERC_L1_CHAIN_ID}
@@ -17,15 +16,41 @@ services:
CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL}
CERC_L1_ADDRESS: ${CERC_L1_ADDRESS}
CERC_L1_PRIV_KEY: ${CERC_L1_PRIV_KEY}
CERC_L1_BLOCK_TIME: ${CERC_L1_BLOCK_TIME}
CERC_L2_BLOCK_TIME: ${CERC_L2_BLOCK_TIME}
CERC_PROPOSER_AMOUNT: ${CERC_PROPOSER_AMOUNT}
CERC_BATCHER_AMOUNT: ${CERC_BATCHER_AMOUNT}
volumes:
- ../config/network/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh
- ../config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh:/app/packages/contracts-bedrock/deploy-contracts.sh
- ../config/network/wait-for-it.sh:/wait-for-it.sh
- ../config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh:/deploy-contracts.sh
- l2_accounts:/l2-accounts
- l1_deployment:/l1-deployment
- l2_config:/l2-config
entrypoint: ["sh", "-c"]
# Waits for L1 endpoint to be up before running the contract deploy script
command: |
"./wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- ./deploy-contracts.sh"
"/wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- /deploy-contracts.sh"
extra_hosts:
- "host.docker.internal:host-gateway"
l2-config-generation:
restart: on-failure
image: cerc/optimism-op-node:local
depends_on:
fixturenet-optimism-contracts:
condition: service_completed_successfully
env_file:
- ../config/fixturenet-optimism/l1-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_L1_CHAIN_ID: ${CERC_L1_CHAIN_ID}
CERC_L1_RPC: ${CERC_L1_RPC}
volumes:
- ../config/fixturenet-optimism/generate-l2-config.sh:/generate-l2-config.sh
- l1_deployment:/l1-deployment:ro
- l2_config:/l2-config
entrypoint: "bash"
command: "/generate-l2-config.sh"
extra_hosts:
- "host.docker.internal:host-gateway"
@@ -35,8 +60,8 @@ services:
image: cerc/optimism-l2geth:local
hostname: op-geth
depends_on:
op-node:
condition: service_started
l2-config-generation:
condition: service_completed_successfully
volumes:
- ../config/fixturenet-optimism/run-op-geth.sh:/run-op-geth.sh
- l2_config:/l2-config:ro
@@ -63,13 +88,16 @@ services:
image: cerc/optimism-op-node:local
hostname: op-node
depends_on:
fixturenet-optimism-contracts:
condition: service_completed_successfully
op-geth:
condition: service_healthy
env_file:
- ../config/fixturenet-optimism/l1-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_L1_RPC: ${CERC_L1_RPC}
CERC_L1_RPC_KIND: ${CERC_L1_RPC_KIND}
CERC_L1_BLOCK_TIME: ${CERC_L1_BLOCK_TIME}
CERC_L1_BEACON: ${CERC_L1_BEACON}
volumes:
- ../config/fixturenet-optimism/run-op-node.sh:/run-op-node.sh
- l1_deployment:/l1-deployment:ro
@@ -132,6 +160,7 @@ services:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_L1_RPC: ${CERC_L1_RPC}
CERC_L1_CHAIN_ID: ${CERC_L1_CHAIN_ID}
CERC_L1_BLOCK_TIME: ${CERC_L1_BLOCK_TIME}
volumes:
- ../config/network/wait-for-it.sh:/wait-for-it.sh
- ../config/fixturenet-optimism/run-op-proposer.sh:/run-op-proposer.sh
@@ -0,0 +1,43 @@
#!/bin/bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
deploy_config_file="/l2-config/$DEPLOYMENT_CONTEXT.json"
l1_deployment_file="/l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json"
l2_allocs_file="/l2-config/allocs-l2.json"
genesis_outfile="/l2-config/genesis.json"
rollup_outfile="/l2-config/rollup.json"
jwt_file="/l2-config/l2-jwt.txt"
# Create a JWT secret at shared path if not found
if [ ! -f "$jwt_file" ]; then
openssl rand -hex 32 > $jwt_file
echo "Generated JWT secret at $jwt_file"
fi
# Check if genesis.json and rollup.json already exist
if [ -f "$genesis_outfile" ] && [ -f "$rollup_outfile" ]; then
echo "Skipping generation, files already exist: $genesis_outfile, $rollup_outfile"
exit 0
fi
# If files don't exist, proceed with generation
echo "Generating l2 config files..."
op-node genesis l2 \
--deploy-config "$deploy_config_file" \
--l1-deployments "$l1_deployment_file" \
--l2-allocs "$l2_allocs_file" \
--outfile.l2 "$genesis_outfile" \
--outfile.rollup "$rollup_outfile" \
--l1-rpc "$CERC_L1_RPC"
echo "Generated the l2 config files successfully"
echo "Exiting"
+9
View File
@@ -6,7 +6,16 @@ DEFAULT_CERC_L1_RPC="http://fixturenet-eth-geth-1:8545"
DEFAULT_CERC_L1_HOST="fixturenet-eth-geth-1"
DEFAULT_CERC_L1_PORT=8545
# Default block time matches L1 fixturenet config.
DEFAULT_CERC_L1_BLOCK_TIME=3
# This can optionally be set to a preset for common node providers like Infura, Alchemy, etc.
# Or, set to "any" to try all available methods.
DEFAULT_CERC_L1_RPC_KIND=standard
# URL to get CSV with credentials for accounts on L1
# that are used to send balance to Optimism Proxy contract
# (enables them to do transactions on L2)
DEFAULT_CERC_L1_ACCOUNTS_CSV_URL="http://fixturenet-eth-bootnode-geth:9898/accounts.csv"
DEFAULT_CERC_PROPOSER_AMOUNT="0.2ether"
DEFAULT_CERC_BATCHER_AMOUNT="0.1ether"
DEFAULT_CERC_L1_BEACON=http://fixturenet-eth-lighthouse-1:8001
+2
View File
@@ -0,0 +1,2 @@
# Default L2 block time. Must be <= L1 block time.
DEFAULT_CERC_L2_BLOCK_TIME=1
@@ -9,6 +9,9 @@ CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
CERC_L1_ACCOUNTS_CSV_URL="${CERC_L1_ACCOUNTS_CSV_URL:-${DEFAULT_CERC_L1_ACCOUNTS_CSV_URL}}"
CERC_PROPOSER_AMOUNT="${CERC_PROPOSER_AMOUNT:-${DEFAULT_CERC_PROPOSER_AMOUNT}}"
CERC_BATCHER_AMOUNT="${CERC_BATCHER_AMOUNT:-${DEFAULT_CERC_BATCHER_AMOUNT}}"
export DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
# Optional create2 salt for deterministic deployment of contract implementations
export IMPL_SALT=$(openssl rand -hex 32)
@@ -16,10 +19,10 @@ export IMPL_SALT=$(openssl rand -hex 32)
echo "Using L1 RPC endpoint ${CERC_L1_RPC}"
# Exit if a deployment already exists (on restarts)
if [ -d "/l1-deployment/$DEPLOYMENT_CONTEXT" ]; then
echo "Deployment directory /l1-deployment/$DEPLOYMENT_CONTEXT, checking OptimismPortal deployment"
if [ -f "/l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json" ]; then
echo "Deployment directory /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json, checking OptimismPortal deployment"
OPTIMISM_PORTAL_ADDRESS=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/.deploy | jq -r .OptimismPortal)
OPTIMISM_PORTAL_ADDRESS=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json | jq -r .OptimismPortal)
contract_code=$(cast code $OPTIMISM_PORTAL_ADDRESS --rpc-url $CERC_L1_RPC)
if [ -z "${contract_code#0x}" ]; then
@@ -68,9 +71,8 @@ if [ -n "$CERC_L1_ADDRESS" ] && [ -n "$CERC_L1_PRIV_KEY" ]; then
echo "Funding accounts."
wait_for_block 1 300
cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value 5ether $PROPOSER --private-key $ADMIN_KEY
cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value 10ether $BATCHER --private-key $ADMIN_KEY
cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value 2ether $SEQ --private-key $ADMIN_KEY
cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value $CERC_PROPOSER_AMOUNT $PROPOSER --private-key $ADMIN_KEY
cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value $CERC_BATCHER_AMOUNT $BATCHER --private-key $ADMIN_KEY
else
curl -o accounts.csv $CERC_L1_ACCOUNTS_CSV_URL
# Admin
@@ -117,7 +119,17 @@ if [ -z "$finalized" ]; then
fi
# Generate the deploy-config/getting-started.json file
GS_ADMIN_ADDRESS=$ADMIN GS_BATCHER_ADDRESS=$BATCHER GS_PROPOSER_ADDRESS=$PROPOSER GS_SEQUENCER_ADDRESS=$SEQ L1_RPC_URL=$CERC_L1_RPC $config_build_script
GS_ADMIN_ADDRESS=$ADMIN \
GS_BATCHER_ADDRESS=$BATCHER \
GS_PROPOSER_ADDRESS=$PROPOSER \
GS_SEQUENCER_ADDRESS=$SEQ \
L1_RPC_URL=$CERC_L1_RPC \
L1_CHAIN_ID=$CERC_L1_CHAIN_ID \
L2_CHAIN_ID=42069 \
L1_BLOCK_TIME=${CERC_L1_BLOCK_TIME:-$DEFAULT_CERC_L1_BLOCK_TIME} \
L2_BLOCK_TIME=${CERC_L2_BLOCK_TIME:-$DEFAULT_CERC_L2_BLOCK_TIME} \
GRANITE_TIME_OFFSET=None \
$config_build_script
echo "Writing deployment config."
deploy_config_file="deploy-config/$DEPLOYMENT_CONTEXT.json"
@@ -127,7 +139,6 @@ cp deploy-config/getting-started.json $deploy_config_file
# 1. Update L1 chain id
# 2. Add missing faultGameWithdrawalDelay field
# (see issue: https://github.com/ethereum-optimism/optimism/issues/9773#issuecomment-2080224969)
echo "$(jq ". += {"l1ChainID": $DEPLOYMENT_CONTEXT, "faultGameWithdrawalDelay": 604800}" $deploy_config_file)" > $deploy_config_file
mkdir -p deployments/$DEPLOYMENT_CONTEXT
@@ -147,24 +158,25 @@ if [ "$create2CodeSize" -eq 0 ]; then
fi
# Create the L2 deployment
# Writes out artifact to /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT/.deploy
# Writes out artifact to $OPTIMISM_ROOT/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT-deploy.json
echo "Deploying L1 Optimism contracts..."
forge script scripts/Deploy.s.sol:Deploy --private-key $ADMIN_KEY --broadcast --rpc-url $CERC_L1_RPC
DEPLOY_CONFIG_PATH=$deploy_config_file forge script scripts/deploy/Deploy.s.sol:Deploy --private-key $ADMIN_KEY --broadcast --rpc-url $CERC_L1_RPC
echo "Done deploying contracts."
echo "Generating L2 genesis allocs..."
L2_CHAIN_ID=$(jq ".l2ChainID" $deploy_config_file)
CONTRACT_ADDRESSES_PATH=deployments/$DEPLOYMENT_CONTEXT/.deploy forge script --chain-id $L2_CHAIN_ID scripts/L2Genesis.s.sol:L2Genesis --sig 'runWithAllUpgrades()' --private-key $ADMIN_KEY
echo "{ \"accounts\": $(jq '.' /app/packages/contracts-bedrock/state-dump-$L2_CHAIN_ID.json) }" > allocs-l2.json
echo "Done."
DEPLOY_CONFIG_PATH=$deploy_config_file \
CONTRACT_ADDRESSES_PATH=deployments/$DEPLOYMENT_CONTEXT-deploy.json \
STATE_DUMP_PATH=allocs-l2.json \
forge script --chain-id $L2_CHAIN_ID scripts/L2Genesis.s.sol:L2Genesis --sig 'runWithStateDump()' --private-key $ADMIN_KEY
echo "Done."
echo "*************************************"
# Copy files needed by other containers to the appropriate shared volumes
echo "Copying deployment artifacts volume l1_deployment and deploy-config to volume l2_config"
cp -a /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT /l1-deployment
cp /app/packages/contracts-bedrock/deploy-config/$DEPLOYMENT_CONTEXT.json /l2-config
cp /opt/optimism/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT-deploy.json /l1-deployment
cp /opt/optimism/packages/contracts-bedrock/deploy-config/$DEPLOYMENT_CONTEXT.json /l2-config
cp allocs-l2.json /l2-config
openssl rand -hex 32 > /l2-config/l2-jwt.txt
echo "Deployment successful. Exiting"
echo "Deployment successful, exiting."
+1 -1
View File
@@ -11,7 +11,7 @@ L2_RPC="http://op-geth:8545"
ROLLUP_RPC="http://op-node:8547"
BATCHER_KEY=$(cat /l2-accounts/accounts.json | jq -r .BatcherKey)
op-batcher \
exec op-batcher \
--l2-eth-rpc=$L2_RPC \
--rollup-rpc=$ROLLUP_RPC \
--poll-interval=1s \
+3 -2
View File
@@ -26,13 +26,13 @@ fi
# Initialize geth from our generated L2 genesis file (if not already initialized)
data_dir="/datadir"
if [ ! -d "$datadir/geth" ]; then
geth init --datadir=$data_dir $l2_genesis_file
geth init --datadir=$data_dir --state.scheme=hash $l2_genesis_file
fi
# Start op-geth
jwt_file="/l2-config/l2-jwt.txt"
geth \
exec geth \
--datadir=$data_dir \
--http \
--http.corsdomain="*" \
@@ -45,6 +45,7 @@ geth \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net,engine \
--syncmode=full \
--state.scheme=hash \
--gcmode=archive \
--nodiscover \
--maxpeers=0 \
+17 -24
View File
@@ -4,44 +4,37 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
CERC_L1_RPC_KIND="${CERC_L1_RPC_KIND:-${DEFAULT_CERC_L1_RPC_KIND}}"
CERC_L1_BLOCK_TIME="${CERC_L1_BLOCK_TIME:-$DEFAULT_CERC_L1_BLOCK_TIME}"
CERC_L1_BEACON="${CERC_L1_BEACON:-${DEFAULT_CERC_L1_BEACON}}"
deploy_config_file="/l2-config/$DEPLOYMENT_CONTEXT.json"
l1_deployment_file="/l1-deployment/$DEPLOYMENT_CONTEXT/.deploy"
l2_allocs_file="/l2-config/allocs-l2.json"
genesis_outfile="/l2-config/genesis.json"
rollup_outfile="/l2-config/rollup.json"
# Generate L2 genesis (if not already done)
if [ ! -f "$genesis_outfile" ] || [ ! -f "$rollup_outfile" ]; then
op-node genesis l2 \
--deploy-config $deploy_config_file \
--l1-deployments $l1_deployment_file \
--l2-allocs $l2_allocs_file \
--outfile.l2 $genesis_outfile \
--outfile.rollup $rollup_outfile \
--l1-rpc $CERC_L1_RPC
log_level=INFO
if [ -n "$CERC_LOG_LEVEL" ]; then
log_level="$CERC_LOG_LEVEL"
fi
# Start op-node
SEQ_KEY=$(cat /l2-accounts/accounts.json | jq -r .SeqKey)
rollup_config=/l2-config/rollup.json
seq_key=$(cat /l2-accounts/accounts.json | jq -r .SeqKey)
jwt_file=/l2-config/l2-jwt.txt
L2_AUTH="http://op-geth:8551"
RPC_KIND=any # this can optionally be set to a preset for common node providers like Infura, Alchemy, etc.
l2_auth="http://op-geth:8551"
op-node \
--l2=$L2_AUTH \
exec op-node \
--l2=$l2_auth \
--l2.jwt-secret=$jwt_file \
--sequencer.enabled \
--sequencer.l1-confs=5 \
--verifier.l1-confs=4 \
--rollup.config=$rollup_outfile \
--rollup.config=$rollup_config \
--rpc.addr=0.0.0.0 \
--rpc.port=8547 \
--p2p.disable \
--rpc.enable-admin \
--p2p.sequencer.key="${SEQ_KEY#0x}" \
--l1=$CERC_L1_RPC \
--l1.rpckind=$RPC_KIND
--l1.rpckind=$CERC_L1_RPC_KIND \
--l1.beacon=$CERC_L1_BEACON \
--l1.http-poll-interval="${CERC_L1_BLOCK_TIME}s" \
--l1.epoch-poll-interval="$((CERC_L1_BLOCK_TIME * 32))s" \
--log.level="$log_level"
@@ -6,15 +6,16 @@ fi
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
CERC_L1_BLOCK_TIME="${CERC_L1_BLOCK_TIME:-${DEFAULT_CERC_L1_BLOCK_TIME}}"
DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
# Start op-proposer
ROLLUP_RPC="http://op-node:8547"
PROPOSER_KEY=$(cat /l2-accounts/accounts.json | jq -r .ProposerKey)
L2OO_ADDR=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/.deploy | jq -r .L2OutputOracleProxy)
L2OO_ADDR=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json | jq -r .L2OutputOracleProxy)
op-proposer \
--poll-interval=12s \
exec op-proposer \
--poll-interval="${CERC_L1_BLOCK_TIME}s" \
--rpc.port=8560 \
--rollup-rpc=$ROLLUP_RPC \
--l2oo-address="${L2OO_ADDR#0x}" \
-4
View File
@@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Build a local version of the foundry-rs/foundry image
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
docker build -t cerc/foundry:local -f ${CERC_REPO_BASE_DIR}/foundry/Dockerfile-debian ${build_command_args} ${CERC_REPO_BASE_DIR}/foundry
@@ -1,25 +0,0 @@
# TODO: Make work for arm64/Apple Silicon
# FROM ghcr.io/foundry-rs/foundry:nightly-267e14fab654d9ce955dce64c0eb09f01c8538ee
FROM cerc/foundry:local
# Install node (local foundry is a debian based image)
RUN apt-get update \
&& apt-get install -y curl wget \
&& curl --silent --location https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get update \
&& apt-get install -y nodejs git busybox jq \
&& node -v
# Add corepack for yarn and pnpm
RUN corepack enable \
&& yarn --version
WORKDIR /app
# Copy optimism repo contents
COPY . .
RUN echo "Building optimism" && \
pnpm install && pnpm build
WORKDIR /app/packages/contracts-bedrock
@@ -6,4 +6,10 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
docker build -t cerc/optimism-contracts:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/optimism
# The optimism contracts image has dependencies with no aarch64 support, so on aarch64 use an
# emulated amd64 image
if [[ $(docker info --format='{{ .Architecture }}') == "aarch64" ]]; then
PLATFORM_ARG="--platform linux/amd64"
fi
docker build -t cerc/optimism-contracts:local -f ${CERC_REPO_BASE_DIR}/optimism/ops/docker/Dockerfile.packages ${build_command_args} ${CERC_REPO_BASE_DIR}/optimism $PLATFORM_ARG
@@ -6,10 +6,9 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
# build op-batcher with the shared go.mod & go.sum files
COPY ./op-batcher /app/op-batcher
COPY ./op-bindings /app/op-bindings
COPY ./op-node /app/op-node
COPY ./op-service /app/op-service
COPY ./op-plasma /app/op-plasma
COPY ./op-alt-da /app/op-alt-da
COPY ./go.mod /app/go.mod
COPY ./go.sum /app/go.sum
@@ -8,9 +8,9 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
COPY ./op-node /app/op-node
COPY ./op-chain-ops /app/op-chain-ops
COPY ./op-service /app/op-service
COPY ./op-bindings /app/op-bindings
COPY ./op-plasma /app/op-plasma
COPY ./op-alt-da /app/op-alt-da
COPY ./op-conductor /app/op-conductor
COPY ./packages /app/packages
COPY ./go.mod /app/go.mod
COPY ./go.sum /app/go.sum
COPY ./.git /app/.git
@@ -6,10 +6,10 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
# build op-proposer with the shared go.mod & go.sum files
COPY ./op-proposer /app/op-proposer
COPY ./op-bindings /app/op-bindings
COPY ./op-node /app/op-node
COPY ./op-service /app/op-service
COPY ./op-plasma /app/op-plasma
COPY ./op-alt-da /app/op-alt-da
COPY ./packages /app/packages
COPY ./go.mod /app/go.mod
COPY ./go.sum /app/go.sum
COPY ./.git /app/.git
+24 -9
View File
@@ -68,7 +68,7 @@ laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism de
### Ports
It is usually necessary to expose certain container ports on one or more the host's addresses to allow incoming connections.
It is usually necessary to expose certain container ports on one or more of the host's addresses to allow incoming connections.
Any ports defined in the Docker compose file are exposed by default with random port assignments, bound to "any" interface (IP address 0.0.0.0), but the port mappings can be customized by editing the "spec" file generated by `laconic-so deploy init`.
In addition, a stack-wide port mapping "recipe" can be applied at the time the
@@ -112,6 +112,15 @@ Inside the `fixturenet-eth-deployment` deployment directory, open `config.env` f
CERC_ALLOW_UNPROTECTED_TXS=true
```
Inside the `fixturenet-optimism-deployment` deployment directory, open `config.env` file and set following env variables:
```bash
# Optional
# Funding amounts for proposer and batcher accounts on L1
CERC_PROPOSER_AMOUNT= # Default 0.2ether
CERC_BATCHER_AMOUNT= # Default 0.1ether
```
## Start the stack
Start the deployment:
@@ -145,7 +154,7 @@ docker logs -f <CONTAINER_ID>
Send some ETH from the desired account to the `L1StandardBridgeProxy` contract on L1 to test bridging to L2.
We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` which is pre-funded and unlocked, and the `cerc/foundry:local` container to make use of the `cast` cli.
We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` which is pre-funded and unlocked, and the `cerc/optimism-contracts:local` container to make use of the `cast` cli.
1. Note the docker network the stack is running on:
@@ -164,16 +173,22 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
ACCOUNT=0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F
```
You can create an alias for running `cast` on the network:
```bash
alias op-cast="docker run --rm --network $NETWORK --entrypoint cast cerc/optimism-contracts:local"
```
If you need to check the L1 chain-id, you can use:
```bash
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast chain-id --rpc-url $L1_RPC"
op-cast chain-id --rpc-url $L1_RPC
```
3. Check the account starting balance on L2 (it should be 0):
```bash
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC"
op-cast balance $ACCOUNT --rpc-url $L2_RPC
# 0
```
@@ -182,8 +197,8 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
```bash
# get the container id for op-node
NODE_CONTAINER=$(docker ps --filter "name=op-node" -q)
BRIDGE=$(docker exec $NODE_CONTAINER cat /l1-deployment/$DEPLOYMENT_CONTEXT/.deploy | jq -r .L1StandardBridgeProxy)
# get the bridge contract address
BRIDGE=$(docker exec $NODE_CONTAINER cat /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json | jq -r .L1StandardBridgeProxy)
# get the funded account's pk
ACCOUNT_PK=$(docker exec $NODE_CONTAINER jq -r '.AdminKey' /l2-accounts/accounts.json)
```
@@ -191,15 +206,15 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
5. Use cast to send some ETH to the bridge contract:
```bash
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast send --from $ACCOUNT --value 1ether $BRIDGE --rpc-url $L1_RPC --private-key $ACCOUNT_PK"
op-cast send --from $ACCOUNT --value 1ether $BRIDGE --rpc-url $L1_RPC --private-key $ACCOUNT_PK
```
6. Allow a couple minutes for the bridge to complete
6. Allow a couple minutes for the bridge to complete.
7. Check the L2 balance again (it should show the bridged funds):
```bash
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC"
op-cast balance $ACCOUNT --rpc-url $L2_RPC
# 1000000000000000000
```
+10
View File
@@ -64,6 +64,9 @@ Inside the deployment directory, open the file `config.env` and add the followin
CERC_L1_HOST=
CERC_L1_PORT=
# External L1 Beacon node endpoint
CERC_L1_BEACON=
# URL to get CSV with credentials for accounts on L1
# that are used to send balance to Optimism Proxy contract
# (enables them to do transactions on L2)
@@ -74,6 +77,13 @@ Inside the deployment directory, open the file `config.env` and add the followin
# Other generated accounts will be funded from this account, so it should contain ~20 Eth
CERC_L1_ADDRESS=
CERC_L1_PRIV_KEY=
# Optional
# Funding amounts for proposer and batcher accounts on L1
# (Accounts funded using the Admin account)
CERC_PROPOSER_AMOUNT=
CERC_BATCHER_AMOUNT=
```
* NOTE: If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port, or use the `ip a` command to find the IP address of the `docker0` interface (this will usually be something like `172.17.0.1` or `172.18.0.1`)
+2 -4
View File
@@ -3,12 +3,10 @@ name: fixturenet-optimism
description: "Optimism Fixturenet"
repos:
# L2 (optimism)
- github.com/cerc-io/foundry@pm-merge-upstream-changes
- github.com/ethereum-optimism/optimism@v1.7.4
- github.com/ethereum-optimism/op-geth@v1.101311.0
- github.com/ethereum-optimism/optimism@v1.7.7
- github.com/ethereum-optimism/op-geth@v1.101315.2
containers:
# L2 (optimism)
- cerc/foundry
- cerc/optimism-contracts
- cerc/optimism-op-node
- cerc/optimism-l2geth