You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Measure the payload copy in the engine request, and share the block if it shows #819
Since #755, a pre-gloas beacon import with an execution client sends engine_newPayloadV4 from a spawned task while the chain actor computes the block's state transition. The task cannot borrow the block, so NewPayloadRequest::into_owned (crates/blockchain/src/beacon_engine.rs) clones the block's ExecutionPayload, transactions included, on the actor thread before the request is spawned. Three automated reviewers raised the copy across two review rounds of that PR.
Its cost has not been measured, neither typically nor for a transaction-heavy worst case, so it is not known how it compares with the transition it overlaps (~157 ms at the docs' p50). Since #755 the engine import phase (lean_block_import_phase_seconds{phase="engine"}) includes building the request, so the copy is visible there on a live node: the phase's floor, for blocks whose answer arrived before the transition finished, is roughly the request construction.
Measuring it was out of scope for #755, since it needs a live node with an execution client.
What a fix would look like, if the floor is material:
Move the block into an Arc for the duration of the question.
Have the task build the request from its clone, so nothing is copied on the actor.
Take the block back with Arc::unwrap_or_clone before on_block_speculative. The task has finished by then, so this does not clone in practice.
OwnedNewPayloadRequest and into_owned would then go away.
Activity