From d71a481db3390b86715e2fd6385d510234d4e9ae Mon Sep 17 00:00:00 2001 From: Neeraj Date: Tue, 10 Sep 2024 13:53:03 +0530 Subject: [PATCH] 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 ```