diff --git a/Makefile b/Makefile index 6b7fba5c..a2f51641 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..48f2ffbf 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,21 @@ 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 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 @@ -114,4 +128,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 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 3760d7a1..bcd9b322 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: @@ -42,10 +42,10 @@ 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 + - --ecdsa-private-key - "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6" 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 + command: --config config-files/31337/operator-docker-compose.anvil.yaml networks: - incredible-squaring-network @@ -78,13 +78,13 @@ 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 # 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 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())