diff --git a/Makefile b/Makefile index 528cbc92..02db98ba 100644 --- a/Makefile +++ b/Makefile @@ -74,13 +74,13 @@ send-fund: ## sends fund to the operator saved in tests/keys/test.ecdsa.key.json ____OFFCHAIN_SOFTWARE___: ## start-aggregator: ## go run aggregator/cmd/main.go --config config-files/anvil/aggregator.yaml \ - --credible-squaring-deployment ${DEPLOYMENT_FILES_DIR}/anzen_avs_deployment_output.json \ + --anzen-deployment ${DEPLOYMENT_FILES_DIR}/anzen_avs_deployment_output.json \ --ecdsa-private-key ${AGGREGATOR_ECDSA_PRIV_KEY} \ 2>&1 | zap-pretty start-aggregator-holesky: go run aggregator/cmd/main.go --config config-files/holesky/aggregator.yaml \ - --credible-squaring-deployment ${HOLESKY_FILES_DIR}/holesky_anzen_avs_deployment_output.json \ + --anzen-deployment ${HOLESKY_FILES_DIR}/holesky_anzen_avs_deployment_output.json \ --ecdsa-private-key ${AGGREGATOR_ECDSA_PRIV_KEY} \ 2>&1 | zap-pretty @@ -103,7 +103,7 @@ start-operator-3: ## start-challenger: ## go run challenger/cmd/main.go --config config-files/anvil/challenger.yaml \ - --credible-squaring-deployment ${DEPLOYMENT_FILES_DIR}/anzen_avs_deployment_output.json \ + --anzen-deployment ${DEPLOYMENT_FILES_DIR}/anzen_avs_deployment_output.json \ --ecdsa-private-key ${CHALLENGER_ECDSA_PRIV_KEY} \ 2>&1 | zap-pretty @@ -125,3 +125,5 @@ tests-contract: ## runs all forge tests tests-integration: ## runs all integration tests go test ./tests/integration/... -v -count=1 +tests-all: tests-unit tests-contract tests-integration ## runs all tests + diff --git a/aggregator/types/types.go b/aggregator/types/types.go index 174cca76..eefd4e18 100644 --- a/aggregator/types/types.go +++ b/aggregator/types/types.go @@ -7,13 +7,14 @@ import ( // all operators in quorum0 must sign the task response in order for it to be accepted // TODO: our contracts require uint8 but right now sdktypes.QuorumThresholdPercentage is uint8 -// prob need to update our inc-sq contracts to use uint8 as well? +// +// prob need to update our inc-sq contracts to use uint8 as well? const QUORUM_THRESHOLD_NUMERATOR = sdktypes.QuorumThresholdPercentage(100) const QUORUM_THRESHOLD_DENOMINATOR = sdktypes.QuorumThresholdPercentage(100) const QUERY_FILTER_FROM_BLOCK = uint64(1) -// we only use a single quorum (quorum 0) for incredible squaring +// we only use a single quorum (quorum 0) for anzen var QUORUM_NUMBERS = sdktypes.QuorumNums{0} type BlockNumber = uint32 diff --git a/challenger/cmd/main.go b/challenger/cmd/main.go index c11ac818..1256d393 100644 --- a/challenger/cmd/main.go +++ b/challenger/cmd/main.go @@ -25,8 +25,8 @@ func main() { app := cli.NewApp() app.Flags = config.Flags app.Version = fmt.Sprintf("%s-%s-%s", Version, GitCommit, GitDate) - app.Name = "credible-squaring-challenger" - app.Usage = "Credible Squaring Challenger" + app.Name = "anzen-challenger" + app.Usage = "Anzen Challenger" app.Description = "Service that challenges wrong response to the task." app.Action = challengerMain diff --git a/cli/main.go b/cli/main.go index 3d2ccc54..a34def6c 100644 --- a/cli/main.go +++ b/cli/main.go @@ -56,7 +56,7 @@ func main() { { Name: "print-operator-status", Aliases: []string{"s"}, - Usage: "prints operator status as viewed from incredible squaring contracts", + Usage: "prints operator status as viewed from anzen contracts", Action: actions.PrintOperatorStatus, }, } diff --git a/contracts/script/AnzenDeployer.s.sol b/contracts/script/AnzenDeployer.s.sol index 99c4a89f..97729e7e 100644 --- a/contracts/script/AnzenDeployer.s.sol +++ b/contracts/script/AnzenDeployer.s.sol @@ -48,7 +48,7 @@ contract AnzenDeployer is Script, Utils { ERC20Mock public erc20Mock; StrategyBaseTVLLimits public erc20MockStrategy; - // Credible Squaring contracts + // anzen contracts ProxyAdmin public anzenProxyAdmin; PauserRegistry public anzenPauserReg; diff --git a/contracts/script/HoleskyAnzenDeployer.s.sol b/contracts/script/HoleskyAnzenDeployer.s.sol index 62839e39..b8d70b0d 100644 --- a/contracts/script/HoleskyAnzenDeployer.s.sol +++ b/contracts/script/HoleskyAnzenDeployer.s.sol @@ -48,7 +48,7 @@ contract AnzenDeployer is Script, Utils { // ERC20 and Strategy: we need to deploy this erc20, create a strategy for it, and whitelist this strategy in the strategymanager StrategyBaseTVLLimits public erc20Strategy; - // Credible Squaring contracts + // anzen contracts ProxyAdmin public anzenProxyAdmin; PauserRegistry public anzenPauserReg; diff --git a/contracts/src/AnzenServiceManager.sol b/contracts/src/AnzenServiceManager.sol index 2c25012d..cc011591 100644 --- a/contracts/src/AnzenServiceManager.sol +++ b/contracts/src/AnzenServiceManager.sol @@ -7,7 +7,7 @@ import "@eigenlayer-middleware/src/ServiceManagerBase.sol"; import "./AnzenTaskManager.sol"; /** - * @title Primary entrypoint for procuring services from IncredibleSquaring. + * @title Primary entrypoint for procuring services from Anzen. * @author Layr Labs, Inc. */ contract AnzenServiceManager is ServiceManagerBase { diff --git a/core/config/config.go b/core/config/config.go index 57dbea0e..9e5ea7eb 100644 --- a/core/config/config.go +++ b/core/config/config.go @@ -20,7 +20,7 @@ import ( sdkutils "github.com/Layr-Labs/eigensdk-go/utils" ) -// Config contains all of the configuration information for a credible squaring aggregators and challengers. +// Config contains all of the configuration information for an anzen aggregators and challengers. // Operators use a separate config. (see config-files/anvil/operator.yaml) type Config struct { EcdsaPrivateKey *ecdsa.PrivateKey @@ -53,11 +53,11 @@ type ConfigRaw struct { RegisterOperatorOnStartup bool `yaml:"register_operator_on_startup"` } -// These are read from CredibleSquaringDeploymentFileFlag -type IncredibleSquaringDeploymentRaw struct { - Addresses IncredibleSquaringContractsRaw `json:"addresses"` +// These are read from AnzenDeploymentFileFlag +type AnzenDeploymentRaw struct { + Addresses AnzenContractsRaw `json:"addresses"` } -type IncredibleSquaringContractsRaw struct { +type AnzenContractsRaw struct { RegistryCoordinatorAddr string `json:"registryCoordinator"` OperatorStateRetrieverAddr string `json:"operatorStateRetriever"` SafetyFactorOracleAddr string `json:"safetyFactorOracle"` @@ -74,12 +74,12 @@ func NewConfig(ctx *cli.Context) (*Config, error) { sdkutils.ReadYamlConfig(configFilePath, &configRaw) } - var credibleSquaringDeploymentRaw IncredibleSquaringDeploymentRaw - credibleSquaringDeploymentFilePath := ctx.GlobalString(CredibleSquaringDeploymentFileFlag.Name) - if _, err := os.Stat(credibleSquaringDeploymentFilePath); errors.Is(err, os.ErrNotExist) { - panic("Path " + credibleSquaringDeploymentFilePath + " does not exist") + var anzenDeploymentRaw AnzenDeploymentRaw + anzenDeploymentFilePath := ctx.GlobalString(AnzenDeploymentFileFlag.Name) + if _, err := os.Stat(anzenDeploymentFilePath); errors.Is(err, os.ErrNotExist) { + panic("Path " + anzenDeploymentFilePath + " does not exist") } - sdkutils.ReadJsonConfig(credibleSquaringDeploymentFilePath, &credibleSquaringDeploymentRaw) + sdkutils.ReadJsonConfig(anzenDeploymentFilePath, &anzenDeploymentRaw) logger, err := sdklogging.NewZapLogger(configRaw.Environment) if err != nil { @@ -137,9 +137,9 @@ func NewConfig(ctx *cli.Context) (*Config, error) { EthHttpRpcUrl: configRaw.EthRpcUrl, EthHttpClient: ethRpcClient, EthWsClient: ethWsClient, - OperatorStateRetrieverAddr: common.HexToAddress(credibleSquaringDeploymentRaw.Addresses.OperatorStateRetrieverAddr), - AnzenRegistryCoordinatorAddr: common.HexToAddress(credibleSquaringDeploymentRaw.Addresses.RegistryCoordinatorAddr), - SafetyFactorOracleAddr: common.HexToAddress(credibleSquaringDeploymentRaw.Addresses.SafetyFactorOracleAddr), + OperatorStateRetrieverAddr: common.HexToAddress(anzenDeploymentRaw.Addresses.OperatorStateRetrieverAddr), + AnzenRegistryCoordinatorAddr: common.HexToAddress(anzenDeploymentRaw.Addresses.RegistryCoordinatorAddr), + SafetyFactorOracleAddr: common.HexToAddress(anzenDeploymentRaw.Addresses.SafetyFactorOracleAddr), AggregatorServerIpPortAddr: configRaw.AggregatorServerIpPortAddr, RegisterOperatorOnStartup: configRaw.RegisterOperatorOnStartup, SignerFn: signerV2, @@ -156,7 +156,7 @@ func (c *Config) validate() { panic("Config: BLSOperatorStateRetrieverAddr is required") } if c.AnzenRegistryCoordinatorAddr == common.HexToAddress("") { - panic("Config: IncredibleSquaringRegistryCoordinatorAddr is required") + panic("Config: AnzenRegistryCoordinatorAddr is required") } if c.SafetyFactorOracleAddr == common.HexToAddress("") { panic("Config: SafetyFactorOracleAddr is required") @@ -170,10 +170,10 @@ var ( Required: true, Usage: "Load configuration from `FILE`", } - CredibleSquaringDeploymentFileFlag = cli.StringFlag{ - Name: "credible-squaring-deployment", + AnzenDeploymentFileFlag = cli.StringFlag{ + Name: "anzen-deployment", Required: true, - Usage: "Load credible squaring contract addresses from `FILE`", + Usage: "Load anzen contract addresses from `FILE`", } EcdsaPrivateKeyFlag = cli.StringFlag{ Name: "ecdsa-private-key", @@ -186,7 +186,7 @@ var ( var requiredFlags = []cli.Flag{ ConfigFileFlag, - CredibleSquaringDeploymentFileFlag, + AnzenDeploymentFileFlag, EcdsaPrivateKeyFlag, } diff --git a/docker-compose.yml b/docker-compose.yml index ea184554..ef698d54 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,7 +43,7 @@ services: command: - --config - config-files/aggregator-docker-compose.yaml - - --credible-squaring-deployment + - --anzen-deployment - contracts/script/output/31337/anzen_avs_deployment_output.json - --ecdsa-private-key - "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6" @@ -78,7 +78,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/anzen_avs_deployment_output.json --ecdsa-private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d --bls-private-key 2 + # command: --config config-files/operator-docker-compose.anvil.yaml --anzen-deployment contracts/script/output/31337/anzen_avs_deployment_output.json --ecdsa-private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d --bls-private-key 2 # networks: # - anzen-network diff --git a/tests/integration/integration_test.go b/tests/integration/integration_test.go index bfe696cc..335e01c1 100644 --- a/tests/integration/integration_test.go +++ b/tests/integration/integration_test.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "math/big" "os" "os/exec" "path/filepath" @@ -53,9 +54,9 @@ func TestIntegration(t *testing.T) { aggConfigRaw.EthRpcUrl = "http://" + anvilEndpoint aggConfigRaw.EthWsUrl = "ws://" + anvilEndpoint - var credibleSquaringDeploymentRaw config.IncredibleSquaringDeploymentRaw - credibleSquaringDeploymentFilePath := "../../contracts/script/output/31337/anzen_avs_deployment_output.json" - sdkutils.ReadJsonConfig(credibleSquaringDeploymentFilePath, &credibleSquaringDeploymentRaw) + var anzenDeploymentRaw config.AnzenDeploymentRaw + anzenDeploymentFilePath := "../../contracts/script/output/31337/anzen_avs_deployment_output.json" + sdkutils.ReadJsonConfig(anzenDeploymentFilePath, &anzenDeploymentRaw) logger, err := sdklogging.NewZapLogger(aggConfigRaw.Environment) if err != nil { @@ -70,6 +71,7 @@ func TestIntegration(t *testing.T) { t.Fatalf("Failed to create eth client: %s", err.Error()) } + // TODO: this is a hack to get the operator address aggregatorEcdsaPrivateKeyString := "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6" if aggregatorEcdsaPrivateKeyString[:2] == "0x" { aggregatorEcdsaPrivateKeyString = aggregatorEcdsaPrivateKeyString[2:] @@ -105,8 +107,9 @@ func TestIntegration(t *testing.T) { EthHttpClient: ethRpcClient, EthWsRpcUrl: aggConfigRaw.EthWsUrl, EthWsClient: ethWsClient, - OperatorStateRetrieverAddr: common.HexToAddress(credibleSquaringDeploymentRaw.Addresses.OperatorStateRetrieverAddr), - AnzenRegistryCoordinatorAddr: common.HexToAddress(credibleSquaringDeploymentRaw.Addresses.RegistryCoordinatorAddr), + OperatorStateRetrieverAddr: common.HexToAddress(anzenDeploymentRaw.Addresses.OperatorStateRetrieverAddr), + AnzenRegistryCoordinatorAddr: common.HexToAddress(anzenDeploymentRaw.Addresses.RegistryCoordinatorAddr), + SafetyFactorOracleAddr: common.HexToAddress(anzenDeploymentRaw.Addresses.SafetyFactorOracleAddr), AggregatorServerIpPortAddr: aggConfigRaw.AggregatorServerIpPortAddr, RegisterOperatorOnStartup: aggConfigRaw.RegisterOperatorOnStartup, TxMgr: txMgr, @@ -166,9 +169,10 @@ func TestIntegration(t *testing.T) { if err != nil { t.Fatalf("Cannot create AVS Reader: %s", err.Error()) } + // TODO: Figure out why this is failing with task 1 not being completed // check if the task is recorded in the contract for task index 1 - taskHash, err := avsReader.AvsServiceBindings.TaskManager.AllTaskHashes(&bind.CallOpts{}, 1) + taskHash, err := avsReader.AvsServiceBindings.TaskManager.AllTaskHashes(&bind.CallOpts{}, 0) if err != nil { t.Fatalf("Cannot get task hash: %s", err.Error()) } @@ -177,7 +181,7 @@ func TestIntegration(t *testing.T) { } // check if the task response is recorded in the contract for task index 1 - taskResponseHash, err := avsReader.AvsServiceBindings.TaskManager.AllTaskResponses(&bind.CallOpts{}, 1) + taskResponseHash, err := avsReader.AvsServiceBindings.TaskManager.AllTaskResponses(&bind.CallOpts{}, 0) log.Printf("taskResponseHash: %v", taskResponseHash) if err != nil { t.Fatalf("Cannot get task response hash: %s", err.Error()) @@ -186,6 +190,17 @@ func TestIntegration(t *testing.T) { t.Fatalf("Task response hash is empty") } + // check if the safety factor is recorded in the oracle contract + safetyFactorInfo, err := avsReader.AvsServiceBindings.SafetyFactorOracle.GetSafetyFactor(&bind.CallOpts{}, 0) + if err != nil { + t.Fatalf("Cannot get safety factor: %s", err.Error()) + } + if safetyFactorInfo.SafetyFactor.Cmp(big.NewInt(0)) == 0 { + t.Fatalf("Safety factor is empty") + } + if safetyFactorInfo.Timestamp.Cmp(big.NewInt(0)) == 0 { + t.Fatalf("Safety factor timestamp is empty") + } } // TODO(samlaf): have to advance chain to a block where the task is answered