From d2894d2fd991489ed8a95f42818d5a5c73db9389 Mon Sep 17 00:00:00 2001 From: Franco Barpp Gomes Date: Wed, 17 Apr 2024 23:02:13 -0300 Subject: [PATCH] fix: Use WS client for event subscriptions (#90) --- aggregator/aggregator.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index c8f56e20..fa0cdeb3 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -103,6 +103,12 @@ func NewAggregator(ctx context.Context, config *config.Config, logger logging.Lo return nil, err } + ethWsClient, err := eth.NewClient(config.EthWsRpcUrl) + if err != nil { + logger.Errorf("Cannot create ws ethclient", "err", err) + return nil, err + } + avsReader, err := chainio.BuildAvsReaderFromConfig(config, ethHttpClient, logger) if err != nil { logger.Error("Cannot create avsReader", "err", err) @@ -135,7 +141,7 @@ func NewAggregator(ctx context.Context, config *config.Config, logger logging.Lo return nil, err } - avsSubscriber, err := chainio.BuildAvsSubscriber(config.SFFLRegistryCoordinatorAddr, config.OperatorStateRetrieverAddr, ethHttpClient, logger) + avsSubscriber, err := chainio.BuildAvsSubscriber(config.SFFLRegistryCoordinatorAddr, config.OperatorStateRetrieverAddr, ethWsClient, logger) if err != nil { logger.Error("Cannot create AvsSubscriber", "err", err) return nil, err