From 5be53cd9b6ab912c41d4cf21b0de9c5fc1dbe7f7 Mon Sep 17 00:00:00 2001 From: Steven Gu Date: Wed, 15 Jan 2025 18:08:29 +0800 Subject: [PATCH 1/3] Add `Run the worker from source` to README. --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0e239af..5be6756 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This is a step by step guide to deploy your own worker. If you prefer video content you can watch this [video tutorial](https://www.youtube.com/watch?v=zRY7AwrJo4w) --- + ### Pre-Requirements There are **3** different types of workers. Every type can generate a specific type of proof. @@ -25,28 +26,37 @@ You can choose your infrastrcture depending on the type of proof you would like 1. Install `Docker` by following this [guide](https://docs.docker.com/engine/install/) 2. Clone this repo + ```sh -git clone https://github.com/Lagrange-Labs/worker.git -cd worker +git clone https://github.com/Lagrange-Labs/lgn-coprocessor.git +cd lgn-coprocessor ``` + 3. Generate a Lagrange key + ```sh #Generate the key docker compose run --rm worker avs new-key ``` + You should see something like this + ```sh Input password for Lagrange key: new Lagrange keystore stored under config/lagr_keystore.json - public_key = "66779122cb188d1e70889278ffb3ee8ee024d4a23742a59afbdaaa096fc5135c3a14d897de87d1c56adbe029619c231416e7dfb3f1de0a542dd8ac7f4748ce07" + public_key = "66779122cb188d1e70889278ffb3ee8ee024d4a23742a59afbdaaa096fc5135c3a14d897de87d1c56adbe029619c231416e7dfb3f1de0a542dd8ac7f4748ce07" ``` + 4. Add the Ethereum keystore under `config/priv_key.json`. * This is the operator keystore generated by [EigenLayer cli](https://docs.eigenlayer.xyz/eigenlayer/operator-guides/operator-installation#cli-installation) 5. Register the Lagrange key on-chain by signing it with the AVS operator key + ```sh docker compose run --rm worker avs register ``` + 6. You are now registered, you can go ahead and remove the keystore from `config/priv_key.json` 7. Add the Lagrange password to the `.env` file so that the service can be restarted without any manual intervention. + ```sh # set the AVS__LAGR_PWD key with the password you have set vim .env @@ -55,14 +65,51 @@ vim .env ### Run the worker Steps 1. Run the worker + ```sh docker compose up -d ``` +### Run the worker from source + +1. Clone this repo + +```sh +git clone https://github.com/Lagrange-Labs/lgn-coprocessor.git +cd lgn-coprocessor +``` + +2. Check your Rust toolchain + +```sh +rustup toolchain list +nightly-2024-12-03... (It is recommended) +``` + +2. Update the worker configuration + +```sh +cat lgn-worker/src/config/default.toml +``` + +3. Update the system maximum stack size to unlimited + +```sh +ulimit -s unlimited +``` + +4. Build and run the worker + +```sh +RUST_BACKTRACE=1 RUST_LOG=debug cargo run --release --bin lgn-worker -- --config YOUR_CONFIG.toml +``` + ### Observability + #### Metrics + The worker exposes the prometheus metrics by default on port 9000 -#### Dashboard -Starting from worker version `v0.2.1`, you can import this [grafana dashboard ](https://grafana.com/grafana/dashboards/21302-worker/) +#### Dashboard +Starting from worker version `v0.2.1`, you can import this [grafana dashboard](https://grafana.com/grafana/dashboards/21302-worker/) From a0282f591eb94c7e9edf6d91fc6468959a8712c9 Mon Sep 17 00:00:00 2001 From: Steven Gu Date: Wed, 15 Jan 2025 19:14:53 +0800 Subject: [PATCH 2/3] Add details for `unlimited`. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5be6756..d18b241 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,8 @@ cat lgn-worker/src/config/default.toml 3. Update the system maximum stack size to unlimited ```sh -ulimit -s unlimited +ulimit -s 100000000 # Only run the worker on one machine +ulimit -s unlimited # Run the worker with other services on one machine (not recommended) ``` 4. Build and run the worker From d74088b3ea91076c2343668cef39aae3c85bb7ce Mon Sep 17 00:00:00 2001 From: Steven Gu Date: Wed, 15 Jan 2025 22:08:49 +0800 Subject: [PATCH 3/3] Update params URL. --- lgn-worker/src/config/default.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lgn-worker/src/config/default.toml b/lgn-worker/src/config/default.toml index 1db90a8..796b853 100644 --- a/lgn-worker/src/config/default.toml +++ b/lgn-worker/src/config/default.toml @@ -17,8 +17,8 @@ dir = "./zkmr_params" checksum_expected_local_path = "/tmp/expected_checksums.txt" # Parameters common directory # v1.1.x PPs -url = "https://pub-fbb5db8dc9ee4e8da9daf13e07d27c24.r2.dev" -checksum_url = "https://pub-fbb5db8dc9ee4e8da9daf13e07d27c24.r2.dev/public_params.hash" +url = "https://pub-a894572689a54c008859f232868fc67d.r2.dev" +checksum_url = "https://pub-a894572689a54c008859f232868fc67d.r2.dev/public_params.hash" skip_checksum = false skip_store = false