From 2793c9e6d7c927ec087b90f9a733db3df59de063 Mon Sep 17 00:00:00 2001 From: Neeraj Date: Mon, 23 Sep 2024 15:20:19 +0530 Subject: [PATCH] Remove optimism references from nitro bridge set up --- ops/deployments-from-scratch.md | 216 ++----------------------------- ops/stage2/nitro-node-config.yml | 6 +- testnet-nitro-node.md | 10 +- 3 files changed, 18 insertions(+), 214 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 60b7bc0..3f26698 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -27,174 +27,9 @@ * laconic-so: see [installation](https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/stack-orchestrator-setup/README.md#setup-stack-orchestrator)
- L2 Optimism + Nitro Contracts Deployment -## L2 Optimism - -* Stack: - -* Source repos: - * - * - -* Target dir: `/srv/op-sepolia/optimism-deployment` - -* Cleanup an existing deployment if required: - - ```bash - cd /srv/op-sepolia - - # Stop the deployment - laconic-so deployment --dir optimism-deployment stop --delete-volumes - - # Remove the deployment dir - sudo rm -rf optimism-deployment - ``` - -### Setup - -* Switch to `testnet-ops/l2-setup` directory on your local machine: - - ```bash - cd testnet-ops/l2-setup - ``` - -* Copy the `l2-vars.example.yml` vars file: - - ```bash - cp l2-vars.example.yml l2-vars.yml - ``` - -* Edit `l2-vars.yml` with required values: - - ```bash - # L1 chain ID (Sepolia: 11155111) - l1_chain_id: "11155111" - - # L1 RPC endpoint - l1_rpc: "http://host.docker.internal:8545" - - # L1 RPC endpoint host or IP address - l1_host: "host.docker.internal" - - # L1 RPC endpoint port number - l1_port: "8545" - - # L1 Beacon endpoint - l1_beacon: "http://host.docker.internal:8001" - - # Account credentials for the Admin account - # Used for Optimism contracts deployment and funding other generated accounts - l1_address: "" - l1_priv_key: "" - ``` - -* Update the target dir in `setup-vars.yml`: - - ```bash - sed -i 's|^l2_directory:.*|l2_directory: /srv/op-sepolia|' setup-vars.yml - - # Will create deployment at /srv/op-sepolia/optimism-deployment - ``` - -### Run - -* Set up and run L2 on remote host by executing `run-optimism.yml` Ansible playbook on your local machine: - - * Create a new `hosts.ini` file: - - ```bash - cp ../hosts.example.ini hosts.ini - ``` - - * Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: - - ```ini - [] - ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' - ``` - - * Replace `` with `l2_host` - * Replace `` with the alias of your choice - * Replace `` with the IP address or hostname of the target machine - * Replace `` with the SSH username (e.g., dev, ubuntu) - - * Verify that you are able to connect to the host using the following command: - - ```bash - ansible all -m ping -i hosts.ini -k - - # Expected output: - # | SUCCESS => { - # "ansible_facts": { - # "discovered_interpreter_python": "/usr/bin/python3.10" - # }, - # "changed": false, - # "ping": "pong" - # } - ``` - - * Execute the `run-optimism.yml` Ansible playbook for remote deployment: - - ```bash - LANG=en_US.utf8 ansible-playbook -i hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host"}' --user $USER -kK - ``` - -* Bridge funds on L2: - - * On the deployment machine, set the following variables: - - ```bash - cd /srv/op-sepolia - - L1_RPC=http://localhost:8545 - L2_RPC=http://op-geth:8545 - - NETWORK=$(grep 'cluster-id' optimism-deployment/deployment.yml | sed 's/cluster-id: //')_default - - DEPLOYMENT_CONTEXT=11155111 - ACCOUNT= - ``` - - * Read the bridge contract address from the L1 deployment records in the `op-node` container: - - ```bash - BRIDGE=$(laconic-so deployment --dir optimism-deployment exec op-node "cat /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json" | jq -r .L1StandardBridgeProxy) - - # Get the funded account's pk - ACCOUNT_PK=$(laconic-so deployment --dir optimism-deployment exec op-node "jq -r '.AdminKey' /l2-accounts/accounts.json") - ``` - - * Check that the starting balance for account on L2 is 0: - - ```bash - docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC" - - # 0 - ``` - - * Use cast to send ETH to the bridge contract: - - ```bash - docker run --rm --network host cerc/optimism-contracts:local "cast send --from $ACCOUNT --value 1ether $BRIDGE --rpc-url $L1_RPC --private-key $ACCOUNT_PK" - ``` - - * Allow a couple minutes for the bridge to complete - - * Check balance on L2: - - ```bash - docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC" - - # 100000000000000000 - ``` - -
- -
- L1 Nitro Contracts Deployment - -## L1 Nitro Contracts Deployment +## Nitro Contracts Deployment * Stack: @@ -303,7 +138,7 @@ ```bash cd /srv/bridge - # Check the l1 nitro contract deployments + # Check the nitro contract deployments laconic-so deployment --dir nitro-contracts-deployment logs nitro-contracts -f ``` @@ -334,7 +169,7 @@ ### Setup -* Execute the following command on deployment machine to get the deployed L1 Nitro contract addresses along with the L1 asset address: +* Execute the following command on deployment machine to get the deployed Nitro contract addresses along with the asset address: ```bash cd /srv/bridge @@ -381,37 +216,20 @@ * Edit `bridge-vars.yml` with required values: ```bash - # L1 WS endpoint - nitro_l1_chain_url: "wss://sepolia.laconic.com" - - # L2 WS endpoint - nitro_l2_chain_url: "wss://optimism.laconic.com" + # WS endpoint + nitro_chain_url: "wss://sepolia.laconic.com" # Private key for bridge Nitro address nitro_sc_pk: "" - # Private key should correspond to a funded account on both L1 and L2, and this account must own the Nitro contracts on L1 - # It also needs to hold L1 tokens to fund Nitro channels and will be used for deploying contracts on L2 + # Private key should correspond to a funded account on L1 and this account must own the Nitro contracts + # It also needs to hold L1 tokens to fund Nitro channels nitro_chain_pk: "" - # L2 chain ID (Optimism: 42069) - optimism_chain_id: "42069" - - # L2 RPC endpoint - optimism_url: "https://optimism.laconic.com" - - # Custom L2 token to be deployed - token_name: "" - token_symbol: "" - intial_token_supply: "" - # Deployed L1 Nitro contract addresses na_address: "" vpa_address: "" ca_address: "" - - # Deployed L1 token address - l1_asset_address: "" ``` * Update the target dir in `setup-vars.yml`: @@ -424,7 +242,7 @@ ### Run -* Deploy L2 contracts and start the bridge on remote host by executing `run-nitro-bridge.yml` Ansible playbook on your local machine: +* Start the bridge on remote host by executing `run-nitro-bridge.yml` Ansible playbook on your local machine: * Create a new `hosts.ini` file: @@ -470,9 +288,6 @@ ```bash cd /srv/bridge - # Check the l2 nitro contract deployments - laconic-so deployment --dir bridge-deployment logs l2-nitro-contracts -f - # Check bridge logs, ensure that the node is running laconic-so deployment --dir bridge-deployment logs nitro-bridge -f ``` @@ -484,15 +299,12 @@ # Create required variables GETH_CHAIN_ID="11155111" - OPTIMISM_CHAIN_ID="42069" export NA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json") export CA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json") export VPA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json") - export L1_ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json") - - export BRIDGE_CONTRACT_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"$OPTIMISM_CHAIN_ID\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json") + export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json") export BRIDGE_NITRO_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-node-info -p 4005 -h nitro-bridge" | jq -r '.SCAddress') @@ -503,13 +315,11 @@ # Create the required config file cat < nitro-node-config.yml - nitro_l1_chain_url: "wss://sepolia.laconic.com" - nitro_l2_chain_url: "wss://optimism.laconic.com" + nitro_chain_url: "wss://sepolia.laconic.com" na_address: "$NA_ADDRESS" ca_address: "$CA_ADDRESS" vpa_address: "$VPA_ADDRESS" - l1_asset_address: "${L1_ASSET_ADDRESS}" - bridge_contract_address: "$BRIDGE_CONTRACT_ADDRESS" + asset_address: "${ASSET_ADDRESS}" bridge_nitro_address: "$BRIDGE_NITRO_ADDRESS" nitro_l1_bridge_multiaddr: "$L1_BRIDGE_MULTIADDR" nitro_l2_bridge_multiaddr: "$L2_BRIDGE_MULTIADDR" @@ -1198,8 +1008,6 @@ https://loro-console.laconic.com -> 4001 # Machine 2 https://sepolia.laconic.com -> 8545 wss://sepolia.laconic.com -> 8546 -https://optimism.laconic.com -> 9545 -wss://optimism.laconic.com -> 9546 bridge.laconic.com Open ports: diff --git a/ops/stage2/nitro-node-config.yml b/ops/stage2/nitro-node-config.yml index 867afe5..50aa188 100644 --- a/ops/stage2/nitro-node-config.yml +++ b/ops/stage2/nitro-node-config.yml @@ -1,10 +1,8 @@ -nitro_l1_chain_url: "wss://sepolia.laconic.com" -nitro_l2_chain_url: "wss://optimism.laconic.com" +nitro_chain_url: "wss://sepolia.laconic.com" na_address: "0xfD5276DDfE0E7738Af5F3dA0dE58D36560BbE544" ca_address: "0xC71F47d58d521aE24FDf5e324969aCD6f83b6Ff8" vpa_address: "0xEA55dEab3718CF4d084a94Fe4C0D750a80Eb1F2C" -l1_asset_address: "0xa4351114dAE1aBEb2d552d441C9733c72682a45D" -bridge_contract_address: "0x0fCC47652bd8Fa5ED4192DD6238B4d523B34D724" +asset_address: "0xa4351114dAE1aBEb2d552d441C9733c72682a45D" bridge_nitro_address: "0xf0E6a85C6D23AcA9ff1b83477D426ed26F218185" nitro_l1_bridge_multiaddr: "/dns4/bridge.laconic.com/tcp/3005/p2p/16Uiu2HAky2PYTfBNHpytybz4ADY9n7boiLgK5btJpTrGVbWC3diZ" nitro_l2_bridge_multiaddr: "/dns4/bridge.laconic.com/tcp/3006/p2p/16Uiu2HAky2PYTfBNHpytybz4ADY9n7boiLgK5btJpTrGVbWC3diZ" diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index c31f84b..997c0f7 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -31,13 +31,11 @@ # Expected variables in the fetched config file: - # nitro_l1_chain_url: "" - # nitro_l2_chain_url: "" + # nitro_chain_url: "" # na_address: "" # ca_address: "" # vpa_address: "" - # l1_asset_address: "" - # bridge_contract_address: "" + # asset_address: "" # bridge_nitro_address: "" # nitro_l1_bridge_multiaddr: "" # nitro_l2_bridge_multiaddr: "" @@ -186,7 +184,7 @@ Create a ledger channel with the bridge on L1 which is mirrored on L2 cd $DEPLOYMENTS_DIR/nitro-node export BRIDGE_NITRO_ADDRESS=$(yq eval '.bridge_nitro_address' nitro-node-config.yml) - export L1_ASSET_ADDRESS=$(yq eval '.l1_asset_address' nitro-node-config.yml) + export ASSET_ADDRESS=$(yq eval '.asset_address' nitro-node-config.yml) ``` * Check that check that you have no existing channels on L1 or L2: @@ -205,7 +203,7 @@ Create a ledger channel with the bridge on L1 which is mirrored on L2 # Set amount to ledger LEDGER_AMOUNT=1000000 - laconic-so deployment --dir l1-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_NITRO_ADDRESS --assetAddress $L1_ASSET_ADDRESS --alphaAmount $LEDGER_AMOUNT --betaAmount $LEDGER_AMOUNT -p 4005 -h nitro-node" + laconic-so deployment --dir l1-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_NITRO_ADDRESS --assetAddress $ASSET_ADDRESS --alphaAmount $LEDGER_AMOUNT --betaAmount $LEDGER_AMOUNT -p 4005 -h nitro-node" # Follow your L1 Nitro node logs for progress