From 0f1ce9bf7081eedd633290656d7581adb3359fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wawrzyniec=20=27Wawrzek=27=20Niewodnicza=C5=84ski?= Date: Thu, 9 May 2024 18:55:33 +0100 Subject: [PATCH 1/4] Enable simple usage of different chainid Move config files into a chain specific directory and adjust makefile --- Makefile | 25 ++++++++++--------- README.md | 4 +-- .../aggregator-docker-compose.yaml | 0 config-files/{ => 31337}/aggregator.yaml | 0 config-files/{ => 31337}/challenger.yaml | 0 .../operator-docker-compose.anvil.yaml | 0 config-files/{ => 31337}/operator.anvil.yaml | 0 7 files changed, 15 insertions(+), 14 deletions(-) rename config-files/{ => 31337}/aggregator-docker-compose.yaml (100%) rename config-files/{ => 31337}/aggregator.yaml (100%) rename config-files/{ => 31337}/challenger.yaml (100%) rename config-files/{ => 31337}/operator-docker-compose.anvil.yaml (100%) rename config-files/{ => 31337}/operator.anvil.yaml (100%) diff --git a/Makefile b/Makefile index 97a79f53..22e44337 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,14 @@ help: AGGREGATOR_ECDSA_PRIV_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 CHALLENGER_ECDSA_PRIV_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a - +DEPLOYER_PRIVATE_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 CHAINID=31337 # Make sure to update this if the strategy address changes # check in contracts/script/output/${CHAINID}/credible_squaring_avs_deployment_output.json STRATEGY_ADDRESS=0x7a2088a1bFc9d81c55368AE168C2C02570cB814F DEPLOYMENT_FILES_DIR=contracts/script/output/${CHAINID} +# Operator key information are saved in tests/keys/test.ecdsa.key.json +OPERATOR_ADDRESS=0x860B6912C2d0337ef05bbC89b0C2CB6CbAEAB4A5 -----------------------------: ## @@ -46,45 +48,44 @@ __CLI__: ## cli-setup-operator: send-fund cli-register-operator-with-eigenlayer cli-deposit-into-mocktoken-strategy cli-register-operator-with-avs ## registers operator with eigenlayer and avs cli-register-operator-with-eigenlayer: ## registers operator with delegationManager - go run cli/main.go --config config-files/operator.anvil.yaml register-operator-with-eigenlayer + go run cli/main.go --config config-files/${CHAINID}/operator.anvil.yaml register-operator-with-eigenlayer cli-deposit-into-mocktoken-strategy: ## ./scripts/deposit-into-mocktoken-strategy.sh cli-register-operator-with-avs: ## - go run cli/main.go --config config-files/operator.anvil.yaml register-operator-with-avs + go run cli/main.go --config config-files/${CHAINID}/operator.anvil.yaml register-operator-with-avs cli-deregister-operator-with-avs: ## - go run cli/main.go --config config-files/operator.anvil.yaml deregister-operator-with-avs + go run cli/main.go --config config-files/${CHAINID}/operator.anvil.yaml deregister-operator-with-avs cli-print-operator-status: ## - go run cli/main.go --config config-files/operator.anvil.yaml print-operator-status - -send-fund: ## sends fund to the operator saved in tests/keys/test.ecdsa.key.json - cast send 0x860B6912C2d0337ef05bbC89b0C2CB6CbAEAB4A5 --value 10ether --private-key 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 + go run cli/main.go --config config-files/${CHAINID}/operator.anvil.yaml print-operator-status +send-fund: ## sends fund to the operator + cast send ${OPERATOR_ADDRESS} --value 10ether --private-key ${DEPLOYER_PRIVATE_KEY} -----------------------------: ## # We pipe all zapper logs through https://github.com/maoueh/zap-pretty so make sure to install it # TODO: piping to zap-pretty only works when zapper environment is set to production, unsure why ____OFFCHAIN_SOFTWARE___: ## start-aggregator: ## - go run aggregator/cmd/main.go --config config-files/aggregator.yaml \ + go run aggregator/cmd/main.go --config config-files/${CHAINID}/aggregator.yaml \ --credible-squaring-deployment ${DEPLOYMENT_FILES_DIR}/credible_squaring_avs_deployment_output.json \ --ecdsa-private-key ${AGGREGATOR_ECDSA_PRIV_KEY} \ 2>&1 | zap-pretty start-operator: ## - go run operator/cmd/main.go --config config-files/operator.anvil.yaml \ + go run operator/cmd/main.go --config config-files/${CHAINID}/operator.anvil.yaml \ 2>&1 | zap-pretty start-challenger: ## - go run challenger/cmd/main.go --config config-files/challenger.yaml \ + go run challenger/cmd/main.go --config config-files/${CHAINID}/challenger.yaml \ --credible-squaring-deployment ${DEPLOYMENT_FILES_DIR}/credible_squaring_avs_deployment_output.json \ --ecdsa-private-key ${CHALLENGER_ECDSA_PRIV_KEY} \ 2>&1 | zap-pretty run-plugin: ## - go run plugin/cmd/main.go --config config-files/operator.anvil.yaml + go run plugin/cmd/main.go --config config-files/${CHAINID}/operator.anvil.yaml -----------------------------: ## _____HELPER_____: ## mocks: ## generates mocks for tests diff --git a/README.md b/README.md index 6d9a80ce..a9fb6794 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Register the operator with eigenlayer and incredible-squaring, and then start th make start-operator ``` -> By default, the `start-operator` command will also setup the operator (see `register_operator_on_startup` flag in `config-files/operator.anvil.yaml`). To disable this, set `register_operator_on_startup` to false, and run `make cli-setup-operator` before running `start-operator`. +> By default, the `start-operator` command will also setup the operator (see `register_operator_on_startup` flag in `config-files/31337/operator.anvil.yaml`). To disable this, set `register_operator_on_startup` to false, and run `make cli-setup-operator` before running `start-operator`. ## Running via docker compose @@ -114,4 +114,4 @@ When running on anvil, a typical log for the operator is [2024-04-09 18:25:10.679 PDT] INFO (logging/zap_logger.go:49) Signed task response header accepted by aggregator. {"reply":false} ``` -The error `task 2 not initialized or already completed` is expected behavior. This is because the aggregator needs to setup its data structures before it can accept responses. But on a local anvil setup, the operator had time to receive the websocket event for the new task, square the number, sign the response, and send it to the aggregator process before the aggregator has finalized its setup. Hence, the operator retries sending the response 2 seconds later and it is accepted. \ No newline at end of file +The error `task 2 not initialized or already completed` is expected behavior. This is because the aggregator needs to setup its data structures before it can accept responses. But on a local anvil setup, the operator had time to receive the websocket event for the new task, square the number, sign the response, and send it to the aggregator process before the aggregator has finalized its setup. Hence, the operator retries sending the response 2 seconds later and it is accepted. diff --git a/config-files/aggregator-docker-compose.yaml b/config-files/31337/aggregator-docker-compose.yaml similarity index 100% rename from config-files/aggregator-docker-compose.yaml rename to config-files/31337/aggregator-docker-compose.yaml diff --git a/config-files/aggregator.yaml b/config-files/31337/aggregator.yaml similarity index 100% rename from config-files/aggregator.yaml rename to config-files/31337/aggregator.yaml diff --git a/config-files/challenger.yaml b/config-files/31337/challenger.yaml similarity index 100% rename from config-files/challenger.yaml rename to config-files/31337/challenger.yaml diff --git a/config-files/operator-docker-compose.anvil.yaml b/config-files/31337/operator-docker-compose.anvil.yaml similarity index 100% rename from config-files/operator-docker-compose.anvil.yaml rename to config-files/31337/operator-docker-compose.anvil.yaml diff --git a/config-files/operator.anvil.yaml b/config-files/31337/operator.anvil.yaml similarity index 100% rename from config-files/operator.anvil.yaml rename to config-files/31337/operator.anvil.yaml From 73eb4749fc00dac76dac97675511c950c5a0603b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wawrzyniec=20=27Wawrzek=27=20Niewodnicza=C5=84ski?= Date: Thu, 9 May 2024 19:09:10 +0100 Subject: [PATCH 2/4] Adjust config pahs in other places - docker-compose.yml - integration-tests - deposit script - comments in the code --- core/config/config.go | 2 +- docker-compose.yml | 6 +++--- scripts/deposit-into-mocktoken-strategy.sh | 2 +- tests/integration/integration_test.go | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/config/config.go b/core/config/config.go index 70f54548..dab286c6 100644 --- a/core/config/config.go +++ b/core/config/config.go @@ -21,7 +21,7 @@ import ( ) // Config contains all of the configuration information for a credible squaring aggregators and challengers. -// Operators use a separate config. (see config-files/operator.anvil.yaml) +// Operators use a separate config. (see config-files/31337/operator.anvil.yaml) type Config struct { EcdsaPrivateKey *ecdsa.PrivateKey BlsPrivateKey *bls.PrivateKey diff --git a/docker-compose.yml b/docker-compose.yml index aebbc4f1..8b9f87c3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,7 @@ services: working_dir: /incredible-squaring command: - --config - - config-files/aggregator-docker-compose.yaml + - config-files/31337/aggregator-docker-compose.yaml - --credible-squaring-deployment - contracts/script/output/31337/credible_squaring_avs_deployment_output.json - --ecdsa-private-key @@ -52,7 +52,7 @@ services: volumes: - ./:/incredible-squaring/ working_dir: /incredible-squaring - command: --config config-files/operator-docker-compose.anvil.yaml + command: --config config-files/31337/operator-docker-compose.anvil.yaml networks: - incredible-squaring-network @@ -65,7 +65,7 @@ services: # volumes: # - ./:/incredible-squaring/ # working_dir: /incredible-squaring - # command: --config config-files/operator-docker-compose.anvil.yaml --credible-squaring-deployment contracts/script/output/31337/credible_squaring_avs_deployment_output.json --ecdsa-private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d --bls-private-key 2 + # command: --config config-files/31337/operator-docker-compose.anvil.yaml --credible-squaring-deployment contracts/script/output/31337/credible_squaring_avs_deployment_output.json --ecdsa-private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d --bls-private-key 2 # networks: # - incredible-squaring-network diff --git a/scripts/deposit-into-mocktoken-strategy.sh b/scripts/deposit-into-mocktoken-strategy.sh index f8910e1a..12e80c54 100755 --- a/scripts/deposit-into-mocktoken-strategy.sh +++ b/scripts/deposit-into-mocktoken-strategy.sh @@ -14,4 +14,4 @@ CHAINID=$(cast chain-id) DEPLOYMENT_OUTPUT_FILE=./contracts/script/output/${CHAINID}/credible_squaring_avs_deployment_output.json STRATEGY_ADDRESS=$(jq -r '.addresses.erc20MockStrategy' $DEPLOYMENT_OUTPUT_FILE) -go run cli/main.go --config config-files/operator.anvil.yaml deposit-into-strategy --strategy-addr ${STRATEGY_ADDRESS} --amount 100 +go run cli/main.go --config config-files/${CHAINID}/operator.anvil.yaml deposit-into-strategy --strategy-addr ${STRATEGY_ADDRESS} --amount 100 diff --git a/tests/integration/integration_test.go b/tests/integration/integration_test.go index 963cc173..aac55eb6 100644 --- a/tests/integration/integration_test.go +++ b/tests/integration/integration_test.go @@ -47,7 +47,7 @@ func TestIntegration(t *testing.T) { /* Prepare the config file for aggregator */ var aggConfigRaw config.ConfigRaw - aggConfigFilePath := "../../config-files/aggregator.yaml" + aggConfigFilePath := "../../config-files/31337/aggregator.yaml" sdkutils.ReadYamlConfig(aggConfigFilePath, &aggConfigRaw) aggConfigRaw.EthRpcUrl = "http://" + anvilEndpoint aggConfigRaw.EthWsUrl = "ws://" + anvilEndpoint @@ -114,7 +114,7 @@ func TestIntegration(t *testing.T) { /* Prepare the config file for operator */ nodeConfig := types.NodeConfig{} - nodeConfigFilePath := "../../config-files/operator.anvil.yaml" + nodeConfigFilePath := "../../config-files/31337/operator.anvil.yaml" err = sdkutils.ReadYamlConfig(nodeConfigFilePath, &nodeConfig) if err != nil { t.Fatalf("Failed to read yaml config: %s", err.Error()) From 635769890faddf478868e37e14519b76d17923c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wawrzyniec=20=27Wawrzek=27=20Niewodnicza=C5=84ski?= Date: Thu, 6 Jun 2024 12:06:50 +0100 Subject: [PATCH 3/4] Update README - add information on how to use CHAINID --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index a9fb6794..48f2ffbf 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,20 @@ make start-operator > By default, the `start-operator` command will also setup the operator (see `register_operator_on_startup` flag in `config-files/31337/operator.anvil.yaml`). To disable this, set `register_operator_on_startup` to false, and run `make cli-setup-operator` before running `start-operator`. +### Running with a different CHAINID + +The AVS can be run with a network different that anvil, which CHAINID default to 31337. +Firstly, the smart contracts have to deployed onto the chain (equivalent of the `start-anvil-chain-with-el-and-avs-deployed` make command). +The output of the smart contract deployment (addresses) and the location of the execution client (host:port) have to saved into the configuration files in the appropriate folder. +E.g. for the network with the chain id 32382, the configuration should be store in: `config-files/32382/{operator.anvil.yaml,aggregator.yaml}`. +(Please keep _anvil_ in the operator configuration file name). +After that the CHAINID variable has to be included to the make commands e.g.: +``` +make CHAINID=32382 start-aggregator +``` + +The [ivynet iv1](https://github.com/ivy-net/iv1/) POS network, is an example of such deployment and should include more detailed informations. + ## Running via docker compose We wrote a [docker-compose.yml](./docker-compose.yml) file to run and test everything on a single machine. It will start an anvil instance, loading a [state](./tests/anvil/avs-and-eigenlayer-deployed-anvil-state.json) where the eigenlayer and incredible-squaring contracts are deployed, start the aggregator, and finally one operator, along with prometheus and grafana servers. The grafana server will be available at http://localhost:3000, with user and password both set to `admin`. We have created a simple [grafana dashboard](./grafana/provisioning/dashboards/AVSs/incredible_squaring.json) which can be used as a starting example and expanded to include AVS specific metrics. The eigen metrics should not be added to this dashboard as they will be exposed on the main eigenlayer dashboard provided by the eigenlayer-cli. From f65d3f6b8a6ad5cc70ba55080740e88f67ef7323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wawrzyniec=20=27Wawrzek=27=20Niewodnicza=C5=84ski?= Date: Fri, 14 Jun 2024 16:12:22 +0100 Subject: [PATCH 4/4] Bump version of monitoring images New version: - prometheus - grafana Remove trailing whitespaces --- docker-compose.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3760d7a1..66f2e23b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: command: --host 0.0.0.0 --load-state /root/.anvil/state.json networks: - incredible-squaring-network - + anvil-advance-chain-script: image: ghcr.io/foundry-rs/foundry:nightly-5b7e4cb3c882b28f3c32ba580de27ce7381f415a depends_on: @@ -40,12 +40,12 @@ services: volumes: - ./:/incredible-squaring/ working_dir: /incredible-squaring - command: - - --config + command: + - --config - config-files/aggregator-docker-compose.yaml - - --credible-squaring-deployment + - --credible-squaring-deployment - contracts/script/output/31337/credible_squaring_avs_deployment_output.json - - --ecdsa-private-key + - --ecdsa-private-key - "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6" networks: - incredible-squaring-network @@ -84,7 +84,7 @@ services: # METRICS RELATED grafana: - image: grafana/grafana:9.4.1 + image: grafana/grafana:10.4.4 container_name: grafana volumes: - grafana_data:/var/lib/grafana @@ -103,7 +103,7 @@ services: - incredible-squaring-network prometheus: - image: prom/prometheus:v2.42.0 + image: prom/prometheus:v2.52.0 container_name: prometheus volumes: - ./prometheus:/etc/prometheus