From 51599190075b3473336dafe020f21ffeddbcb28e Mon Sep 17 00:00:00 2001 From: Diyahir <32445955+diyahir@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:58:22 +0200 Subject: [PATCH] smol improvements --- config-files/holesky/sample.aggregator.yaml | 2 +- contracts/README.md | 31 +++++++++++------- docs/holesky-guide.md | 36 ++++++++++++++------- operator.docker-compose.yml | 2 +- safety-factor/safety_factor_service.go | 1 + 5 files changed, 47 insertions(+), 25 deletions(-) diff --git a/config-files/holesky/sample.aggregator.yaml b/config-files/holesky/sample.aggregator.yaml index 5ae8ee90..1f75a4c6 100644 --- a/config-files/holesky/sample.aggregator.yaml +++ b/config-files/holesky/sample.aggregator.yaml @@ -4,5 +4,5 @@ eth_rpc_url: your_eth_holesky_rpc_url eth_ws_url: your_eth_holesky_ws_url # address which the aggregator listens on for operator signed messages -aggregator_server_ip_port_address: localhost:8090 +aggregator_server_ip_port_address: 0.0.0.0:8090 # use 0.0.0.0:8090 if you want to expose the aggregator to the network diff --git a/contracts/README.md b/contracts/README.md index 50301e56..f9d9c708 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -1,17 +1,30 @@ -## Architecture +## Smart Contract Architecture ```mermaid graph TD + F[Anzen Operators] -->|Oracle Consensus| A[Anzen Task Manager] + G[Anzen Aggregator] -->|Initializes Tasks| A A -->|Operator Consensus| B((Safety Factor Oracle)) - B --> |Adjusts Emissions| D((AVS Reserves)) - C[AVS Reserves Factory] --> |Creates Reserves Manager| D + B --> |Adjusts Emissions| D1((AVS1 Reserves)) + B --> |Adjusts Emissions| D2((AVS2 Reserves)) + B --> |Adjusts Emissions| D3((AVS3 Reserves)) + C[AVS Reserves Factory] --> |Creates Reserves Manager| D1 + C --> |Creates Reserves Manager| D2 + C --> |Creates Reserves Manager| D3 C --> |Register AVS| B - subgraph AVS Controlled Contracts - D --> |Sends Payment| E((AVS Reward Manager)) + subgraph AVS1 Controlled Contracts + D1 --> |Sends Payment| E1((AVS1 Reward Manager)) + end + + subgraph AVS2 Controlled Contracts + D2 --> |Sends Payment| E2((AVS2 Reward Manager)) end + subgraph AVS3 Controlled Contracts + D3 --> |Sends Payment| E3((AVS3 Reward Manager)) + end ``` ### Build @@ -47,13 +60,7 @@ $ anvil ### Deploy ```shell -$ forge script script/Counter.s.sol:CounterScript --rpc-url --private-key -``` - -### Cast - -```shell -$ cast +$ make deploy-anzen-contracts-to-anvil-and-save-state ``` ### Help diff --git a/docs/holesky-guide.md b/docs/holesky-guide.md index e1b158cc..9e1e10d9 100644 --- a/docs/holesky-guide.md +++ b/docs/holesky-guide.md @@ -34,32 +34,35 @@ Follow the Eigenlayer guide to create keys [here](https://docs.eigenlayer.xyz/ei ### Create config files +You only need to set up the operator.yaml file for the operator. If you want to set up an aggregator you will need to set up the aggregator.yaml file as well, but this is not required to join the AVS. + ```bash cd config-files/holesky -cp sample.aggregator.yaml aggregator.yaml cp sample.operator.yaml operator.yaml ``` +Optional: + +```bash +cp sample.aggregator.yaml aggregator.yaml +``` + Edit the aggregator.yaml and operator.yaml files with your variables: [aggregator.yaml](../config-files/holesky/aggregator.yaml) [operator.yaml](../config-files/holesky/operator.yaml) -### Start the Holesky AVS using Make +### Start the Holesky AVS using Docker -```bash -make start-aggregator-holesky -``` +#### Operator in a separate terminal ```bash -make start-operator-holesky +docker compose -f operator.docker-compose.yml up ``` -### Start the Holesky AVS using Docker - #### Aggregator Configure the aggregator environment variables with the aggregator private key @@ -72,16 +75,27 @@ cp sample.aggregator.env .env docker compose -f aggregator.docker-compose.yml up ``` -#### Operator +### Start the Holesky AVS using Make -in a separate terminal +```bash +make start-operator-holesky +``` + +Optional: ```bash -docker compose -f operator.docker-compose.yml up +make start-aggregator-holesky ``` ## Troubleshooting +First, you should check for any updates to the operator image + +```bash +docker pull ghcr.io/hydrogen-labs/anzen-avs/aggregator/cmd/main.go:latest +docker pull ghcr.io/hydrogen-labs/anzen-avs/operator/cmd/main.go:latest +``` + #### RPC Issues Ensure that your RPC client let's you create websocket subscriptions. diff --git a/operator.docker-compose.yml b/operator.docker-compose.yml index 451763d1..ea80f594 100644 --- a/operator.docker-compose.yml +++ b/operator.docker-compose.yml @@ -13,5 +13,5 @@ services: - config-files/holesky/operator.yaml - --anzen-deployment - contracts/script/output/17000/anzen_avs_deployment_output.json - network_mode: "bridge" + network_mode: "host" diff --git a/safety-factor/safety_factor_service.go b/safety-factor/safety_factor_service.go index c0cecccc..81bc4a58 100644 --- a/safety-factor/safety_factor_service.go +++ b/safety-factor/safety_factor_service.go @@ -60,6 +60,7 @@ func (s *SafetyFactorService) IsSafetyFactorInfoStale(moduleID int32) (bool, err // TODO let this be configurable // Check if the safety factor has deviated + // TODO: check if the deviation is within the threshold isDeviated := latestSafetyFactorOffChainInfo.SF.Cmp(currentSafetyFactorOnChainInfo.SafetyFactor) != 0 // Check if the safety factor is stale by one minute