Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add Run the worker from source section to README #137

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 53 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -55,14 +65,52 @@ 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 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

```sh
RUST_BACKTRACE=1 RUST_LOG=debug cargo run --release --bin lgn-worker -- --config YOUR_CONFIG.toml
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe lets also add a default config, and a link to the public params that work with this version of the worker?

Copy link
Contributor Author

@silathdiir silathdiir Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the latest public parameters URL to lgn-worker/src/config/default.toml (but I don't fix the gateway URL) in commit d74088b.

I have a section of Update the worker configuration, I think maybe the gateway URL should be set at this step. Wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me. @kaisbaccour , just double checking, is the URL https://pub-a894572689a54c008859f232868fc67d.r2.dev the one to make public?


### 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/)