diff --git a/core/services/relay/evm/mercury/wsrpc/client.go b/core/services/relay/evm/mercury/wsrpc/client.go index ebd282e6093..1cd8c9af50d 100644 --- a/core/services/relay/evm/mercury/wsrpc/client.go +++ b/core/services/relay/evm/mercury/wsrpc/client.go @@ -286,13 +286,6 @@ func (w *client) waitForReady(ctx context.Context) (err error) { func (w *client) Transmit(ctx context.Context, req *pb.TransmitRequest) (resp *pb.TransmitResponse, err error) { ok := w.IfStarted(func() { - defer func() { - if r := recover(); r != nil { - w.handlePanic(r) - resp = nil - err = fmt.Errorf("Transmit: caught panic: %v", r) - } - }() w.logger.Trace("Transmit") start := time.Now() if err = w.waitForReady(ctx); err != nil { @@ -360,13 +353,6 @@ func (w *client) handleTimeout(err error) { func (w *client) LatestReport(ctx context.Context, req *pb.LatestReportRequest) (resp *pb.LatestReportResponse, err error) { ok := w.IfStarted(func() { - defer func() { - if r := recover(); r != nil { - w.handlePanic(r) - resp = nil - err = fmt.Errorf("LatestReport: caught panic: %v", r) - } - }() lggr := w.logger.With("req.FeedId", hexutil.Encode(req.FeedId)) lggr.Trace("LatestReport") if err = w.waitForReady(ctx); err != nil { diff --git a/core/services/relay/evm/mercury/wsrpc/client_test.go b/core/services/relay/evm/mercury/wsrpc/client_test.go index b2bbf074e91..7c6706eddf8 100644 --- a/core/services/relay/evm/mercury/wsrpc/client_test.go +++ b/core/services/relay/evm/mercury/wsrpc/client_test.go @@ -2,16 +2,11 @@ package wsrpc import ( "context" - "math/big" - "math/rand" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - grpc_connectivity "google.golang.org/grpc/connectivity" - - "github.com/smartcontractkit/wsrpc" "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -128,67 +123,6 @@ func Test_Client_Transmit(t *testing.T) { } }) }) - - t.Run("recovers panics in underlying client and attempts redial", func(t *testing.T) { - makeConn := func() *mocks.MockConn { - return &mocks.MockConn{ - Ready: true, - State: grpc_connectivity.Ready, - InvokeF: func(ctx context.Context, method string, args interface{}, reply interface{}) error { - panic("TESTING CONN INVOKE PANIC") - }, - } - } - - ch := make(chan *mocks.MockConn, 100) - cnt := 0 - - f := func(ctxCaller context.Context, target string, opts ...wsrpc.DialOption) (Conn, error) { - cnt++ - switch cnt { - case 1, 2: - conn := makeConn() - ch <- conn - return conn, nil - default: - t.Fatalf("too many dials, got: %d", cnt) - return nil, nil - } - } - - clientKey := csakey.MustNewV2XXXTestingOnly(big.NewInt(rand.Int63())) - serverKey := csakey.MustNewV2XXXTestingOnly(big.NewInt(rand.Int63())) - opts := ClientOpts{ - lggr, - clientKey, - serverKey.PublicKey, - "", - noopCacheSet, - f, - } - c := newClient(opts) - - servicetest.Run(t, c) - - // drain the channel - var conn *mocks.MockConn - select { - case conn = <-ch: - assert.Equal(t, 1, cnt) - default: - t.Fatalf("expected dial to be called") - } - - _, err := c.Transmit(ctx, req) - require.EqualError(t, err, "Transmit: caught panic: TESTING CONN INVOKE PANIC") - - // expect conn to be closed and re-dialed - conn2 := <-ch - assert.Equal(t, 2, cnt) - - assert.True(t, conn.Closed) - assert.False(t, conn2.Closed) - }) } func Test_Client_LatestReport(t *testing.T) {