Skip to content

Commit 01fd186

Browse files
authored
Fix nil pointer on log in builder submission (#529)
* Try fix log point in builder api * Fix log reassignment in builder submission
1 parent 847f33b commit 01fd186

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

services/api/service.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -1605,15 +1605,15 @@ type bidFloorOpts struct {
16051605
payload *common.BuilderSubmitBlockRequest
16061606
}
16071607

1608-
func (api *RelayAPI) checkFloorBidValue(opts bidFloorOpts) (*big.Int, *logrus.Entry, bool) {
1608+
func (api *RelayAPI) checkFloorBidValue(opts bidFloorOpts) (*big.Int, bool) {
16091609
// Reject new submissions once the payload for this slot was delivered - TODO: store in memory as well
16101610
slotLastPayloadDelivered, err := api.redis.GetLastSlotDelivered(context.Background(), opts.tx)
16111611
if err != nil && !errors.Is(err, redis.Nil) {
16121612
opts.log.WithError(err).Error("failed to get delivered payload slot from redis")
16131613
} else if opts.payload.Slot() <= slotLastPayloadDelivered {
16141614
opts.log.Info("rejecting submission because payload for this slot was already delivered")
16151615
api.RespondError(opts.w, http.StatusBadRequest, "payload for this slot was already delivered")
1616-
return nil, nil, false
1616+
return nil, false
16171617
}
16181618

16191619
// Grab floor bid value
@@ -1636,17 +1636,17 @@ func (api *RelayAPI) checkFloorBidValue(opts bidFloorOpts) (*big.Int, *logrus.En
16361636
if err != nil {
16371637
opts.log.WithError(err).Error("failed processing cancellable bid below floor")
16381638
api.RespondError(opts.w, http.StatusInternalServerError, "failed processing cancellable bid below floor")
1639-
return nil, nil, false
1639+
return nil, false
16401640
}
16411641
api.Respond(opts.w, http.StatusAccepted, "accepted bid below floor, skipped validation")
1642-
return nil, nil, false
1642+
return nil, false
16431643
} else if !opts.cancellationsEnabled && isBidAtOrBelowFloor { // without cancellations: if at or below floor -> ignore
16441644
opts.simResultC <- &blockSimResult{false, false, nil, nil}
16451645
opts.log.Info("submission at or below floor bid value, without cancellation")
16461646
api.RespondMsg(opts.w, http.StatusAccepted, "accepted bid below floor, skipped validation")
1647-
return nil, nil, false
1647+
return nil, false
16481648
}
1649-
return floorBidValue, opts.log, true
1649+
return floorBidValue, true
16501650
}
16511651

16521652
type redisUpdateBidOpts struct {
@@ -1874,7 +1874,7 @@ func (api *RelayAPI) handleSubmitNewBlock(w http.ResponseWriter, req *http.Reque
18741874
simResultC: simResultC,
18751875
payload: payload,
18761876
}
1877-
floorBidValue, log, ok := api.checkFloorBidValue(bfOpts)
1877+
floorBidValue, ok := api.checkFloorBidValue(bfOpts)
18781878
if !ok {
18791879
return
18801880
}

services/api/service_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ func TestCheckFloorBidValue(t *testing.T) {
937937
simResultC: simResultC,
938938
payload: tc.payload,
939939
}
940-
floor, log, ok := backend.relay.checkFloorBidValue(bfOpts)
940+
floor, ok := backend.relay.checkFloorBidValue(bfOpts)
941941
require.Equal(t, tc.expectOk, ok)
942942
if ok {
943943
require.NotNil(t, floor)

0 commit comments

Comments
 (0)