Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
383 changes: 108 additions & 275 deletions lean_client/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lean_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ indexmap = "2"
http-body-util = "0.1"
http_api_utils = { git = "https://github.com/grandinetech/grandine", rev = "c4b676e3daa0ddcb86d0bcb321b7166d59f920f9" }
k256 = "0.13"
lean-multisig = { git = "https://github.com/leanEthereum/leanVM.git", rev = "a5909d18647de6aed38640c098d9177fab2bf36a" }
leanvm = { git = "https://github.com/leanEthereum/leanVM.git", rev = "48a904208d682848dac0e18ef8b01ebfc40df9ad" }
postcard = { version = "1.1.3", features = ["alloc"] }
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", rev = "91e8931e275bcd1c72791d18b09fea8b77209baf", default-features = false, features = [
'dns',
Expand Down
12 changes: 12 additions & 0 deletions lean_client/fork_choice/src/block_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ impl BlockCache {
results.into_iter().collect()
}

pub fn prune_finalized(&mut self, finalized_slot: Slot) {
let stale: Vec<H256> = self
.blocks
.iter()
.filter(|(_, pending)| pending.slot <= finalized_slot)
.map(|(root, _)| *root)
.collect();
for root in stale {
self.remove(&root);
}
}

pub fn clear(&mut self) {
self.blocks.clear();
self.insertion_order.clear();
Expand Down
10 changes: 4 additions & 6 deletions lean_client/fork_choice/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,7 @@ pub fn on_aggregated_attestation(
}
}

// Store the verified proof in latest_new_aggregated_payloads, keyed by data_root
store
.latest_new_aggregated_payloads
.entry(data_root)
.or_default()
.push(proof);
store.add_new_aggregated_payload(data_root, proof);

METRICS.get().map(|metrics| {
metrics
Expand Down Expand Up @@ -765,6 +760,9 @@ pub fn apply_verified_block(
);

store.blocks.insert(block_root, block.clone());
store
.proto
.on_block(block.slot.0, block_root, block.parent_root);
store.states.insert(block_root, Arc::clone(&new_state));

METRICS.get().map(|m| {
Expand Down
1 change: 1 addition & 0 deletions lean_client/fork_choice/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod block_cache;
pub mod handlers;
pub mod proto;
pub mod reaggregate;
pub mod store;
pub mod sync_state;
Expand Down
Loading
Loading