From a6cfdf5325ffeba4bad5fe105604061943acc651 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Mon, 2 Sep 2024 18:17:19 +0530 Subject: [PATCH 01/22] Add instructions to setup and run L2 deployment from scratch --- ops/deployments-from-scratch.md | 90 +++++++++++++++++++++++++++++++++ scripts/package.json | 3 +- 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 58dcf12..9274405 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -10,6 +10,96 @@ cd /srv ``` +
+ L2 Optimism + +## L2 Optimism + +* Stack: + +* Source repos: + * + * + +* Target dir: `/srv/l2/optimism-deployment` + +* Cleanup an existing deployment if required: + + ```bash + cd /srv/l2 + + # Stop the deployment + laconic-so deployment --dir optimism-deployment stop --delete-volumes + + # Remove the deployment dir + sudo rm -rf optimism-deployment + ``` + +### Prerequisites + +* Ansible: see [installation](https://git.vdb.to/cerc-io/ops#installation) + +### Setup + +* Clone the `cerc-io/testnet-ops` repository: + + ```bash + git clone git@git.vdb.to:cerc-io/testnet-ops.git + + cd testnet-ops/l2-setup + ``` + +* Edit `l2-config.env.j2` and fill in the following values: + + ```bash + # Chain ID of the L1 chain (Sepolia: 11155111) + CERC_L1_CHAIN_ID=11155111 + + # L1 RPC endpoint + CERC_L1_RPC= + + # L1 RPC endpoint host or IP address + CERC_L1_HOST= + + # L1 RPC endpoint port number + CERC_L1_PORT= + + # Account credentials for the Admin account + # Used for Optimism contracts deployment and funding other generated accounts + CERC_L1_ADDRESS= + CERC_L1_PRIV_KEY= + + # Funding amount for Optimism Proposer account on L1 (default: 0.2 ether) + CERC_L2_PROPOSER_AMOUNT= + + # Funding amount for Optimism Batcher account on L1 (default: 0.1 ether) + CERC_L2_BATCHER_AMOUNT= + ``` + +* Update the target dir in `vars.yml`: + + ```bash + sed -i 's|^l2_directory:.*|l2_directory: /srv/l2|' vars.yml + + # Will create deployment at /srv/l2/optimism-deployment + ``` + +### Run + +* Setup and run L2 by executing the `run-optimism.yml` Ansible playbook: + + ```bash + LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{ "target_host": "localhost"}' --user $USER + ``` + + * For skipping container build, run with `"skip_container_build" : true`: + + ```bash + LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER + ``` + +
+
stage0 laconicd diff --git a/scripts/package.json b/scripts/package.json index fb8c8f1..c9c5d7e 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -22,7 +22,8 @@ }, "scripts": { "build": "tsc", - "map-subscribers-to-participants": "node dist/map-subscribers-to-participants.js" + "map-subscribers-to-participants": "node dist/map-subscribers-to-participants.js", + "participants-with-filtered-validators": "node dist/participants-with-filtered-validators.js" }, "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447" } -- 2.45.2 From aa656e828d831356ad78215105532f76f4ce67f4 Mon Sep 17 00:00:00 2001 From: Neeraj Date: Mon, 2 Sep 2024 18:24:40 +0530 Subject: [PATCH 02/22] Add README to run nitro node --- ops/nitro-node.md | 85 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 ops/nitro-node.md diff --git a/ops/nitro-node.md b/ops/nitro-node.md new file mode 100644 index 0000000..13e5a11 --- /dev/null +++ b/ops/nitro-node.md @@ -0,0 +1,85 @@ +# Run nitro-nodes + +## Setup + +- Follow the [installation guide](https://github.com/deep-stack/ops/blob/ag-run-l2/README.md#installation) to setup ansible on your machine + +- Ensure laconic-so is installed + + ```bash + laconic-so version + ``` + +- Clone the ops repo + + ```bash + git clone git@github.com:deep-stack/ops.git + cd ops + git checkout ag-run-l2 + ``` + + +## Run l1, l2 nitro nodes + +- Navigate to the `vulcanize/nitro-node-setup` directory + + ```bash + cd vulcanize/nitro-node-setup + ``` + +- Copy the `nitro-vars-example.yml` vars file + + ```bash + cp nitro-vars-example.yml nitro-vars.yml + ``` + + +- Edit [`nitro-vars.yml`](./nitro-vars.yml) and fill in the following values + + ```bash + # URL endpoint of the L1 chain + l1_nitro_chain_url: "" + + # URL endpoint of the L2 chain + l2_nitro_chain_url: "" + + # Private key for your nitro address + nitro_sc_pk: "" + + # Private key of the account on chain that is used for funding channels in Nitro node + nitro_chain_pk: "" + + # Contract address of NitroAdjudicator + na_address: "" + + # Contract address of VirtualPaymentApp + vpa_address: "" + + # Contract address of ConsensusApp + ca_address: "" + + # Contract address of bridge + bridge_address: "" + + # IP address of the bridge node + nitro_bridge_ip: "" + + # Publically accessible IP address of your nitro node + nitro_node_ip: "" + ``` + +- To run nitro nodes, execute the `run-nitro-node.yml` Ansible playbook by running the following command. + + NOTE: By default, deployments are created in the `nitro-node-setup/out` directory. If you need to change this location, you can update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. + + ```bash + LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost"}' --user $USER + ``` + + - If you want to skip building the containers, set `"skip_container_build" : true` in the `--extra-vars` parameter: + + ```bash + LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER + ``` + +- Follow steps from [Demo](https://git.vdb.to/cerc-io/nitro-stack/src/branch/main/nitro-bridge-demo.md#demo) to create mirror channels on L2, create virtual channel and make payments -- 2.45.2 From 21bafbfd4b902cf05e7a7825f7e65510e04e2bba Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 3 Sep 2024 14:47:18 +0530 Subject: [PATCH 03/22] Add instructions for running a testnet Nitro node --- ops/deployments-from-scratch.md | 8 ++- ops/nitro-node.md | 85 --------------------------- testnet-nitro-node.md | 101 ++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 88 deletions(-) delete mode 100644 ops/nitro-node.md create mode 100644 testnet-nitro-node.md diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 9274405..293fdb6 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -37,7 +37,9 @@ ### Prerequisites -* Ansible: see [installation](https://git.vdb.to/cerc-io/ops#installation) +* laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install) + +* Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation) ### Setup @@ -89,13 +91,13 @@ * Setup and run L2 by executing the `run-optimism.yml` Ansible playbook: ```bash - LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{ "target_host": "localhost"}' --user $USER + LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{ "target_host": "localhost"}' --user $USER ``` * For skipping container build, run with `"skip_container_build" : true`: ```bash - LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER ```
diff --git a/ops/nitro-node.md b/ops/nitro-node.md deleted file mode 100644 index 13e5a11..0000000 --- a/ops/nitro-node.md +++ /dev/null @@ -1,85 +0,0 @@ -# Run nitro-nodes - -## Setup - -- Follow the [installation guide](https://github.com/deep-stack/ops/blob/ag-run-l2/README.md#installation) to setup ansible on your machine - -- Ensure laconic-so is installed - - ```bash - laconic-so version - ``` - -- Clone the ops repo - - ```bash - git clone git@github.com:deep-stack/ops.git - cd ops - git checkout ag-run-l2 - ``` - - -## Run l1, l2 nitro nodes - -- Navigate to the `vulcanize/nitro-node-setup` directory - - ```bash - cd vulcanize/nitro-node-setup - ``` - -- Copy the `nitro-vars-example.yml` vars file - - ```bash - cp nitro-vars-example.yml nitro-vars.yml - ``` - - -- Edit [`nitro-vars.yml`](./nitro-vars.yml) and fill in the following values - - ```bash - # URL endpoint of the L1 chain - l1_nitro_chain_url: "" - - # URL endpoint of the L2 chain - l2_nitro_chain_url: "" - - # Private key for your nitro address - nitro_sc_pk: "" - - # Private key of the account on chain that is used for funding channels in Nitro node - nitro_chain_pk: "" - - # Contract address of NitroAdjudicator - na_address: "" - - # Contract address of VirtualPaymentApp - vpa_address: "" - - # Contract address of ConsensusApp - ca_address: "" - - # Contract address of bridge - bridge_address: "" - - # IP address of the bridge node - nitro_bridge_ip: "" - - # Publically accessible IP address of your nitro node - nitro_node_ip: "" - ``` - -- To run nitro nodes, execute the `run-nitro-node.yml` Ansible playbook by running the following command. - - NOTE: By default, deployments are created in the `nitro-node-setup/out` directory. If you need to change this location, you can update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. - - ```bash - LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost"}' --user $USER - ``` - - - If you want to skip building the containers, set `"skip_container_build" : true` in the `--extra-vars` parameter: - - ```bash - LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER - ``` - -- Follow steps from [Demo](https://git.vdb.to/cerc-io/nitro-stack/src/branch/main/nitro-bridge-demo.md#demo) to create mirror channels on L2, create virtual channel and make payments diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md new file mode 100644 index 0000000..4cbbd90 --- /dev/null +++ b/testnet-nitro-node.md @@ -0,0 +1,101 @@ +# testnet-nitro-node + +## Prerequisites + +* laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install) + +* Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation) + +* Check versions to verify installation: + + ```bash + laconic-so version + + ansible --version + ``` + +## Setup + +* Clone the `cerc-io/testnet-ops` repository: + + ```bash + git clone git@git.vdb.to:cerc-io/testnet-ops.git + + cd testnet-ops/nitro-node-setup + ``` + +* Fetch the required Nitro node config: + + ```bash + wget -O nitro-vars.yml https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/stage2/nitro-node-config.yml + ``` + +* TODO: Get Laconic tokens on your address + +* Edit `nitro-vars.yml` and fill in the following values: + + ```bash + # L1 RPC endpoint + l1_nitro_chain_url: "" + + # Private key for your Nitro address + nitro_sc_pk: "" + + # Private key for a funded account on L1 + # This account should have Laconic tokens for funding your Nitro channels + nitro_chain_pk: "" + + # Multiaddr with publically accessible IP address / DNS for your nitro node + # Example: "/ip4/192.168.x.y/tcp/3009" + # Example: "/dns4/example.com/tcp/3009" + nitro_node_multiaddr: "" + ``` + +* Update the target dir in `setup-vars.yml`: + + ```bash + DEPLOYMENTS_DIR= + sed -i "s|^nitro_directory:.*|nitro_directory: $DEPLOYMENTS_DIR/nitro-node|" setup-vars.yml + + # Will create deployments at $DEPLOYMENTS_DIR/nitro-node/l1-nitro-deployment and $DEPLOYMENTS_DIR/nitro-node/l2-nitro-deployment + ``` + +## Run + +* Setup and run a Nitro node (L1+L2) by executing the `run-nitro-node.yml` Ansible playbook: + + ```bash + LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost"}' --user $USER + ``` + + * For skipping container build, run with `"skip_container_build" : true`: + + ```bash + LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER + ``` + +### Clean up + +* Switch to deployments dir: + + ```bash + cd $DEPLOYMENTS_DIR/nitro-node + ``` + +* Stop all Nitro services running in the background: + + ```bash + laconic-so deployment --dir l1-nitro-deployment stop + laconic-so deployment --dir l2-nitro-deployment stop + ``` + +* To stop all services and also delete data: + + ```bash + laconic-so deployment --dir l1-nitro-deployment stop --delete-volumes + laconic-so deployment --dir l2-nitro-deployment stop --delete-volumes + + # Remove deployment directories (deployments will have to be recreated for a re-run) + sudo rm -r l1-nitro-deployment + sudo rm -r l2-nitro-deployment + ``` -- 2.45.2 From 5ad781d2581fea1e91665b80521865b7da79de77 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 3 Sep 2024 15:40:29 +0530 Subject: [PATCH 04/22] Fix L2 config file path in instructions --- ops/deployments-from-scratch.md | 2 +- testnet-nitro-node.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 293fdb6..ca33dd1 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -51,7 +51,7 @@ cd testnet-ops/l2-setup ``` -* Edit `l2-config.env.j2` and fill in the following values: +* Edit `templates/configs/l2-config.env` and fill in the following values: ```bash # Chain ID of the L1 chain (Sepolia: 11155111) diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index 4cbbd90..560f805 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -54,7 +54,9 @@ * Update the target dir in `setup-vars.yml`: ```bash + # Set path to desired deployments dir DEPLOYMENTS_DIR= + sed -i "s|^nitro_directory:.*|nitro_directory: $DEPLOYMENTS_DIR/nitro-node|" setup-vars.yml # Will create deployments at $DEPLOYMENTS_DIR/nitro-node/l1-nitro-deployment and $DEPLOYMENTS_DIR/nitro-node/l2-nitro-deployment -- 2.45.2 From ed0b13ce31ee8fee699232524583b070931a23be Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 3 Sep 2024 19:34:08 +0530 Subject: [PATCH 05/22] Add instructions to setup and run Nitro bridge deployment --- README.md | 4 + ops/deployments-from-scratch.md | 125 ++++++++++++++++++++++++++++++-- testnet-nitro-node.md | 2 +- 3 files changed, 123 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 388d85b..34923f0 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,7 @@ Stacks to run a node for laconic testnet ## Join LORO testnet Follow steps in [testnet-onboarding-validator.md](./testnet-onboarding-validator.md) to onboard your participant and join as a validator on the LORO testnet + +## Run Testnet Nitro Node + +Follow steps in [testnet-nitro-node.md](./testnet-nitro-node.md) to run you Nitro node for the testnet diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index ca33dd1..3fadedf 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -10,6 +10,20 @@ cd /srv ``` +### Prerequisites + +* laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install) + +* Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation) + +* Check versions to verify installation: + + ```bash + laconic-so version + + ansible --version + ``` +
L2 Optimism @@ -35,17 +49,12 @@ sudo rm -rf optimism-deployment ``` -### Prerequisites - -* laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install) - -* Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation) - ### Setup * Clone the `cerc-io/testnet-ops` repository: ```bash + cd /srv git clone git@git.vdb.to:cerc-io/testnet-ops.git cd testnet-ops/l2-setup @@ -54,7 +63,7 @@ * Edit `templates/configs/l2-config.env` and fill in the following values: ```bash - # Chain ID of the L1 chain (Sepolia: 11155111) + # L1 chain ID (Sepolia: 11155111) CERC_L1_CHAIN_ID=11155111 # L1 RPC endpoint @@ -66,6 +75,9 @@ # L1 RPC endpoint port number CERC_L1_PORT= + # L1 Beacon endpoint + CERC_L1_BEACON= + # Account credentials for the Admin account # Used for Optimism contracts deployment and funding other generated accounts CERC_L1_ADDRESS= @@ -102,6 +114,105 @@
+
+ Nitro Bridge + +## Nitro Bridge + +* Stack: + +* Source repos: + +* Target dir: `/srv/bridge/bridge-deployment` + +* Cleanup an existing deployment if required: + + ```bash + cd /srv/bridge + + # Stop the deployment + laconic-so deployment --dir bridge-deployment stop --delete-volumes + + # Remove the deployment dir + sudo rm -rf bridge-deployment + ``` + +### Setup + +* Clone the `cerc-io/testnet-ops` repository: + + ```bash + cd /srv + + # Can be skipped if repo already exists + git clone git@git.vdb.to:cerc-io/testnet-ops.git + + cd testnet-ops/nitro-bridge-setup + ``` + +* Create the required vars file: + + ```bash + cp bridge-vars-example.yml bridge-vars.yml + ``` + +* Edit `bridge-vars.yml` and fill in the following values: + + ```bash + # L1 WS endpoint + l1_nitro_chain_url: "" + + # L2 WS endpoint + l2_nitro_chain_url: '' + + # Private key for your Nitro address + nitro_sc_pk: "" + + # Private key for a funded account on L1 + # This account should have Laconic tokens for funding Nitro channels + nitro_chain_pk: "" + + # L1 chain ID (Sepolia: 11155111) + geth_chain_id: "11155111" + + # L1 RPC endpoint + geth_url: "" + + # L2 RPC endpoint + optimism_url: "" + + # Private key for a funded account on L1 to use for contracts deployment on L1 + geth_deployer_pk: '' + + # Private key for a funded account on L2 to use for contracts deployment on L2 + # Use the same account for L1 and L2 deployments + optimism_deployer_pk: '' + ``` + +* Update the target dir in `setup-vars.yml`: + + ```bash + sed -i 's|^nitro_directory:.*|nitro_directory: /srv/bridge|' vars.yml + + # Will create deployment at /srv/bridge/bridge-deployment + ``` + +### Run + +* Setup and run L2 by executing the `run-nitro-bridge.yml` Ansible playbook: + + ```bash + LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost"}' --user $USER + ``` + + * For skipping container build, run with `"skip_container_build" : true`: + + ```bash + LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-bridge.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER + ``` + +
+
stage0 laconicd diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index 560f805..0ed4d4a 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -35,7 +35,7 @@ * Edit `nitro-vars.yml` and fill in the following values: ```bash - # L1 RPC endpoint + # L1 WS endpoint l1_nitro_chain_url: "" # Private key for your Nitro address -- 2.45.2 From 1bf0066234e2793f565bc3711c8473c63eafb10f Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 5 Sep 2024 09:10:54 +0530 Subject: [PATCH 06/22] Update instructions L2 and bridge setup --- ops/deployments-from-scratch.md | 42 ++++++++++++++------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 3fadedf..7e1c946 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -60,40 +60,34 @@ cd testnet-ops/l2-setup ``` -* Edit `templates/configs/l2-config.env` and fill in the following values: +* Edit `l2-vars.yml` with required values: ```bash # L1 chain ID (Sepolia: 11155111) - CERC_L1_CHAIN_ID=11155111 + l1_chain_id: "11155111" # L1 RPC endpoint - CERC_L1_RPC= + l1_rpc: "" # L1 RPC endpoint host or IP address - CERC_L1_HOST= + l1_host: "" # L1 RPC endpoint port number - CERC_L1_PORT= + l1_port: "" # L1 Beacon endpoint - CERC_L1_BEACON= + l1_beacon: "" # Account credentials for the Admin account # Used for Optimism contracts deployment and funding other generated accounts - CERC_L1_ADDRESS= - CERC_L1_PRIV_KEY= - - # Funding amount for Optimism Proposer account on L1 (default: 0.2 ether) - CERC_L2_PROPOSER_AMOUNT= - - # Funding amount for Optimism Batcher account on L1 (default: 0.1 ether) - CERC_L2_BATCHER_AMOUNT= + l1_address: "" + l1_priv_key: "" ``` -* Update the target dir in `vars.yml`: +* Update the target dir in `setup-vars.yml`: ```bash - sed -i 's|^l2_directory:.*|l2_directory: /srv/l2|' vars.yml + sed -i 's|^l2_directory:.*|l2_directory: /srv/l2|' setup-vars.yml # Will create deployment at /srv/l2/optimism-deployment ``` @@ -156,16 +150,16 @@ cp bridge-vars-example.yml bridge-vars.yml ``` -* Edit `bridge-vars.yml` and fill in the following values: +* Edit `bridge-vars.yml` with required values: ```bash # L1 WS endpoint - l1_nitro_chain_url: "" + nitro_l1_chain_url: "" # L2 WS endpoint - l2_nitro_chain_url: '' + nitro_l2_chain_url: "" - # Private key for your Nitro address + # Private key for bridge Nitro address nitro_sc_pk: "" # Private key for a funded account on L1 @@ -181,12 +175,12 @@ # L2 RPC endpoint optimism_url: "" - # Private key for a funded account on L1 to use for contracts deployment on L1 - geth_deployer_pk: '' + # Private key for a funded account for L1 contracts deployment + geth_deployer_pk: "" - # Private key for a funded account on L2 to use for contracts deployment on L2 + # Private key for a funded account for L2 contracts deployment # Use the same account for L1 and L2 deployments - optimism_deployer_pk: '' + optimism_deployer_pk: "" ``` * Update the target dir in `setup-vars.yml`: -- 2.45.2 From 2c7077d2f785ee8683c1a87ca47e784f6dec412a Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 5 Sep 2024 12:36:41 +0530 Subject: [PATCH 07/22] Fill in values for L2 deployment config --- ops/deployments-from-scratch.md | 18 +++++++++--------- testnet-nitro-node.md | 28 ++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 7e1c946..3070555 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -10,7 +10,7 @@ cd /srv ``` -### Prerequisites +## Prerequisites * laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install) @@ -35,12 +35,12 @@ * * -* Target dir: `/srv/l2/optimism-deployment` +* Target dir: `/srv/op-sepolia/optimism-deployment` * Cleanup an existing deployment if required: ```bash - cd /srv/l2 + cd /srv/op-sepolia # Stop the deployment laconic-so deployment --dir optimism-deployment stop --delete-volumes @@ -67,16 +67,16 @@ l1_chain_id: "11155111" # L1 RPC endpoint - l1_rpc: "" + l1_rpc: "http://host.docker.internal:8545" # L1 RPC endpoint host or IP address - l1_host: "" + l1_host: "host.docker.internal" # L1 RPC endpoint port number - l1_port: "" + l1_port: "8545" # L1 Beacon endpoint - l1_beacon: "" + l1_beacon: "http://host.docker.internal:8001" # Account credentials for the Admin account # Used for Optimism contracts deployment and funding other generated accounts @@ -87,9 +87,9 @@ * Update the target dir in `setup-vars.yml`: ```bash - sed -i 's|^l2_directory:.*|l2_directory: /srv/l2|' setup-vars.yml + sed -i 's|^l2_directory:.*|l2_directory: /srv/op-sepolia|' setup-vars.yml - # Will create deployment at /srv/l2/optimism-deployment + # Will create deployment at /srv/op-sepolia/optimism-deployment ``` ### Run diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index 0ed4d4a..3ff45e7 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -28,16 +28,25 @@ ```bash wget -O nitro-vars.yml https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/stage2/nitro-node-config.yml + + # Expected variables in the fetched config file: + + # nitro_l1_chain_url: "" + # nitro_l2_chain_url: "" + # na_address: "" + # vpa_address: "" + # ca_address: "" + # bridge_contract_address: "" + # bridge_nitro_address: "" + # nitro_l1_bridge_multiaddr: "" + # nitro_l2_bridge_multiaddr: "" ``` * TODO: Get Laconic tokens on your address -* Edit `nitro-vars.yml` and fill in the following values: +* Edit `nitro-vars.yml` and add the following variables: ```bash - # L1 WS endpoint - l1_nitro_chain_url: "" - # Private key for your Nitro address nitro_sc_pk: "" @@ -45,10 +54,17 @@ # This account should have Laconic tokens for funding your Nitro channels nitro_chain_pk: "" - # Multiaddr with publically accessible IP address / DNS for your nitro node + # Multiaddr with publically accessible IP address / DNS for your L1 nitro node + # Use port 3007 + # Example: "/ip4/192.168.x.y/tcp/3007" + # Example: "/dns4/example.com/tcp/3007" + nitro_l1_ext_multiaddr: "" + + # Multiaddr with publically accessible IP address / DNS for your L2 nitro node + # Use port 3009 # Example: "/ip4/192.168.x.y/tcp/3009" # Example: "/dns4/example.com/tcp/3009" - nitro_node_multiaddr: "" + nitro_l2_ext_multiaddr: "" ``` * Update the target dir in `setup-vars.yml`: -- 2.45.2 From 776f91468e3cad06d44292008b320fa812ff4367 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 5 Sep 2024 13:12:09 +0530 Subject: [PATCH 08/22] Add steps to create the required config for Nitro nodes --- ops/deployments-from-scratch.md | 58 ++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 3070555..d2715aa 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -154,10 +154,10 @@ ```bash # L1 WS endpoint - nitro_l1_chain_url: "" + nitro_l1_chain_url: "wss://sepolia.laconic.com" # L2 WS endpoint - nitro_l2_chain_url: "" + nitro_l2_chain_url: "wss://optimism.laconic.com" # Private key for bridge Nitro address nitro_sc_pk: "" @@ -170,10 +170,10 @@ geth_chain_id: "11155111" # L1 RPC endpoint - geth_url: "" + geth_url: "https://sepolia.laconic.com" # L2 RPC endpoint - optimism_url: "" + optimism_url: "https://optimism.laconic.com" # Private key for a funded account for L1 contracts deployment geth_deployer_pk: "" @@ -188,7 +188,7 @@ ```bash sed -i 's|^nitro_directory:.*|nitro_directory: /srv/bridge|' vars.yml - # Will create deployment at /srv/bridge/bridge-deployment + # Will create deployment at /srv/bridge/nitro-contracts-deployment and /srv/bridge/bridge-deployment ``` ### Run @@ -205,6 +205,54 @@ LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-bridge.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER ``` +* Check status: + + ```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 + ``` + +* Create Nitro node config for users: + + ```bash + cd /srv/bridge + + # 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 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") + + # TODO + export BRIDGE_NITRO_ADDRESS= + export L1_BRIDGE_MULTIADDR= + export L2_BRIDGE_MULTIADDR= + + # 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" + na_address: "$NA_ADDRESS" + ca_address: "$CA_ADDRESS" + vpa_address: "$VPA_ADDRESS" + bridge_contract_address: "$BRIDGE_CONTRACT_ADDRESS" + bridge_nitro_address: "$BRIDGE_NITRO_ADDRESS" + nitro_l1_bridge_multiaddr: "$L1_BRIDGE_MULTIADDR" + nitro_l2_bridge_multiaddr: "$L2_BRIDGE_MULTIADDR" + EOF + ``` + + The required config file should be generated at `/srv/bridge/nitro-node-config.yml` +
-- 2.45.2 From 2039ad645df2df569d396127db6361bd86e6d32d Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 5 Sep 2024 17:08:25 +0530 Subject: [PATCH 09/22] Add instructions for users to create ledger channel --- ops/deployments-from-scratch.md | 8 ++- testnet-nitro-node.md | 117 +++++++++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 5 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index d2715aa..96453b5 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -234,10 +234,12 @@ # TODO export BRIDGE_NITRO_ADDRESS= - export L1_BRIDGE_MULTIADDR= - export L2_BRIDGE_MULTIADDR= + export BRIDGE_PEER_ID= - # Create the required config file: + export L1_BRIDGE_MULTIADDR="/dns4/bridge.laconic.com/tcp/3005/p2p/$BRIDGE_PEER_ID" + export L2_BRIDGE_MULTIADDR="/dns4/bridge.laconic.com/tcp/3006/p2p/$BRIDGE_PEER_ID" + + # 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" diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index 3ff45e7..d201370 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -6,12 +6,16 @@ * Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation) +* yq: see [installation](https://github.com/mikefarah/yq#install) + * Check versions to verify installation: ```bash laconic-so version ansible --version + + yq --version ``` ## Setup @@ -34,8 +38,9 @@ # nitro_l1_chain_url: "" # nitro_l2_chain_url: "" # na_address: "" - # vpa_address: "" # ca_address: "" + # vpa_address: "" + # l1_asset_address: "" # bridge_contract_address: "" # bridge_nitro_address: "" # nitro_l1_bridge_multiaddr: "" @@ -92,7 +97,115 @@ LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER ``` -### Clean up +* Check status: + + ```bash + cd $DEPLOYMENTS_DIR + + # Check the logs, ensure that the nodes are running + laconic-so deployment --dir l1-nitro-deployment logs nitro-node -f + laconic-so deployment --dir l2-nitro-deployment logs nitro-node -f + ``` + +## Create Channels + +* Create a ledger channel with the bridge on L1 that gets mirrored on L2 + +* Set required variables: + + ```bash + cd $DEPLOYMENTS_DIR + + # Fetch the required Nitro node config + wget https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/stage2/nitro-node-config.yml + + export BRIDGE_NITRO_ADDRESS=$(yq eval '.bridge_contract_address' nitro-node-config.yml) + export L1_ASSET_ADDRESS=$(yq eval '.l1_asset_address' nitro-node-config.yml) + ``` + +* Check that check that you have no existing channels on L1 or L2: + + ```bash + laconic-so deployment --dir l1-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-all-ledger-channels -p 4005 -h nitro-node" + laconic-so deployment --dir l2-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-all-ledger-channels -p 4005 -h nitro-node" + + # Expected output: + # [] + ``` + +* Create a ledger channel between your L1 Nitro node and Bridge with custom asset: + + ```bash + # 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" + + # Follow your L1 Nitro node logs for progress + + # Expected Output: + # Objective started DirectFunding-0x161d289a50222caa781db215bb82a3ede4f557217742245525b8e8cbff04ec21 + # Channel Open 0x161d289a50222caa781db215bb82a3ede4f557217742245525b8e8cbff04ec21 + + # Set the resulting ledger channel id in a variable + export LEDGER_CHANNEL_ID= + ``` + + * Check the [Troubleshooting](#troubleshooting) section if command to create a ledger channel fails or gets stuck + +* Once direct-fund objective is complete, the bridge will create a mirrored channel on L2 + +* Check L2 Nitro node's logs to see that a bridged-fund objective completed: + + ```bash + laconic-so deployment --dir l2-nitro-deployment logs nitro-node -f --tail 30 + + # Expected Output: + # nitro-node-1 | 5:01AM INF INFO Objective cranked address=0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce objective-id=bridgedfunding-0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179 waiting-for=WaitingForNothing + # nitro-node-1 | 5:01AM INF INFO Objective is complete & returned to API address=0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce objective-id=bridgedfunding-0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179 + ``` + +* Check status of L1 ledger channel with the bridge using channel id: + + ```bash + laconic-so deployment --dir l1-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-ledger-channel $LEDGER_CHANNEL_ID -p 4005 -h nitro-node" + + # Expected output: + # { + # ID: '0x161d289a50222caa781db215bb82a3ede4f557217742245525b8e8cbff04ec21', + # Status: 'Open', + # Balance: { + # AssetAddress: '', + # Me: '', + # Them: '', + # MyBalance: 1000000n, + # TheirBalance: 1000000n + # }, + # ChannelMode: 'Open' + # } + ``` + +* Check status of the mirrored channel on L2: + + ```bash + laconic-so deployment --dir l2-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-all-ledger-channels -p 4005 -h nitro-node" + + # Expected output: + # { + # ID: '0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179', + # Status: 'Open', + # Balance: { + # AssetAddress: '', + # Me: '', + # Them: '', + # MyBalance: 1000000n, + # TheirBalance: 1000000n + # }, + # ChannelMode: 'Open' + # } + ``` + +## Clean up * Switch to deployments dir: -- 2.45.2 From cdf26a0014e3846f61b89fbaab529b492552ffde Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 5 Sep 2024 17:47:39 +0530 Subject: [PATCH 10/22] Add troubleshooting steps --- ops/deployments-from-scratch.md | 3 ++ testnet-nitro-node.md | 60 +++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 96453b5..a232876 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -230,6 +230,8 @@ 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") # TODO @@ -246,6 +248,7 @@ na_address: "$NA_ADDRESS" ca_address: "$CA_ADDRESS" vpa_address: "$VPA_ADDRESS" + l1_asset_address: "${L1_ASSET_ADDRESS}" bridge_contract_address: "$BRIDGE_CONTRACT_ADDRESS" bridge_nitro_address: "$BRIDGE_NITRO_ADDRESS" nitro_l1_bridge_multiaddr: "$L1_BRIDGE_MULTIADDR" diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index d201370..4079c73 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -178,8 +178,8 @@ # AssetAddress: '', # Me: '', # Them: '', - # MyBalance: 1000000n, - # TheirBalance: 1000000n + # MyBalance: n, + # TheirBalance: n # }, # ChannelMode: 'Open' # } @@ -191,18 +191,20 @@ laconic-so deployment --dir l2-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-all-ledger-channels -p 4005 -h nitro-node" # Expected output: - # { - # ID: '0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179', - # Status: 'Open', - # Balance: { - # AssetAddress: '', - # Me: '', - # Them: '', - # MyBalance: 1000000n, - # TheirBalance: 1000000n - # }, - # ChannelMode: 'Open' - # } + # [ + # { + # "ID": "0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179", + # "Status": "Open", + # "Balance": { + # "AssetAddress": "", + # "Me": "", + # "Them": "", + # "MyBalance": n, + # "TheirBalance": n + # }, + # "ChannelMode": "Open" + # } + # ] ``` ## Clean up @@ -230,3 +232,33 @@ sudo rm -r l1-nitro-deployment sudo rm -r l2-nitro-deployment ``` + +## Troubleshooting + +* Stop (`Ctrl+C`) the direct-fund command if it is stuck + +* Restart the L1 Nitro node: + + * Stop the deployment: + + ```bash + cd $DEPLOYMENTS_DIR + + laconic-so deployment --dir l1-nitro-deployment stop + ``` + + * Reset the node's durable store: + + ```bash + sudo rm -rf l1-nitro-deployment/data/nitro_node_data + + mkdir l1-nitro-deployment/data/nitro_node_data + ``` + + * Restart the deployment: + + ```bash + laconic-so deployment --dir l1-nitro-deployment start + ``` + +* Retry the ledger channel creation command -- 2.45.2 From 7067208d2a6d1a464ff8b048382986ff88960b61 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Mon, 9 Sep 2024 12:19:29 +0530 Subject: [PATCH 11/22] Add instructions to bridge funds on L2 --- ops/deployments-from-scratch.md | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index a232876..7badfc0 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -106,6 +106,55 @@ LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER ``` +* Bridge funds on L2: + + * Set the following variables: + + ```bash + cd /srv/op-sepolia + + L1_RPC=http://host.docker.internal:8545 + L2_RPC=http://host.docker.internal:9545 + + NETWORK= + + 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 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 + ``` +
-- 2.45.2 From db67b2fe3b7803b4a3dee89e3400f58ad3d82444 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 10 Sep 2024 16:20:51 +0530 Subject: [PATCH 12/22] Add details for users Nitro account --- ops/deployments-from-scratch.md | 2 +- testnet-nitro-node.md | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 7badfc0..e2d19d1 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -212,7 +212,7 @@ nitro_sc_pk: "" # Private key for a funded account on L1 - # This account should have Laconic tokens for funding Nitro channels + # This account should have L1 tokens for funding Nitro channels nitro_chain_pk: "" # L1 chain ID (Sepolia: 11155111) diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index 4079c73..b5e68e8 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -47,16 +47,17 @@ # nitro_l2_bridge_multiaddr: "" ``` -* TODO: Get Laconic tokens on your address +* TODO: Get L1 tokens on your address * Edit `nitro-vars.yml` and add the following variables: ```bash - # Private key for your Nitro address + # Private key for your Nitro account (same as the one used in stage0 onboarding) + # Export the key from Laconic wallet (https://wallet.laconic.com) nitro_sc_pk: "" # Private key for a funded account on L1 - # This account should have Laconic tokens for funding your Nitro channels + # This account should have L1 tokens for funding your Nitro channels nitro_chain_pk: "" # Multiaddr with publically accessible IP address / DNS for your L1 nitro node -- 2.45.2 From d71a481db3390b86715e2fd6385d510234d4e9ae Mon Sep 17 00:00:00 2001 From: Neeraj Date: Tue, 10 Sep 2024 13:53:03 +0530 Subject: [PATCH 13/22] Add steps to deploy l1 nitro contracts --- ops/deployments-from-scratch.md | 111 +++++++++++++++++++++++++++++--- testnet-nitro-node.md | 8 +-- 2 files changed, 105 insertions(+), 14 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index e2d19d1..c9fa474 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -24,6 +24,12 @@ ansible --version ``` +* Clone the `cerc-io/testnet-ops` repository: + + ```bash + git clone git@git.vdb.to:cerc-io/testnet-ops.git + ``` +
L2 Optimism @@ -51,15 +57,18 @@ ### Setup -* Clone the `cerc-io/testnet-ops` repository: +* Following commands have to be executed in `testnet-ops/l2-setup` directory ```bash - cd /srv - git clone git@git.vdb.to:cerc-io/testnet-ops.git - 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 @@ -157,6 +166,93 @@
+
+ L1 nitro contracts deployment + +## L1 nitro contracts deployment + +* Stack: + +* Source repos: + +* Target dir: `/srv/bridge/nitro-contracts-deployment` + +* Cleanup an existing deployment if required: + + ```bash + cd /srv/bridge + + # Stop the deployment + laconic-so deployment --dir nitro-contracts-deployment stop --delete-volumes + + # Remove the deployment dir + sudo rm -rf nitro-contracts-deployment + +### Setup + +* Following commands have to be executed in `testnet-ops/nitro-contracts-setup` directory + + ```bash + cd testnet-ops/nitro-contracts-setup + ``` + +* Copy the `contract-vars-example.yml` vars file + + ```bash + cp contract-vars-example.yml contract-vars.yml + ``` + +* Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values + + ```bash + # L1 RPC endpoint + geth_url: "https://sepolia.laconic.com" + + # L1 chain ID (Sepolia: 11155111) + geth_chain_id: "11155111" + + # Private key for a funded account on L1 to use for contracts deployment on L1 + geth_deployer_pk: "" + + # Custom L1 token to be deployed + token_name: "LaconicNetworkToken" + token_symbol: "LNT" + intial_token_supply: "129600" + ``` + +* Update the target dir in `setup-vars.yml`: + + ```bash + sed -i 's|^nitro_directory:.*|nitro_directory: /srv/bridge|' vars.yml + + # Will create deployment at /srv/bridge/nitro-contracts-deployment + ``` + +### Run + +* To deploy nitro contracts locally, execute the `deploy-contracts.yml` Ansible playbook: + + ```bash + LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK + ``` + + * For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter: + + ```bash + LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' --user $USER -kK + ``` + +* Check logs for deployments: + + ```bash + cd /srv/bridge + + # Check the l1 nitro contract deployments + laconic-so deployment --dir nitro-contracts-deployment logs nitro-contracts -f + ``` + +
+
Nitro Bridge @@ -182,14 +278,9 @@ ### Setup -* Clone the `cerc-io/testnet-ops` repository: +* Following commands have to be executed in `testnet-ops/nitro-bridge-setup` directory ```bash - cd /srv - - # Can be skipped if repo already exists - git clone git@git.vdb.to:cerc-io/testnet-ops.git - cd testnet-ops/nitro-bridge-setup ``` diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index b5e68e8..ab58dda 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -101,7 +101,7 @@ * Check status: ```bash - cd $DEPLOYMENTS_DIR + cd $DEPLOYMENTS_DIR/nitro-node # Check the logs, ensure that the nodes are running laconic-so deployment --dir l1-nitro-deployment logs nitro-node -f @@ -115,12 +115,12 @@ * Set required variables: ```bash - cd $DEPLOYMENTS_DIR + cd $DEPLOYMENTS_DIR/nitro-node # Fetch the required Nitro node config wget https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/stage2/nitro-node-config.yml - export BRIDGE_NITRO_ADDRESS=$(yq eval '.bridge_contract_address' nitro-node-config.yml) + 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) ``` @@ -243,7 +243,7 @@ * Stop the deployment: ```bash - cd $DEPLOYMENTS_DIR + cd $DEPLOYMENTS_DIR/nitro-node laconic-so deployment --dir l1-nitro-deployment stop ``` -- 2.45.2 From 5649d8fd6dc33532c3fa303e54d5566ced47a85a Mon Sep 17 00:00:00 2001 From: Neeraj Date: Tue, 10 Sep 2024 16:21:11 +0530 Subject: [PATCH 14/22] Fetch and use peer id and state channel address --- ops/deployments-from-scratch.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index c9fa474..eb17422 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -215,9 +215,9 @@ geth_deployer_pk: "" # Custom L1 token to be deployed - token_name: "LaconicNetworkToken" - token_symbol: "LNT" - intial_token_supply: "129600" + token_name: "" + token_symbol: "" + intial_token_supply: "" ``` * Update the target dir in `setup-vars.yml`: @@ -374,9 +374,9 @@ 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") - # TODO - export BRIDGE_NITRO_ADDRESS= - export BRIDGE_PEER_ID= + export BRIDGE_NITRO_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-node-info -p 4006 -h nitro-bridge" | jq -r '.SCAddress') + + export BRIDGE_PEER_ID=$(laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-node-info -p 4006 -h nitro-bridge" | jq -r '.MessageServicePeerId') export L1_BRIDGE_MULTIADDR="/dns4/bridge.laconic.com/tcp/3005/p2p/$BRIDGE_PEER_ID" export L2_BRIDGE_MULTIADDR="/dns4/bridge.laconic.com/tcp/3006/p2p/$BRIDGE_PEER_ID" -- 2.45.2 From 3b6dd2b2c6046b08169d97c380a3a549cc471757 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 11 Sep 2024 10:16:50 +0530 Subject: [PATCH 15/22] Update prerequisites and port mappings --- ops/deployments-from-scratch.md | 51 ++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index eb17422..174343a 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -12,23 +12,19 @@ ## Prerequisites -* laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install) +* On deployments VM(s): -* Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation) + * laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install) -* Check versions to verify installation: +* Local: - ```bash - laconic-so version + * Clone the `cerc-io/testnet-ops` repository: - ansible --version - ``` + ```bash + git clone git@git.vdb.to:cerc-io/testnet-ops.git + ``` -* Clone the `cerc-io/testnet-ops` repository: - - ```bash - git clone git@git.vdb.to:cerc-io/testnet-ops.git - ``` + * Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation)
L2 Optimism @@ -57,13 +53,13 @@ ### Setup -* Following commands have to be executed in `testnet-ops/l2-setup` directory +* 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 +* Copy the `l2-vars-example.yml` vars file: ```bash cp l2-vars-example.yml l2-vars.yml @@ -398,6 +394,8 @@ The required config file should be generated at `/srv/bridge/nitro-node-config.yml` + Check in the file at location `ops/stage2/nitro-node-config.yml` +
@@ -1059,10 +1057,23 @@ ## Domains / Port Mappings ```bash -laconicd.laconic.com -> 26657 -laconicd.laconic.com/api -> 9473/api -faucet.laconic.com -> 4000 -loro-signup.laconic.com -> 3000 -wallet.laconic.com -> 5000 -loro-console.laconic.com -> 4001 +# Machine 1 +https://laconicd.laconic.com -> 26657 +https://laconicd.laconic.com/api -> 9473/api +https://faucet.laconic.com -> 4000 +https://loro-signup.laconic.com -> 3000 +https://wallet.laconic.com -> 5000 +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: +3005 (L1 side) +3006 (L2 side) ``` -- 2.45.2 From edc4f743d6bcfd92b9dd77687e26eeb6bba4de36 Mon Sep 17 00:00:00 2001 From: Neeraj Date: Wed, 11 Sep 2024 11:01:37 +0530 Subject: [PATCH 16/22] Add steps to make nitro contract and bridge deployment on remote host --- ops/deployments-from-scratch.md | 122 +++++++++++++++++++++++++------- 1 file changed, 96 insertions(+), 26 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 174343a..994c8c3 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -163,9 +163,9 @@
- L1 nitro contracts deployment + L1 Nitro Contracts Deployment -## L1 nitro contracts deployment +## L1 Nitro Contracts Deployment * Stack: @@ -173,7 +173,7 @@ * Target dir: `/srv/bridge/nitro-contracts-deployment` -* Cleanup an existing deployment if required: +* Cleanup an existing deployment on virtual machine if required: ```bash cd /srv/bridge @@ -186,7 +186,7 @@ ### Setup -* Following commands have to be executed in `testnet-ops/nitro-contracts-setup` directory +* Following commands have to be executed in `testnet-ops/nitro-contracts-setup` directory on your local machine ```bash cd testnet-ops/nitro-contracts-setup @@ -211,9 +211,9 @@ geth_deployer_pk: "" # Custom L1 token to be deployed - token_name: "" - token_symbol: "" - intial_token_supply: "" + token_name: "" + token_symbol: "" + intial_token_supply: "" ``` * Update the target dir in `setup-vars.yml`: @@ -226,19 +226,54 @@ ### Run -* To deploy nitro contracts locally, execute the `deploy-contracts.yml` Ansible playbook: +* Execute the `deploy-contracts.yml` Ansible playbook on the remote host to deploy Nitro contracts: - ```bash - LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK - ``` + * Create a new `hosts.ini` file: - * For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter: + ```bash + cp ../hosts.example.ini hosts.ini + ``` - ```bash - LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' --user $USER -kK - ``` + * Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: -* Check logs for deployments: + ```ini + [] + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ``` + + - Replace `` with `nitro_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 `deploy-contracts.yml` Ansible playbook for remote deployment: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK + ``` + + * For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK + ``` + +* Check logs for deployments on the virtual machine: ```bash cd /srv/bridge @@ -260,7 +295,7 @@ * Target dir: `/srv/bridge/bridge-deployment` -* Cleanup an existing deployment if required: +* Cleanup an existing deployment on virtual machine if required: ```bash cd /srv/bridge @@ -274,7 +309,7 @@ ### Setup -* Following commands have to be executed in `testnet-ops/nitro-bridge-setup` directory +* Following commands have to be executed in `testnet-ops/nitro-bridge-setup` directory on your local machine ```bash cd testnet-ops/nitro-bridge-setup @@ -329,19 +364,54 @@ ### Run -* Setup and run L2 by executing the `run-nitro-bridge.yml` Ansible playbook: +* Execute the `run-nitro-bridge.yml` Ansible playbook on the remote host to deploy the L2 contracts and start the bridge: - ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost"}' --user $USER - ``` + * Create a new `hosts.ini` file: - * For skipping container build, run with `"skip_container_build" : true`: + ```bash + cp ../hosts.example.ini hosts.ini + ``` - ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-bridge.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER + * 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' ``` -* Check status: + - Replace `` with `nitro_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-nitro-bridge.yml` Ansible playbook for remote deployment: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK + ``` + + * For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK + ``` + +* Check logs for deployments on the virtual machine: ```bash cd /srv/bridge -- 2.45.2 From 5c79a718512966d5e299bc04d106073b66a7c533 Mon Sep 17 00:00:00 2001 From: Neeraj Date: Wed, 11 Sep 2024 11:26:25 +0530 Subject: [PATCH 17/22] Add steps to make optimism deployment on remote host --- ops/deployments-from-scratch.md | 50 ++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 994c8c3..6686f3a 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -39,7 +39,7 @@ * Target dir: `/srv/op-sepolia/optimism-deployment` -* Cleanup an existing deployment if required: +* Cleanup an existing deployment on virtual machine if required: ```bash cd /srv/op-sepolia @@ -99,16 +99,51 @@ ### Run -* Setup and run L2 by executing the `run-optimism.yml` Ansible playbook: +* Execute the `run-optimism.yml` Ansible playbook on the remote host to set up and run L2: - ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{ "target_host": "localhost"}' --user $USER - ``` + * Create a new `hosts.ini` file: - * For skipping container build, run with `"skip_container_build" : true`: + ```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 - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER + 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 + ``` + + * For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host", "skip_container_build": true }' --user $USER -kK ``` * Bridge funds on L2: @@ -116,6 +151,7 @@ * Set the following variables: ```bash + # Switch to `/srv/op-sepolia` directory on the virtual machine cd /srv/op-sepolia L1_RPC=http://host.docker.internal:8545 -- 2.45.2 From 98c502a8825ca2e229b09980797cbffa1779d48b Mon Sep 17 00:00:00 2001 From: Neeraj Date: Wed, 11 Sep 2024 12:12:52 +0530 Subject: [PATCH 18/22] Update steps to modify output directory in setup-vars file --- ops/deployments-from-scratch.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 6686f3a..4374ece 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -231,7 +231,7 @@ * Copy the `contract-vars-example.yml` vars file ```bash - cp contract-vars-example.yml contract-vars.yml + cp contract-vars.example.yml contract-vars.yml ``` * Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values @@ -255,7 +255,7 @@ * Update the target dir in `setup-vars.yml`: ```bash - sed -i 's|^nitro_directory:.*|nitro_directory: /srv/bridge|' vars.yml + sed -i 's|^nitro_directory:.*|nitro_directory: /srv/bridge|' setup-vars.yml # Will create deployment at /srv/bridge/nitro-contracts-deployment ``` @@ -393,7 +393,7 @@ * Update the target dir in `setup-vars.yml`: ```bash - sed -i 's|^nitro_directory:.*|nitro_directory: /srv/bridge|' vars.yml + sed -i 's|^nitro_directory:.*|nitro_directory: /srv/bridge|' setup-vars.yml # Will create deployment at /srv/bridge/nitro-contracts-deployment and /srv/bridge/bridge-deployment ``` -- 2.45.2 From 32b0b9ee527a8e28892f3dd7d589cb278181daac Mon Sep 17 00:00:00 2001 From: Neeraj Date: Wed, 11 Sep 2024 14:51:47 +0530 Subject: [PATCH 19/22] Add comments for values in bridge-vars file --- ops/deployments-from-scratch.md | 34 +++++++++++++++++++-------------- testnet-nitro-node.md | 6 +++--- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 4374ece..e7be9bd 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -12,10 +12,6 @@ ## Prerequisites -* On deployments VM(s): - - * laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install) - * Local: * Clone the `cerc-io/testnet-ops` repository: @@ -26,6 +22,10 @@ * Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation) +* On deployments VM(s): + + * laconic-so: see [installation](https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/stack-orchestrator-setup/README.md) +
L2 Optimism @@ -354,7 +354,7 @@ * Create the required vars file: ```bash - cp bridge-vars-example.yml bridge-vars.yml + cp bridge-vars.example.yml bridge-vars.yml ``` * Edit `bridge-vars.yml` with required values: @@ -373,21 +373,28 @@ # This account should have L1 tokens for funding Nitro channels nitro_chain_pk: "" - # L1 chain ID (Sepolia: 11155111) - geth_chain_id: "11155111" - - # L1 RPC endpoint - geth_url: "https://sepolia.laconic.com" + # L2 chain ID (Optimism: 42069) + optimism_chain_id: "42069" # L2 RPC endpoint optimism_url: "https://optimism.laconic.com" - # Private key for a funded account for L1 contracts deployment - geth_deployer_pk: "" - # Private key for a funded account for L2 contracts deployment # Use the same account for L1 and L2 deployments optimism_deployer_pk: "" + + # 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`: @@ -1171,7 +1178,6 @@ https://loro-signup.laconic.com -> 3000 https://wallet.laconic.com -> 5000 https://loro-console.laconic.com -> 4001 - # Machine 2 https://sepolia.laconic.com -> 8545 wss://sepolia.laconic.com -> 8546 diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index ab58dda..e2c501a 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -86,16 +86,16 @@ ## Run -* Setup and run a Nitro node (L1+L2) by executing the `run-nitro-node.yml` Ansible playbook: +* Setup and run a Nitro node (L1+L2) by executing the `run-nitro-nodes.yml` Ansible playbook: ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost"}' --user $USER + LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' --user $USER ``` * For skipping container build, run with `"skip_container_build" : true`: ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER + LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER ``` * Check status: -- 2.45.2 From c49336321446fd2bd1790bbff1cb3414ad83ad4e Mon Sep 17 00:00:00 2001 From: Neeraj Date: Thu, 12 Sep 2024 10:54:02 +0530 Subject: [PATCH 20/22] Remove skip container build instruction --- ops/deployments-from-scratch.md | 99 ++++++++++++++++++--------------- testnet-nitro-node.md | 6 -- 2 files changed, 55 insertions(+), 50 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index e7be9bd..14432e4 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -39,7 +39,7 @@ * Target dir: `/srv/op-sepolia/optimism-deployment` -* Cleanup an existing deployment on virtual machine if required: +* Cleanup an existing deployment on VM if required: ```bash cd /srv/op-sepolia @@ -99,7 +99,7 @@ ### Run -* Execute the `run-optimism.yml` Ansible playbook on the remote host to set up and run L2: +* 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: @@ -110,16 +110,15 @@ * Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: ```ini - [] + [l2_host] 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 + * Verify that you are able to connect to the host using the following command: ```bash ansible all -m ping -i hosts.ini -k @@ -140,15 +139,9 @@ LANG=en_US.utf8 ansible-playbook -i hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host"}' --user $USER -kK ``` - * For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter: - - ```bash - LANG=en_US.utf8 ansible-playbook -i hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host", "skip_container_build": true }' --user $USER -kK - ``` - * Bridge funds on L2: - * Set the following variables: + * On the deployment VM, set the following variables: ```bash # Switch to `/srv/op-sepolia` directory on the virtual machine @@ -188,7 +181,7 @@ * Allow a couple minutes for the bridge to complete - * Check balance on L2 + * Check balance on L2: ```bash docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC" @@ -203,13 +196,13 @@ ## L1 Nitro Contracts Deployment -* Stack: +* Stack: -* Source repos: +* Source repo: * Target dir: `/srv/bridge/nitro-contracts-deployment` -* Cleanup an existing deployment on virtual machine if required: +* Cleanup an existing deployment on VM if required: ```bash cd /srv/bridge @@ -222,19 +215,19 @@ ### Setup -* Following commands have to be executed in `testnet-ops/nitro-contracts-setup` directory on your local machine +* Switch to `testnet-ops/nitro-contracts-setup` directory on your local machine: ```bash cd testnet-ops/nitro-contracts-setup ``` -* Copy the `contract-vars-example.yml` vars file +* Copy the `contract-vars-example.yml` vars file: ```bash cp contract-vars.example.yml contract-vars.yml ``` -* Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values +* Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values: ```bash # L1 RPC endpoint @@ -262,7 +255,7 @@ ### Run -* Execute the `deploy-contracts.yml` Ansible playbook on the remote host to deploy Nitro contracts: +* Deploy nitro contracts on remote host by executing `deploy-contracts.yml` Ansible playbook on your local machine: * Create a new `hosts.ini` file: @@ -273,16 +266,15 @@ * Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: ```ini - [] + [nitro_host] ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' ``` - - Replace `` with `nitro_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 + * Verify that you are able to connect to the host using the following command: ```bash ansible all -m ping -i hosts.ini -k @@ -303,13 +295,7 @@ LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK ``` - * For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter: - - ```bash - LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK - ``` - -* Check logs for deployments on the virtual machine: +* Check logs for deployment on the virtual machine: ```bash cd /srv/bridge @@ -325,13 +311,13 @@ ## Nitro Bridge -* Stack: +* Stack: -* Source repos: +* Source repo: * Target dir: `/srv/bridge/bridge-deployment` -* Cleanup an existing deployment on virtual machine if required: +* Cleanup an existing deployment on VM if required: ```bash cd /srv/bridge @@ -345,7 +331,39 @@ ### Setup -* Following commands have to be executed in `testnet-ops/nitro-bridge-setup` directory on your local machine +* Execute the command on the deployment VM to get the deployed L1 Nitro contract addresses along with the L1 asset address: + + ```bash + cd /srv/bridge + + laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cat /app/deployment/nitro-addresses.json" + + # Expected output: + # { + # "11155111": [ + # { + # "name": "geth", + # "chainId": "11155111", + # "contracts": { + # "ConsensusApp": { + # "address": "0xC98aD0B41B9224dad0605be32A9241dB9c67E2e8" + # }, + # "NitroAdjudicator": { + # "address": "0x7C22fdA703Cdf09eB8D3B5Adc81F723526713D0e" + # }, + # "VirtualPaymentApp": { + # "address": "0x778e4e6297E8BF04C67a20Ec989618d72eB4a19E" + # }, + # "Token": { + # "address": "0x02ebfB2706527C7310F2a7d9098b2BC61014C5F2" + # } + # } + # } + # ] + # } + ``` + +* Switch to `testnet-ops/nitro-bridge-setup` directory on your local machine: ```bash cd testnet-ops/nitro-bridge-setup @@ -407,7 +425,7 @@ ### Run -* Execute the `run-nitro-bridge.yml` Ansible playbook on the remote host to deploy the L2 contracts and start the bridge: +* Deploy L2 contracts and start the bridge on remote host by executing `run-nitro-bridge.yml` Ansible playbook on your local machine: * Create a new `hosts.ini` file: @@ -418,16 +436,15 @@ * Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: ```ini - [] + [nitro_host] ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' ``` - - Replace `` with `nitro_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 + * Verify that you are able to connect to the host using the following command: ```bash ansible all -m ping -i hosts.ini -k @@ -448,12 +465,6 @@ LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK ``` - * For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter: - - ```bash - LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK - ``` - * Check logs for deployments on the virtual machine: ```bash diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index e2c501a..399a427 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -92,12 +92,6 @@ LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' --user $USER ``` - * For skipping container build, run with `"skip_container_build" : true`: - - ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER - ``` - * Check status: ```bash -- 2.45.2 From 699253df567dcc04b2f2c8baabdde91128628517 Mon Sep 17 00:00:00 2001 From: Neeraj Date: Thu, 12 Sep 2024 11:11:49 +0530 Subject: [PATCH 21/22] Extract network name from deployment file --- ops/deployments-from-scratch.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 14432e4..1208497 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -144,13 +144,12 @@ * On the deployment VM, set the following variables: ```bash - # Switch to `/srv/op-sepolia` directory on the virtual machine cd /srv/op-sepolia L1_RPC=http://host.docker.internal:8545 L2_RPC=http://host.docker.internal:9545 - NETWORK= + NETWORK=$(grep 'cluster-id' optimism-deployment/deployment.yml | sed 's/cluster-id: //')_default DEPLOYMENT_CONTEXT=11155111 ACCOUNT= -- 2.45.2 From 4740fcf749b77834203d189fb3f4b9bb5972b73c Mon Sep 17 00:00:00 2001 From: Neeraj Date: Thu, 12 Sep 2024 18:05:59 +0530 Subject: [PATCH 22/22] Add steps to make nitro deployment on remote host --- README.md | 2 +- ops/deployments-from-scratch.md | 16 +++++----- testnet-nitro-node.md | 56 ++++++++++++++++++++++++++++++--- 3 files changed, 59 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 34923f0..ac60865 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,6 @@ Stacks to run a node for laconic testnet Follow steps in [testnet-onboarding-validator.md](./testnet-onboarding-validator.md) to onboard your participant and join as a validator on the LORO testnet -## Run Testnet Nitro Node +## Run testnet Nitro Node Follow steps in [testnet-nitro-node.md](./testnet-nitro-node.md) to run you Nitro node for the testnet diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 1208497..d933896 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -235,7 +235,9 @@ # L1 chain ID (Sepolia: 11155111) geth_chain_id: "11155111" - # Private key for a funded account on L1 to use for contracts deployment on L1 + # Private key for a funded L1 account, to be used for contract deployment on L1 + # Must also be funded on L2 for deploying contracts + # Required since this private key will be utilized by both L1 and L2 nodes of the bridge geth_deployer_pk: "" # Custom L1 token to be deployed @@ -386,8 +388,8 @@ # Private key for bridge Nitro address nitro_sc_pk: "" - # Private key for a funded account on L1 - # This account should have L1 tokens for funding Nitro channels + # 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 nitro_chain_pk: "" # L2 chain ID (Optimism: 42069) @@ -396,10 +398,6 @@ # L2 RPC endpoint optimism_url: "https://optimism.laconic.com" - # Private key for a funded account for L2 contracts deployment - # Use the same account for L1 and L2 deployments - optimism_deployer_pk: "" - # Custom L2 token to be deployed token_name: "" token_symbol: "" @@ -515,9 +513,9 @@ EOF ``` - The required config file should be generated at `/srv/bridge/nitro-node-config.yml` + * The required config file should be generated at `/srv/bridge/nitro-node-config.yml` - Check in the file at location `ops/stage2/nitro-node-config.yml` + * Check in the generated file at location `ops/stage2/nitro-node-config.yml` within this repository
diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index 399a427..5c83184 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -2,12 +2,12 @@ ## Prerequisites -* laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install) - * Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation) * yq: see [installation](https://github.com/mikefarah/yq#install) +* laconic-so: see [installation](https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/stack-orchestrator-setup/README.md) + * Check versions to verify installation: ```bash @@ -84,7 +84,9 @@ # Will create deployments at $DEPLOYMENTS_DIR/nitro-node/l1-nitro-deployment and $DEPLOYMENTS_DIR/nitro-node/l2-nitro-deployment ``` -## Run +## Run Nitro Nodes + +### On Local Host * Setup and run a Nitro node (L1+L2) by executing the `run-nitro-nodes.yml` Ansible playbook: @@ -92,7 +94,50 @@ LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' --user $USER ``` -* Check status: +### On Remote Host (optional) + +* 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 + [nitro_host] + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ``` + + - 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-nitro-nodes.yml` Ansible playbook for remote deployment: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK + ``` + +### Check Deployment Status + +* Run the following command in the directory where the deployments are created: ```bash cd $DEPLOYMENTS_DIR/nitro-node @@ -103,8 +148,9 @@ ``` ## Create Channels +Create a ledger channel with the bridge on L1 which is mirrored on L2 -* Create a ledger channel with the bridge on L1 that gets mirrored on L2 +* Run the following commands from the directory where the deployments are created * Set required variables: -- 2.45.2