Skip to content

Use optimistic execution processing when syncing the finalized chain #3704

@michaelsproul

Description

@michaelsproul

Description

Presently Lighthouse will always send execution payloads to the EL, even while syncing.

This results in sync being really slow when it has any substantial distance to cover, with speeds usually sitting below the 1 slot/second mark because of how long the EL takes to respond.

I think we could drastically improve this situation by not sending the execution payloads while syncing the finalized portion of the chain. In other words, we could import blocks optimistically while syncing and then mark them valid only on occasional calls to fork choice (which will usually give us a VALID response, or an INVALID response with a latest block hash that we can backtrack to). From the consensus-side, I think all the machinery is already there to support this.

Steps to resolve

I think we can modify the PayloadNotifier to set the payload_verification_status to Optimistic based on a parameter threaded through from sync:

impl<T: BeaconChainTypes> PayloadNotifier<T> {
pub fn new(
chain: Arc<BeaconChain<T>>,
block: Arc<SignedBeaconBlock<T::EthSpec>>,
state: &BeaconState<T::EthSpec>,
) -> Result<Self, BlockError<T::EthSpec>> {
let payload_verification_status = if is_execution_enabled(state, block.message().body()) {
// Perform the initial stages of payload verification.
//
// We will duplicate these checks again during `per_block_processing`, however these checks
// are cheap and doing them here ensures we protect the execution engine from junk.
partially_verify_execution_payload(
state,
block.message().execution_payload()?,
&chain.spec,
)
.map_err(BlockError::PerBlockProcessingError)?;
None
} else {
Some(PayloadVerificationStatus::Irrelevant)
};
Ok(Self {
chain,
block,
payload_verification_status,
})
}

Threading that parameter through might be more involved as it will have to go through all of block_verification. A new type like FinalizedSignatureVerifiedBlock might be necessary.

Version

Lighthouse v3.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions