mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
Update Rust Edition to 2024 (#7766)
* #7749 Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
|
||||
use beacon_chain::block_verification_types::AsBlock;
|
||||
use beacon_chain::test_utils::{
|
||||
generate_deterministic_keypairs, BeaconChainHarness, EphemeralHarnessType,
|
||||
BeaconChainHarness, EphemeralHarnessType, generate_deterministic_keypairs,
|
||||
};
|
||||
use beacon_chain::{
|
||||
BlockError, ChainConfig, StateSkipConfig, WhenSlotSkipped,
|
||||
test_utils::{AttestationStrategy, BlockStrategy, RelativeSyncCommittee},
|
||||
types::{Epoch, EthSpec, Keypair, MinimalEthSpec},
|
||||
BlockError, ChainConfig, StateSkipConfig, WhenSlotSkipped,
|
||||
};
|
||||
use eth2::types::{StandardAttestationRewards, TotalAttestationRewards, ValidatorId};
|
||||
use state_processing::{BlockReplayError, BlockReplayer};
|
||||
@@ -424,9 +424,11 @@ async fn test_rewards_altair() {
|
||||
.unwrap();
|
||||
|
||||
// assert ideal rewards are greater than 0
|
||||
assert!(ideal_rewards
|
||||
.iter()
|
||||
.all(|reward| reward.head > 0 && reward.target > 0 && reward.source > 0));
|
||||
assert!(
|
||||
ideal_rewards
|
||||
.iter()
|
||||
.all(|reward| reward.head > 0 && reward.target > 0 && reward.source > 0)
|
||||
);
|
||||
|
||||
// apply attestation, proposal, and sync committee rewards and penalties to initial balances
|
||||
apply_attestation_rewards(&mut expected_balances, total_rewards);
|
||||
@@ -507,12 +509,16 @@ async fn test_rewards_altair_inactivity_leak() {
|
||||
|
||||
// assert inactivity penalty for both ideal rewards and individual validators
|
||||
assert!(ideal_rewards.iter().all(|reward| reward.inactivity == 0));
|
||||
assert!(total_rewards[..half]
|
||||
.iter()
|
||||
.all(|reward| reward.inactivity == 0));
|
||||
assert!(total_rewards[half..]
|
||||
.iter()
|
||||
.all(|reward| reward.inactivity < 0));
|
||||
assert!(
|
||||
total_rewards[..half]
|
||||
.iter()
|
||||
.all(|reward| reward.inactivity == 0)
|
||||
);
|
||||
assert!(
|
||||
total_rewards[half..]
|
||||
.iter()
|
||||
.all(|reward| reward.inactivity < 0)
|
||||
);
|
||||
|
||||
// apply attestation, proposal, and sync committee rewards and penalties to initial balances
|
||||
apply_attestation_rewards(&mut expected_balances, total_rewards);
|
||||
@@ -612,9 +618,11 @@ async fn test_rewards_altair_inactivity_leak_justification_epoch() {
|
||||
.unwrap();
|
||||
|
||||
// assert ideal rewards are greater than 0
|
||||
assert!(ideal_rewards
|
||||
.iter()
|
||||
.all(|reward| reward.head > 0 && reward.target > 0 && reward.source > 0));
|
||||
assert!(
|
||||
ideal_rewards
|
||||
.iter()
|
||||
.all(|reward| reward.head > 0 && reward.target > 0 && reward.source > 0)
|
||||
);
|
||||
|
||||
// apply attestation, proposal, and sync committee rewards and penalties to initial balances
|
||||
apply_attestation_rewards(&mut expected_balances, total_rewards);
|
||||
@@ -688,9 +696,11 @@ async fn test_rewards_electra() {
|
||||
ideal_rewards.len() as u64,
|
||||
spec.max_effective_balance_electra / spec.effective_balance_increment
|
||||
);
|
||||
assert!(ideal_rewards
|
||||
.iter()
|
||||
.all(|reward| reward.head > 0 && reward.target > 0 && reward.source > 0));
|
||||
assert!(
|
||||
ideal_rewards
|
||||
.iter()
|
||||
.all(|reward| reward.head > 0 && reward.target > 0 && reward.source > 0)
|
||||
);
|
||||
|
||||
// apply attestation, proposal, and sync committee rewards and penalties to initial balances
|
||||
apply_attestation_rewards(&mut expected_balances, total_rewards);
|
||||
@@ -776,9 +786,11 @@ async fn check_all_electra_rewards(
|
||||
harness.spec.max_effective_balance_electra / harness.spec.effective_balance_increment
|
||||
);
|
||||
|
||||
assert!(ideal_rewards
|
||||
.iter()
|
||||
.all(|reward| reward.head > 0 && reward.target > 0 && reward.source > 0));
|
||||
assert!(
|
||||
ideal_rewards
|
||||
.iter()
|
||||
.all(|reward| reward.head > 0 && reward.target > 0 && reward.source > 0)
|
||||
);
|
||||
|
||||
// apply attestation, proposal, and sync committee rewards and penalties to initial balances
|
||||
apply_attestation_rewards(&mut balances, total_rewards);
|
||||
|
||||
Reference in New Issue
Block a user