Remove optimism utilization

This commit is contained in:
Shreerang Kale 2024-09-20 12:35:48 +05:30
parent 2826bbd67d
commit 6e01534724
11 changed files with 15 additions and 75 deletions

View File

@ -335,7 +335,7 @@
- Create a spec-file for the deployment, map container ports to host ports and set env variables:
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --map-ports-to-host any-same --output bridge-nitro-spec.yml --config "NITRO_L1_CHAIN_URL=ws://host.docker.internal:8546,NITRO_L2_CHAIN_URL=ws://host.docker.internal:9546,NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4,OPTIMISM_URL=http://host.docker.internal:9545,OPTIMISM_DEPLOYER_PK=$ACCOUNT_PK,TOKEN_NAME=LaconicNetworkToken,TOKEN_SYMBOL=LNT,INITIAL_TOKEN_SUPPLY=129600,NA_ADDRESS=$NA_ADDRESS,VPA_ADDRESS=$VPA_ADDRESS,CA_ADDRESS=$CA_ADDRESS,L1_ASSET_ADDRESS=$L1_ASSET_ADDRESS"
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --map-ports-to-host any-same --output bridge-nitro-spec.yml --config "NITRO_CHAIN_URL=ws://host.docker.internal:8546,NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4,OPTIMISM_URL=http://host.docker.internal:9545,TOKEN_NAME=LaconicNetworkToken,TOKEN_SYMBOL=LNT,INITIAL_TOKEN_SUPPLY=129600,NA_ADDRESS=$NA_ADDRESS,VPA_ADDRESS=$VPA_ADDRESS,CA_ADDRESS=$CA_ADDRESS,L1_ASSET_ADDRESS=$L1_ASSET_ADDRESS"
```
- Create a deployment from the spec file:
@ -389,7 +389,6 @@
# Contract address of bridge
export OPTIMISM_CHAIN_ID="42069"
export BRIDGE_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"$OPTIMISM_CHAIN_ID\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json")
```
```bash
@ -457,7 +456,6 @@
NA_ADDRESS=$NA_ADDRESS
VPA_ADDRESS=$VPA_ADDRESS
CA_ADDRESS=$CA_ADDRESS
BRIDGE_ADDRESS=$BRIDGE_ADDRESS
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3009
NITRO_L2=true
@ -480,7 +478,6 @@
NA_ADDRESS=$NA_ADDRESS
VPA_ADDRESS=$VPA_ADDRESS
CA_ADDRESS=$CA_ADDRESS
BRIDGE_ADDRESS=$BRIDGE_ADDRESS
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3010
NITRO_L2=true

View File

@ -6,9 +6,6 @@ services:
restart: on-failure
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
OPTIMISM_DEPLOYER_PK: ${OPTIMISM_DEPLOYER_PK}
OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID:-42069}
OPTIMISM_URL: ${OPTIMISM_URL}
TOKEN_NAME: ${TOKEN_NAME}
TOKEN_SYMBOL: ${TOKEN_SYMBOL}
INITIAL_TOKEN_SUPPLY: ${INITIAL_TOKEN_SUPPLY}
@ -30,9 +27,7 @@ services:
condition: service_started
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID:-42069}
NITRO_L1_CHAIN_URL: ${NITRO_L1_CHAIN_URL}
NITRO_L2_CHAIN_URL: ${NITRO_L2_CHAIN_URL}
NITRO_CHAIN_URL: ${NITRO_CHAIN_URL}
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}
NITRO_SC_PK: ${NITRO_SC_PK}
NITRO_L1_MSG_PORT: ${NITRO_L1_MSG_PORT:-3005}

View File

@ -19,7 +19,7 @@ services:
NA_ADDRESS: ${NA_ADDRESS}
CA_ADDRESS: ${CA_ADDRESS}
VPA_ADDRESS: ${VPA_ADDRESS}
BRIDGE_ADDRESS: ${BRIDGE_ADDRESS}
BRIDGE_ADDRESS: ""
NITRO_PUBLIC_RPC_HOST: nitro-node
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
volumes:

View File

@ -10,8 +10,7 @@ bridge_assets_map_file="/app/deployment/bridge-assets-map.toml"
bridge_config_file="/app/bridge.toml"
echo "Using the following environment variables:"
echo "NITRO_L1_CHAIN_URL: ${NITRO_L1_CHAIN_URL}"
echo "NITRO_L2_CHAIN_URL: ${NITRO_L2_CHAIN_URL}"
echo "NITRO_CHAIN_URL: ${NITRO_CHAIN_URL}"
echo "NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}"
echo "NITRO_SC_PK: ${NITRO_SC_PK}"
echo "NITRO_L1_MSG_PORT: ${NITRO_L1_MSG_PORT}"
@ -23,7 +22,6 @@ echo "NITRO_L2_EXT_MULTIADDR: ${NITRO_L2_EXT_MULTIADDR}"
echo "NA_ADDRESS: ${NA_ADDRESS}"
echo "CA_ADDRESS: ${CA_ADDRESS}"
echo "VPA_ADDRESS: ${VPA_ADDRESS}"
echo "OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID}"
echo "Waiting for $bridge_assets_map_file to be ready"
@ -40,8 +38,8 @@ echo "File $bridge_assets_map_file found"
cat <<EOF > "$bridge_config_file"
chainpk = "$NITRO_CHAIN_PK"
statechannelpk = "$NITRO_SC_PK"
l1chainurl = "$NITRO_L1_CHAIN_URL"
l2chainurl = "$NITRO_L2_CHAIN_URL"
l1chainurl = "$NITRO_CHAIN_URL"
l2chainurl = "$NITRO_CHAIN_URL"
nodel1msgport = $NITRO_L1_MSG_PORT
nodel2msgport = $NITRO_L2_MSG_PORT
rpcport = $NITRO_RPC_PORT
@ -55,7 +53,7 @@ caaddress = "${CA_ADDRESS}"
EOF
# Export bridge address
export BRIDGE_ADDRESS=$(jq -r ".\"$OPTIMISM_CHAIN_ID\"[0].contracts.Bridge.address" ${nitro_addresses_file})
export BRIDGE_ADDRESS=""
# Start bridge
echo "Starting nitro-bridge"

View File

@ -22,7 +22,6 @@ echo "Using Nitro contract addresses:"
echo "NA_ADDRESS: ${NA_ADDRESS}"
echo "CA_ADDRESS: ${CA_ADDRESS}"
echo "VPA_ADDRESS: ${VPA_ADDRESS}"
echo "BRIDGE_ADDRESS: ${BRIDGE_ADDRESS}"
# Create required certs
./create-certs.sh
@ -43,7 +42,7 @@ l2 = ${NITRO_L2}
naaddress = "${NA_ADDRESS}"
vpaaddress = "${VPA_ADDRESS}"
caaddress = "${CA_ADDRESS}"
bridgeaddress = "${BRIDGE_ADDRESS}"
bridgeaddress = ""
EOF
# Start the node

View File

@ -1,44 +0,0 @@
#!/bin/bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
addresses_deployment_file="packages/nitro-protocol/addresses.json"
nitro_addresses_file="/app/deployment/nitro-addresses.json"
bridge_assets_map_file="/app/deployment/bridge-assets-map.toml"
echo "Using the following environment variables:"
echo "OPTIMISM_URL: ${OPTIMISM_URL}"
echo "OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID}"
echo "OPTIMISM_DEPLOYER_PK: ${OPTIMISM_DEPLOYER_PK}"
echo "TOKEN_NAME: ${TOKEN_NAME}"
echo "TOKEN_SYMBOL: ${TOKEN_SYMBOL}"
echo "INITIAL_TOKEN_SUPPLY: ${INITIAL_TOKEN_SUPPLY}"
echo "DISABLE_DETERMINISTIC_DEPLOYMENT: ${DISABLE_DETERMINISTIC_DEPLOYMENT}"
echo "L1_ASSET_ADDRESS: ${L1_ASSET_ADDRESS}"
# Check if L2 chain id key is present for L2 deployment
if [ -f "$nitro_addresses_file" ] && jq -e "has(\"$OPTIMISM_CHAIN_ID\")" ${nitro_addresses_file} > /dev/null; then
echo "L2 addresses found in ${nitro_addresses_file}, skipping deployment"
else
# Deploy Nitro contracts
yarn contracts:deploy-optimism
# Deploy custom token
yarn contracts:deploy-token-optimism
cp ${addresses_deployment_file} ${nitro_addresses_file}
fi
L2_ASSET_ADDRESS=$(jq -r ".\"$OPTIMISM_CHAIN_ID\"[0].contracts.Token.address" ${nitro_addresses_file})
# Deploy custom tokens and create bridge-assets-map.toml
cat <<EOF > "$bridge_assets_map_file"
[[assets]]
l1AssetAddress = "$L1_ASSET_ADDRESS"
l2AssetAddress = "$L2_ASSET_ADDRESS"
EOF
echo "Done"

View File

@ -52,13 +52,8 @@
```bash
GETH_CHAIN_ID=1212
OPTIMISM_CHAIN_ID=42069
# URL endpoint of the L1 chain (Example: ws://host.docker.internal:8545)
NITRO_L1_CHAIN_URL=
# URL endpoint of the L2 chain (Example: ws://host.docker.internal:8546)
NITRO_L2_CHAIN_URL=
# URL endpoint of the chain (Example: ws://host.docker.internal:8545)
NITRO_CHAIN_URL=
# Private key of the account on chain that is used for funding channels
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}

View File

@ -2,7 +2,7 @@ version: "1.0"
name: bridge
description: "Nitro bridge with contracts deployment and nitro-rpc-client"
repos:
- github.com/cerc-io/go-nitro
- github.com/cerc-io/go-nitro@feat-remove-optimism
containers:
- cerc/nitro-client
- cerc/go-nitro

View File

@ -45,9 +45,9 @@
# Private key of the account on chain that is used for deploying L1 contracts
GETH_DEPLOYER_PK=
TOKEN_NAME=LaconicNetworkToken
TOKEN_NAME=TestToken
TOKEN_SYMBOL=LNT
TOKEN_SYMBOL=TST
INITIAL_TOKEN_SUPPLY=129600
```

View File

@ -2,7 +2,7 @@ version: "1.0"
name: nitro-contracts
description: "Deploy nitro contracts"
repos:
- github.com/cerc-io/go-nitro
- github.com/cerc-io/go-nitro@feat-remove-optimism
containers:
- cerc/nitro-client
pods:

View File

@ -2,7 +2,7 @@ version: "1.0"
name: nitro-node
description: "Nitro node with nitro-rpc-client"
repos:
- github.com/cerc-io/go-nitro
- github.com/cerc-io/go-nitro@feat-remove-optimism
containers:
- cerc/go-nitro
- cerc/nitro-client