mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Verify Versioned Hashes During Optimistic Sync (#4832)
* Convert NewPayloadRequest to use Reference * Refactor for Clarity * Verify Versioned Hashes * Added Tests for Version Hash Verification * Added Moar Tests * Fix Problems Caused By Merge * Update to use Alloy Instead of Reth Crates (#14) * Update beacon_node/execution_layer/src/engine_api/new_payload_request.rs Co-authored-by: realbigsean <seananderson33@GMAIL.com> * Faster Versioned Hash Extraction * Update to rust 1.75 & Pin alloy-consensus
This commit is contained in:
@@ -81,14 +81,10 @@ impl<T: BeaconChainTypes> PayloadNotifier<T> {
|
||||
|
||||
match notify_execution_layer {
|
||||
NotifyExecutionLayer::No if chain.config.optimistic_finalized_sync => {
|
||||
// Verify the block hash here in Lighthouse and immediately mark the block as
|
||||
// optimistically imported. This saves a lot of roundtrips to the EL.
|
||||
let execution_layer = chain
|
||||
.execution_layer
|
||||
.as_ref()
|
||||
.ok_or(ExecutionPayloadError::NoExecutionConnection)?;
|
||||
|
||||
if let Err(e) = execution_layer.verify_payload_block_hash(block_message) {
|
||||
// Create a NewPayloadRequest (no clones required) and check optimistic sync verifications
|
||||
let new_payload_request: NewPayloadRequest<T::EthSpec> =
|
||||
block_message.try_into()?;
|
||||
if let Err(e) = new_payload_request.perform_optimistic_sync_verifications() {
|
||||
warn!(
|
||||
chain.log,
|
||||
"Falling back to slow block hash verification";
|
||||
@@ -143,11 +139,8 @@ async fn notify_new_payload<'a, T: BeaconChainTypes>(
|
||||
.as_ref()
|
||||
.ok_or(ExecutionPayloadError::NoExecutionConnection)?;
|
||||
|
||||
let new_payload_request: NewPayloadRequest<T::EthSpec> = block.try_into()?;
|
||||
let execution_block_hash = new_payload_request.block_hash();
|
||||
let new_payload_response = execution_layer
|
||||
.notify_new_payload(new_payload_request)
|
||||
.await;
|
||||
let execution_block_hash = block.execution_payload()?.block_hash();
|
||||
let new_payload_response = execution_layer.notify_new_payload(block.try_into()?).await;
|
||||
|
||||
match new_payload_response {
|
||||
Ok(status) => match status {
|
||||
|
||||
Reference in New Issue
Block a user