Skip to content

Let the payloadjob know it is being resolved #15154

Open
@mattsse

Description

@mattsse

Describe the feature

currently if a payloadjob is being resolved we start racing it against an empty block:

match self.builder.on_missing_payload(args) {
MissingPayloadBehaviour::AwaitInProgress => {
debug!(target: "payload_builder", id=%self.config.payload_id(), "awaiting in progress payload build job");
}
MissingPayloadBehaviour::RaceEmptyPayload => {

and the default eth builder just tries to max fill the block:

while let Some(pool_tx) = best_txs.next() {

so in case the payload is resolved immediately, we might end up with an empty block if we race it against an empty block.

instead we want to let the job know that it is being resolved right now

fn try_build(
&self,
args: BuildArguments<EthPayloadBuilderAttributes, EthBuiltPayload>,
) -> Result<BuildOutcome<EthBuiltPayload>, PayloadBuilderError> {
default_ethereum_payload(
self.evm_config.clone(),
self.client.clone(),
self.pool.clone(),
self.builder_config.clone(),
args,
|attributes| self.pool.best_transactions_with_attributes(attributes),
)
}

for this we can introduce another bool marker, like:

/// A marker that can be used to cancel the job.
pub cancel: CancelOnDrop,

which is invoked by the job here:

let args =
BuildArguments { cached_reads, config: payload_config, cancel, best_payload };
let result = builder.try_build(args);

which we then can trigger when the payload is being resolved:

fn resolve_kind(

TODO

  • introduce a bool toggle for the BasicPayloadJob that is passed as part of BuildArguments and a clone kept in BasicPayloadJob
  • when the BasicPayloadJob is being resolved, it should fire the toggle
  • and the builder tx loop should break if the toggle is fired, similar to:
    // check if the job was cancelled, if so we can exit early
    if cancel.is_cancelled() {
    return Ok(BuildOutcome::Cancelled)
    }

Additional context

No response

Metadata

Metadata

Assignees

Labels

C-enhancementNew feature or requestD-good-first-issueNice and easy! A great choice to get started

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions