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

feat(l1): parallel state sync + rebuild state trie in background #1896

Closed
wants to merge 305 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
305 commits
Select commit Hold shift + click to select a range
d3cb204
Disregard bodies
fmoletta Jan 10, 2025
fc7249e
Download only bodies past pivot
fmoletta Jan 10, 2025
b38351a
Mute revalidation'
fmoletta Jan 10, 2025
8b10f5d
Debug
fmoletta Jan 10, 2025
16116c4
Debug
fmoletta Jan 10, 2025
c72de56
Do not switch to full sync on aborted sync
fmoletta Jan 13, 2025
c3ec08e
Debug
fmoletta Jan 13, 2025
62db683
Debug
fmoletta Jan 13, 2025
9008b1b
Debug
fmoletta Jan 13, 2025
de2f849
Debug
fmoletta Jan 13, 2025
d092b12
Mute connection errors
fmoletta Jan 14, 2025
f4cd209
Use current SyncStatus when applying a fork choice update
fmoletta Jan 14, 2025
40e4cc5
Use current SyncStatus when applying a new payload
fmoletta Jan 14, 2025
25785f3
Debug
fmoletta Jan 14, 2025
eb8cce5
Debug
fmoletta Jan 14, 2025
84f5de6
Debug
fmoletta Jan 14, 2025
b3074bb
Debug
fmoletta Jan 14, 2025
d55d22f
Debug
fmoletta Jan 14, 2025
ce488ba
Debug
fmoletta Jan 14, 2025
90571fe
[REVERT ME] disable receipt fetching
fmoletta Jan 14, 2025
a7b195f
Execute blocks after pivot
fmoletta Jan 14, 2025
a53cfaa
Trace verify range
fmoletta Jan 14, 2025
81fd7f0
Revert "Trace verify range"
fmoletta Jan 14, 2025
f3ac721
Trace verify range
fmoletta Jan 14, 2025
1d6548e
Trace verify range
fmoletta Jan 14, 2025
a8aba12
Trace verify range
fmoletta Jan 14, 2025
b5b4a24
Trace verify range
fmoletta Jan 14, 2025
024c13b
Trace verify range
fmoletta Jan 14, 2025
3a77d93
Trace verify range
fmoletta Jan 14, 2025
bb97334
Trace verify range
fmoletta Jan 14, 2025
f768099
Trace verify range
fmoletta Jan 14, 2025
26855e4
Trace verify range
fmoletta Jan 14, 2025
d915aac
Trace verify range
fmoletta Jan 14, 2025
7512ad4
Fix validate storage range logic
fmoletta Jan 14, 2025
075ce35
Fix retry counter when fetching account ranges
fmoletta Jan 14, 2025
94338ae
Only activate full sync after succesful snap sync
fmoletta Jan 14, 2025
231867f
Restore comment
fmoletta Jan 14, 2025
c523bca
Merge branch 'fix-retry-handling-sync' into sepolia-debug
fmoletta Jan 14, 2025
be6464a
Clean verify range tracing
fmoletta Jan 14, 2025
132aecc
Clean verify range tracing
fmoletta Jan 14, 2025
f6e75e6
Clean verify range tracing
fmoletta Jan 14, 2025
b5e5c88
Adjust numbers + silence mac failure
fmoletta Jan 14, 2025
27e01f5
Simplify logic (aka no longer care about bodies and receipts before t…
fmoletta Jan 14, 2025
4ce3e0c
Use current SyncStatus when applying a fork choice update
fmoletta Jan 14, 2025
fc81ab2
Use current SyncStatus when applying a new payload
fmoletta Jan 14, 2025
730bb5e
Mute non-sync logs
fmoletta Jan 15, 2025
fbde9ff
Merge branch 'main' into track-snap-state-simplified
fmoletta Jan 15, 2025
7145b92
Fix
fmoletta Jan 15, 2025
9c03b78
Fix
fmoletta Jan 15, 2025
36f26ee
Mute non-sync logs
fmoletta Jan 15, 2025
fb4fb3e
Periodically show peer stats
fmoletta Jan 15, 2025
824f623
Periodically show peer stats
fmoletta Jan 15, 2025
de73c29
Add comment
fmoletta Jan 15, 2025
b80d447
Fix typo + move call to appropiate context
fmoletta Jan 15, 2025
d5a37c4
Revert "Periodically show peer stats"
fmoletta Jan 15, 2025
f87052a
Merge branch 'periodically-show-peer-stats' into sepolia-debug
fmoletta Jan 15, 2025
7399f89
Trace storage bottlenecks
fmoletta Jan 15, 2025
d9654bd
Trace storage bottlenecks
fmoletta Jan 15, 2025
9b3900a
Abort early if stale pivot on storage fetcher
fmoletta Jan 15, 2025
20f9f47
Adjust batch sizes
fmoletta Jan 15, 2025
3db8c76
Handle large storage batch
fmoletta Jan 15, 2025
6c6753f
Trace Handle large storage batch
fmoletta Jan 15, 2025
b67da8e
Fix
fmoletta Jan 15, 2025
a0ef349
Fix
fmoletta Jan 15, 2025
d580dc2
Update
fmoletta Jan 16, 2025
283529a
Update
fmoletta Jan 16, 2025
f8de62b
Update
fmoletta Jan 16, 2025
f387ff9
Merge branch 'track-snap-state-simplified' into sepolia-debug
fmoletta Jan 16, 2025
d163535
Store state trie checkpoint
fmoletta Jan 16, 2025
9c7b395
Use checkpoints in state trie download
fmoletta Jan 16, 2025
e0d3fa7
Debug
fmoletta Jan 16, 2025
495bbbe
Debug
fmoletta Jan 16, 2025
ec548e3
Debug
fmoletta Jan 16, 2025
b38fe36
Fix
fmoletta Jan 16, 2025
340ce4e
Add storage handling of pending healing lists
fmoletta Jan 16, 2025
3dc9b13
Revert "Add storage handling of pending healing lists"
fmoletta Jan 16, 2025
6c40cc5
Allow healing restart
fmoletta Jan 16, 2025
85de436
Allow healing restart
fmoletta Jan 16, 2025
ad22712
Allow healing restart
fmoletta Jan 16, 2025
f999957
Fix
fmoletta Jan 16, 2025
dc14663
Fix
fmoletta Jan 16, 2025
2f9bfae
Healing: Dont write nodes only leaf values, may be slower but we wont…
fmoletta Jan 17, 2025
6aec5b4
Remove noise
fmoletta Jan 17, 2025
abc85d5
Fix
fmoletta Jan 17, 2025
5f2bdd8
Soft reset
fmoletta Jan 17, 2025
6cf2dd8
Soft reset
fmoletta Jan 17, 2025
0111892
(test) try increasing response bytes
fmoletta Jan 17, 2025
c3120d3
Unify batch sizes
fmoletta Jan 17, 2025
e7542d2
(test) try increasing batch size
fmoletta Jan 17, 2025
69ed322
Dont overwrite pending storages
fmoletta Jan 17, 2025
868d35a
Dont overwrite pending storages
fmoletta Jan 17, 2025
93d2f91
Remove soft reset
fmoletta Jan 17, 2025
8f90a1f
Dont overwrite pending storages
fmoletta Jan 17, 2025
bf74c47
Remove soft reset
fmoletta Jan 17, 2025
3723b88
Show completion percentage during state sync
fmoletta Jan 17, 2025
4bf453e
Debug
fmoletta Jan 17, 2025
75f2182
Show completion percentage during state sync
fmoletta Jan 17, 2025
1f267e9
Show progress: detatch task + show estimated time to finish
fmoletta Jan 17, 2025
691d651
Spawn multiple tasks for storage fetcher
fmoletta Jan 17, 2025
59fcde2
Trace storage tasks
fmoletta Jan 17, 2025
0bd9f53
Fix bit logic
fmoletta Jan 17, 2025
4746e9e
Fix tracing
fmoletta Jan 17, 2025
91162b7
Update bytes limit for peer requests
fmoletta Jan 20, 2025
87485db
Remove internal StalePivot error
fmoletta Jan 20, 2025
ccec4cc
Handle edge case: sync head not found
fmoletta Jan 20, 2025
0e4bd69
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
fmoletta Jan 20, 2025
e282079
Remove debug code
fmoletta Jan 20, 2025
c92627d
Debug
fmoletta Jan 20, 2025
b3531b7
Remove debug code
fmoletta Jan 20, 2025
181d5fd
Mute connection errors
fmoletta Jan 20, 2025
cffb582
Clean branch
fmoletta Jan 20, 2025
fb0b509
Fix potential unwrap
fmoletta Jan 21, 2025
12b2791
Fix conditional
fmoletta Jan 21, 2025
1541cce
Debug
fmoletta Jan 21, 2025
34b4fd9
Fix logic
fmoletta Jan 21, 2025
d4b0350
Soft reset
fmoletta Jan 21, 2025
cddf287
Get rid of noisy unwrap
fmoletta Jan 21, 2025
598e14a
Get rid of noisy unwrap
fmoletta Jan 21, 2025
1fd66c5
Debug
fmoletta Jan 21, 2025
9fd8425
Not so much debug
fmoletta Jan 21, 2025
4f4b6c9
Debug
fmoletta Jan 21, 2025
49c165e
Remove soft reset
fmoletta Jan 21, 2025
7dc43bf
Debug
fmoletta Jan 21, 2025
f1e5416
Debug
fmoletta Jan 21, 2025
a1c8f53
Debug
fmoletta Jan 21, 2025
7dc1a4f
Debug
fmoletta Jan 21, 2025
791a6be
Debug
fmoletta Jan 21, 2025
e9db4f2
Recount
fmoletta Jan 22, 2025
06425cc
Debug
fmoletta Jan 22, 2025
b699909
Filter out storages without paths left to fetch
fmoletta Jan 22, 2025
91ed3b9
Revert "Debug"
fmoletta Jan 22, 2025
2404d2d
Revert "Recount"
fmoletta Jan 22, 2025
fd14b20
Debug leaf touches
fmoletta Jan 22, 2025
c318740
Debug leaf touches
fmoletta Jan 22, 2025
8872ee1
Make storage heal quieter and state heal louder
fmoletta Jan 22, 2025
070034d
Prioritize reaching leaves on state trie heal + increase batch size f…
fmoletta Jan 22, 2025
384f1b2
Fix
fmoletta Jan 22, 2025
09f14c3
Cleaning
fmoletta Jan 22, 2025
ef868d2
Soft reset
fmoletta Jan 23, 2025
4d2a6c4
Revert "Soft reset"
fmoletta Jan 23, 2025
7656bd5
Revert "Cleaning"
fmoletta Jan 23, 2025
9f3afb9
Revert "Fix"
fmoletta Jan 23, 2025
b24a118
Revert "Prioritize reaching leaves on state trie heal + increase batc…
fmoletta Jan 23, 2025
b4adf6c
Save full nodes instead of leafs during healing
fmoletta Jan 23, 2025
eef3b60
restore one net trace
fmoletta Jan 23, 2025
ce5ea22
Lower request byte limit
fmoletta Jan 23, 2025
2580fce
Revert "restore one net trace"
fmoletta Jan 23, 2025
2ca9357
Show active peers more frequently
fmoletta Jan 23, 2025
c64b209
Soft reset + add enode
fmoletta Jan 27, 2025
7bb6e50
Revert "Lower request byte limit"
fmoletta Jan 27, 2025
1ffb043
Remove soft reset
fmoletta Jan 27, 2025
180970c
Revert "Revert "Lower request byte limit""
fmoletta Jan 27, 2025
f562b1e
Remove slow bootnode
fmoletta Jan 27, 2025
1c1028e
Show peer distribution
fmoletta Jan 27, 2025
794eeb0
Update cancun engine tests
fmoletta Jan 27, 2025
ab5ebb3
[PickMe] Use `recv_many` to avoid piling up multiple incoming batches…
fmoletta Jan 28, 2025
83caa20
[PickMe] Store state sync checkpoints regardless of staleness
fmoletta Jan 28, 2025
8a12e2c
Skip state sync if we already begun healing
fmoletta Jan 28, 2025
fa62807
Fix
fmoletta Jan 28, 2025
27567ca
Speed up Storage healing
fmoletta Jan 29, 2025
cf45dd7
Limit amount of paths in node request
fmoletta Jan 29, 2025
4f0d547
Reduce noise
fmoletta Jan 30, 2025
a72f6f2
Add state snapshot methods
fmoletta Jan 30, 2025
d77116e
Use snapshot instead of downloading state directly
fmoletta Jan 30, 2025
b6546c3
Remove state trie root checkpoint
fmoletta Jan 30, 2025
905b254
Make it work
fmoletta Jan 30, 2025
6b0eccc
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
fmoletta Feb 4, 2025
26f2e80
Amend diffs
fmoletta Feb 4, 2025
45a8a1a
Amend diffs
fmoletta Feb 4, 2025
9f5cb6d
Amend diffs
fmoletta Feb 4, 2025
8d80c8a
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
fmoletta Feb 4, 2025
2a15cf4
Write storage snapshot
fmoletta Feb 4, 2025
d63b422
Remove unused ret
fmoletta Feb 4, 2025
5b9a124
Fix libmdx impl
fmoletta Feb 4, 2025
dd1eb23
Fix libmdx impl
fmoletta Feb 4, 2025
5310bae
Add trie segmentation constants
fmoletta Feb 4, 2025
5a37ac5
Spawn tasks for each state trie segment
fmoletta Feb 4, 2025
3e97fce
Adapt state sync to support multiple processes
fmoletta Feb 5, 2025
8b2e524
Fix
fmoletta Feb 5, 2025
24f2874
Up segment count to 2 & fix issue regarding acc range boundaries
fmoletta Feb 5, 2025
b837478
Add constants MAX_CHANNEL_MESSAGES + MAX_CHANNEL_READS
fmoletta Feb 5, 2025
af62ecb
state_sync: process returns by segment number
fmoletta Feb 6, 2025
1b0c58f
Update state sync progress tracking
fmoletta Feb 6, 2025
4689a15
Progress
fmoletta Feb 6, 2025
e1595b8
Mute debug tracing
fmoletta Feb 6, 2025
0bab2fb
Fix
fmoletta Feb 6, 2025
11050e3
Mute p2p logs
fmoletta Feb 6, 2025
21ae3a5
Fix
fmoletta Feb 6, 2025
ea57483
Fix
fmoletta Feb 6, 2025
633abd6
Fix
fmoletta Feb 6, 2025
dabb708
Debug
fmoletta Feb 6, 2025
135eb6a
Reoder code
fmoletta Feb 6, 2025
4af5e3d
Merge branch 'paralell-state-sync' into paralell-state-sync-refactor
fmoletta Feb 6, 2025
11e0ad9
Refactor snap sync modularization
fmoletta Feb 6, 2025
9c15ffc
Measure rebuild time
fmoletta Feb 6, 2025
176bc56
Debug
fmoletta Feb 6, 2025
3fb6d5f
Debug
fmoletta Feb 6, 2025
04a1308
Save early progress
fmoletta Feb 6, 2025
0ee95e3
Sig change
fmoletta Feb 7, 2025
1baed0e
Commit trie to DB every N inserts
fmoletta Feb 7, 2025
d075fb3
Commit trie to DB every N inserts
fmoletta Feb 7, 2025
fb3d877
Progress
fmoletta Feb 7, 2025
f165531
Integrate to snap sync
fmoletta Feb 7, 2025
96a896c
Update debug
fmoletta Feb 7, 2025
2f3588b
Update debug
fmoletta Feb 7, 2025
5bf44b9
state trie rebuild -> notice state sync completeness
fmoletta Feb 7, 2025
1242807
Store trie rebuild checkpoints in Store
fmoletta Feb 7, 2025
229991c
Show trie rebuild progress
fmoletta Feb 7, 2025
8050cf4
Remove debug
fmoletta Feb 7, 2025
45d068e
Clear Snapshot
fmoletta Feb 7, 2025
e3c46eb
Clear Snapshot
fmoletta Feb 7, 2025
048a062
Estimate trie rebuild time
fmoletta Feb 7, 2025
db4fbed
Debug
fmoletta Feb 7, 2025
ea60612
Revert "Debug"
fmoletta Feb 7, 2025
5744255
Fix
fmoletta Feb 10, 2025
8cc3b73
Debug
fmoletta Feb 10, 2025
8716d10
Prevent absurd estimated time to finish display
fmoletta Feb 10, 2025
eb9ab58
Debug arith op
fmoletta Feb 10, 2025
6a3cdc2
Debug
fmoletta Feb 10, 2025
d8f0943
Debug
fmoletta Feb 10, 2025
067b26e
Debug
fmoletta Feb 10, 2025
995c383
Debug
fmoletta Feb 10, 2025
4e0a2e7
Fix checkpoint
fmoletta Feb 10, 2025
62b2e75
Respawn trie rebuilder if it crashes
fmoletta Feb 10, 2025
ef369bf
Remove debug
fmoletta Feb 10, 2025
59020c1
Fix + clear state
fmoletta Feb 10, 2025
627eb95
Remove state clear + fix
fmoletta Feb 10, 2025
36fb99c
Fix arith
fmoletta Feb 10, 2025
dc0abf7
Refactor show progress
fmoletta Feb 10, 2025
a2d9269
Use CancellationToken to cancel trie rebuild upon shutdown
fmoletta Feb 10, 2025
1e61121
Fix
fmoletta Feb 10, 2025
f93a99d
Debug
fmoletta Feb 10, 2025
3a8eca4
Mute newpayload
fmoletta Feb 10, 2025
b902997
Pass cancel token to storage method
fmoletta Feb 10, 2025
00aa1bc
Debug
fmoletta Feb 10, 2025
775266d
Debug
fmoletta Feb 10, 2025
79d5955
Debug
fmoletta Feb 10, 2025
1f9a276
Debug
fmoletta Feb 10, 2025
622795e
Fix logic
fmoletta Feb 10, 2025
d50de22
Rempve debug
fmoletta Feb 10, 2025
07a18fe
Reduce amount of inserts before committing trie
fmoletta Feb 10, 2025
f64ee26
[Debug] disable trie rebuild
fmoletta Feb 10, 2025
e596f88
[Debug] disable storage trie rebuild
fmoletta Feb 10, 2025
34a60dc
Enable state trie rebuild
fmoletta Feb 10, 2025
8bf2b43
Decouple state & storage rebuild
fmoletta Feb 10, 2025
c65afe4
[Debug] disable storage trie rebuild
fmoletta Feb 10, 2025
48fb366
Limit snapshot reads [Test]
fmoletta Feb 10, 2025
45f036c
Raise snapshot read cap
fmoletta Feb 10, 2025
b247002
Undo change
fmoletta Feb 10, 2025
9342eb4
Fix: move clear snapshot
fmoletta Feb 10, 2025
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
1 change: 1 addition & 0 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion cmd/ethrex/ethrex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ async fn main() {
.expect("Node record could not be created from local node");
// Create Kademlia Table here so we can access it from rpc server (for syncing)
let peer_table = peer_table(signer.clone());
// Create a cancellation_token for long_living tasks
let cancel_token = tokio_util::sync::CancellationToken::new();
// Create SyncManager
let syncer = SyncManager::new(peer_table.clone(), sync_mode);
let syncer = SyncManager::new(peer_table.clone(), sync_mode, cancel_token.clone());

// TODO: Check every module starts properly.
let tracker = TaskTracker::new();
Expand Down Expand Up @@ -304,6 +306,7 @@ async fn main() {
_ = tokio::signal::ctrl_c() => {
info!("Server shut down started...");
info!("Storing known peers at {:?}...", peers_file);
cancel_token.cancel();
store_known_peers(peer_table, peers_file).await;
tokio::time::sleep(Duration::from_secs(1)).await;
info!("Server shutting down!");
Expand Down
3 changes: 2 additions & 1 deletion crates/networking/p2p/peer_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,15 @@ impl PeerHandler {
&self,
state_root: H256,
start: H256,
limit: H256,
) -> Option<(Vec<H256>, Vec<AccountState>, bool)> {
for _ in 0..REQUEST_RETRY_ATTEMPTS {
let request_id = rand::random();
let request = RLPxMessage::GetAccountRange(GetAccountRange {
id: request_id,
root_hash: state_root,
starting_hash: start,
limit_hash: HASH_MAX,
limit_hash: limit,
response_bytes: MAX_RESPONSE_BYTES,
});
let peer = self.get_peer_channel_with_retry(Capability::Snap).await?;
Expand Down
4 changes: 2 additions & 2 deletions crates/networking/p2p/rlpx/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ pub(crate) fn log_peer_debug(node: &Node, text: &str) {
}

pub(crate) fn log_peer_error(node: &Node, text: &str) {
error!("[{0}]: {1}", node, text)
//error!("[{0}]: {1}", node, text)
}
pub(crate) fn log_peer_warn(node: &Node, text: &str) {
warn!("[{0}]: {1}", node, text)
//warn!("[{0}]: {1}", node, text)
}

#[cfg(test)]
Expand Down
Loading
Loading