mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 05:48:31 +00:00
Cargo.lock fixes and EF test fixes
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -3728,7 +3728,6 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "milhouse"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/sigp/milhouse?branch=main#30c87f256deacc381fb15e39ccc4a281445f98da"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"eth2_hashing 0.2.0",
|
||||
@@ -3741,6 +3740,7 @@ dependencies = [
|
||||
"tree_hash",
|
||||
"triomphe",
|
||||
"typenum",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5964,6 +5964,7 @@ dependencies = [
|
||||
"smallvec",
|
||||
"tree_hash",
|
||||
"types",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -26,6 +26,7 @@ arbitrary = { version = "1.0", features = ["derive"], optional = true }
|
||||
lighthouse_metrics = { path = "../../common/lighthouse_metrics", optional = true }
|
||||
lazy_static = { version = "1.4.0", optional = true }
|
||||
rustc-hash = "1.1.0"
|
||||
vec_map = "0.8.2"
|
||||
|
||||
[features]
|
||||
default = ["legacy-arith", "metrics"]
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
use crate::common::altair::get_base_reward;
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
use std::collections::BTreeMap;
|
||||
use types::milhouse::update_map::{MaxMap, UpdateMap};
|
||||
use types::{
|
||||
consts::altair::{
|
||||
NUM_FLAG_INDICES, TIMELY_HEAD_FLAG_INDEX, TIMELY_SOURCE_FLAG_INDEX,
|
||||
@@ -22,6 +22,7 @@ use types::{
|
||||
BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, ParticipationFlags, RelativeEpoch,
|
||||
Unsigned, Validator,
|
||||
};
|
||||
use vec_map::VecMap;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Error {
|
||||
@@ -198,7 +199,7 @@ pub struct ParticipationCache {
|
||||
/// `process_slashings`.
|
||||
process_slashings_indices: Vec<(usize, u64)>,
|
||||
/// Updates to the inactivity scores if we are definitely not in an inactivity leak.
|
||||
pub inactivity_score_updates: Option<BTreeMap<usize, u64>>,
|
||||
pub inactivity_score_updates: Option<MaxMap<VecMap<u64>>>,
|
||||
}
|
||||
|
||||
impl ParticipationCache {
|
||||
@@ -237,7 +238,7 @@ impl ParticipationCache {
|
||||
let definitely_not_in_inactivity_leak =
|
||||
state.finalized_checkpoint().epoch + spec.min_epochs_to_inactivity_penalty + 1
|
||||
>= state.current_epoch();
|
||||
let mut inactivity_score_updates = BTreeMap::new();
|
||||
let mut inactivity_score_updates = MaxMap::default();
|
||||
|
||||
// Iterate through all validators, updating:
|
||||
//
|
||||
|
||||
@@ -213,7 +213,7 @@ impl<E: EthSpec> EpochTransition<E> for InactivityUpdates {
|
||||
BeaconState::Base(_) => Ok(()),
|
||||
BeaconState::Altair(_) | BeaconState::Merge(_) => altair::process_inactivity_updates(
|
||||
state,
|
||||
&altair::ParticipationCache::new(state, spec).unwrap(),
|
||||
&mut altair::ParticipationCache::new(state, spec).unwrap(),
|
||||
spec,
|
||||
),
|
||||
}
|
||||
@@ -278,19 +278,22 @@ impl<E: EthSpec, T: EpochTransition<E>> Case for EpochProcessing<E, T> {
|
||||
fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> {
|
||||
self.metadata.bls_setting.unwrap_or_default().check()?;
|
||||
|
||||
let mut state = self.pre.clone();
|
||||
let spec = &testing_spec::<E>(fork_name);
|
||||
let mut pre_state = self.pre.clone();
|
||||
|
||||
// Processing requires the committee caches.
|
||||
pre_state.build_all_committee_caches(spec).unwrap();
|
||||
|
||||
let mut state = pre_state.clone();
|
||||
let mut expected = self.post.clone();
|
||||
|
||||
let spec = &testing_spec::<E>(fork_name);
|
||||
expected.as_mut().map(|post_state| {
|
||||
post_state.build_all_committee_caches(spec).unwrap();
|
||||
});
|
||||
|
||||
let mut result = (|| {
|
||||
// Processing requires the committee caches.
|
||||
state.build_all_committee_caches(spec)?;
|
||||
let mut result = T::run(&mut state, spec).map(|_| state);
|
||||
|
||||
T::run(&mut state, spec).map(|_| state)
|
||||
})();
|
||||
|
||||
compare_beacon_state_results_without_caches(&mut result, &mut expected)?;
|
||||
check_state_diff(&self.pre, &self.post)
|
||||
check_state_diff(&pre_state, &expected)?;
|
||||
compare_beacon_state_results_without_caches(&mut result, &mut expected)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,14 +323,20 @@ impl<E: EthSpec, O: Operation<E>> Case for Operations<E, O> {
|
||||
|
||||
fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> {
|
||||
let spec = &testing_spec::<E>(fork_name);
|
||||
let mut state = self.pre.clone();
|
||||
let mut expected = self.post.clone();
|
||||
|
||||
let mut pre_state = self.pre.clone();
|
||||
// Processing requires the committee caches.
|
||||
state
|
||||
pre_state
|
||||
.build_all_committee_caches(spec)
|
||||
.expect("committee caches OK");
|
||||
|
||||
let mut state = pre_state.clone();
|
||||
let mut expected = self.post.clone();
|
||||
|
||||
expected
|
||||
.as_mut()
|
||||
.map(|post_state| post_state.build_all_committee_caches(spec).unwrap());
|
||||
|
||||
let mut result = self
|
||||
.operation
|
||||
.as_ref()
|
||||
@@ -338,7 +344,7 @@ impl<E: EthSpec, O: Operation<E>> Case for Operations<E, O> {
|
||||
.apply_to(&mut state, spec, self)
|
||||
.map(|()| state);
|
||||
|
||||
compare_beacon_state_results_without_caches(&mut result, &mut expected)?;
|
||||
check_state_diff(&self.pre, &self.post)
|
||||
check_state_diff(&pre_state, &expected)?;
|
||||
compare_beacon_state_results_without_caches(&mut result, &mut expected)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user