Skip to content

Commit

Permalink
Optimistic v1 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
avalonche committed May 14, 2024
1 parent c1eb4ca commit e17022f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ func (s *DatabaseService) DeleteExecutionPayloads(idFirst, idLast uint64) error
}

func (s *DatabaseService) InsertBuilderDemotion(submitBlockRequest *common.VersionedSubmitBlockRequest, simError error) error {
_submitBlockRequest, err := json.Marshal(submitBlockRequest.Capella)
_submitBlockRequest, err := json.Marshal(submitBlockRequest)
if err != nil {
return err
}
Expand Down
13 changes: 9 additions & 4 deletions services/api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,12 @@ func (api *RelayAPI) demoteBuilder(pubkey string, req *common.VersionedSubmitBlo
api.log.Error(fmt.Errorf("error setting builder: %v status: %w", pubkey, err))
}
// Write to demotions table.
api.log.WithFields(logrus.Fields{"builder_pubkey": pubkey}).Info("demoting builder")
api.log.WithFields(logrus.Fields{
"builderPubkey": pubkey,
"slot": req.Slot,
"blockHash": req.BlockHash,
"demotionErr": simError.Error(),
}).Info("demoting builder")
bidTrace, err := req.BidTrace()
if err != nil {
api.log.WithError(err).Warn("failed to get bid trace from submit block request")
Expand Down Expand Up @@ -2263,15 +2268,15 @@ func (api *RelayAPI) handleInternalBuilderCollateral(w http.ResponseWriter, req
builderPubkey := vars["pubkey"]
if req.Method == http.MethodPost || req.Method == http.MethodPut {
args := req.URL.Query()
builderID := args.Get("builderID")
collateral := args.Get("collateral")
value := args.Get("value")
log := api.log.WithFields(logrus.Fields{
"pubkey": builderPubkey,
"builderID": builderID,
"collateral": collateral,
"value": value,
})
log.Infof("updating builder collateral")
if err := api.db.SetBlockBuilderCollateral(builderPubkey, collateral, value); err != nil {
if err := api.db.SetBlockBuilderCollateral(builderPubkey, builderID, collateral); err != nil {
fullErr := fmt.Errorf("unable to set collateral in db for pubkey: %v: %w", builderPubkey, err)
log.Error(fullErr.Error())
api.RespondError(w, http.StatusInternalServerError, fullErr.Error())
Expand Down

0 comments on commit e17022f

Please sign in to comment.