Compare commits
6 Commits
pm-use-for
...
main
Author | SHA1 | Date | |
---|---|---|---|
6d7101bd85 | |||
ab0e42a54b | |||
c5f97dda13 | |||
9ca108e877 | |||
89b2a7d82c | |||
002d334b98 |
@ -17,6 +17,8 @@ services:
|
|||||||
CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL}
|
CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL}
|
||||||
CERC_L1_ADDRESS: ${CERC_L1_ADDRESS}
|
CERC_L1_ADDRESS: ${CERC_L1_ADDRESS}
|
||||||
CERC_L1_PRIV_KEY: ${CERC_L1_PRIV_KEY}
|
CERC_L1_PRIV_KEY: ${CERC_L1_PRIV_KEY}
|
||||||
|
CERC_PROPOSER_AMOUNT: ${CERC_PROPOSER_AMOUNT}
|
||||||
|
CERC_BATCHER_AMOUNT: ${CERC_BATCHER_AMOUNT}
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/network/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh
|
- ../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/fixturenet-optimism/optimism-contracts/deploy-contracts.sh:/app/packages/contracts-bedrock/deploy-contracts.sh
|
||||||
@ -29,14 +31,35 @@ services:
|
|||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "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"
|
||||||
|
|
||||||
# Initializes and runs the L2 execution client (outputs to volume l2_geth_data)
|
# Initializes and runs the L2 execution client (outputs to volume l2_geth_data)
|
||||||
op-geth:
|
op-geth:
|
||||||
restart: always
|
restart: always
|
||||||
image: cerc/optimism-l2geth:local
|
image: cerc/optimism-l2geth:local
|
||||||
hostname: op-geth
|
hostname: op-geth
|
||||||
depends_on:
|
depends_on:
|
||||||
op-node:
|
l2-config-generation:
|
||||||
condition: service_started
|
condition: service_completed_successfully
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/fixturenet-optimism/run-op-geth.sh:/run-op-geth.sh
|
- ../config/fixturenet-optimism/run-op-geth.sh:/run-op-geth.sh
|
||||||
- l2_config:/l2-config:ro
|
- l2_config:/l2-config:ro
|
||||||
@ -63,13 +86,14 @@ services:
|
|||||||
image: cerc/optimism-op-node:local
|
image: cerc/optimism-op-node:local
|
||||||
hostname: op-node
|
hostname: op-node
|
||||||
depends_on:
|
depends_on:
|
||||||
fixturenet-optimism-contracts:
|
op-geth:
|
||||||
condition: service_completed_successfully
|
condition: service_healthy
|
||||||
env_file:
|
env_file:
|
||||||
- ../config/fixturenet-optimism/l1-params.env
|
- ../config/fixturenet-optimism/l1-params.env
|
||||||
environment:
|
environment:
|
||||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||||
|
CERC_L1_BEACON: ${CERC_L1_BEACON}
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/fixturenet-optimism/run-op-node.sh:/run-op-node.sh
|
- ../config/fixturenet-optimism/run-op-node.sh:/run-op-node.sh
|
||||||
- l1_deployment:/l1-deployment:ro
|
- l1_deployment:/l1-deployment:ro
|
||||||
|
43
config/fixturenet-optimism/generate-l2-config.sh
Normal file
43
config/fixturenet-optimism/generate-l2-config.sh
Normal file
@ -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"
|
@ -10,3 +10,6 @@ DEFAULT_CERC_L1_PORT=8545
|
|||||||
# that are used to send balance to Optimism Proxy contract
|
# that are used to send balance to Optimism Proxy contract
|
||||||
# (enables them to do transactions on L2)
|
# (enables them to do transactions on L2)
|
||||||
DEFAULT_CERC_L1_ACCOUNTS_CSV_URL="http://fixturenet-eth-bootnode-geth:9898/accounts.csv"
|
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
|
@ -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_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"
|
export DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
|
||||||
# Optional create2 salt for deterministic deployment of contract implementations
|
# Optional create2 salt for deterministic deployment of contract implementations
|
||||||
export IMPL_SALT=$(openssl rand -hex 32)
|
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}"
|
echo "Using L1 RPC endpoint ${CERC_L1_RPC}"
|
||||||
|
|
||||||
# Exit if a deployment already exists (on restarts)
|
# Exit if a deployment already exists (on restarts)
|
||||||
if [ -d "/l1-deployment/$DEPLOYMENT_CONTEXT" ]; then
|
if [ -f "/l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json" ]; then
|
||||||
echo "Deployment directory /l1-deployment/$DEPLOYMENT_CONTEXT, checking OptimismPortal deployment"
|
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)
|
contract_code=$(cast code $OPTIMISM_PORTAL_ADDRESS --rpc-url $CERC_L1_RPC)
|
||||||
|
|
||||||
if [ -z "${contract_code#0x}" ]; then
|
if [ -z "${contract_code#0x}" ]; then
|
||||||
@ -47,59 +50,78 @@ wait_for_block() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# We need four accounts and their private keys for the deployment: Admin, Proposer, Batcher, and Sequencer
|
# We need four accounts and their private keys for the deployment: Admin, Proposer, Batcher, and Sequencer
|
||||||
# If $CERC_L1_ADDRESS and $CERC_L1_PRIV_KEY have been set, we'll assign it to Admin and generate/fund the remaining three accounts from it
|
# Check if accounts file already exists
|
||||||
# If not, we'll assume the L1 is the stack's own fixturenet-eth and use the pre-funded accounts/keys from $CERC_L1_ACCOUNTS_CSV_URL
|
l2_accounts_file="/l2-accounts/accounts.json"
|
||||||
if [ -n "$CERC_L1_ADDRESS" ] && [ -n "$CERC_L1_PRIV_KEY" ]; then
|
if [ -f $l2_accounts_file ]; then
|
||||||
wallet1=$(cast wallet new)
|
echo "Using existing accounts from $l2_accounts_file."
|
||||||
wallet2=$(cast wallet new)
|
|
||||||
wallet3=$(cast wallet new)
|
|
||||||
# Admin
|
|
||||||
ADMIN=$CERC_L1_ADDRESS
|
|
||||||
ADMIN_KEY=$CERC_L1_PRIV_KEY
|
|
||||||
# Proposer
|
|
||||||
PROPOSER=$(echo "$wallet1" | awk '/Address:/{print $2}')
|
|
||||||
PROPOSER_KEY=$(echo "$wallet1" | awk '/Private key:/{print $3}')
|
|
||||||
# Batcher
|
|
||||||
BATCHER=$(echo "$wallet2" | awk '/Address:/{print $2}')
|
|
||||||
BATCHER_KEY=$(echo "$wallet2" | awk '/Private key:/{print $3}')
|
|
||||||
# Sequencer
|
|
||||||
SEQ=$(echo "$wallet3" | awk '/Address:/{print $2}')
|
|
||||||
SEQ_KEY=$(echo "$wallet3" | awk '/Private key:/{print $3}')
|
|
||||||
|
|
||||||
echo "Funding accounts."
|
ADMIN=$(jq -r .Admin $l2_accounts_file)
|
||||||
wait_for_block 1 300
|
ADMIN_KEY=$(jq -r .AdminKey $l2_accounts_file)
|
||||||
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
|
|
||||||
else
|
|
||||||
curl -o accounts.csv $CERC_L1_ACCOUNTS_CSV_URL
|
|
||||||
# Admin
|
|
||||||
ADMIN=$(awk -F ',' 'NR == 1 {print $2}' accounts.csv)
|
|
||||||
ADMIN_KEY=$(awk -F ',' 'NR == 1 {print $3}' accounts.csv)
|
|
||||||
# Proposer
|
# Proposer
|
||||||
PROPOSER=$(awk -F ',' 'NR == 2 {print $2}' accounts.csv)
|
PROPOSER=$(jq -r .Proposer $l2_accounts_file)
|
||||||
PROPOSER_KEY=$(awk -F ',' 'NR == 2 {print $3}' accounts.csv)
|
PROPOSER_KEY=$(jq -r .ProposerKey $l2_accounts_file)
|
||||||
# Batcher
|
# Batcher
|
||||||
BATCHER=$(awk -F ',' 'NR == 3 {print $2}' accounts.csv)
|
BATCHER=$(jq -r .Batcher $l2_accounts_file)
|
||||||
BATCHER_KEY=$(awk -F ',' 'NR == 3 {print $3}' accounts.csv)
|
BATCHER_KEY=$(jq -r .BatcherKey $l2_accounts_file)
|
||||||
# Sequencer
|
# Sequencer
|
||||||
SEQ=$(awk -F ',' 'NR == 4 {print $2}' accounts.csv)
|
SEQ=$(jq -r .Seq $l2_accounts_file)
|
||||||
SEQ_KEY=$(awk -F ',' 'NR == 4 {print $3}' accounts.csv)
|
SEQ_KEY=$(jq -r .SeqKey $l2_accounts_file)
|
||||||
|
else
|
||||||
|
# If $CERC_L1_ADDRESS and $CERC_L1_PRIV_KEY have been set, we'll assign it to Admin and generate/fund the remaining three accounts from it
|
||||||
|
# If not, we'll assume the L1 is the stack's own fixturenet-eth and use the pre-funded accounts/keys from $CERC_L1_ACCOUNTS_CSV_URL
|
||||||
|
|
||||||
|
if [ -n "$CERC_L1_ADDRESS" ] && [ -n "$CERC_L1_PRIV_KEY" ]; then
|
||||||
|
echo "Creating new accounts for Optimism deployment."
|
||||||
|
wallet1=$(cast wallet new)
|
||||||
|
wallet2=$(cast wallet new)
|
||||||
|
wallet3=$(cast wallet new)
|
||||||
|
# Admin
|
||||||
|
ADMIN=$CERC_L1_ADDRESS
|
||||||
|
ADMIN_KEY=$CERC_L1_PRIV_KEY
|
||||||
|
# Proposer
|
||||||
|
PROPOSER=$(echo "$wallet1" | awk '/Address:/{print $2}')
|
||||||
|
PROPOSER_KEY=$(echo "$wallet1" | awk '/Private key:/{print $3}')
|
||||||
|
# Batcher
|
||||||
|
BATCHER=$(echo "$wallet2" | awk '/Address:/{print $2}')
|
||||||
|
BATCHER_KEY=$(echo "$wallet2" | awk '/Private key:/{print $3}')
|
||||||
|
# Sequencer
|
||||||
|
SEQ=$(echo "$wallet3" | awk '/Address:/{print $2}')
|
||||||
|
SEQ_KEY=$(echo "$wallet3" | awk '/Private key:/{print $3}')
|
||||||
|
|
||||||
|
echo "Funding accounts..."
|
||||||
|
wait_for_block 1 300
|
||||||
|
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
|
||||||
|
ADMIN=$(awk -F ',' 'NR == 1 {print $2}' accounts.csv)
|
||||||
|
ADMIN_KEY=$(awk -F ',' 'NR == 1 {print $3}' accounts.csv)
|
||||||
|
# Proposer
|
||||||
|
PROPOSER=$(awk -F ',' 'NR == 2 {print $2}' accounts.csv)
|
||||||
|
PROPOSER_KEY=$(awk -F ',' 'NR == 2 {print $3}' accounts.csv)
|
||||||
|
# Batcher
|
||||||
|
BATCHER=$(awk -F ',' 'NR == 3 {print $2}' accounts.csv)
|
||||||
|
BATCHER_KEY=$(awk -F ',' 'NR == 3 {print $3}' accounts.csv)
|
||||||
|
# Sequencer
|
||||||
|
SEQ=$(awk -F ',' 'NR == 4 {print $2}' accounts.csv)
|
||||||
|
SEQ_KEY=$(awk -F ',' 'NR == 4 {print $3}' accounts.csv)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# These accounts will be needed by other containers, so write them to a shared volume
|
||||||
|
echo "Writing accounts/private keys to volume l2_accounts."
|
||||||
|
accounts_json=$(jq -n \
|
||||||
|
--arg Admin "$ADMIN" --arg AdminKey "$ADMIN_KEY" \
|
||||||
|
--arg Proposer "$PROPOSER" --arg ProposerKey "$PROPOSER_KEY" \
|
||||||
|
--arg Batcher "$BATCHER" --arg BatcherKey "$BATCHER_KEY" \
|
||||||
|
--arg Seq "$SEQ" --arg SeqKey "$SEQ_KEY" \
|
||||||
|
'{Admin: $Admin, AdminKey: $AdminKey, Proposer: $Proposer, ProposerKey: $ProposerKey, Batcher: $Batcher, BatcherKey: $BatcherKey, Seq: $Seq, SeqKey: $SeqKey}')
|
||||||
|
echo "$accounts_json" > $l2_accounts_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using accounts:"
|
echo "Using accounts:"
|
||||||
echo -e "Admin: $ADMIN\nProposer: $PROPOSER\nBatcher: $BATCHER\nSequencer: $SEQ"
|
echo -e "Admin: $ADMIN\nProposer: $PROPOSER\nBatcher: $BATCHER\nSequencer: $SEQ"
|
||||||
|
|
||||||
# These accounts will be needed by other containers, so write them to a shared volume
|
|
||||||
echo "Writing accounts/private keys to volume l2_accounts."
|
|
||||||
accounts_json=$(jq -n \
|
|
||||||
--arg Admin "$ADMIN" --arg AdminKey "$ADMIN_KEY" \
|
|
||||||
--arg Proposer "$PROPOSER" --arg ProposerKey "$PROPOSER_KEY" \
|
|
||||||
--arg Batcher "$BATCHER" --arg BatcherKey "$BATCHER_KEY" \
|
|
||||||
--arg Seq "$SEQ" --arg SeqKey "$SEQ_KEY" \
|
|
||||||
'{Admin: $Admin, AdminKey: $AdminKey, Proposer: $Proposer, ProposerKey: $ProposerKey, Batcher: $Batcher, BatcherKey: $BatcherKey, Seq: $Seq, SeqKey: $SeqKey}')
|
|
||||||
echo "$accounts_json" > "/l2-accounts/accounts.json"
|
|
||||||
|
|
||||||
# Get a finalized L1 block to set as the starting point for the L2 deployment
|
# Get a finalized L1 block to set as the starting point for the L2 deployment
|
||||||
# If the chain is a freshly created fixturenet-eth, a finalized block won't be available for many minutes; rather than wait, we can use block 1
|
# If the chain is a freshly created fixturenet-eth, a finalized block won't be available for many minutes; rather than wait, we can use block 1
|
||||||
echo "Checking L1 for finalized block..."
|
echo "Checking L1 for finalized block..."
|
||||||
@ -117,7 +139,16 @@ if [ -z "$finalized" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate the deploy-config/getting-started.json file
|
# 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=12 \
|
||||||
|
L2_BLOCK_TIME=2 \
|
||||||
|
$config_build_script
|
||||||
|
|
||||||
echo "Writing deployment config."
|
echo "Writing deployment config."
|
||||||
deploy_config_file="deploy-config/$DEPLOYMENT_CONTEXT.json"
|
deploy_config_file="deploy-config/$DEPLOYMENT_CONTEXT.json"
|
||||||
@ -127,7 +158,6 @@ cp deploy-config/getting-started.json $deploy_config_file
|
|||||||
# 1. Update L1 chain id
|
# 1. Update L1 chain id
|
||||||
# 2. Add missing faultGameWithdrawalDelay field
|
# 2. Add missing faultGameWithdrawalDelay field
|
||||||
# (see issue: https://github.com/ethereum-optimism/optimism/issues/9773#issuecomment-2080224969)
|
# (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
|
mkdir -p deployments/$DEPLOYMENT_CONTEXT
|
||||||
|
|
||||||
@ -147,24 +177,25 @@ if [ "$create2CodeSize" -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Create the L2 deployment
|
# Create the L2 deployment
|
||||||
# Writes out artifact to /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT/.deploy
|
# Writes out artifact to /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT-deploy.json
|
||||||
echo "Deploying L1 Optimism contracts..."
|
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.s.sol:Deploy --private-key $ADMIN_KEY --broadcast --rpc-url $CERC_L1_RPC
|
||||||
echo "Done deploying contracts."
|
echo "Done deploying contracts."
|
||||||
|
|
||||||
echo "Generating L2 genesis allocs..."
|
echo "Generating L2 genesis allocs..."
|
||||||
L2_CHAIN_ID=$(jq ".l2ChainID" $deploy_config_file)
|
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
|
DEPLOY_CONFIG_PATH=$deploy_config_file \
|
||||||
echo "{ \"accounts\": $(jq '.' /app/packages/contracts-bedrock/state-dump-$L2_CHAIN_ID.json) }" > allocs-l2.json
|
CONTRACT_ADDRESSES_PATH="deployments/$DEPLOYMENT_CONTEXT-deploy.json" \
|
||||||
echo "Done."
|
forge script --chain-id $L2_CHAIN_ID scripts/L2Genesis.s.sol:L2Genesis --sig 'runWithAllUpgrades()' --private-key $ADMIN_KEY
|
||||||
|
|
||||||
|
cp /app/packages/contracts-bedrock/state-dump-$L2_CHAIN_ID.json allocs-l2.json
|
||||||
|
echo "Done."
|
||||||
echo "*************************************"
|
echo "*************************************"
|
||||||
|
|
||||||
# Copy files needed by other containers to the appropriate shared volumes
|
# 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"
|
echo "Copying deployment artifacts to 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/deployments/$DEPLOYMENT_CONTEXT-deploy.json /l1-deployment
|
||||||
cp /app/packages/contracts-bedrock/deploy-config/$DEPLOYMENT_CONTEXT.json /l2-config
|
cp /app/packages/contracts-bedrock/deploy-config/$DEPLOYMENT_CONTEXT.json /l2-config
|
||||||
cp allocs-l2.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"
|
||||||
|
@ -7,24 +7,14 @@ fi
|
|||||||
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
|
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
|
||||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||||
DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
|
DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
|
||||||
|
CERC_L1_BEACON="${CERC_L1_BEACON:-${DEFAULT_CERC_L1_BEACON}}"
|
||||||
|
|
||||||
deploy_config_file="/l2-config/$DEPLOYMENT_CONTEXT.json"
|
deploy_config_file="/l2-config/$DEPLOYMENT_CONTEXT.json"
|
||||||
l1_deployment_file="/l1-deployment/$DEPLOYMENT_CONTEXT/.deploy"
|
l1_deployment_file="/l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json"
|
||||||
l2_allocs_file="/l2-config/allocs-l2.json"
|
l2_allocs_file="/l2-config/allocs-l2.json"
|
||||||
genesis_outfile="/l2-config/genesis.json"
|
genesis_outfile="/l2-config/genesis.json"
|
||||||
rollup_outfile="/l2-config/rollup.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
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start op-node
|
# Start op-node
|
||||||
SEQ_KEY=$(cat /l2-accounts/accounts.json | jq -r .SeqKey)
|
SEQ_KEY=$(cat /l2-accounts/accounts.json | jq -r .SeqKey)
|
||||||
jwt_file=/l2-config/l2-jwt.txt
|
jwt_file=/l2-config/l2-jwt.txt
|
||||||
@ -44,4 +34,5 @@ op-node \
|
|||||||
--rpc.enable-admin \
|
--rpc.enable-admin \
|
||||||
--p2p.sequencer.key="${SEQ_KEY#0x}" \
|
--p2p.sequencer.key="${SEQ_KEY#0x}" \
|
||||||
--l1=$CERC_L1_RPC \
|
--l1=$CERC_L1_RPC \
|
||||||
--l1.rpckind=$RPC_KIND
|
--l1.rpckind=$RPC_KIND \
|
||||||
|
--l1.beacon=$CERC_L1_BEACON
|
||||||
|
@ -11,7 +11,7 @@ DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
|
|||||||
# Start op-proposer
|
# Start op-proposer
|
||||||
ROLLUP_RPC="http://op-node:8547"
|
ROLLUP_RPC="http://op-node:8547"
|
||||||
PROPOSER_KEY=$(cat /l2-accounts/accounts.json | jq -r .ProposerKey)
|
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 \
|
op-proposer \
|
||||||
--poll-interval=12s \
|
--poll-interval=12s \
|
||||||
|
@ -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,17 +1,16 @@
|
|||||||
# TODO: Make work for arm64/Apple Silicon
|
# TODO: Make work for arm64/Apple Silicon
|
||||||
# FROM ghcr.io/foundry-rs/foundry:nightly-267e14fab654d9ce955dce64c0eb09f01c8538ee
|
FROM ghcr.io/foundry-rs/foundry:nightly-c4a984fbf2c48b793c8cd53af84f56009dd1070c
|
||||||
FROM cerc/foundry:local
|
|
||||||
|
|
||||||
# Install node (local foundry is a debian based image)
|
RUN apk update
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y curl wget \
|
# Install node (use edge repo to get latest version)
|
||||||
&& curl --silent --location https://deb.nodesource.com/setup_18.x | bash - \
|
RUN apk add --update --no-cache curl wget bash git busybox jq openssl \
|
||||||
&& apt-get update \
|
&& apk add nodejs --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main --allow-untrusted \
|
||||||
&& apt-get install -y nodejs git busybox jq \
|
&& apk add npm \
|
||||||
&& node -v
|
&& node -v
|
||||||
|
|
||||||
# Add corepack for yarn and pnpm
|
# Add corepack for yarn and pnpm
|
||||||
RUN corepack enable \
|
RUN npm install -g corepack && corepack enable \
|
||||||
&& yarn --version
|
&& yarn --version
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
@ -6,7 +6,6 @@ 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
|
# build op-batcher with the shared go.mod & go.sum files
|
||||||
COPY ./op-batcher /app/op-batcher
|
COPY ./op-batcher /app/op-batcher
|
||||||
COPY ./op-bindings /app/op-bindings
|
|
||||||
COPY ./op-node /app/op-node
|
COPY ./op-node /app/op-node
|
||||||
COPY ./op-service /app/op-service
|
COPY ./op-service /app/op-service
|
||||||
COPY ./op-plasma /app/op-plasma
|
COPY ./op-plasma /app/op-plasma
|
||||||
|
@ -8,7 +8,6 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
|
|||||||
COPY ./op-node /app/op-node
|
COPY ./op-node /app/op-node
|
||||||
COPY ./op-chain-ops /app/op-chain-ops
|
COPY ./op-chain-ops /app/op-chain-ops
|
||||||
COPY ./op-service /app/op-service
|
COPY ./op-service /app/op-service
|
||||||
COPY ./op-bindings /app/op-bindings
|
|
||||||
COPY ./op-plasma /app/op-plasma
|
COPY ./op-plasma /app/op-plasma
|
||||||
COPY ./op-conductor /app/op-conductor
|
COPY ./op-conductor /app/op-conductor
|
||||||
COPY ./go.mod /app/go.mod
|
COPY ./go.mod /app/go.mod
|
||||||
|
@ -6,7 +6,6 @@ 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
|
# build op-proposer with the shared go.mod & go.sum files
|
||||||
COPY ./op-proposer /app/op-proposer
|
COPY ./op-proposer /app/op-proposer
|
||||||
COPY ./op-bindings /app/op-bindings
|
|
||||||
COPY ./op-node /app/op-node
|
COPY ./op-node /app/op-node
|
||||||
COPY ./op-service /app/op-service
|
COPY ./op-service /app/op-service
|
||||||
COPY ./op-plasma /app/op-plasma
|
COPY ./op-plasma /app/op-plasma
|
||||||
|
@ -112,6 +112,15 @@ Inside the `fixturenet-eth-deployment` deployment directory, open `config.env` f
|
|||||||
CERC_ALLOW_UNPROTECTED_TXS=true
|
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 stack
|
||||||
|
|
||||||
Start the deployment:
|
Start the deployment:
|
||||||
|
@ -64,6 +64,9 @@ Inside the deployment directory, open the file `config.env` and add the followin
|
|||||||
CERC_L1_HOST=
|
CERC_L1_HOST=
|
||||||
CERC_L1_PORT=
|
CERC_L1_PORT=
|
||||||
|
|
||||||
|
# External L1 Beacon node endpoint
|
||||||
|
CERC_L1_BEACON=
|
||||||
|
|
||||||
# URL to get CSV with credentials for accounts on L1
|
# URL to get CSV with credentials for accounts on L1
|
||||||
# that are used to send balance to Optimism Proxy contract
|
# that are used to send balance to Optimism Proxy contract
|
||||||
# (enables them to do transactions on L2)
|
# (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
|
# Other generated accounts will be funded from this account, so it should contain ~20 Eth
|
||||||
CERC_L1_ADDRESS=
|
CERC_L1_ADDRESS=
|
||||||
CERC_L1_PRIV_KEY=
|
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`)
|
* 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`)
|
||||||
|
@ -3,12 +3,10 @@ name: fixturenet-optimism
|
|||||||
description: "Optimism Fixturenet"
|
description: "Optimism Fixturenet"
|
||||||
repos:
|
repos:
|
||||||
# L2 (optimism)
|
# L2 (optimism)
|
||||||
- github.com/cerc-io/foundry@pm-merge-upstream-changes
|
- github.com/ethereum-optimism/optimism@v1.7.7
|
||||||
- github.com/ethereum-optimism/optimism@v1.7.4
|
- github.com/ethereum-optimism/op-geth@v1.101315.2
|
||||||
- github.com/ethereum-optimism/op-geth@v1.101311.0
|
|
||||||
containers:
|
containers:
|
||||||
# L2 (optimism)
|
# L2 (optimism)
|
||||||
- cerc/foundry
|
|
||||||
- cerc/optimism-contracts
|
- cerc/optimism-contracts
|
||||||
- cerc/optimism-op-node
|
- cerc/optimism-op-node
|
||||||
- cerc/optimism-l2geth
|
- cerc/optimism-l2geth
|
||||||
|
Loading…
Reference in New Issue
Block a user