-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the feature
currently if a payloadjob is being resolved we start racing it against an empty block:
reth/crates/payload/basic/src/lib.rs
Lines 481 to 485 in 9f6fec2
| 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:
reth/crates/ethereum/payload/src/lib.rs
Line 185 in 9f6fec2
| 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
reth/crates/ethereum/payload/src/lib.rs
Lines 86 to 98 in 9f6fec2
| 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:
reth/crates/payload/basic/src/lib.rs
Lines 786 to 787 in 9f6fec2
| /// A marker that can be used to cancel the job. | |
| pub cancel: CancelOnDrop, |
which is invoked by the job here:
reth/crates/payload/basic/src/lib.rs
Lines 355 to 357 in 9f6fec2
| 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:
reth/crates/payload/basic/src/lib.rs
Line 458 in 9f6fec2
| fn resolve_kind( |
TODO
- introduce a bool toggle for the
BasicPayloadJobthat is passed as part ofBuildArgumentsand a clone kept inBasicPayloadJob - when the
BasicPayloadJobis being resolved, it should fire the toggle - and the builder tx loop should break if the toggle is fired, similar to:
reth/crates/ethereum/payload/src/lib.rs
Lines 198 to 201 in 9f6fec2
// 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
Type
Projects
Status