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

Bump monitoring image versions #71

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

-----------------------------: ##

Expand Down Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
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.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion core/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/deposit-into-mocktoken-strategy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions tests/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down