Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Commit 6e691c0

Browse files
authored
chore: Remove BlockMeta variants and unused code (paradigmxyz#17835)
1 parent 3cfc01d commit 6e691c0

File tree

13 files changed

+35
-274
lines changed

13 files changed

+35
-274
lines changed

crates/cli/commands/src/db/get.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ impl Command {
7272
StaticFileSegment::Receipts => {
7373
(table_key::<tables::Receipts>(&key)?, <ReceiptMask<ReceiptTy<N>>>::MASK)
7474
}
75-
StaticFileSegment::BlockMeta => todo!(),
7675
};
7776

7877
let content = tool.provider_factory.static_file_provider().find_static_file(
@@ -114,9 +113,6 @@ impl Command {
114113
)?;
115114
println!("{}", serde_json::to_string_pretty(&receipt)?);
116115
}
117-
StaticFileSegment::BlockMeta => {
118-
todo!()
119-
}
120116
}
121117
}
122118
}

crates/stages/stages/src/stages/s3/filelist.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@ pub(crate) static DOWNLOAD_FILE_LIST: [[(&str, B256); 3]; 2] = [
66
("static_file_transactions_0_499999", B256::ZERO),
77
("static_file_transactions_0_499999.off", B256::ZERO),
88
("static_file_transactions_0_499999.conf", B256::ZERO),
9-
// ("static_file_blockmeta_0_499999", B256::ZERO),
10-
// ("static_file_blockmeta_0_499999.off", B256::ZERO),
11-
// ("static_file_blockmeta_0_499999.conf", B256::ZERO),
129
],
1310
[
1411
("static_file_transactions_500000_999999", B256::ZERO),
1512
("static_file_transactions_500000_999999.off", B256::ZERO),
1613
("static_file_transactions_500000_999999.conf", B256::ZERO),
17-
// ("static_file_blockmeta_500000_999999", B256::ZERO),
18-
// ("static_file_blockmeta_500000_999999.off", B256::ZERO),
19-
// ("static_file_blockmeta_500000_999999.conf", B256::ZERO),
2014
],
2115
];

crates/static-file/static-file/src/static_file_producer.rs

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ where
187187
headers: stages_checkpoints[0],
188188
receipts: stages_checkpoints[1],
189189
transactions: stages_checkpoints[2],
190-
block_meta: stages_checkpoints[2],
191190
};
192191
let targets = self.get_static_file_targets(highest_static_files)?;
193192
self.run(targets)?;
@@ -227,9 +226,6 @@ where
227226
finalized_block_number,
228227
)
229228
}),
230-
block_meta: finalized_block_numbers.block_meta.and_then(|finalized_block_number| {
231-
self.get_static_file_target(highest_static_files.block_meta, finalized_block_number)
232-
}),
233229
};
234230

235231
trace!(
@@ -328,72 +324,56 @@ mod tests {
328324
headers: Some(1),
329325
receipts: Some(1),
330326
transactions: Some(1),
331-
block_meta: None,
332327
})
333328
.expect("get static file targets");
334329
assert_eq!(
335330
targets,
336331
StaticFileTargets {
337332
headers: Some(0..=1),
338333
receipts: Some(0..=1),
339-
transactions: Some(0..=1),
340-
block_meta: None
334+
transactions: Some(0..=1)
341335
}
342336
);
343337
assert_matches!(static_file_producer.run(targets), Ok(_));
344338
assert_eq!(
345339
provider_factory.static_file_provider().get_highest_static_files(),
346-
HighestStaticFiles {
347-
headers: Some(1),
348-
receipts: Some(1),
349-
transactions: Some(1),
350-
block_meta: None
351-
}
340+
HighestStaticFiles { headers: Some(1), receipts: Some(1), transactions: Some(1) }
352341
);
353342

354343
let targets = static_file_producer
355344
.get_static_file_targets(HighestStaticFiles {
356345
headers: Some(3),
357346
receipts: Some(3),
358347
transactions: Some(3),
359-
block_meta: None,
360348
})
361349
.expect("get static file targets");
362350
assert_eq!(
363351
targets,
364352
StaticFileTargets {
365353
headers: Some(2..=3),
366354
receipts: Some(2..=3),
367-
transactions: Some(2..=3),
368-
block_meta: None
355+
transactions: Some(2..=3)
369356
}
370357
);
371358
assert_matches!(static_file_producer.run(targets), Ok(_));
372359
assert_eq!(
373360
provider_factory.static_file_provider().get_highest_static_files(),
374-
HighestStaticFiles {
375-
headers: Some(3),
376-
receipts: Some(3),
377-
transactions: Some(3),
378-
block_meta: None
379-
}
361+
HighestStaticFiles { headers: Some(3), receipts: Some(3), transactions: Some(3) }
380362
);
381363

382364
let targets = static_file_producer
383365
.get_static_file_targets(HighestStaticFiles {
384366
headers: Some(4),
385367
receipts: Some(4),
386368
transactions: Some(4),
387-
block_meta: None,
388369
})
389370
.expect("get static file targets");
390371
assert_eq!(
391372
targets,
392373
StaticFileTargets {
393374
headers: Some(4..=4),
394375
receipts: Some(4..=4),
395-
transactions: Some(4..=4),
396-
block_meta: None
376+
transactions: Some(4..=4)
397377
}
398378
);
399379
assert_matches!(
@@ -402,12 +382,7 @@ mod tests {
402382
);
403383
assert_eq!(
404384
provider_factory.static_file_provider().get_highest_static_files(),
405-
HighestStaticFiles {
406-
headers: Some(3),
407-
receipts: Some(3),
408-
transactions: Some(3),
409-
block_meta: None
410-
}
385+
HighestStaticFiles { headers: Some(3), receipts: Some(3), transactions: Some(3) }
411386
);
412387
}
413388

@@ -435,7 +410,6 @@ mod tests {
435410
headers: Some(1),
436411
receipts: Some(1),
437412
transactions: Some(1),
438-
block_meta: None,
439413
})
440414
.expect("get static file targets");
441415
assert_matches!(locked_producer.run(targets.clone()), Ok(_));

crates/static-file/types/src/lib.rs

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ pub struct HighestStaticFiles {
3636
/// Highest static file block of transactions, inclusive.
3737
/// If [`None`], no static file is available.
3838
pub transactions: Option<BlockNumber>,
39-
/// Highest static file block of transactions, inclusive.
40-
/// If [`None`], no static file is available.
41-
pub block_meta: Option<BlockNumber>,
4239
}
4340

4441
impl HighestStaticFiles {
@@ -48,7 +45,6 @@ impl HighestStaticFiles {
4845
StaticFileSegment::Headers => self.headers,
4946
StaticFileSegment::Transactions => self.transactions,
5047
StaticFileSegment::Receipts => self.receipts,
51-
StaticFileSegment::BlockMeta => self.block_meta,
5248
}
5349
}
5450

@@ -58,13 +54,12 @@ impl HighestStaticFiles {
5854
StaticFileSegment::Headers => &mut self.headers,
5955
StaticFileSegment::Transactions => &mut self.transactions,
6056
StaticFileSegment::Receipts => &mut self.receipts,
61-
StaticFileSegment::BlockMeta => &mut self.block_meta,
6257
}
6358
}
6459

6560
/// Returns an iterator over all static file segments
6661
fn iter(&self) -> impl Iterator<Item = Option<BlockNumber>> {
67-
[self.headers, self.transactions, self.receipts, self.block_meta].into_iter()
62+
[self.headers, self.transactions, self.receipts].into_iter()
6863
}
6964

7065
/// Returns the minimum block of all segments.
@@ -87,17 +82,12 @@ pub struct StaticFileTargets {
8782
pub receipts: Option<RangeInclusive<BlockNumber>>,
8883
/// Targeted range of transactions.
8984
pub transactions: Option<RangeInclusive<BlockNumber>>,
90-
/// Targeted range of block meta.
91-
pub block_meta: Option<RangeInclusive<BlockNumber>>,
9285
}
9386

9487
impl StaticFileTargets {
9588
/// Returns `true` if any of the targets are [Some].
9689
pub const fn any(&self) -> bool {
97-
self.headers.is_some() ||
98-
self.receipts.is_some() ||
99-
self.transactions.is_some() ||
100-
self.block_meta.is_some()
90+
self.headers.is_some() || self.receipts.is_some() || self.transactions.is_some()
10191
}
10292

10393
/// Returns `true` if all targets are either [`None`] or has beginning of the range equal to the
@@ -107,7 +97,6 @@ impl StaticFileTargets {
10797
(self.headers.as_ref(), static_files.headers),
10898
(self.receipts.as_ref(), static_files.receipts),
10999
(self.transactions.as_ref(), static_files.transactions),
110-
(self.block_meta.as_ref(), static_files.block_meta),
111100
]
112101
.iter()
113102
.all(|(target_block_range, highest_static_file_block)| {
@@ -136,12 +125,8 @@ mod tests {
136125

137126
#[test]
138127
fn test_highest_static_files_highest() {
139-
let files = HighestStaticFiles {
140-
headers: Some(100),
141-
receipts: Some(200),
142-
transactions: None,
143-
block_meta: None,
144-
};
128+
let files =
129+
HighestStaticFiles { headers: Some(100), receipts: Some(200), transactions: None };
145130

146131
// Test for headers segment
147132
assert_eq!(files.highest(StaticFileSegment::Headers), Some(100));
@@ -168,20 +153,12 @@ mod tests {
168153
// Modify transactions value
169154
*files.as_mut(StaticFileSegment::Transactions) = Some(350);
170155
assert_eq!(files.transactions, Some(350));
171-
172-
// Modify block meta value
173-
*files.as_mut(StaticFileSegment::BlockMeta) = Some(350);
174-
assert_eq!(files.block_meta, Some(350));
175156
}
176157

177158
#[test]
178159
fn test_highest_static_files_min() {
179-
let files = HighestStaticFiles {
180-
headers: Some(300),
181-
receipts: Some(100),
182-
transactions: None,
183-
block_meta: None,
184-
};
160+
let files =
161+
HighestStaticFiles { headers: Some(300), receipts: Some(100), transactions: None };
185162

186163
// Minimum value among the available segments
187164
assert_eq!(files.min_block_num(), Some(100));
@@ -193,12 +170,8 @@ mod tests {
193170

194171
#[test]
195172
fn test_highest_static_files_max() {
196-
let files = HighestStaticFiles {
197-
headers: Some(300),
198-
receipts: Some(100),
199-
transactions: Some(500),
200-
block_meta: Some(500),
201-
};
173+
let files =
174+
HighestStaticFiles { headers: Some(300), receipts: Some(100), transactions: Some(500) };
202175

203176
// Maximum value among the available segments
204177
assert_eq!(files.max_block_num(), Some(500));

crates/static-file/types/src/segment.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ pub enum StaticFileSegment {
3737
#[strum(serialize = "receipts")]
3838
/// Static File segment responsible for the `Receipts` table.
3939
Receipts,
40-
#[strum(serialize = "blockmeta")]
41-
/// Static File segment responsible for the `BlockBodyIndices`, `BlockOmmers`,
42-
/// `BlockWithdrawals` tables.
43-
BlockMeta,
4440
}
4541

4642
impl StaticFileSegment {
@@ -50,15 +46,13 @@ impl StaticFileSegment {
5046
Self::Headers => "headers",
5147
Self::Transactions => "transactions",
5248
Self::Receipts => "receipts",
53-
Self::BlockMeta => "blockmeta",
5449
}
5550
}
5651

5752
/// Returns an iterator over all segments.
5853
pub fn iter() -> impl Iterator<Item = Self> {
59-
// The order of segments is significant and must be maintained to ensure correctness. For
60-
// example, Transactions require BlockBodyIndices from Blockmeta to be sound.
61-
[Self::Headers, Self::BlockMeta, Self::Transactions, Self::Receipts].into_iter()
54+
// The order of segments is significant and must be maintained to ensure correctness.
55+
[Self::Headers, Self::Transactions, Self::Receipts].into_iter()
6256
}
6357

6458
/// Returns the default configuration of the segment.
@@ -69,7 +63,7 @@ impl StaticFileSegment {
6963
/// Returns the number of columns for the segment
7064
pub const fn columns(&self) -> usize {
7165
match self {
72-
Self::Headers | Self::BlockMeta => 3,
66+
Self::Headers => 3,
7367
Self::Transactions | Self::Receipts => 1,
7468
}
7569
}
@@ -133,11 +127,6 @@ impl StaticFileSegment {
133127
matches!(self, Self::Headers)
134128
}
135129

136-
/// Returns `true` if the segment is `StaticFileSegment::BlockMeta`.
137-
pub const fn is_block_meta(&self) -> bool {
138-
matches!(self, Self::BlockMeta)
139-
}
140-
141130
/// Returns `true` if the segment is `StaticFileSegment::Receipts`.
142131
pub const fn is_receipts(&self) -> bool {
143132
matches!(self, Self::Receipts)
@@ -150,7 +139,7 @@ impl StaticFileSegment {
150139

151140
/// Returns `true` if a segment row is linked to a block.
152141
pub const fn is_block_based(&self) -> bool {
153-
matches!(self, Self::Headers | Self::BlockMeta)
142+
matches!(self, Self::Headers)
154143
}
155144
}
156145

crates/storage/db/src/static_file/masks.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
use crate::{
22
add_static_file_mask,
33
static_file::mask::{ColumnSelectorOne, ColumnSelectorTwo},
4-
BlockBodyIndices, HeaderTerminalDifficulties,
4+
HeaderTerminalDifficulties,
55
};
66
use alloy_primitives::BlockHash;
7-
use reth_db_api::{
8-
models::{StaticFileBlockWithdrawals, StoredBlockOmmers},
9-
table::Table,
10-
};
7+
use reth_db_api::table::Table;
118

129
// HEADER MASKS
1310
add_static_file_mask! {
@@ -45,17 +42,3 @@ add_static_file_mask! {
4542
#[doc = "Mask for selecting a single transaction from Transactions static file segment"]
4643
TransactionMask<T>, T, 0b1
4744
}
48-
49-
// BLOCK_META MASKS
50-
add_static_file_mask! {
51-
#[doc = "Mask for a `StoredBlockBodyIndices` from `BlockMeta` static file segment"]
52-
BodyIndicesMask, <BlockBodyIndices as Table>::Value, 0b001
53-
}
54-
add_static_file_mask! {
55-
#[doc = "Mask for a `StoredBlockOmmers` from `BlockMeta` static file segment"]
56-
OmmersMask<H>, StoredBlockOmmers<H>, 0b010
57-
}
58-
add_static_file_mask! {
59-
#[doc = "Mask for a `StaticFileBlockWithdrawals` from `BlockMeta` static file segment"]
60-
WithdrawalsMask, StaticFileBlockWithdrawals, 0b100
61-
}

crates/storage/provider/src/providers/database/mod.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -540,29 +540,14 @@ impl<N: ProviderNodeTypes> BlockBodyIndicesProvider for ProviderFactory<N> {
540540
&self,
541541
number: BlockNumber,
542542
) -> ProviderResult<Option<StoredBlockBodyIndices>> {
543-
self.static_file_provider.get_with_static_file_or_database(
544-
StaticFileSegment::BlockMeta,
545-
number,
546-
|static_file| static_file.block_body_indices(number),
547-
|| self.provider()?.block_body_indices(number),
548-
)
543+
self.provider()?.block_body_indices(number)
549544
}
550545

551546
fn block_body_indices_range(
552547
&self,
553548
range: RangeInclusive<BlockNumber>,
554549
) -> ProviderResult<Vec<StoredBlockBodyIndices>> {
555-
self.static_file_provider.get_range_with_static_file_or_database(
556-
StaticFileSegment::BlockMeta,
557-
*range.start()..*range.end() + 1,
558-
|static_file, range, _| {
559-
static_file.block_body_indices_range(range.start..=range.end.saturating_sub(1))
560-
},
561-
|range, _| {
562-
self.provider()?.block_body_indices_range(range.start..=range.end.saturating_sub(1))
563-
},
564-
|_| true,
565-
)
550+
self.provider()?.block_body_indices_range(range)
566551
}
567552
}
568553

0 commit comments

Comments
 (0)