From 75a88e3c3cf1ca80cc7d33ef7a1723761442ddaa Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Mon, 8 Jul 2024 19:50:06 +0530 Subject: [PATCH 1/3] Feed Client should log loud error when rate limited --- broadcastclient/broadcastclient.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/broadcastclient/broadcastclient.go b/broadcastclient/broadcastclient.go index 1167dba133..a0348b7f9c 100644 --- a/broadcastclient/broadcastclient.go +++ b/broadcastclient/broadcastclient.go @@ -25,6 +25,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" + "github.com/ethereum/go-ethereum/rpc" "github.com/offchainlabs/nitro/arbutil" m "github.com/offchainlabs/nitro/broadcaster/message" @@ -292,6 +293,11 @@ func (bc *BroadcastClient) connect(ctx context.Context, nextSeqNum arbutil.Messa return nil, err } if err != nil { + var httpError rpc.HTTPError + if errors.As(err, &httpError) { + if httpError.StatusCode == 429 { + log.Error("rate limit exceeded, please run own local relay because too many nodes are connecting to feed from same IP address", "err", err) + } return nil, fmt.Errorf("broadcast client unable to connect: %w", err) } if config.RequireChainId && !foundChainId { From c1284529b82c552118fa59a8c6441fc6e316c46c Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Mon, 8 Jul 2024 20:03:35 +0530 Subject: [PATCH 2/3] fix --- broadcastclient/broadcastclient.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/broadcastclient/broadcastclient.go b/broadcastclient/broadcastclient.go index a0348b7f9c..d4135ed75f 100644 --- a/broadcastclient/broadcastclient.go +++ b/broadcastclient/broadcastclient.go @@ -294,10 +294,9 @@ func (bc *BroadcastClient) connect(ctx context.Context, nextSeqNum arbutil.Messa } if err != nil { var httpError rpc.HTTPError - if errors.As(err, &httpError) { - if httpError.StatusCode == 429 { - log.Error("rate limit exceeded, please run own local relay because too many nodes are connecting to feed from same IP address", "err", err) - } + if errors.As(err, &httpError) && httpError.StatusCode == 429 { + log.Error("rate limit exceeded, please run own local relay because too many nodes are connecting to feed from same IP address", "err", err) + } return nil, fmt.Errorf("broadcast client unable to connect: %w", err) } if config.RequireChainId && !foundChainId { From c205b67f99e9cd6f038f521cf74a5bae98661f4c Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Tue, 9 Jul 2024 16:17:27 +0530 Subject: [PATCH 3/3] Changes based on PR comments --- broadcastclient/broadcastclient.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/broadcastclient/broadcastclient.go b/broadcastclient/broadcastclient.go index d4135ed75f..2225341560 100644 --- a/broadcastclient/broadcastclient.go +++ b/broadcastclient/broadcastclient.go @@ -25,8 +25,6 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/rpc" - "github.com/offchainlabs/nitro/arbutil" m "github.com/offchainlabs/nitro/broadcaster/message" "github.com/offchainlabs/nitro/util/contracts" @@ -293,8 +291,8 @@ func (bc *BroadcastClient) connect(ctx context.Context, nextSeqNum arbutil.Messa return nil, err } if err != nil { - var httpError rpc.HTTPError - if errors.As(err, &httpError) && httpError.StatusCode == 429 { + connectionRejectedError := &ws.ConnectionRejectedError{} + if errors.As(err, &connectionRejectedError) && connectionRejectedError.StatusCode() == 429 { log.Error("rate limit exceeded, please run own local relay because too many nodes are connecting to feed from same IP address", "err", err) } return nil, fmt.Errorf("broadcast client unable to connect: %w", err)