Skip to content

Commit c1d2d0c

Browse files
committed
Revert blob changes
1 parent 66dbc04 commit c1d2d0c

35 files changed

+200
-452
lines changed

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ use safe_arith::SafeArith;
102102
use slasher::Slasher;
103103
use slot_clock::SlotClock;
104104
use ssz::Encode;
105-
use ssz_types::RuntimeVariableList;
106105
use state_processing::{
107106
BlockSignatureStrategy, ConsensusContext, SigVerifiedOp, VerifyBlockRoot, VerifyOperation,
108107
common::get_attesting_indices_from_state,
@@ -1267,19 +1266,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
12671266
Ok(None)
12681267
}
12691268
} else {
1270-
let max_blobs = self.spec.max_blobs_per_block(block.epoch());
1271-
let blobs = self.get_blobs(block_root)?.blobs();
1272-
match blobs {
1273-
Some(blobs) => {
1274-
let list: Vec<_> = blobs
1275-
.into_iter()
1276-
.map(|blob| Arc::new(BlobSidecar::Deneb((*blob).clone())))
1277-
.collect();
1278-
let blob_sidecar_list = RuntimeVariableList::new(list, max_blobs as usize)?;
1279-
Ok(Some(blob_sidecar_list))
1280-
}
1281-
None => Ok(None),
1282-
}
1269+
Ok(self.get_blobs(block_root)?.blobs())
12831270
}
12841271
}
12851272

@@ -3128,7 +3115,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
31283115

31293116
fn emit_sse_blob_sidecar_events<'a, I>(self: &Arc<Self>, block_root: &Hash256, blobs_iter: I)
31303117
where
3131-
I: Iterator<Item = &'a BlobSidecarDeneb<T::EthSpec>>,
3118+
I: Iterator<Item = &'a BlobSidecar<T::EthSpec>>,
31323119
{
31333120
if let Some(event_handler) = self.event_handler.as_ref()
31343121
&& event_handler.has_blob_sidecar_subscribers()
@@ -3528,7 +3515,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
35283515
fn check_blob_header_signature_and_slashability<'a>(
35293516
self: &Arc<Self>,
35303517
block_root: Hash256,
3531-
blobs: impl IntoIterator<Item = &'a BlobSidecarDeneb<T::EthSpec>>,
3518+
blobs: impl IntoIterator<Item = &'a BlobSidecar<T::EthSpec>>,
35323519
) -> Result<(), BlockError> {
35333520
let mut slashable_cache = self.observed_slashable.write();
35343521
for header in blobs

beacon_node/beacon_chain/src/blob_verification.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::sync::Arc;
77
use std::time::Duration;
88
use tracing::instrument;
99
use tree_hash::TreeHash;
10-
use types::{BeaconStateError, BlobSidecar, BlobSidecarDeneb, EthSpec, Hash256, Slot};
10+
use types::{BeaconStateError, BlobSidecar, EthSpec, Hash256, Slot};
1111

1212
/// An error occurred while validating a gossip blob.
1313
#[derive(Debug)]
@@ -151,7 +151,7 @@ impl From<BeaconStateError> for GossipBlobError {
151151
#[educe(PartialEq, Eq)]
152152
#[ssz(struct_behaviour = "transparent")]
153153
pub struct KzgVerifiedBlob<E: EthSpec> {
154-
blob: Arc<BlobSidecarDeneb<E>>,
154+
blob: Arc<BlobSidecar<E>>,
155155
#[ssz(skip_serializing, skip_deserializing)]
156156
seen_timestamp: Duration,
157157
}
@@ -170,23 +170,23 @@ impl<E: EthSpec> Ord for KzgVerifiedBlob<E> {
170170

171171
impl<E: EthSpec> KzgVerifiedBlob<E> {
172172
pub fn new(
173-
blob: Arc<BlobSidecarDeneb<E>>,
173+
blob: Arc<BlobSidecar<E>>,
174174
kzg: &Kzg,
175175
seen_timestamp: Duration,
176176
) -> Result<Self, KzgError> {
177177
verify_kzg_for_blob(blob, kzg, seen_timestamp)
178178
}
179-
pub fn to_blob(self) -> Arc<BlobSidecarDeneb<E>> {
179+
pub fn to_blob(self) -> Arc<BlobSidecar<E>> {
180180
self.blob
181181
}
182-
pub fn as_blob(&self) -> &BlobSidecarDeneb<E> {
182+
pub fn as_blob(&self) -> &BlobSidecar<E> {
183183
&self.blob
184184
}
185185
pub fn get_commitment(&self) -> &KzgCommitment {
186186
&self.blob.kzg_commitment
187187
}
188188
/// This is cheap as we're calling clone on an Arc
189-
pub fn clone_blob(&self) -> Arc<BlobSidecarDeneb<E>> {
189+
pub fn clone_blob(&self) -> Arc<BlobSidecar<E>> {
190190
self.blob.clone()
191191
}
192192
pub fn blob_index(&self) -> u64 {
@@ -199,18 +199,15 @@ impl<E: EthSpec> KzgVerifiedBlob<E> {
199199
///
200200
/// This should ONLY be used for testing.
201201
#[cfg(test)]
202-
pub fn __assumed_valid(blob: Arc<BlobSidecarDeneb<E>>) -> Self {
202+
pub fn __assumed_valid(blob: Arc<BlobSidecar<E>>) -> Self {
203203
Self {
204204
blob,
205205
seen_timestamp: Duration::from_secs(0),
206206
}
207207
}
208208
/// Mark a blob as KZG verified. Caller must ONLY use this on blob sidecars constructed
209209
/// from EL blobs.
210-
pub fn from_execution_verified(
211-
blob: Arc<BlobSidecarDeneb<E>>,
212-
seen_timestamp: Duration,
213-
) -> Self {
210+
pub fn from_execution_verified(blob: Arc<BlobSidecar<E>>, seen_timestamp: Duration) -> Self {
214211
Self {
215212
blob,
216213
seen_timestamp,
@@ -222,7 +219,7 @@ impl<E: EthSpec> KzgVerifiedBlob<E> {
222219
///
223220
/// Returns an error if the kzg verification check fails.
224221
pub fn verify_kzg_for_blob<E: EthSpec>(
225-
blob: Arc<BlobSidecarDeneb<E>>,
222+
blob: Arc<BlobSidecar<E>>,
226223
kzg: &Kzg,
227224
seen_timestamp: Duration,
228225
) -> Result<KzgVerifiedBlob<E>, KzgError> {
@@ -238,7 +235,7 @@ pub struct KzgVerifiedBlobList<E: EthSpec> {
238235
}
239236

240237
impl<E: EthSpec> KzgVerifiedBlobList<E> {
241-
pub fn new<I: IntoIterator<Item = Arc<BlobSidecarDeneb<E>>>>(
238+
pub fn new<I: IntoIterator<Item = Arc<BlobSidecar<E>>>>(
242239
blob_list: I,
243240
kzg: &Kzg,
244241
seen_timestamp: Duration,
@@ -284,7 +281,7 @@ pub fn verify_kzg_for_blob_list<'a, E: EthSpec, I>(
284281
kzg: &'a Kzg,
285282
) -> Result<(), KzgError>
286283
where
287-
I: Iterator<Item = &'a Arc<BlobSidecarDeneb<E>>>,
284+
I: Iterator<Item = &'a Arc<BlobSidecar<E>>>,
288285
{
289286
let (blobs, (commitments, proofs)): (Vec<_>, (Vec<_>, Vec<_>)) = blob_iter
290287
.map(|blob| (&blob.blob, (blob.kzg_commitment, blob.kzg_proof)))

beacon_node/beacon_chain/src/block_verification_types.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::fmt::{Debug, Formatter};
99
use std::sync::Arc;
1010
use types::data::BlobIdentifier;
1111
use types::{
12-
BeaconBlockRef, BeaconState, BlindedPayload, BlobSidecarListDeneb, Epoch, EthSpec, Hash256,
12+
BeaconBlockRef, BeaconState, BlindedPayload, BlobSidecarList, Epoch, EthSpec, Hash256,
1313
SignedBeaconBlock, SignedBeaconBlockHeader, Slot,
1414
};
1515

@@ -60,7 +60,7 @@ impl<E: EthSpec> RpcBlock<E> {
6060
}
6161
}
6262

63-
pub fn blobs(&self) -> Option<&BlobSidecarListDeneb<E>> {
63+
pub fn blobs(&self) -> Option<&BlobSidecarList<E>> {
6464
match &self.block {
6565
RpcBlockInner::Block(_) => None,
6666
RpcBlockInner::BlockAndBlobs(_, blobs) => Some(blobs),
@@ -87,7 +87,7 @@ enum RpcBlockInner<E: EthSpec> {
8787
Block(Arc<SignedBeaconBlock<E>>),
8888
/// This variant is used with parent lookups and by-range responses. It should have all blobs
8989
/// ordered, all block roots matching, and the correct number of blobs for this block.
90-
BlockAndBlobs(Arc<SignedBeaconBlock<E>>, BlobSidecarListDeneb<E>),
90+
BlockAndBlobs(Arc<SignedBeaconBlock<E>>, BlobSidecarList<E>),
9191
/// This variant is used with parent lookups and by-range responses. It should have all
9292
/// requested data columns, all block roots matching for this block.
9393
BlockAndCustodyColumns(Arc<SignedBeaconBlock<E>>, CustodyDataColumnList<E>),
@@ -115,7 +115,7 @@ impl<E: EthSpec> RpcBlock<E> {
115115
pub fn new(
116116
block_root: Option<Hash256>,
117117
block: Arc<SignedBeaconBlock<E>>,
118-
blobs: Option<BlobSidecarListDeneb<E>>,
118+
blobs: Option<BlobSidecarList<E>>,
119119
) -> Result<Self, AvailabilityCheckError> {
120120
let block_root = block_root.unwrap_or_else(|| get_block_root(&block));
121121
// Treat empty blob lists as if they are missing.
@@ -177,7 +177,7 @@ impl<E: EthSpec> RpcBlock<E> {
177177
) -> (
178178
Hash256,
179179
Arc<SignedBeaconBlock<E>>,
180-
Option<BlobSidecarListDeneb<E>>,
180+
Option<BlobSidecarList<E>>,
181181
Option<CustodyDataColumnList<E>>,
182182
) {
183183
let block_root = self.block_root();

beacon_node/beacon_chain/src/builder.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ use rand::RngCore;
3535
use rayon::prelude::*;
3636
use slasher::Slasher;
3737
use slot_clock::{SlotClock, TestingSlotClock};
38-
use ssz_types::RuntimeVariableList;
3938
use state_processing::{AllCaches, per_slot_processing};
4039
use std::marker::PhantomData;
4140
use std::sync::Arc;
4241
use std::time::Duration;
4342
use store::{Error as StoreError, HotColdDB, ItemStore, KeyValueStoreOp};
4443
use task_executor::{ShutdownReason, TaskExecutor};
4544
use tracing::{debug, error, info};
46-
use types::BlobSidecar;
4745
use types::data::CustodyIndex;
4846
use types::{
4947
BeaconBlock, BeaconState, BlobSidecarList, ChainSpec, ColumnIndex, DataColumnSidecarList,
@@ -508,7 +506,7 @@ where
508506
if commitments
509507
.iter()
510508
.zip(blobs.iter())
511-
.any(|(commitment, blob)| *commitment != *blob.kzg_commitment())
509+
.any(|(commitment, blob)| *commitment != blob.kzg_commitment)
512510
{
513511
return Err("Checkpoint blob does not match block commitment".into());
514512
}
@@ -597,18 +595,6 @@ where
597595
.put_data_columns(&weak_subj_block_root, data_columns)
598596
.map_err(|e| format!("Failed to store weak subjectivity data_column: {e:?}"))?;
599597
} else {
600-
let blobs = blobs
601-
.into_iter()
602-
.filter_map(|b| match b.as_ref() {
603-
BlobSidecar::Deneb(blob) => Some(Arc::new(blob.clone())),
604-
BlobSidecar::Gloas(_) => None,
605-
})
606-
.collect::<Vec<_>>();
607-
608-
let max_blobs = self.spec.max_blobs_per_block(weak_subj_block.epoch()) as usize;
609-
let blobs = RuntimeVariableList::new(blobs, max_blobs)
610-
.map_err(|e| format!("failed to store weak subjectivity blobs: {e:?}"))?;
611-
612598
store
613599
.put_blobs(&weak_subj_block_root, blobs)
614600
.map_err(|e| format!("Failed to store weak subjectivity blobs: {e:?}"))?;
@@ -1209,7 +1195,7 @@ fn build_data_columns_from_blobs<E: EthSpec>(
12091195
.into_par_iter()
12101196
.map(|blob_sidecar| {
12111197
let kzg_blob_ref = blob_sidecar
1212-
.blob()
1198+
.blob
12131199
.as_ref()
12141200
.try_into()
12151201
.map_err(|e| format!("Failed to convert blob to kzg blob: {e:?}"))?;

beacon_node/beacon_chain/src/data_availability_checker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use task_executor::TaskExecutor;
1919
use tracing::{debug, error, instrument};
2020
use types::data::{BlobIdentifier, FixedBlobSidecarList};
2121
use types::{
22-
BlobSidecarDeneb, BlobSidecarListDeneb, BlockImportSource, ChainSpec, DataColumnSidecar,
22+
BlobSidecar, BlobSidecarList, BlockImportSource, ChainSpec, DataColumnSidecar,
2323
DataColumnSidecarList, Epoch, EthSpec, Hash256, SignedBeaconBlock, Slot,
2424
};
2525

@@ -195,7 +195,7 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
195195
pub fn get_blob(
196196
&self,
197197
blob_id: &BlobIdentifier,
198-
) -> Result<Option<Arc<BlobSidecarDeneb<T::EthSpec>>>, AvailabilityCheckError> {
198+
) -> Result<Option<Arc<BlobSidecar<T::EthSpec>>>, AvailabilityCheckError> {
199199
self.availability_cache.peek_blob(blob_id)
200200
}
201201

@@ -734,7 +734,7 @@ pub enum AvailableBlockData<E: EthSpec> {
734734
/// Block is pre-Deneb or has zero blobs
735735
NoData,
736736
/// Block is post-Deneb, pre-PeerDAS and has more than zero blobs
737-
Blobs(BlobSidecarListDeneb<E>),
737+
Blobs(BlobSidecarList<E>),
738738
/// Block is post-PeerDAS and has more than zero blobs
739739
DataColumns(DataColumnSidecarList<E>),
740740
}

beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use tracing::{Span, debug, debug_span};
2020
use types::data::BlobIdentifier;
2121
use types::kzg_ext::KzgCommitments;
2222
use types::{
23-
BlobSidecarDeneb, BlockImportSource, ChainSpec, ColumnIndex, DataColumnSidecar,
23+
BlobSidecar, BlockImportSource, ChainSpec, ColumnIndex, DataColumnSidecar,
2424
DataColumnSidecarList, Epoch, EthSpec, Hash256, SignedBeaconBlock,
2525
};
2626

@@ -452,7 +452,7 @@ impl<T: BeaconChainTypes> DataAvailabilityCheckerInner<T> {
452452
pub fn peek_blob(
453453
&self,
454454
blob_id: &BlobIdentifier,
455-
) -> Result<Option<Arc<BlobSidecarDeneb<T::EthSpec>>>, AvailabilityCheckError> {
455+
) -> Result<Option<Arc<BlobSidecar<T::EthSpec>>>, AvailabilityCheckError> {
456456
if let Some(pending_components) = self.critical.read().peek(&blob_id.block_root) {
457457
Ok(pending_components
458458
.verified_blobs
@@ -1315,8 +1315,8 @@ mod pending_components_tests {
13151315

13161316
type Setup<E> = (
13171317
SignedBeaconBlock<E>,
1318-
RuntimeFixedVector<Option<Arc<BlobSidecarDeneb<E>>>>,
1319-
RuntimeFixedVector<Option<Arc<BlobSidecarDeneb<E>>>>,
1318+
RuntimeFixedVector<Option<Arc<BlobSidecar<E>>>>,
1319+
RuntimeFixedVector<Option<Arc<BlobSidecar<E>>>>,
13201320
usize,
13211321
);
13221322

@@ -1326,7 +1326,7 @@ mod pending_components_tests {
13261326
let (block, blobs_vec) =
13271327
generate_rand_block_and_blobs::<E>(ForkName::Deneb, NumBlobs::Random, &mut rng);
13281328
let max_len = spec.max_blobs_per_block(block.epoch()) as usize;
1329-
let mut blobs: RuntimeFixedVector<Option<Arc<BlobSidecarDeneb<E>>>> =
1329+
let mut blobs: RuntimeFixedVector<Option<Arc<BlobSidecar<E>>>> =
13301330
RuntimeFixedVector::default(max_len);
13311331

13321332
for blob in blobs_vec {
@@ -1335,7 +1335,7 @@ mod pending_components_tests {
13351335
}
13361336
}
13371337

1338-
let mut invalid_blobs: RuntimeFixedVector<Option<Arc<BlobSidecarDeneb<E>>>> =
1338+
let mut invalid_blobs: RuntimeFixedVector<Option<Arc<BlobSidecar<E>>>> =
13391339
RuntimeFixedVector::default(max_len);
13401340
for (index, blob) in blobs.iter().enumerate() {
13411341
if let Some(invalid_blob) = blob {
@@ -1356,8 +1356,8 @@ mod pending_components_tests {
13561356

13571357
pub fn setup_pending_components(
13581358
block: SignedBeaconBlock<E>,
1359-
valid_blobs: RuntimeFixedVector<Option<Arc<BlobSidecarDeneb<E>>>>,
1360-
invalid_blobs: RuntimeFixedVector<Option<Arc<BlobSidecarDeneb<E>>>>,
1359+
valid_blobs: RuntimeFixedVector<Option<Arc<BlobSidecar<E>>>>,
1360+
invalid_blobs: RuntimeFixedVector<Option<Arc<BlobSidecar<E>>>>,
13611361
) -> PendingComponentsSetup<E> {
13621362
let blobs = RuntimeFixedVector::new(
13631363
valid_blobs

beacon_node/beacon_chain/src/early_attester_cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub struct CacheItem<E: EthSpec> {
8787
* Values used to make the block available.
8888
*/
8989
block: Arc<SignedBeaconBlock<E>>,
90-
blobs: Option<BlobSidecarListDeneb<E>>,
90+
blobs: Option<BlobSidecarList<E>>,
9191
data_columns: Option<DataColumnSidecarList<E>>,
9292
proto_block: ProtoBlock,
9393
}
@@ -229,7 +229,7 @@ impl<E: EthSpec> EarlyAttesterCache<E> {
229229
}
230230

231231
/// Returns the blobs, if `block_root` matches the cached item.
232-
pub fn get_blobs(&self, block_root: Hash256) -> Option<BlobSidecarListDeneb<E>> {
232+
pub fn get_blobs(&self, block_root: Hash256) -> Option<BlobSidecarList<E>> {
233233
self.item
234234
.read()
235235
.as_ref()

0 commit comments

Comments
 (0)