Add CERC prefix to env variables in fixturenet-optimism stack
This commit is contained in:
parent
3da83102d2
commit
1841cc4929
@ -11,15 +11,15 @@ services:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
L1_CHAIN_ID: ${L1_CHAIN_ID}
|
||||
L1_RPC: ${L1_RPC}
|
||||
L1_ADDRESS: ${L1_ADDRESS}
|
||||
L1_PRIV_KEY: ${L1_PRIV_KEY}
|
||||
L1_ADDRESS_2: ${L1_ADDRESS_2}
|
||||
L1_PRIV_KEY_2: ${L1_PRIV_KEY_2}
|
||||
CERC_L1_CHAIN_ID: ${CERC_L1_CHAIN_ID}
|
||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||
CERC_L1_ADDRESS: ${CERC_L1_ADDRESS}
|
||||
CERC_L1_PRIV_KEY: ${CERC_L1_PRIV_KEY}
|
||||
CERC_L1_ADDRESS_2: ${CERC_L1_ADDRESS_2}
|
||||
CERC_L1_PRIV_KEY_2: ${CERC_L1_PRIV_KEY_2}
|
||||
# Waits for L1 endpoint to be up before running the script
|
||||
command: |
|
||||
"./wait-for-it.sh -h ${L1_HOST:-$${DEFAULT_L1_HOST}} -p ${L1_PORT:-$${DEFAULT_L1_PORT}} -s -t 60 -- ./run.sh"
|
||||
"./wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_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
|
||||
@ -43,7 +43,7 @@ services:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
L1_RPC: ${L1_RPC}
|
||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||
volumes:
|
||||
- ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh
|
||||
- l1_deployment:/contracts-bedrock:ro
|
||||
@ -84,7 +84,7 @@ services:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
L1_RPC: ${L1_RPC}
|
||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||
volumes:
|
||||
- ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh
|
||||
- l2_config:/op-node-data:ro
|
||||
@ -113,7 +113,7 @@ services:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
L1_RPC: ${L1_RPC}
|
||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||
volumes:
|
||||
- ../config/wait-for-it.sh:/wait-for-it.sh
|
||||
- ../config/fixturenet-optimism/run-op-batcher.sh:/run-op-batcher.sh
|
||||
@ -121,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:-$${DEFAULT_L1_HOST}} -p ${L1_PORT:-$${DEFAULT_L1_PORT}} -s -t 60 -- /run-op-batcher.sh"
|
||||
"/wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- /run-op-batcher.sh"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
L1_RPC="${L1_RPC:-${DEFAULT_L1_RPC}}"
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
# Check existing config if it exists
|
||||
if [ -f /app/jwt.txt ] && [ -f /app/rollup.json ]; then
|
||||
@ -32,6 +32,6 @@ op-node genesis l2 \
|
||||
--deployment-dir /contracts-bedrock/deployments/getting-started/ \
|
||||
--outfile.l2 /app/genesis.json \
|
||||
--outfile.rollup /app/rollup.json \
|
||||
--l1-rpc $L1_RPC
|
||||
--l1-rpc $CERC_L1_RPC
|
||||
|
||||
openssl rand -hex 32 > /app/jwt.txt
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
# Defaults
|
||||
|
||||
# L1 endpoint
|
||||
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
|
||||
DEFAULT_CERC_L1_CHAIN_ID=1212
|
||||
DEFAULT_CERC_L1_RPC="http://fixturenet-eth-geth-1:8545"
|
||||
DEFAULT_CERC_L1_HOST="fixturenet-eth-geth-1"
|
||||
DEFAULT_CERC_L1_PORT=8545
|
||||
|
||||
# Credentials for accounts on L1 to send balance to Optimism Proxy contract from
|
||||
# (enables them to do transactions on L2)
|
||||
DEFAULT_L1_ADDRESS=
|
||||
DEFAULT_L1_PRIV_KEY=
|
||||
DEFAULT_L1_ADDRESS_2=
|
||||
DEFAULT_L1_PRIV_KEY_2=
|
||||
DEFAULT_CERC_L1_ADDRESS=
|
||||
DEFAULT_CERC_L1_PRIV_KEY=
|
||||
DEFAULT_CERC_L1_ADDRESS_2=
|
||||
DEFAULT_CERC_L1_PRIV_KEY_2=
|
||||
|
||||
@ -4,15 +4,15 @@ 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}}"
|
||||
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_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}}"
|
||||
CERC_L1_ADDRESS="${CERC_L1_ADDRESS:-${DEFAULT_CERC_L1_ADDRESS}}"
|
||||
CERC_L1_PRIV_KEY="${CERC_L1_PRIV_KEY:-${DEFAULT_CERC_L1_PRIV_KEY}}"
|
||||
CERC_L1_ADDRESS_2="${CERC_L1_ADDRESS_2:-${DEFAULT_CERC_L1_ADDRESS_2}}"
|
||||
CERC_L1_PRIV_KEY_2="${CERC_L1_PRIV_KEY_2:-${DEFAULT_CERC_L1_PRIV_KEY_2}}"
|
||||
|
||||
echo "Using L1 RPC endpoint ${L1_RPC}"
|
||||
echo "Using L1 RPC endpoint ${CERC_L1_RPC}"
|
||||
|
||||
IMPORT_1="import './verify-contract-deployment'"
|
||||
IMPORT_2="import './rekey-json'"
|
||||
@ -26,7 +26,7 @@ if ! grep -Fxq "$IMPORT_1" tasks/index.ts; then
|
||||
fi
|
||||
|
||||
# Update the chainId in the hardhat config
|
||||
sed -i "/getting-started/ {n; s/.*chainId.*/ chainId: $L1_CHAIN_ID,/}" hardhat.config.ts
|
||||
sed -i "/getting-started/ {n; s/.*chainId.*/ chainId: $CERC_L1_CHAIN_ID,/}" hardhat.config.ts
|
||||
|
||||
# Exit if a deployment already exists (on restarts)
|
||||
# Note: fixturenet-eth-geth currently starts fresh on a restart
|
||||
@ -65,16 +65,16 @@ SEQUENCER_ADDRESS=$(echo "$KEYS_JSON" | jq -r '.Sequencer.address')
|
||||
# Read the private key of L1 accounts
|
||||
if [ -f /geth-accounts/accounts.csv ]; then
|
||||
echo "Using L1 account credentials from the mounted volume"
|
||||
L1_ADDRESS=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 2)
|
||||
L1_PRIV_KEY=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
|
||||
L1_ADDRESS_2=$(awk -F, 'NR==2{print $(NF-1)}' /geth-accounts/accounts.csv)
|
||||
L1_PRIV_KEY_2=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
|
||||
CERC_L1_ADDRESS=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 2)
|
||||
CERC_L1_PRIV_KEY=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
|
||||
CERC_L1_ADDRESS_2=$(awk -F, 'NR==2{print $(NF-1)}' /geth-accounts/accounts.csv)
|
||||
CERC_L1_PRIV_KEY_2=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
|
||||
else
|
||||
echo "Using L1 account credentials from env"
|
||||
fi
|
||||
|
||||
# Select a finalized L1 block as the starting point for roll ups
|
||||
until FINALIZED_BLOCK=$(cast block finalized --rpc-url "$L1_RPC"); do
|
||||
until FINALIZED_BLOCK=$(cast block finalized --rpc-url "$CERC_L1_RPC"); do
|
||||
echo "Waiting for a finalized L1 block to exist, retrying after 10s"
|
||||
sleep 10
|
||||
done
|
||||
@ -86,22 +86,22 @@ L1_BLOCKTIMESTAMP=$(echo "$FINALIZED_BLOCK" | awk '/timestamp/{print $2}')
|
||||
echo "Selected L1 block ${L1_BLOCKNUMBER} as the starting block for roll ups"
|
||||
|
||||
# Send balances to the above L2 addresses
|
||||
yarn hardhat send-balance --to "${ADMIN_ADDRESS}" --amount 2 --private-key "${L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${PROPOSER_ADDRESS}" --amount 5 --private-key "${L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${BATCHER_ADDRESS}" --amount 1000 --private-key "${L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${ADMIN_ADDRESS}" --amount 2 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${PROPOSER_ADDRESS}" --amount 5 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${BATCHER_ADDRESS}" --amount 1000 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
|
||||
echo "Balances sent to L2 accounts"
|
||||
|
||||
# Update the deployment config
|
||||
sed -i 's/"l2OutputOracleStartingTimestamp": TIMESTAMP/"l2OutputOracleStartingTimestamp": '"$L1_BLOCKTIMESTAMP"'/g' deploy-config/getting-started.json
|
||||
jq --arg chainid "$L1_CHAIN_ID" '.l1ChainID = ($chainid | tonumber)' deploy-config/getting-started.json > tmp.json && mv tmp.json deploy-config/getting-started.json
|
||||
jq --arg chainid "$CERC_L1_CHAIN_ID" '.l1ChainID = ($chainid | tonumber)' deploy-config/getting-started.json > tmp.json && mv tmp.json deploy-config/getting-started.json
|
||||
|
||||
node update-config.js deploy-config/getting-started.json "$ADMIN_ADDRESS" "$PROPOSER_ADDRESS" "$BATCHER_ADDRESS" "$SEQUENCER_ADDRESS" "$L1_BLOCKHASH"
|
||||
|
||||
echo "Updated the deployment config"
|
||||
|
||||
# Create a .env file
|
||||
echo "L1_RPC=$L1_RPC" > .env
|
||||
echo "CERC_L1_RPC=$CERC_L1_RPC" > .env
|
||||
echo "PRIVATE_KEY_DEPLOYER=$ADMIN_PRIV_KEY" >> .env
|
||||
|
||||
echo "Deploying the L1 smart contracts, this will take a while..."
|
||||
@ -117,12 +117,12 @@ PROXY_ADDRESS=$(echo "$PROXY_JSON" | jq -r '.address')
|
||||
|
||||
# Send balance to the above Proxy contract in L1 for reflecting balance in L2
|
||||
# First account
|
||||
yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
# Second account
|
||||
yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${L1_PRIV_KEY_2}" --network getting-started
|
||||
yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${CERC_L1_PRIV_KEY_2}" --network getting-started
|
||||
|
||||
echo "Balance sent to Proxy L2 contract"
|
||||
echo "Use following accounts for transactions in L2:"
|
||||
echo "${L1_ADDRESS}"
|
||||
echo "${L1_ADDRESS_2}"
|
||||
echo "${CERC_L1_ADDRESS}"
|
||||
echo "${CERC_L1_ADDRESS_2}"
|
||||
echo "Done"
|
||||
|
||||
@ -4,7 +4,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
L1_RPC="${L1_RPC:-${DEFAULT_L1_RPC}}"
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
# Get BACTHER_KEY from keys.json
|
||||
BATCHER_KEY=$(jq -r '.Batcher.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
@ -22,5 +22,5 @@ op-batcher \
|
||||
--rpc.enable-admin \
|
||||
--max-channel-duration=1 \
|
||||
--target-l1-tx-size-bytes=2048 \
|
||||
--l1-eth-rpc=$L1_RPC \
|
||||
--l1-eth-rpc=$CERC_L1_RPC \
|
||||
--private-key=$BATCHER_KEY
|
||||
|
||||
@ -4,7 +4,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
L1_RPC="${L1_RPC:-${DEFAULT_L1_RPC}}"
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
# Get SEQUENCER KEY from keys.json
|
||||
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
@ -21,5 +21,5 @@ op-node \
|
||||
--p2p.disable \
|
||||
--rpc.enable-admin \
|
||||
--p2p.sequencer.key=$SEQUENCER_KEY \
|
||||
--l1=$L1_RPC \
|
||||
--l1=$CERC_L1_RPC \
|
||||
--l1.rpckind=any
|
||||
|
||||
@ -8,7 +8,7 @@ task('send-balance', 'Sends Ether to a specified Ethereum account')
|
||||
.addParam('privateKey', 'The private key of the sender')
|
||||
.setAction(async ({ to, amount, privateKey }, {}) => {
|
||||
// Open the wallet using sender's private key
|
||||
const provider = new ethers.providers.JsonRpcProvider(`${process.env.L1_RPC}`)
|
||||
const provider = new ethers.providers.JsonRpcProvider(`${process.env.CERC_L1_RPC}`)
|
||||
const wallet = new ethers.Wallet(privateKey, provider)
|
||||
|
||||
// Send amount to the specified address
|
||||
|
||||
@ -9,7 +9,7 @@ task(
|
||||
.addParam('transactionHash', 'Hash of the deployment transaction')
|
||||
.setAction(async ({ contract, transactionHash }, { ethers }) => {
|
||||
const provider = new ethers.providers.JsonRpcProvider(
|
||||
`${process.env.L1_RPC}`
|
||||
`${process.env.CERC_L1_RPC}`
|
||||
)
|
||||
|
||||
// Get the deployment tx receipt
|
||||
|
||||
@ -111,7 +111,7 @@ docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_geth_accounts
|
||||
docker volume rm $(docker volume ls -q --filter name=l2_geth_data)
|
||||
```
|
||||
|
||||
* Reuse the deployment command used in [Deploy](#deploy) to restart the stopped containers
|
||||
* Re-run the deployment command used in [Deploy](#deploy) to restart the stopped containers
|
||||
|
||||
## Known Issues
|
||||
|
||||
|
||||
@ -41,17 +41,17 @@ Create and update an env file to be used in the next step ([defaults](../../conf
|
||||
|
||||
```bash
|
||||
# External L1 endpoint
|
||||
L1_CHAIN_ID=
|
||||
L1_RPC=
|
||||
L1_HOST=
|
||||
L1_PORT=
|
||||
CERC_L1_CHAIN_ID=
|
||||
CERC_L1_RPC=
|
||||
CERC_L1_HOST=
|
||||
CERC_L1_PORT=
|
||||
|
||||
# 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=
|
||||
CERC_L1_ADDRESS=
|
||||
CERC_L1_PRIV_KEY=
|
||||
CERC_L1_ADDRESS_2=
|
||||
CERC_L1_PRIV_KEY_2=
|
||||
```
|
||||
|
||||
* NOTE: If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
||||
@ -99,4 +99,4 @@ docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_geth_accounts
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
See [Troubleshooting](./README.md#troubleshooting)
|
||||
See [Troubleshooting](./README.md#troubleshooting)
|
||||
|
||||
@ -84,7 +84,7 @@ docker ps
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
The watcher endpoint is exposed on port `3001` and the relay node endpoint is exposed on port `9090`
|
||||
The watcher endpoint is exposed on host port `3001` and the relay node endpoint is exposed on host port `9090`
|
||||
|
||||
Check the logs of the deployment container to get the deployed contract's address and generated root invite link:
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user