Skip to content

Commit

Permalink
Merge pull request #10 from bnb-chain/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
irrun authored May 29, 2024
2 parents 0c44d2f + 3910281 commit 37b0740
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 13 additions & 2 deletions node/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"math/big"
"net"
"net/http"
"strings"
"sync/atomic"
"time"

Expand All @@ -26,7 +27,7 @@ var (
PayBidTxGasUsed = uint64(25000)

dialer = &net.Dialer{
Timeout: time.Second,
Timeout: 5 * time.Second,
KeepAlive: 60 * time.Second,
}

Expand Down Expand Up @@ -117,7 +118,17 @@ type validator struct {
}

func (n *validator) SendBid(ctx context.Context, args types.BidArgs) (common.Hash, error) {
return n.client.SendBid(ctx, args)
hash, err := n.client.SendBid(ctx, args)
if err != nil {
metrics.ChainError.Inc()
log.Errorw("failed to send bid", "err", err)

if strings.Contains(err.Error(), "timeout") {
err = errors.New("timeout when send bid to validator")
}
}

return hash, err
}

func (n *validator) MevRunning() bool {
Expand Down
6 changes: 5 additions & 1 deletion service/sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ func (s *MevSentry) SendBid(ctx context.Context, args types.BidArgs) (bidHash co
log.Errorw("failed to parse bid signature", "err", err)
err = types.NewInvalidBidError(fmt.Sprintf("invalid signature:%v", err))
return
} else if _, ok = s.builders[builder]; !ok {
log.Errorw("builder not registered", "address", builder)
err = types.NewInvalidBidError("builder not registered")
return
}

payBidTx, err := validator.GeneratePayBidTx(ctx, builder, args.RawBid.BuilderFee)
Expand Down Expand Up @@ -208,7 +212,7 @@ func (s *MevSentry) ReportIssue(ctx context.Context, issue types.BidIssue) (err

builder, ok = s.builders[issue.Builder]
if !ok {
log.Errorw("builder not found", "address", issue.Builder)
log.Errorw("builder url not found", "address", issue.Builder, "issue", issue)
err = errors.New("builder not found")
return
}
Expand Down

0 comments on commit 37b0740

Please sign in to comment.