Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upcoming feature: allowing block builders to cancel previous submissions #202

Closed
metachris opened this issue Oct 17, 2022 · 0 comments · Fixed by #206
Closed

Upcoming feature: allowing block builders to cancel previous submissions #202

metachris opened this issue Oct 17, 2022 · 0 comments · Fixed by #206

Comments

@metachris
Copy link
Collaborator

metachris commented Oct 17, 2022

We will allow builders to cancel previous block submissions. This will work by always using the latest submission of a builder, even if it's less valuable.

Currently it works like this:

  • Once a builder submissions is validated and the highest bid for a slot+parent_hash combination, a new getHeader response is generated and saved to Redis, which will be used for the next getHeader responses:
    // Check if there's already a bid
    prevBid, err := api.datastore.GetGetHeaderResponse(payload.Message.Slot, payload.Message.ParentHash.String(), payload.Message.ProposerPubkey.String())
    if err != nil {
    log.WithError(err).Error("error getting previous bid")
    api.RespondError(w, http.StatusInternalServerError, err.Error())
    return
    }
    // Only proceed if this bid is higher than previous one
    isMostProfitableBlock = prevBid == nil || payload.Message.Value.Cmp(&prevBid.Data.Message.Value) == 1
    if !isMostProfitableBlock {
    log.Debug("block submission with same or lower value")
    w.WriteHeader(http.StatusOK)
    return
    }
    // Prepare the response data
    signedBuilderBid, err := BuilderSubmitBlockRequestToSignedBuilderBid(payload, api.blsSk, api.publicKey, api.opts.EthNetDetails.DomainBuilder)
    if err != nil {
    log.WithError(err).Error("could not sign builder bid")
    api.RespondError(w, http.StatusBadRequest, err.Error())
    return
    }
    getHeaderResponse := types.GetHeaderResponse{
    Version: VersionBellatrix,
    Data: signedBuilderBid,
    }
    getPayloadResponse := types.GetPayloadResponse{
    Version: VersionBellatrix,
    Data: payload.ExecutionPayload,
    }
    bidTrace := common.BidTraceV2{
    BidTrace: *payload.Message,
    BlockNumber: payload.ExecutionPayload.BlockNumber,
    NumTx: uint64(len(payload.ExecutionPayload.Transactions)),
    }
    err = api.datastore.SaveBid(&bidTrace, &getHeaderResponse, &getPayloadResponse)
    if err != nil {
    log.WithError(err).Error("could not save bid and block")
    api.RespondError(w, http.StatusBadRequest, err.Error())
    return
    }

Changes needed:

  1. Save the latest bid of every builder
  2. On every valid submission, recalculate the current best bid
  3. If bid value is different from the last cached getHeader response, then update it

Notes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant