diff --git a/operator/operator.go b/operator/operator.go index a70e7741..14d44271 100644 --- a/operator/operator.go +++ b/operator/operator.go @@ -459,19 +459,30 @@ func (o *Operator) registerOperatorOnStartup( o.logger.Infof("Registered operator with eigenlayer") } - // TODO(samlaf): shouldn't hardcode number here - amount := big.NewInt(1000) - err = o.DepositIntoStrategy(mockTokenStrategyAddr, amount) - if err != nil { - o.logger.Fatal("Error depositing into strategy", "err", err) + if mockTokenStrategyAddr.Cmp(common.Address{}) != 0 { + // TODO(samlaf): shouldn't hardcode number here + amount := big.NewInt(1000) + err = o.DepositIntoStrategy(mockTokenStrategyAddr, amount) + if err != nil { + o.logger.Fatal("Error depositing into strategy", "err", err) + } + o.logger.Infof("Deposited %s into strategy %s", amount, mockTokenStrategyAddr) } - o.logger.Infof("Deposited %s into strategy %s", amount, mockTokenStrategyAddr) - err = o.avsManager.RegisterOperatorWithAvs(o.ethClient, operatorEcdsaPrivateKey, o.blsKeypair) + isOperatorRegistered, err := o.avsManager.avsReader.IsOperatorRegistered(&bind.CallOpts{}, o.operatorAddr) if err != nil { - o.logger.Fatal("Error registering operator with avs", "err", err) + o.logger.Fatal("Error checking if operator is registered", "err", err) + } + + if !isOperatorRegistered { + err = o.avsManager.RegisterOperatorWithAvs(o.ethClient, operatorEcdsaPrivateKey, o.blsKeypair) + if err != nil { + o.logger.Fatal("Error registering operator with avs", "err", err) + } + o.logger.Infof("Registered operator with avs") + } else { + o.logger.Infof("Operator already registered with avs") } - o.logger.Infof("Registered operator with avs") } func (o *Operator) BlsPubkeyG1() *bls.G1Point { diff --git a/setup/operator/config/operator.yaml b/setup/operator/config/operator.yaml index c297807e..15c7831b 100644 --- a/setup/operator/config/operator.yaml +++ b/setup/operator/config/operator.yaml @@ -18,7 +18,7 @@ enable_metrics: true node_api_ip_port_address: near-sffl-operator0:9010 enable_node_api: true -register_operator_on_startup: false +register_operator_on_startup: true token_strategy_addr: 0x0000000000000000000000000000000000000000 near_da_indexer_rmq_ip_port_address: amqp://rmq:5672