-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(snapshots): write Receipt
to snapshots during ExecutionStage
#6103
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
Changes from all commits
999a14e
34d324d
0a5931a
c7422ca
615e8b4
1119adf
4a6ae7d
a784733
90c5968
ab74e35
b9c51e9
94cb5e6
53189da
b0d62d5
f029ccf
a991bc5
92bf0fb
2c7595c
77e3572
4687864
df6d39b
96408be
b7145dd
b4271e1
d3a8051
9189c18
62131f2
299bfc8
05c5caf
d65b1fc
fc86307
53afb76
4d86bdb
42526ea
43290a5
612ee17
d86575d
d155996
56a2a74
0dffeb8
a026fd4
5e9a3f8
ee87ea2
82714d6
ede4bd5
d827ef5
0b3c541
b1bf9ff
60c2852
2517658
b6e260e
b355de0
f795252
abb79c1
4c9d014
457fcfd
31d8ab6
4c71964
f68f03b
89bd906
4cf80c7
16db801
69d8691
eccd512
54831d8
54b4877
4ecfcf2
aad40d4
144c28b
6a33e75
ae79086
30a35c2
d458a51
0d3dc0a
5e720d1
365468d
8732595
436e606
c58d6a5
5be02b8
8f80230
b475eae
579da38
c9c8a9f
882bd98
79a789f
a89fdde
a32a017
ffdc327
81635e3
de73878
63c3b15
50e4073
df3e020
d72035d
d9d41cb
20039a3
3d0a14f
aa269f2
3a183cf
9d62f7d
464632a
cc02564
5e5c6cf
22a4042
04e2831
26b18d8
cad373c
4470e69
ce9f75b
8d6d17d
fbc5027
312f683
13e4b66
cc75fb6
15156df
8a21242
4d4815b
c4162a7
17862c7
7ab3287
61e9f22
8dcd208
4cf39f2
c416918
a5552ff
1517133
c6daaee
f09aeae
586287c
fcf79ab
68c77dd
d55c9f7
0bc9b91
dd749fc
40b5ee7
2a5fc4f
782f7e3
b21950b
957a6e1
f78a00d
153a36d
f340fde
f94bdbc
8bb80fc
5cc4cf4
3e643fe
fd86e88
815f100
86e6760
1109058
e57e820
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
use super::{LoadedJar, SnapshotJarProvider, SnapshotProviderRW, BLOCKS_PER_SNAPSHOT}; | ||
use super::{ | ||
LoadedJar, SnapshotJarProvider, SnapshotProviderRW, SnapshotProviderRWRefMut, | ||
BLOCKS_PER_SNAPSHOT, | ||
}; | ||
use crate::{ | ||
to_range, BlockHashReader, BlockNumReader, BlockReader, BlockSource, HeaderProvider, | ||
ReceiptProvider, TransactionVariant, TransactionsProvider, TransactionsProviderExt, | ||
WithdrawalsProvider, | ||
}; | ||
use dashmap::{ | ||
mapref::{entry::Entry as DashMapEntry, one::RefMut}, | ||
DashMap, | ||
}; | ||
use dashmap::{mapref::entry::Entry as DashMapEntry, DashMap}; | ||
use parking_lot::RwLock; | ||
use reth_db::{ | ||
codecs::CompactU256, | ||
|
@@ -264,6 +264,13 @@ impl SnapshotProvider { | |
index.insert(tx_end, current_block_range.clone()); | ||
}) | ||
.or_insert_with(|| BTreeMap::from([(tx_end, current_block_range)])); | ||
} else if let Some(1) = tx_index.get(&segment).map(|index| index.len()) { | ||
// Only happens if we unwind all the txs/receipts from the first static file. | ||
// Should only happen in test scenarios. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, isn't it possible that we have index of length one during the normal node operation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i may be missing something, but i think highly unlikely... |
||
if matches!(segment, SnapshotSegment::Receipts | SnapshotSegment::Transactions) | ||
{ | ||
tx_index.remove(&segment); | ||
} | ||
} | ||
|
||
// Update the cached provider. | ||
|
@@ -420,13 +427,13 @@ pub trait SnapshotWriter { | |
&self, | ||
block: BlockNumber, | ||
segment: SnapshotSegment, | ||
) -> ProviderResult<RefMut<'_, SnapshotSegment, SnapshotProviderRW<'static>>>; | ||
) -> ProviderResult<SnapshotProviderRWRefMut<'_>>; | ||
|
||
/// Returns a mutable reference to a [`SnapshotProviderRW`] of the latest [`SnapshotSegment`]. | ||
fn latest_writer( | ||
&self, | ||
segment: SnapshotSegment, | ||
) -> ProviderResult<RefMut<'_, SnapshotSegment, SnapshotProviderRW<'static>>>; | ||
) -> ProviderResult<SnapshotProviderRWRefMut<'_>>; | ||
|
||
/// Commits all changes of all [`SnapshotProviderRW`] of all [`SnapshotSegment`]. | ||
fn commit(&self) -> ProviderResult<()>; | ||
|
@@ -437,7 +444,7 @@ impl SnapshotWriter for Arc<SnapshotProvider> { | |
&self, | ||
block: BlockNumber, | ||
segment: SnapshotSegment, | ||
) -> ProviderResult<RefMut<'_, SnapshotSegment, SnapshotProviderRW<'static>>> { | ||
) -> ProviderResult<SnapshotProviderRWRefMut<'_>> { | ||
Ok(match self.writers.entry(segment) { | ||
DashMapEntry::Occupied(entry) => entry.into_ref(), | ||
DashMapEntry::Vacant(entry) => { | ||
|
@@ -449,7 +456,7 @@ impl SnapshotWriter for Arc<SnapshotProvider> { | |
fn latest_writer( | ||
&self, | ||
segment: SnapshotSegment, | ||
) -> ProviderResult<RefMut<'_, SnapshotSegment, SnapshotProviderRW<'static>>> { | ||
) -> ProviderResult<SnapshotProviderRWRefMut<'_>> { | ||
self.get_writer(self.get_highest_snapshot_block(segment).unwrap_or_default(), segment) | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.