mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Optimizations, disable val client sync check & additional lcli tools (#834)
* Start adding interop genesis state to lcli * Use more efficient method to generate genesis state * Remove duplicate int_to_bytes32 * Add lcli command to change state genesis time * Add option to allow VC to start with unsynced BN * Set VC to do parallel key loading * Don't default to dummy eth1 backend * Add endpoint to dump operation pool * Add metrics for op pool * Remove state clone for slot notifier * Add mem size approximation for tree hash cache * Avoid cloning tree hash when getting head * Fix failing API tests * Address Michael's comments * Add HashMap::from_par_iter
This commit is contained in:
@@ -97,6 +97,21 @@ impl BeaconTreeHashCache {
|
||||
pub fn is_initialized(&self) -> bool {
|
||||
self.initialized
|
||||
}
|
||||
|
||||
/// Returns the approximate size of the cache in bytes.
|
||||
///
|
||||
/// The size is approximate because we ignore some stack-allocated `u64` and `Vec` pointers.
|
||||
/// We focus instead on the lists of hashes, which should massively outweigh the items that we
|
||||
/// ignore.
|
||||
pub fn approx_mem_size(&self) -> usize {
|
||||
self.block_roots.approx_mem_size()
|
||||
+ self.state_roots.approx_mem_size()
|
||||
+ self.historical_roots.approx_mem_size()
|
||||
+ self.validators.approx_mem_size()
|
||||
+ self.balances.approx_mem_size()
|
||||
+ self.randao_mixes.approx_mem_size()
|
||||
+ self.slashings.approx_mem_size()
|
||||
}
|
||||
}
|
||||
|
||||
/// The state of the `BeaconChain` at some slot.
|
||||
@@ -996,6 +1011,12 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
tree_hash_cache: BeaconTreeHashCache::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clone_with_only_committee_caches(&self) -> Self {
|
||||
let mut state = self.clone_without_caches();
|
||||
state.committee_caches = self.committee_caches.clone();
|
||||
state
|
||||
}
|
||||
}
|
||||
|
||||
impl From<RelativeEpochError> for Error {
|
||||
|
||||
Reference in New Issue
Block a user