Update Rust Edition to 2024 (#7766)

* #7749

Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
chonghe
2025-08-13 11:04:31 +08:00
committed by GitHub
parent bd6b8b6a65
commit 522bd9e9c6
468 changed files with 3594 additions and 3396 deletions

View File

@@ -6,9 +6,9 @@ use state_processing::common::{
};
use std::collections::HashMap;
use types::{
Attestation, BeaconState, BitList, ChainSpec, EthSpec,
beacon_state::BeaconStateBase,
consts::altair::{PARTICIPATION_FLAG_WEIGHTS, PROPOSER_WEIGHT, WEIGHT_DENOMINATOR},
Attestation, BeaconState, BitList, ChainSpec, EthSpec,
};
pub const PROPOSER_REWARD_DENOMINATOR: u64 =
@@ -30,7 +30,7 @@ impl<'a, E: EthSpec> AttMaxCover<'a, E> {
total_active_balance: u64,
spec: &ChainSpec,
) -> Option<Self> {
if let BeaconState::Base(ref base_state) = state {
if let BeaconState::Base(base_state) = state {
Self::new_for_base(att, state, base_state, total_active_balance, spec)
} else {
Self::new_for_altair_or_later(att, state, reward_cache, spec)

View File

@@ -2,9 +2,10 @@ use crate::AttestationStats;
use itertools::Itertools;
use std::collections::{BTreeMap, HashMap, HashSet};
use types::{
AggregateSignature, Attestation, AttestationData, BeaconState, BitList, BitVector, Checkpoint,
Epoch, EthSpec, Hash256, Slot, Unsigned,
attestation::{AttestationBase, AttestationElectra},
superstruct, AggregateSignature, Attestation, AttestationData, BeaconState, BitList, BitVector,
Checkpoint, Epoch, EthSpec, Hash256, Slot, Unsigned,
superstruct,
};
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]

View File

@@ -1,5 +1,5 @@
use state_processing::SigVerifiedOp;
use std::collections::{hash_map::Entry, HashMap, HashSet};
use std::collections::{HashMap, HashSet, hash_map::Entry};
use std::sync::Arc;
use types::{
AbstractExecPayload, BeaconState, ChainSpec, EthSpec, SignedBeaconBlock,

View File

@@ -9,7 +9,7 @@ mod reward_cache;
mod sync_aggregate_id;
pub use crate::bls_to_execution_changes::ReceivedPreCapella;
pub use attestation::{earliest_attestation_validators, AttMaxCover, PROPOSER_REWARD_DENOMINATOR};
pub use attestation::{AttMaxCover, PROPOSER_REWARD_DENOMINATOR, earliest_attestation_validators};
pub use attestation_storage::{CompactAttestationRef, SplitAttestation};
pub use max_cover::MaxCover;
pub use persistence::{
@@ -25,21 +25,22 @@ use crate::sync_aggregate_id::SyncAggregateId;
use attester_slashing::AttesterSlashingMaxCover;
use max_cover::maximum_cover;
use parking_lot::{RwLock, RwLockWriteGuard};
use rand::rng;
use rand::seq::SliceRandom;
use rand::thread_rng;
use state_processing::per_block_processing::errors::AttestationValidationError;
use state_processing::per_block_processing::{
get_slashable_indices_modular, verify_exit, VerifySignatures,
VerifySignatures, get_slashable_indices_modular, verify_exit,
};
use state_processing::{SigVerifiedOp, VerifyOperation};
use std::collections::{hash_map::Entry, HashMap, HashSet};
use std::collections::{HashMap, HashSet, hash_map::Entry};
use std::marker::PhantomData;
use std::ptr;
use types::{
sync_aggregate::Error as SyncAggregateError, typenum::Unsigned, AbstractExecPayload,
Attestation, AttestationData, AttesterSlashing, BeaconState, BeaconStateError, ChainSpec,
Epoch, EthSpec, ProposerSlashing, SignedBeaconBlock, SignedBlsToExecutionChange,
SignedVoluntaryExit, Slot, SyncAggregate, SyncCommitteeContribution, Validator,
AbstractExecPayload, Attestation, AttestationData, AttesterSlashing, BeaconState,
BeaconStateError, ChainSpec, Epoch, EthSpec, ProposerSlashing, SignedBeaconBlock,
SignedBlsToExecutionChange, SignedVoluntaryExit, Slot, SyncAggregate,
SyncCommitteeContribution, Validator, sync_aggregate::Error as SyncAggregateError,
typenum::Unsigned,
};
type SyncContributions<E> = RwLock<HashMap<SyncAggregateId, Vec<SyncCommitteeContribution<E>>>>;
@@ -612,7 +613,7 @@ impl<E: EthSpec> OperationPool<E> {
|address_change| address_change.as_inner().clone(),
usize::MAX,
);
changes.shuffle(&mut thread_rng());
changes.shuffle(&mut rng());
changes
}
@@ -790,11 +791,11 @@ mod release_tests {
use super::attestation::earliest_attestation_validators;
use super::*;
use beacon_chain::test_utils::{
test_spec, BeaconChainHarness, EphemeralHarnessType, RelativeSyncCommittee,
BeaconChainHarness, EphemeralHarnessType, RelativeSyncCommittee, test_spec,
};
use maplit::hashset;
use state_processing::epoch_cache::initialize_epoch_cache;
use state_processing::{common::get_attesting_indices_from_state, VerifyOperation};
use state_processing::{VerifyOperation, common::get_attesting_indices_from_state};
use std::collections::BTreeSet;
use std::sync::{Arc, LazyLock};
use types::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT;

View File

@@ -1,8 +1,8 @@
use crate::OpPoolError;
use crate::OperationPool;
use crate::attestation_storage::AttestationMap;
use crate::bls_to_execution_changes::{BlsToExecutionChanges, ReceivedPreCapella};
use crate::sync_aggregate_id::SyncAggregateId;
use crate::OpPoolError;
use crate::OperationPool;
use derivative::Derivative;
use parking_lot::RwLock;
use ssz::{Decode, Encode};