From 05530d5c627335ecc76041b59fa200cbefbd20cf Mon Sep 17 00:00:00 2001 From: raina Date: Thu, 7 Mar 2024 20:42:00 +0800 Subject: [PATCH] fix: err message --- configs/config-example.toml | 2 +- service/sentry.go | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/configs/config-example.toml b/configs/config-example.toml index aee8df1..a3fdc64 100644 --- a/configs/config-example.toml +++ b/configs/config-example.toml @@ -14,7 +14,7 @@ PrivateURL = "http://127.0.0.1:8546" PublicHostName = "127.0.0.1" [[Builders]] -Address = "0x295e26495CEF6F69dFA69911d9D8e4F3bBadB89B" +Address = "0x837060bd423eFcDd5B7b6B92aB3CFc74B9CD0df4" URL = "http://localhost:8555" [FullNode] diff --git a/service/sentry.go b/service/sentry.go index 863d3ce..eaa4dfa 100644 --- a/service/sentry.go +++ b/service/sentry.go @@ -3,6 +3,7 @@ package service import ( "context" "errors" + "fmt" "math/big" "strings" "time" @@ -84,7 +85,7 @@ func (s *MevSentry) SendBid(ctx context.Context, args types.BidArgs) (common.Has builder, err := args.EcrecoverSender() if err != nil { log.Errorw("failed to parse bid signature", "err", err) - return common.Hash{}, err + return common.Hash{}, types.NewInvalidBidError(fmt.Sprintf("invalid signature:%v", err)) } if args.RawBid.BuilderFee != nil && args.RawBid.BuilderFee.Cmp(big.NewInt(0)) > 0 { @@ -160,7 +161,7 @@ func (s *MevSentry) Running(ctx context.Context) (bool, error) { return validator.MevRunning(), nil } -func (s *MevSentry) ReportIssue(ctx context.Context, args types.BidIssue) error { +func (s *MevSentry) ReportIssue(ctx context.Context, issue types.BidIssue) error { method := "mev_reportIssue" start := time.Now() defer recordLatency(method, start) @@ -169,13 +170,15 @@ func (s *MevSentry) ReportIssue(ctx context.Context, args types.BidIssue) error var builder node.Builder var ok bool - builder, ok = s.builders[args.Builder] + builder, ok = s.builders[issue.Builder] if !ok { - log.Errorw("builder not found", "address", args.Builder) + log.Errorw("builder not found", "address", issue.Builder) return errors.New("builder not found") } - return builder.ReportIssue(ctx, args) + fmt.Sprintf("issue: %+v", issue) + + return builder.ReportIssue(ctx, issue) } func recordLatency(method string, start time.Time) {