Test fixes and Cargo.lock update

This commit is contained in:
Michael Sproul
2022-02-02 17:44:48 +11:00
parent 05a136e016
commit 6c05b1de9b
2 changed files with 18 additions and 13 deletions

2
Cargo.lock generated
View File

@@ -3411,6 +3411,7 @@ dependencies = [
"slashing_protection",
"slog",
"sloggers",
"store",
"task_executor",
"tempfile",
"types",
@@ -3657,7 +3658,6 @@ dependencies = [
"itertools",
"parking_lot",
"serde",
"smallvec",
"tree_hash",
"triomphe",
"typenum",

View File

@@ -1009,6 +1009,7 @@ mod test {
mod collect_valid_votes {
use super::*;
use types::VList;
fn get_eth1_data_vec(n: u64, block_number_offset: u64) -> Vec<(Eth1Data, BlockNumber)> {
(0..n)
@@ -1056,12 +1057,14 @@ mod test {
let votes_to_consider = get_eth1_data_vec(slots, 0);
*state.eth1_data_votes_mut() = votes_to_consider[0..slots as usize / 4]
.iter()
.map(|(eth1_data, _)| eth1_data)
.cloned()
.collect::<Vec<_>>()
.into();
*state.eth1_data_votes_mut() = VList::new(
votes_to_consider[0..slots as usize / 4]
.iter()
.map(|(eth1_data, _)| eth1_data)
.cloned()
.collect::<Vec<_>>(),
)
.unwrap();
let votes =
collect_valid_votes(&state, &votes_to_consider.clone().into_iter().collect());
@@ -1085,12 +1088,14 @@ mod test {
.expect("should have some eth1 data")
.clone();
*state.eth1_data_votes_mut() = vec![duplicate_eth1_data.clone(); 4]
.iter()
.map(|(eth1_data, _)| eth1_data)
.cloned()
.collect::<Vec<_>>()
.into();
*state.eth1_data_votes_mut() = VList::new(
vec![duplicate_eth1_data.clone(); 4]
.iter()
.map(|(eth1_data, _)| eth1_data)
.cloned()
.collect::<Vec<_>>(),
)
.unwrap();
let votes = collect_valid_votes(&state, &votes_to_consider.into_iter().collect());
assert_votes!(