Run cargofmt --all
This commit is contained in:
parent
6c9be1a73c
commit
89d64b007f
@ -1,7 +1,7 @@
|
|||||||
use self::epoch_cache::{get_active_validator_indices, EpochCache, Error as EpochCacheError};
|
use self::epoch_cache::{get_active_validator_indices, EpochCache, Error as EpochCacheError};
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use cached_tree_hash::{TreeHashCache, Error as TreeHashCacheError};
|
use cached_tree_hash::{Error as TreeHashCacheError, TreeHashCache};
|
||||||
use int_to_bytes::int_to_bytes32;
|
use int_to_bytes::int_to_bytes32;
|
||||||
use pubkey_cache::PubkeyCache;
|
use pubkey_cache::PubkeyCache;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
@ -827,7 +827,8 @@ impl BeaconState {
|
|||||||
/// Returns an error if the cache is not initialized or if an error is encountered during the
|
/// Returns an error if the cache is not initialized or if an error is encountered during the
|
||||||
/// cache update.
|
/// cache update.
|
||||||
pub fn cached_tree_hash_root(&self) -> Result<Hash256, Error> {
|
pub fn cached_tree_hash_root(&self) -> Result<Hash256, Error> {
|
||||||
self.tree_hash_cache.root()
|
self.tree_hash_cache
|
||||||
|
.root()
|
||||||
.and_then(|b| Ok(Hash256::from_slice(b)))
|
.and_then(|b| Ok(Hash256::from_slice(b)))
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,12 @@ pub fn update_tree_hash_cache<T: CachedTreeHash<T>>(
|
|||||||
//
|
//
|
||||||
// Splice the tree for the new item into the current chunk_index.
|
// Splice the tree for the new item into the current chunk_index.
|
||||||
(LeafNode::DoesNotExist, LeafNode::Exists(new)) => {
|
(LeafNode::DoesNotExist, LeafNode::Exists(new)) => {
|
||||||
splice_in_new_tree(&vec[i], new.start..new.start, new_overlay.depth + 1, cache)?;
|
splice_in_new_tree(
|
||||||
|
&vec[i],
|
||||||
|
new.start..new.start,
|
||||||
|
new_overlay.depth + 1,
|
||||||
|
cache,
|
||||||
|
)?;
|
||||||
|
|
||||||
cache.chunk_index = new.end;
|
cache.chunk_index = new.end;
|
||||||
}
|
}
|
||||||
@ -174,7 +179,12 @@ pub fn update_tree_hash_cache<T: CachedTreeHash<T>>(
|
|||||||
//
|
//
|
||||||
// Splice the tree for the new item over the padding chunk.
|
// Splice the tree for the new item over the padding chunk.
|
||||||
(LeafNode::Padding, LeafNode::Exists(new)) => {
|
(LeafNode::Padding, LeafNode::Exists(new)) => {
|
||||||
splice_in_new_tree(&vec[i], new.start..new.start + 1, new_overlay.depth + 1, cache)?;
|
splice_in_new_tree(
|
||||||
|
&vec[i],
|
||||||
|
new.start..new.start + 1,
|
||||||
|
new_overlay.depth + 1,
|
||||||
|
cache,
|
||||||
|
)?;
|
||||||
|
|
||||||
cache.chunk_index = new.end;
|
cache.chunk_index = new.end;
|
||||||
}
|
}
|
||||||
@ -255,10 +265,10 @@ fn splice_in_new_tree<T>(
|
|||||||
depth: usize,
|
depth: usize,
|
||||||
cache: &mut TreeHashCache,
|
cache: &mut TreeHashCache,
|
||||||
) -> Result<(), Error>
|
) -> Result<(), Error>
|
||||||
where T: CachedTreeHash<T>
|
where
|
||||||
|
T: CachedTreeHash<T>,
|
||||||
{
|
{
|
||||||
let (bytes, mut bools, schemas) =
|
let (bytes, mut bools, schemas) = TreeHashCache::new(item, depth)?.into_components();
|
||||||
TreeHashCache::new(item, depth)?.into_components();
|
|
||||||
|
|
||||||
// Record the number of schemas, this will be used later in the fn.
|
// Record the number of schemas, this will be used later in the fn.
|
||||||
let num_schemas = schemas.len();
|
let num_schemas = schemas.len();
|
||||||
|
Loading…
Reference in New Issue
Block a user