mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 04:01:51 +00:00
Fix failing tests (#4423)
* Get tests passing * Get benchmarks compiling * Fix EF withdrawals test * Remove unused deps * Fix tree_hash panic in tests * Fix slasher compilation * Fix ssz_generic test * Get more tests passing * Fix EF tests for real * Fix local testnet scripts
This commit is contained in:
@@ -127,17 +127,18 @@ async fn attestations_across_fork_with_skip_slots() {
|
||||
let all_validators = harness.get_all_validators();
|
||||
|
||||
let fork_slot = fork_epoch.start_slot(E::slots_per_epoch());
|
||||
let fork_state = harness
|
||||
let mut fork_state = harness
|
||||
.chain
|
||||
.state_at_slot(fork_slot, StateSkipConfig::WithStateRoots)
|
||||
.unwrap();
|
||||
let fork_state_root = fork_state.update_tree_hash_cache().unwrap();
|
||||
|
||||
harness.set_current_slot(fork_slot);
|
||||
|
||||
let attestations = harness.make_attestations(
|
||||
&all_validators,
|
||||
&fork_state,
|
||||
fork_state.canonical_root(),
|
||||
fork_state_root,
|
||||
(*fork_state.get_block_root(fork_slot - 1).unwrap()).into(),
|
||||
fork_slot,
|
||||
);
|
||||
|
||||
@@ -788,7 +788,7 @@ impl ApiTester {
|
||||
let state_opt = state_id.state(&self.chain).ok();
|
||||
let validators: Vec<Validator> = match state_opt.as_ref() {
|
||||
Some((state, _execution_optimistic, _finalized)) => {
|
||||
state.validators().clone().into()
|
||||
state.validators().clone().to_vec()
|
||||
}
|
||||
None => vec![],
|
||||
};
|
||||
@@ -804,7 +804,7 @@ impl ApiTester {
|
||||
ValidatorId::PublicKey(
|
||||
validators
|
||||
.get(i as usize)
|
||||
.map_or(PublicKeyBytes::empty(), |val| val.pubkey.clone()),
|
||||
.map_or(PublicKeyBytes::empty(), |val| *val.pubkey),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<ValidatorId>>();
|
||||
@@ -835,7 +835,7 @@ impl ApiTester {
|
||||
if i < state.balances().len() as u64 {
|
||||
validators.push(ValidatorBalanceData {
|
||||
index: i as u64,
|
||||
balance: state.balances()[i as usize],
|
||||
balance: *state.balances().get(i as usize).unwrap(),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -860,7 +860,7 @@ impl ApiTester {
|
||||
.ok()
|
||||
.map(|(state, _execution_optimistic, _finalized)| state);
|
||||
let validators: Vec<Validator> = match state_opt.as_ref() {
|
||||
Some(state) => state.validators().clone().into(),
|
||||
Some(state) => state.validators().to_vec(),
|
||||
None => vec![],
|
||||
};
|
||||
let validator_index_ids = validator_indices
|
||||
@@ -875,7 +875,7 @@ impl ApiTester {
|
||||
ValidatorId::PublicKey(
|
||||
validators
|
||||
.get(i as usize)
|
||||
.map_or(PublicKeyBytes::empty(), |val| val.pubkey.clone()),
|
||||
.map_or(PublicKeyBytes::empty(), |val| *val.pubkey),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<ValidatorId>>();
|
||||
@@ -912,7 +912,7 @@ impl ApiTester {
|
||||
if i >= state.validators().len() as u64 {
|
||||
continue;
|
||||
}
|
||||
let validator = state.validators()[i as usize].clone();
|
||||
let validator = state.validators().get(i as usize).unwrap().clone();
|
||||
let status = ValidatorStatus::from_validator(
|
||||
&validator,
|
||||
epoch,
|
||||
@@ -924,7 +924,7 @@ impl ApiTester {
|
||||
{
|
||||
validators.push(ValidatorData {
|
||||
index: i as u64,
|
||||
balance: state.balances()[i as usize],
|
||||
balance: *state.balances().get(i as usize).unwrap(),
|
||||
status,
|
||||
validator,
|
||||
});
|
||||
@@ -950,13 +950,13 @@ impl ApiTester {
|
||||
.ok()
|
||||
.map(|(state, _execution_optimistic, _finalized)| state);
|
||||
let validators = match state_opt.as_ref() {
|
||||
Some(state) => state.validators().clone().into(),
|
||||
Some(state) => state.validators().to_vec(),
|
||||
None => vec![],
|
||||
};
|
||||
|
||||
for (i, validator) in validators.into_iter().enumerate() {
|
||||
let validator_ids = &[
|
||||
ValidatorId::PublicKey(validator.pubkey.clone()),
|
||||
ValidatorId::PublicKey(*validator.pubkey),
|
||||
ValidatorId::Index(i as u64),
|
||||
];
|
||||
|
||||
@@ -980,7 +980,7 @@ impl ApiTester {
|
||||
|
||||
ValidatorData {
|
||||
index: i as u64,
|
||||
balance: state.balances()[i],
|
||||
balance: *state.balances().get(i).unwrap(),
|
||||
status: ValidatorStatus::from_validator(
|
||||
&validator,
|
||||
epoch,
|
||||
@@ -2095,7 +2095,7 @@ impl ApiTester {
|
||||
.unwrap()
|
||||
{
|
||||
let expected = AttesterData {
|
||||
pubkey: state.validators()[i as usize].pubkey.clone().into(),
|
||||
pubkey: *state.validators().get(i as usize).unwrap().pubkey,
|
||||
validator_index: i,
|
||||
committees_at_slot: duty.committees_at_slot,
|
||||
committee_index: duty.index,
|
||||
@@ -2200,7 +2200,7 @@ impl ApiTester {
|
||||
let index = state
|
||||
.get_beacon_proposer_index(slot, &self.chain.spec)
|
||||
.unwrap();
|
||||
let pubkey = state.validators()[index].pubkey.clone().into();
|
||||
let pubkey = *state.validators().get(index).unwrap().pubkey;
|
||||
|
||||
ProposerData {
|
||||
pubkey,
|
||||
|
||||
Reference in New Issue
Block a user