Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sidecar): minor TODOs cleanup #601

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions bolt-sidecar/src/api/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ where

/// Registers the validators. Just forwards the request to constraints client
/// and returns the status.
///
/// TODO: intercept this to register Bolt validators on-chain as well.
pub async fn register_validators(
State(server): State<Arc<Self>>,
Json(registrations): Json<Vec<SignedValidatorRegistration>>,
Expand Down Expand Up @@ -140,9 +138,8 @@ where
warn!(slot, elapsed = ?start.elapsed(), err = ?err, "Proxy error, fetching local payload instead");

let Some(payload_and_bid) = server.payload_fetcher.fetch_payload(slot).await else {
// TODO: handle failure? In this case, we don't have a fallback block
// which means we haven't made any commitments. This means the EL should
// fallback to local block building.
// In this case, we don't have a fallback block which means we haven't made any
// commitments. This means the EL should fallback to local block building.
debug!("No local payload with commitments produced for slot {slot}");
return Err(BuilderApiError::FailedToFetchLocalPayload(slot));
};
Expand Down
4 changes: 2 additions & 2 deletions bolt-sidecar/src/crypto/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ impl SignerECDSA for PrivateKeySigner {

async fn sign_hash(&self, hash: &[u8; 32]) -> eyre::Result<AlloySignature> {
let sig = Signer::sign_hash(self, hash.into()).await?;
// TODO: compat: this is necessary since alloy PrimitiveSignature and Signature
// are different types in the new version

// this is necessary since alloy PrimitiveSignature and Signature are different types now
Ok(AlloySignature::try_from(sig.as_bytes().as_ref()).expect("signature conversion"))
}
}
Expand Down
16 changes: 7 additions & 9 deletions bolt-sidecar/src/signer/commit_boost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,21 @@ impl CommitBoostSigner {

/// Sign an object root with the Commit Boost domain.
pub async fn sign_commit_boost_root(&self, data: [u8; 32]) -> SignerResult<BlsSignature> {
// convert the pubkey from ethereum_consensus to commit-boost format
// TODO: compat: this is the only way to obtain a BlsPubkey for now unfortunately
let pubkey = cb_common::signer::BlsPublicKey::from(FixedBytes::<48>::from_slice(
self.pubkey().as_ref(),
));
// convert the pubkey from ethereum_consensus to alloy
let alloy_pubkey = FixedBytes::<48>::from_slice(self.pubkey().as_ref());
let pubkey = cb_common::signer::BlsPublicKey::from(alloy_pubkey);

let request = SignConsensusRequest { pubkey, object_root: data };

debug!(?request, "Requesting signature from commit_boost");

Ok(self
let sig = self
.signer_client
.request_consensus_signature(request)
.await
// TODO: compat: this is necessary until commit-boost bumps their alloy version
.map(|sig| BlsSignature::from_slice(sig.as_ref()))
.map_err(CommitBoostError::SignerClientError)?)
.map_err(CommitBoostError::SignerClientError)?;

Ok(sig)
}
}

Expand Down
Loading