Skip to content

Commit

Permalink
Merge pull request #121 from attestantio/ignore-zero-value-bids
Browse files Browse the repository at this point in the history
Ignore zero-value bids.
  • Loading branch information
mcdee authored Feb 16, 2023
2 parents 2b163eb + 7138bb5 commit 9b8114d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions services/blockrelay/standard/auctionblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (s *Service) bestBuilderBid(ctx context.Context,
errored := 0
timedOut := 0
softTimedOut := 0
bestScore := new(big.Int)
bestScore := big.NewInt(0)

// Loop 1: prior to soft timeout.
for responded+errored+timedOut+softTimedOut != requests {
Expand All @@ -182,12 +182,12 @@ func (s *Service) bestBuilderBid(ctx context.Context,
continue
}
switch {
case res.Bid == nil || resp.score.Cmp(bestScore) > 0:
case resp.score.Cmp(bestScore) > 0:
log.Trace().Str("provider", resp.provider.Address()).Stringer("score", resp.score).Msg("New winning bid")
res.Bid = resp.bid
bestScore = resp.score
res.Providers = []builderclient.BuilderBidProvider{resp.provider}
case resp.score.Cmp(bestScore) == 0 && bidsEqual(res.Bid, resp.bid):
case res.Bid != nil && resp.score.Cmp(bestScore) == 0 && bidsEqual(res.Bid, resp.bid):
log.Trace().Str("provider", resp.provider.Address()).Msg("Matching bid from different relay")
res.Providers = append(res.Providers, resp.provider)
default:
Expand Down Expand Up @@ -222,12 +222,12 @@ func (s *Service) bestBuilderBid(ctx context.Context,
continue
}
switch {
case res.Bid == nil || resp.score.Cmp(bestScore) > 0:
case resp.score.Cmp(bestScore) > 0:
log.Trace().Str("provider", resp.provider.Address()).Stringer("score", resp.score).Msg("New winning bid")
res.Bid = resp.bid
bestScore = resp.score
res.Providers = []builderclient.BuilderBidProvider{resp.provider}
case resp.score.Cmp(bestScore) == 0 && bidsEqual(res.Bid, resp.bid):
case res.Bid != nil && resp.score.Cmp(bestScore) == 0 && bidsEqual(res.Bid, resp.bid):
log.Trace().Str("provider", resp.provider.Address()).Msg("Matching bid from different relay")
res.Providers = append(res.Providers, resp.provider)
default:
Expand Down
4 changes: 2 additions & 2 deletions services/blockrelay/standard/executionconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ func (s *Service) obtainExecutionConfig(ctx context.Context,
for _, pubkey := range pubkeys {
pubkeyStrs = append(pubkeyStrs, fmt.Sprintf("%#x", pubkey))
}
ctx = context.WithValue(ctx, &httpconfidant.Body{}, []byte(fmt.Sprintf(`["%s"]`, strings.Join(pubkeyStrs, `","`))))
ctx = context.WithValue(ctx, &httpconfidant.Body{}, []byte(fmt.Sprintf(`[%q]`, strings.Join(pubkeyStrs, `","`))))

res, err = s.majordomo.Fetch(ctx, s.configURL)
}
if err != nil {
return nil, errors.Wrap(err, "failed to obtain execution configuration")
}

log.Trace().Str("res", string(res)).Msg("Received response")
log.Trace().RawJSON("res", res).Msg("Received response")

executionConfig, err := blockrelay.UnmarshalJSON(res)
if err != nil {
Expand Down

0 comments on commit 9b8114d

Please sign in to comment.