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

Blobs support #233

Merged
merged 2 commits into from
May 2, 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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ default-members = ["bin/mev"]
version = "0.3.0"

[workspace.dependencies]
ethereum-consensus = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "0919f02435e1b64e27c53931cac8e08edaad5f8b" }
beacon-api-client = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "0919f02435e1b64e27c53931cac8e08edaad5f8b" }
ethereum-consensus = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "5cf67a5944ef4e18742178374eb4d37b50a5b292" }
beacon-api-client = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "5cf67a5944ef4e18742178374eb4d37b50a5b292" }

reth = { git = "https://github.com/paradigmxyz/reth", rev = "8e65cb3" }
reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "8e65cb3" }
Expand Down
3 changes: 3 additions & 0 deletions mev-build-rs/src/auctioneer/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ impl<
slot = auction.slot,
block_number = payload.block().number,
block_hash = %payload.block().hash(),
parent_hash = %payload.block().header.header().parent_hash,
txn_count = %payload.block().body.len(),
blob_count = %payload.sidecars().iter().map(|s| s.blobs.len()).sum::<usize>(),
value = %payload.fees(),
relays=?auction.relays,
"submitting payload"
Expand Down
8 changes: 8 additions & 0 deletions mev-relay-rs/src/auction_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ impl AuctionContext {
}
}

pub fn blobs_bundle(&self) -> Option<&BlobsBundle> {
match self {
Self::Bellatrix(_) => None,
Self::Capella(_) => None,
Self::Deneb(context) => Some(&context.blobs_bundle),
}
}

pub fn value(&self) -> U256 {
match self {
Self::Bellatrix(context) => context.value,
Expand Down
14 changes: 11 additions & 3 deletions mev-relay-rs/src/relay.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::auction_context::AuctionContext;
use async_trait::async_trait;
use beacon_api_client::{BroadcastValidation, PayloadAttributesEvent};
use beacon_api_client::{BroadcastValidation, PayloadAttributesEvent, SubmitSignedBeaconBlock};
use ethereum_consensus::{
clock::get_current_unix_time_in_nanos,
crypto::SecretKey,
Expand Down Expand Up @@ -424,7 +424,10 @@ impl Relay {
)?;
let auction_context = Arc::new(auction_context);
let block_hash = auction_context.execution_payload().block_hash();
info!(%auction_request, builder_public_key = %auction_context.builder_public_key(), %block_hash, "inserting new bid");
let txn_count = auction_context.execution_payload().transactions().len();
let blob_count =
auction_context.blobs_bundle().map(|bundle| bundle.blobs.len()).unwrap_or_default();
info!(%auction_request, builder_public_key = %auction_context.builder_public_key(), %block_hash, txn_count, blob_count, "inserting new bid");
let mut state = self.state.lock();
state.auctions.insert(auction_request, auction_context);
Ok(())
Expand Down Expand Up @@ -525,10 +528,15 @@ impl BlindedBlockProvider for Relay {
let version = signed_block.version();
let block_root =
signed_block.message().hash_tree_root().map_err(ConsensusError::from)?;
let request = SubmitSignedBeaconBlock {
signed_block: &signed_block,
kzg_proofs: auction_context.blobs_bundle().map(|bundle| bundle.proofs.as_ref()),
blobs: auction_context.blobs_bundle().map(|bundle| bundle.blobs.as_ref()),
};
if let Err(err) = self
.beacon_node
.post_signed_beacon_block_v2(
&signed_block,
request,
version,
Some(BroadcastValidation::ConsensusAndEquivocation),
)
Expand Down
Loading