Skip to content

Commit b92f978

Browse files
committed
Revert BlobsBundle field name change and rename proofs field in BlobsAndProof.
1 parent 898e3fa commit b92f978

File tree

11 files changed

+81
-188
lines changed

11 files changed

+81
-188
lines changed

beacon_node/beacon_chain/src/fetch_blobs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ async fn fetch_and_process_blobs_v2<T: BeaconChainTypes>(
216216
.into_iter()
217217
.filter_map(|blob_and_proof_opt| {
218218
blob_and_proof_opt.map(|blob_and_proof| {
219-
let BlobAndProofV2 { blob, cell_proofs } = blob_and_proof;
220-
(blob, cell_proofs)
219+
let BlobAndProofV2 { blob, proofs } = blob_and_proof;
220+
(blob, proofs)
221221
})
222222
})
223223
.unzip();

beacon_node/beacon_chain/src/kzg_utils.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn validate_blob<E: EthSpec>(
4545
}
4646

4747
// TODO
48-
pub fn verify_cell_proof_batch<'a, E: EthSpec>(
48+
pub fn verify_cell_proof_batch<E: EthSpec>(
4949
_kzg: &Kzg,
5050
_cells: Vec<Cell<E>>,
5151
_cell_indices: Vec<u64>,
@@ -434,6 +434,7 @@ mod test {
434434
blobs_to_data_column_sidecars, reconstruct_blobs, reconstruct_data_columns,
435435
};
436436
use bls::Signature;
437+
use eth2::types::BlobsBundle;
437438
use execution_layer::test_utils::generate_blobs;
438439
use kzg::{trusted_setup::get_trusted_setup, Kzg, KzgCommitment, TrustedSetup};
439440
use types::{
@@ -588,7 +589,11 @@ mod test {
588589
let mut signed_block = SignedBeaconBlock::from_block(block, Signature::empty());
589590
let fork = signed_block.fork_name_unchecked();
590591
let (blobs_bundle, _) = generate_blobs::<E>(num_of_blobs, fork).unwrap();
591-
let (blobs, proofs, commitments) = blobs_bundle.deconstruct();
592+
let BlobsBundle {
593+
blobs,
594+
commitments,
595+
proofs,
596+
} = blobs_bundle;
592597

593598
*signed_block
594599
.message_mut()

beacon_node/beacon_chain/src/test_utils.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,7 @@ pub fn generate_rand_block_and_blobs<E: EthSpec>(
32473247
for tx in Vec::from(transactions) {
32483248
payload.execution_payload.transactions.push(tx).unwrap();
32493249
}
3250-
message.body.blob_kzg_commitments = bundle.commitments().clone();
3250+
message.body.blob_kzg_commitments = bundle.commitments.clone();
32513251
bundle
32523252
}
32533253
SignedBeaconBlock::Electra(SignedBeaconBlockElectra {
@@ -3266,7 +3266,7 @@ pub fn generate_rand_block_and_blobs<E: EthSpec>(
32663266
for tx in Vec::from(transactions) {
32673267
payload.execution_payload.transactions.push(tx).unwrap();
32683268
}
3269-
message.body.blob_kzg_commitments = bundle.commitments().clone();
3269+
message.body.blob_kzg_commitments = bundle.commitments.clone();
32703270
bundle
32713271
}
32723272
SignedBeaconBlock::Fulu(SignedBeaconBlockFulu {
@@ -3285,13 +3285,17 @@ pub fn generate_rand_block_and_blobs<E: EthSpec>(
32853285
for tx in Vec::from(transactions) {
32863286
payload.execution_payload.transactions.push(tx).unwrap();
32873287
}
3288-
message.body.blob_kzg_commitments = bundle.commitments().clone();
3288+
message.body.blob_kzg_commitments = bundle.commitments.clone();
32893289
bundle
32903290
}
32913291
_ => return (block, blob_sidecars),
32923292
};
32933293

3294-
let (blobs, proofs, commitments) = bundle.deconstruct();
3294+
let eth2::types::BlobsBundle {
3295+
commitments,
3296+
proofs,
3297+
blobs,
3298+
} = bundle;
32953299

32963300
for (index, ((blob, kzg_commitment), kzg_proof)) in blobs
32973301
.into_iter()

beacon_node/execution_layer/src/engine_api.rs

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use crate::http::{
88
ENGINE_NEW_PAYLOAD_V4, ENGINE_NEW_PAYLOAD_V5,
99
};
1010
use eth2::types::{
11-
BlobsBundle, BlobsBundleRef, BlobsBundleV1, BlobsBundleV2, SsePayloadAttributes,
12-
SsePayloadAttributesV1, SsePayloadAttributesV2, SsePayloadAttributesV3,
11+
BlobsBundle, SsePayloadAttributes, SsePayloadAttributesV1, SsePayloadAttributesV2,
12+
SsePayloadAttributesV3,
1313
};
1414
use http::deposit_methods::RpcError;
1515
pub use json_structures::{JsonWithdrawal, TransitionConfigurationV1};
@@ -292,10 +292,8 @@ pub struct GetPayloadResponse<E: EthSpec> {
292292
#[superstruct(only(Fulu), partial_getter(rename = "execution_payload_fulu"))]
293293
pub execution_payload: ExecutionPayloadFulu<E>,
294294
pub block_value: Uint256,
295-
#[superstruct(only(Deneb, Electra), partial_getter(rename = "blobs_bundle_v1"))]
296-
pub blobs_bundle: BlobsBundleV1<E>,
297-
#[superstruct(only(Fulu), partial_getter(rename = "blobs_bundle_v2"))]
298-
pub blobs_bundle: BlobsBundleV2<E>,
295+
#[superstruct(only(Deneb, Electra, Fulu))]
296+
pub blobs_bundle: BlobsBundle<E>,
299297
#[superstruct(only(Deneb, Electra, Fulu), partial_getter(copy))]
300298
pub should_override_builder: bool,
301299
#[superstruct(only(Electra, Fulu))]
@@ -314,18 +312,6 @@ impl<E: EthSpec> GetPayloadResponse<E> {
314312
pub fn block_number(&self) -> u64 {
315313
ExecutionPayloadRef::from(self.to_ref()).block_number()
316314
}
317-
318-
pub fn blobs_bundle(&self) -> Result<BlobsBundleRef<E>, Error> {
319-
match self {
320-
GetPayloadResponse::Bellatrix(_) | GetPayloadResponse::Capella(_) => {
321-
Err(Error::IncorrectStateVariant)
322-
}
323-
GetPayloadResponse::Deneb(_) | GetPayloadResponse::Electra(_) => {
324-
self.blobs_bundle_v1().map(|b| b.into())
325-
}
326-
GetPayloadResponse::Fulu(_) => self.blobs_bundle_v2().map(|b| b.into()),
327-
}
328-
}
329315
}
330316

331317
impl<'a, E: EthSpec> From<GetPayloadResponseRef<'a, E>> for ExecutionPayloadRef<'a, E> {
@@ -369,19 +355,19 @@ impl<E: EthSpec> From<GetPayloadResponse<E>>
369355
GetPayloadResponse::Deneb(inner) => (
370356
ExecutionPayload::Deneb(inner.execution_payload),
371357
inner.block_value,
372-
Some(BlobsBundle::V1(inner.blobs_bundle)),
358+
Some(inner.blobs_bundle),
373359
None,
374360
),
375361
GetPayloadResponse::Electra(inner) => (
376362
ExecutionPayload::Electra(inner.execution_payload),
377363
inner.block_value,
378-
Some(BlobsBundle::V1(inner.blobs_bundle)),
364+
Some(inner.blobs_bundle),
379365
Some(inner.requests),
380366
),
381367
GetPayloadResponse::Fulu(inner) => (
382368
ExecutionPayload::Fulu(inner.execution_payload),
383369
inner.block_value,
384-
Some(BlobsBundle::V2(inner.blobs_bundle)),
370+
Some(inner.blobs_bundle),
385371
Some(inner.requests),
386372
),
387373
}

beacon_node/execution_layer/src/engine_api/json_structures.rs

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use super::*;
22
use alloy_rlp::RlpEncodable;
3-
use eth2::types::BlobsBundleV1;
43
use serde::{Deserialize, Serialize};
54
use ssz::Decode;
65
use strum::EnumString;
@@ -506,10 +505,8 @@ pub struct JsonGetPayloadResponse<E: EthSpec> {
506505
pub execution_payload: JsonExecutionPayloadV5<E>,
507506
#[serde(with = "serde_utils::u256_hex_be")]
508507
pub block_value: Uint256,
509-
#[superstruct(only(V3, V4), partial_getter(rename = "blobs_bundle_v1"))]
508+
#[superstruct(only(V3, V4, V5))]
510509
pub blobs_bundle: JsonBlobsBundleV1<E>,
511-
#[superstruct(only(V5), partial_getter(rename = "blobs_bundle_v2"))]
512-
pub blobs_bundle: JsonBlobsBundleV2<E>,
513510
#[superstruct(only(V3, V4, V5))]
514511
pub should_override_builder: bool,
515512
#[superstruct(only(V4, V5))]
@@ -692,35 +689,25 @@ impl From<JsonPayloadAttributes> for PayloadAttributes {
692689
}
693690
}
694691

695-
#[superstruct(
696-
variants(V1, V2),
697-
variant_attributes(
698-
derive(Debug, PartialEq, Serialize, Deserialize),
699-
serde(bound = "E: EthSpec", rename_all = "camelCase")
700-
)
701-
)]
702692
#[derive(Debug, PartialEq, Serialize, Deserialize)]
703-
pub struct JsonBlobsBundle<E: EthSpec> {
693+
#[serde(bound = "E: EthSpec", rename_all = "camelCase")]
694+
pub struct JsonBlobsBundleV1<E: EthSpec> {
704695
pub commitments: KzgCommitments<E>,
705-
#[superstruct(only(V1))]
706696
pub proofs: KzgProofs<E>,
707-
#[superstruct(only(V2))]
708-
pub cell_proofs: KzgProofs<E>,
709697
#[serde(with = "ssz_types::serde_utils::list_of_hex_fixed_vec")]
710698
pub blobs: BlobsList<E>,
711699
}
712700

713-
impl<E: EthSpec> From<BlobsBundleV1<E>> for JsonBlobsBundleV1<E> {
714-
fn from(blobs_bundle: BlobsBundleV1<E>) -> Self {
701+
impl<E: EthSpec> From<BlobsBundle<E>> for JsonBlobsBundleV1<E> {
702+
fn from(blobs_bundle: BlobsBundle<E>) -> Self {
715703
Self {
716704
commitments: blobs_bundle.commitments,
717705
proofs: blobs_bundle.proofs,
718706
blobs: blobs_bundle.blobs,
719707
}
720708
}
721709
}
722-
723-
impl<E: EthSpec> From<JsonBlobsBundleV1<E>> for BlobsBundleV1<E> {
710+
impl<E: EthSpec> From<JsonBlobsBundleV1<E>> for BlobsBundle<E> {
724711
fn from(json_blobs_bundle: JsonBlobsBundleV1<E>) -> Self {
725712
Self {
726713
commitments: json_blobs_bundle.commitments,
@@ -730,26 +717,6 @@ impl<E: EthSpec> From<JsonBlobsBundleV1<E>> for BlobsBundleV1<E> {
730717
}
731718
}
732719

733-
impl<E: EthSpec> From<BlobsBundleV2<E>> for JsonBlobsBundleV2<E> {
734-
fn from(blobs_bundle: BlobsBundleV2<E>) -> Self {
735-
Self {
736-
commitments: blobs_bundle.commitments,
737-
cell_proofs: blobs_bundle.cell_proofs,
738-
blobs: blobs_bundle.blobs,
739-
}
740-
}
741-
}
742-
743-
impl<E: EthSpec> From<JsonBlobsBundleV2<E>> for BlobsBundleV2<E> {
744-
fn from(json_blobs_bundle: JsonBlobsBundleV2<E>) -> Self {
745-
Self {
746-
commitments: json_blobs_bundle.commitments,
747-
cell_proofs: json_blobs_bundle.cell_proofs,
748-
blobs: json_blobs_bundle.blobs,
749-
}
750-
}
751-
}
752-
753720
#[superstruct(
754721
variants(V1, V2),
755722
variant_attributes(
@@ -761,10 +728,12 @@ impl<E: EthSpec> From<JsonBlobsBundleV2<E>> for BlobsBundleV2<E> {
761728
pub struct BlobAndProof<E: EthSpec> {
762729
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
763730
pub blob: Blob<E>,
731+
/// KZG proof for the blob (Deneb)
764732
#[superstruct(only(V1))]
765733
pub proof: KzgProof,
734+
/// KZG cell proofs for the extended blob (PeerDAS)
766735
#[superstruct(only(V2))]
767-
pub cell_proofs: KzgProofs<E>,
736+
pub proofs: KzgProofs<E>,
768737
}
769738

770739
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]

beacon_node/execution_layer/src/lib.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use engine_api::{http, http::deposit_methods, http::HttpJsonRpc};
1717
use engines::{Engine, EngineError};
1818
pub use engines::{EngineState, ForkchoiceState};
1919
use eth2::types::{builder_bid::SignedBuilderBid, ForkVersionedResponse};
20-
use eth2::types::{BlobsBundleRef, FullPayloadContents};
20+
use eth2::types::{BlobsBundle, FullPayloadContents};
2121
use ethers_core::types::Transaction as EthersTransaction;
2222
use fixed_bytes::UintExtended;
2323
use fork_choice::ForkchoiceUpdateParameters;
@@ -250,16 +250,13 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> TryFrom<GetPayloadResponse<E>>
250250
fn try_from(response: GetPayloadResponse<E>) -> Result<Self, Error> {
251251
let (execution_payload, block_value, maybe_bundle, maybe_requests) = response.into();
252252
match maybe_bundle {
253-
Some(bundle) => {
254-
let (blobs, proofs, commitments) = bundle.deconstruct();
255-
Ok(Self::PayloadAndBlobs {
256-
payload: execution_payload.into(),
257-
block_value,
258-
kzg_commitments: commitments,
259-
blobs_and_proofs: Some((blobs, proofs)),
260-
requests: maybe_requests,
261-
})
262-
}
253+
Some(bundle) => Ok(Self::PayloadAndBlobs {
254+
payload: execution_payload.into(),
255+
block_value,
256+
kzg_commitments: bundle.commitments,
257+
blobs_and_proofs: Some((bundle.blobs, bundle.proofs)),
258+
requests: maybe_requests,
259+
}),
263260
None => Ok(Self::Payload {
264261
payload: execution_payload.into(),
265262
block_value,
@@ -413,7 +410,7 @@ pub enum FailedCondition {
413410
EpochsSinceFinalization,
414411
}
415412

416-
type PayloadContentsRefTuple<'a, E> = (ExecutionPayloadRef<'a, E>, Option<BlobsBundleRef<'a, E>>);
413+
type PayloadContentsRefTuple<'a, E> = (ExecutionPayloadRef<'a, E>, Option<&'a BlobsBundle<E>>);
417414

418415
struct Inner<E: EthSpec> {
419416
engine: Arc<Engine>,
@@ -601,7 +598,7 @@ impl<E: EthSpec> ExecutionLayer<E> {
601598
let (payload_ref, maybe_json_blobs_bundle) = payload_and_blobs;
602599

603600
let payload = payload_ref.clone_from_ref();
604-
let maybe_blobs_bundle = maybe_json_blobs_bundle.map(|b| b.into());
601+
let maybe_blobs_bundle = maybe_json_blobs_bundle.cloned();
605602

606603
self.inner
607604
.payload_cache

beacon_node/execution_layer/src/test_utils/execution_block_generator.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::engine_api::{
66
};
77
use crate::engines::ForkchoiceState;
88
use crate::EthersTransaction;
9-
use eth2::types::{BlobsBundle, BlobsBundleV1, BlobsBundleV2};
9+
use eth2::types::BlobsBundle;
1010
use kzg::{Kzg, KzgCommitment, KzgProof};
1111
use parking_lot::Mutex;
1212
use rand::{rngs::StdRng, Rng, SeedableRng};
@@ -722,11 +722,11 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
722722

723723
pub fn load_test_blobs_bundle_v1<E: EthSpec>() -> Result<(KzgCommitment, KzgProof, Blob<E>), String>
724724
{
725-
let BlobsBundleV1::<E> {
725+
let BlobsBundle::<E> {
726726
commitments,
727727
proofs,
728728
blobs,
729-
} = BlobsBundleV1::from_ssz_bytes(TEST_BLOB_BUNDLE)
729+
} = BlobsBundle::from_ssz_bytes(TEST_BLOB_BUNDLE)
730730
.map_err(|e| format!("Unable to decode ssz: {:?}", e))?;
731731

732732
Ok((
@@ -747,11 +747,11 @@ pub fn load_test_blobs_bundle_v1<E: EthSpec>() -> Result<(KzgCommitment, KzgProo
747747

748748
pub fn load_test_blobs_bundle_v2<E: EthSpec>(
749749
) -> Result<(KzgCommitment, KzgProofs<E>, Blob<E>), String> {
750-
let BlobsBundleV2::<E> {
750+
let BlobsBundle::<E> {
751751
commitments,
752-
cell_proofs,
752+
proofs,
753753
blobs,
754-
} = BlobsBundleV2::from_ssz_bytes(TEST_BLOB_BUNDLE_V2)
754+
} = BlobsBundle::from_ssz_bytes(TEST_BLOB_BUNDLE_V2)
755755
.map_err(|e| format!("Unable to decode ssz: {:?}", e))?;
756756

757757
Ok((
@@ -760,7 +760,7 @@ pub fn load_test_blobs_bundle_v2<E: EthSpec>(
760760
.cloned()
761761
.ok_or("commitment missing in test bundle")?,
762762
// there's only one blob in the test bundle, hence we take all the cell proofs here.
763-
cell_proofs,
763+
proofs,
764764
blobs
765765
.first()
766766
.cloned()
@@ -778,24 +778,22 @@ pub fn generate_blobs<E: EthSpec>(
778778

779779
let bundle = if fork_name.fulu_enabled() {
780780
let (kzg_commitment, kzg_proofs, blob) = load_test_blobs_bundle_v2::<E>()?;
781-
let bundle = BlobsBundleV2 {
781+
BlobsBundle {
782782
commitments: vec![kzg_commitment; n_blobs].into(),
783-
cell_proofs: vec![kzg_proofs.to_vec(); n_blobs]
783+
proofs: vec![kzg_proofs.to_vec(); n_blobs]
784784
.into_iter()
785785
.flatten()
786786
.collect::<Vec<_>>()
787787
.into(),
788788
blobs: vec![blob; n_blobs].into(),
789-
};
790-
BlobsBundle::V2(bundle)
789+
}
791790
} else {
792791
let (kzg_commitment, kzg_proof, blob) = load_test_blobs_bundle_v1::<E>()?;
793-
let bundle = BlobsBundleV1 {
792+
BlobsBundle {
794793
commitments: vec![kzg_commitment; n_blobs].into(),
795794
proofs: vec![kzg_proof; n_blobs].into(),
796795
blobs: vec![blob; n_blobs].into(),
797-
};
798-
BlobsBundle::V1(bundle)
796+
}
799797
};
800798

801799
Ok((bundle, transactions.into()))

0 commit comments

Comments
 (0)