From 71ecb7f0f1796c69fb88d2b8877c34fe15ca5f1e Mon Sep 17 00:00:00 2001 From: irrun Date: Wed, 29 May 2024 15:41:23 +0800 Subject: [PATCH 1/5] feat: set dial timeout as 5s --- node/validator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/validator.go b/node/validator.go index c396178..1078f83 100644 --- a/node/validator.go +++ b/node/validator.go @@ -26,7 +26,7 @@ var ( PayBidTxGasUsed = uint64(25000) dialer = &net.Dialer{ - Timeout: time.Second, + Timeout: 5 * time.Second, KeepAlive: 60 * time.Second, } From f0e69f00b0264ac4a7c1923c64df466af8ac1eff Mon Sep 17 00:00:00 2001 From: irrun Date: Wed, 29 May 2024 15:45:03 +0800 Subject: [PATCH 2/5] feat: hide validator ip --- node/validator.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/node/validator.go b/node/validator.go index 1078f83..270d122 100644 --- a/node/validator.go +++ b/node/validator.go @@ -7,6 +7,7 @@ import ( "math/big" "net" "net/http" + "strings" "sync/atomic" "time" @@ -117,7 +118,18 @@ 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 { From ae1b1476b9058fc124842e2d82f1f5993756c0b4 Mon Sep 17 00:00:00 2001 From: Mars Date: Wed, 29 May 2024 15:48:48 +0800 Subject: [PATCH 3/5] fix: verify builder (#9) --- service/sentry.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/sentry.go b/service/sentry.go index e37880d..02cd923 100644 --- a/service/sentry.go +++ b/service/sentry.go @@ -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) From 56c08123dd7dfa363869a4256432a0385d568729 Mon Sep 17 00:00:00 2001 From: irrun Date: Wed, 29 May 2024 15:52:16 +0800 Subject: [PATCH 4/5] chore: fix log --- service/sentry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/sentry.go b/service/sentry.go index 02cd923..4ade969 100644 --- a/service/sentry.go +++ b/service/sentry.go @@ -212,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 } From 39102810d1ee535a141a81793ff8fe326d418d19 Mon Sep 17 00:00:00 2001 From: irrun Date: Wed, 29 May 2024 15:55:46 +0800 Subject: [PATCH 5/5] fix: ci --- node/validator.go | 1 - 1 file changed, 1 deletion(-) diff --git a/node/validator.go b/node/validator.go index 270d122..afbbec1 100644 --- a/node/validator.go +++ b/node/validator.go @@ -126,7 +126,6 @@ func (n *validator) SendBid(ctx context.Context, args types.BidArgs) (common.Has if strings.Contains(err.Error(), "timeout") { err = errors.New("timeout when send bid to validator") } - } return hash, err