Skip to content

Commit

Permalink
feat: convert commitments to list
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit authored and thedevbirb committed Jul 19, 2024
1 parent 9720a8a commit 2eafafc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bolt-sidecar/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use alloy_primitives::U256;
use blst::min_pk::SecretKey;
use ethereum_consensus::{
crypto::{KzgCommitment, PublicKey},
deneb::mainnet::{ExecutionPayloadHeader, MAX_BLOB_COMMITMENTS_PER_BLOCK},
deneb::mainnet::ExecutionPayloadHeader,
ssz::prelude::{List, MerkleizationError},
};
use payload_builder::FallbackPayloadBuilder;
Expand Down Expand Up @@ -102,6 +102,7 @@ impl LocalBuilder {
) -> Result<(), BuilderError> {
let transactions = template.as_signed_transactions();
let blobs_bundle = template.as_blobs_bundle();
let kzg_commitments = blobs_bundle.commitments.clone();

// 1. build a fallback payload with the given transactions, on top of
// the current head of the chain
Expand Down Expand Up @@ -132,8 +133,7 @@ impl LocalBuilder {
);

// 3. sign the bid with the local builder's BLS key
let signed_bid =
self.create_signed_builder_bid(value, eth_header, blobs_bundle.commitments)?;
let signed_bid = self.create_signed_builder_bid(value, eth_header, kzg_commitments)?;

// 4. prepare a get_payload response for when the beacon node will ask for it
let Some(get_payload_res) =
Expand Down Expand Up @@ -166,11 +166,12 @@ impl LocalBuilder {
&self,
value: U256,
header: ExecutionPayloadHeader,
blob_kzg_commitments: List<KzgCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK>,
blob_kzg_commitments: Vec<KzgCommitment>,
) -> Result<SignedBuilderBid, BuilderError> {
// compat: convert from blst to ethereum consensus types
let pubkey = self.secret_key.sk_to_pk().to_bytes();
let consensus_pubkey = PublicKey::try_from(pubkey.as_slice()).expect("valid pubkey bytes");
let blob_kzg_commitments = List::try_from(blob_kzg_commitments).expect("valid list");

let message = BuilderBid {
header,
Expand Down

0 comments on commit 2eafafc

Please sign in to comment.