Skip to content

Commit

Permalink
fix: goto last saved for icon ws error, rf: use plain http rpc instea…
Browse files Browse the repository at this point in the history
…d of ws on evm
  • Loading branch information
debendraoli committed Jun 12, 2024
1 parent 5f1ab86 commit 5b3d383
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions relayer/chains/evm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ func newClient(ctx context.Context, connectionContract, XcallContract common.Add
return nil, err
}

connection, err := bridgeContract.NewConnection(connectionContract, eth)
ethRpc, err := ethclient.DialContext(ctx, rpcUrl)
if err != nil {
return nil, err
}

connection, err := bridgeContract.NewConnection(connectionContract, ethRpc)
if err != nil {
return nil, fmt.Errorf("error occured when creating connection cobtract: %v ", err)
}

xcall, err := bridgeContract.NewXcall(XcallContract, eth)
xcall, err := bridgeContract.NewXcall(XcallContract, ethRpc)
if err != nil {
return nil, fmt.Errorf("error occured when creating eth client: %v ", err)
}
Expand Down
3 changes: 2 additions & 1 deletion relayer/chains/icon/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,13 @@ func (c *Client) Monitor(ctx context.Context, reqUrl string, reqPtr, respPtr int
return err
}
defer func() {
c.log.Debug(fmt.Sprintf("Monitor finish %s", conn.LocalAddr().String()))
c.log.Debug(fmt.Sprintf("Monitor finish %s", conn.RemoteAddr().String()))
c.wsClose(conn)
}()
if err = c.wsRequest(conn, reqPtr); err != nil {
return err
}
c.log.Info("Monitoring started", zap.String("address", conn.RemoteAddr().String()))
conn.SetPongHandler(func(string) error {
return conn.SetReadDeadline(time.Now().Add(15 * time.Second))
})
Expand Down
1 change: 1 addition & 0 deletions relayer/chains/icon/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (p *Provider) Listener(ctx context.Context, lastSavedHeight uint64, incomin
if errors.Is(err, context.Canceled) {
return
}
eventReq.Height = types.NewHexInt(int64(p.GetLastSavedBlockHeight()))
time.Sleep(time.Second * 3)
reconnect()
p.log.Warn("error occured during monitor event", zap.Error(err))
Expand Down

0 comments on commit 5b3d383

Please sign in to comment.