Skip to content

Commit

Permalink
Merge pull request #191 from chainbound/nico/fix/local-payload
Browse files Browse the repository at this point in the history
fix: re-add local payload building logic to driver
  • Loading branch information
mempirate authored Aug 9, 2024
2 parents 9b43af0 + 33aafee commit 64c7c1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 0 additions & 6 deletions bolt-sidecar/src/api/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,8 @@ where
State(server): State<Arc<BuilderProxyServer<T, P>>>,
Json(registrations): Json<Vec<SignedValidatorRegistration>>,
) -> Result<StatusCode, BuilderApiError> {
let start = std::time::Instant::now();
debug!("Received register validators request");

let response = server.proxy_target.register_validators(registrations).await;

let elapsed = start.elapsed();
debug!(?elapsed, "Returning response: {:?}", response);

response.map(|_| StatusCode::OK)
}

Expand Down
2 changes: 1 addition & 1 deletion bolt-sidecar/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl LocalBuilder {
//
// NOTE: we don't strictly need this. The validator & beacon nodes have options
// to ALWAYS prefer PBS blocks. This is a safety measure that doesn't hurt to keep.
let value = U256::from(1_000_000_000_000_000_000u128);
let value = U256::from(100_000_000_000_000_000_000u128);

let eth_payload = compat::to_consensus_execution_payload(&sealed_block);
let payload_and_blobs = PayloadAndBlobs { execution_payload: eth_payload, blobs_bundle };
Expand Down
8 changes: 6 additions & 2 deletions bolt-sidecar/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<C: StateFetcher, BLS: SignerBLS, ECDSA: SignerECDSA> SidecarDriver<C, BLS,
self.handle_new_head_event(head_event).await;
}
Some(slot) = self.consensus.commitment_deadline.wait() => {
self.handle_commitment_deadline(slot);
self.handle_commitment_deadline(slot).await;
}
Some(payload_request) = self.payload_requests_rx.recv() => {
self.handle_fetch_payload_request(payload_request);
Expand Down Expand Up @@ -242,7 +242,7 @@ impl<C: StateFetcher, BLS: SignerBLS, ECDSA: SignerECDSA> SidecarDriver<C, BLS,
}

/// Handle a commitment deadline event, submitting constraints to the MEV-Boost service.
fn handle_commitment_deadline(&mut self, slot: u64) {
async fn handle_commitment_deadline(&mut self, slot: u64) {
debug!(slot, "Commitment deadline reached, building local block");

let Some(template) = self.execution.get_block_template(slot) else {
Expand All @@ -266,6 +266,10 @@ impl<C: StateFetcher, BLS: SignerBLS, ECDSA: SignerECDSA> SidecarDriver<C, BLS,
}
}
});

if let Err(e) = self.local_builder.build_new_local_payload(template).await {
tracing::error!(err = ?e, "CRITICAL: Error while building local payload at slot deadline for {slot}");
};
}

/// Handle a fetch payload request, responding with the local payload if available.
Expand Down

0 comments on commit 64c7c1b

Please sign in to comment.