Skip to content

Commit 1587f1e

Browse files
Optimisations relating to get_expected_withdrawals (#9314)
Tweaking/optimising `get_expected_withdrawals` on the pre-Gloas path, after the removal of some optimisations in: - #9102 - Remove `prepare_beacon_proposer` calls from `register_validator`. These calls were: heavily duplicated, happening _too early_ (at the start of the slot before the block arrived), expensive on epoch boundaries (forcing an early epoch transition), _and_ unnecessary. They are completely safe to remove because the scheduled proposer preparation routine exists. - Instrument `get_expected_withdrawals`/`prepare_beacon_proposer` to find more unexpected callers. Co-Authored-By: Michael Sproul <michael@sigmaprime.io> Co-Authored-By: Tan Chee Keong <tanck@sigmaprime.io> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
1 parent 369decc commit 1587f1e

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

  • beacon_node

beacon_node/execution_layer/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,10 @@ impl ProposerPreparationDataEntry {
406406
}
407407
}
408408

409+
// NOTE: This key should arguably include the `suggested_fee_recipient`, as it is part of the
410+
// `Proposer::payload_attributes` value that is cached based on it. However, in some cases where
411+
// this key is constructed the fee recipient is not straight-forward to determine. Therefore we
412+
// accept the risk of loading a stale fee recipient within the timespan of a single slot.
409413
#[derive(Hash, PartialEq, Eq)]
410414
pub struct ProposerKey {
411415
slot: Slot,

beacon_node/http_api/src/validator/mod.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -664,26 +664,15 @@ pub fn post_validator_register_validator<T: BeaconChainTypes>(
664664
.unzip();
665665

666666
// Update the prepare beacon proposer cache based on this request.
667+
// This data will get picked up by the next scheduled run of
668+
// `prepare_beacon_proposer`.
667669
execution_layer
668670
.update_proposer_preparation(
669671
current_epoch,
670672
preparation_data.iter().map(|(data, limit)| (data, limit)),
671673
)
672674
.await;
673675

674-
// Call prepare beacon proposer blocking with the latest update in order to make
675-
// sure we have a local payload to fall back to in the event of the blinded block
676-
// flow failing.
677-
chain
678-
.prepare_beacon_proposer(current_slot)
679-
.await
680-
.map_err(|e| {
681-
warp_utils::reject::custom_bad_request(format!(
682-
"error updating proposer preparations: {:?}",
683-
e
684-
))
685-
})?;
686-
687676
info!(
688677
count = filtered_registration_data.len(),
689678
"Forwarding register validator request to connected builder"

0 commit comments

Comments
 (0)