Use E for EthSpec globally (#5264)

* Use `E` for `EthSpec` globally

* Fix tests

* Merge branch 'unstable' into e-ethspec

* Merge branch 'unstable' into e-ethspec

# Conflicts:
#	beacon_node/execution_layer/src/engine_api.rs
#	beacon_node/execution_layer/src/engine_api/http.rs
#	beacon_node/execution_layer/src/engine_api/json_structures.rs
#	beacon_node/execution_layer/src/test_utils/handle_rpc.rs
#	beacon_node/store/src/partial_beacon_state.rs
#	consensus/types/src/beacon_block.rs
#	consensus/types/src/beacon_block_body.rs
#	consensus/types/src/beacon_state.rs
#	consensus/types/src/config_and_preset.rs
#	consensus/types/src/execution_payload.rs
#	consensus/types/src/execution_payload_header.rs
#	consensus/types/src/light_client_optimistic_update.rs
#	consensus/types/src/payload.rs
#	lcli/src/parse_ssz.rs
This commit is contained in:
Mac L
2024-04-03 02:12:25 +11:00
committed by GitHub
parent f8fdb71f50
commit 969d12dc6f
230 changed files with 2743 additions and 2792 deletions

View File

@@ -8,11 +8,11 @@ use crate::per_block_processing::errors::{BlockProcessingError, IntoWithIndex};
use crate::VerifySignatures;
use types::consts::altair::{PARTICIPATION_FLAG_WEIGHTS, PROPOSER_WEIGHT, WEIGHT_DENOMINATOR};
pub fn process_operations<T: EthSpec, Payload: AbstractExecPayload<T>>(
state: &mut BeaconState<T>,
block_body: BeaconBlockBodyRef<T, Payload>,
pub fn process_operations<E: EthSpec, Payload: AbstractExecPayload<E>>(
state: &mut BeaconState<E>,
block_body: BeaconBlockBodyRef<E, Payload>,
verify_signatures: VerifySignatures,
ctxt: &mut ConsensusContext<T>,
ctxt: &mut ConsensusContext<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
process_proposer_slashings(
@@ -47,11 +47,11 @@ pub mod base {
///
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
pub fn process_attestations<T: EthSpec>(
state: &mut BeaconState<T>,
attestations: &[Attestation<T>],
pub fn process_attestations<E: EthSpec>(
state: &mut BeaconState<E>,
attestations: &[Attestation<E>],
verify_signatures: VerifySignatures,
ctxt: &mut ConsensusContext<T>,
ctxt: &mut ConsensusContext<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
// Ensure the previous epoch cache exists.
@@ -99,11 +99,11 @@ pub mod altair_deneb {
use crate::common::update_progressive_balances_cache::update_progressive_balances_on_attestation;
use types::consts::altair::TIMELY_TARGET_FLAG_INDEX;
pub fn process_attestations<T: EthSpec>(
state: &mut BeaconState<T>,
attestations: &[Attestation<T>],
pub fn process_attestations<E: EthSpec>(
state: &mut BeaconState<E>,
attestations: &[Attestation<E>],
verify_signatures: VerifySignatures,
ctxt: &mut ConsensusContext<T>,
ctxt: &mut ConsensusContext<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
attestations
@@ -114,11 +114,11 @@ pub mod altair_deneb {
})
}
pub fn process_attestation<T: EthSpec>(
state: &mut BeaconState<T>,
attestation: &Attestation<T>,
pub fn process_attestation<E: EthSpec>(
state: &mut BeaconState<E>,
attestation: &Attestation<E>,
att_index: usize,
ctxt: &mut ConsensusContext<T>,
ctxt: &mut ConsensusContext<E>,
verify_signatures: VerifySignatures,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
@@ -190,11 +190,11 @@ pub mod altair_deneb {
///
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
pub fn process_proposer_slashings<T: EthSpec>(
state: &mut BeaconState<T>,
pub fn process_proposer_slashings<E: EthSpec>(
state: &mut BeaconState<E>,
proposer_slashings: &[ProposerSlashing],
verify_signatures: VerifySignatures,
ctxt: &mut ConsensusContext<T>,
ctxt: &mut ConsensusContext<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
// Verify and apply proposer slashings in series.
@@ -223,11 +223,11 @@ pub fn process_proposer_slashings<T: EthSpec>(
///
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
pub fn process_attester_slashings<T: EthSpec>(
state: &mut BeaconState<T>,
attester_slashings: &[AttesterSlashing<T>],
pub fn process_attester_slashings<E: EthSpec>(
state: &mut BeaconState<E>,
attester_slashings: &[AttesterSlashing<E>],
verify_signatures: VerifySignatures,
ctxt: &mut ConsensusContext<T>,
ctxt: &mut ConsensusContext<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
for (i, attester_slashing) in attester_slashings.iter().enumerate() {
@@ -245,11 +245,11 @@ pub fn process_attester_slashings<T: EthSpec>(
/// Wrapper function to handle calling the correct version of `process_attestations` based on
/// the fork.
pub fn process_attestations<T: EthSpec, Payload: AbstractExecPayload<T>>(
state: &mut BeaconState<T>,
block_body: BeaconBlockBodyRef<T, Payload>,
pub fn process_attestations<E: EthSpec, Payload: AbstractExecPayload<E>>(
state: &mut BeaconState<E>,
block_body: BeaconBlockBodyRef<E, Payload>,
verify_signatures: VerifySignatures,
ctxt: &mut ConsensusContext<T>,
ctxt: &mut ConsensusContext<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
match block_body {
@@ -283,8 +283,8 @@ pub fn process_attestations<T: EthSpec, Payload: AbstractExecPayload<T>>(
///
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
pub fn process_exits<T: EthSpec>(
state: &mut BeaconState<T>,
pub fn process_exits<E: EthSpec>(
state: &mut BeaconState<E>,
voluntary_exits: &[SignedVoluntaryExit],
verify_signatures: VerifySignatures,
spec: &ChainSpec,
@@ -304,8 +304,8 @@ pub fn process_exits<T: EthSpec>(
///
/// Returns `Ok(())` if the validation and state updates completed successfully. Otherwise returns
/// an `Err` describing the invalid object or cause of failure.
pub fn process_bls_to_execution_changes<T: EthSpec>(
state: &mut BeaconState<T>,
pub fn process_bls_to_execution_changes<E: EthSpec>(
state: &mut BeaconState<E>,
bls_to_execution_changes: &[SignedBlsToExecutionChange],
verify_signatures: VerifySignatures,
spec: &ChainSpec,
@@ -329,13 +329,13 @@ pub fn process_bls_to_execution_changes<T: EthSpec>(
///
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
/// an `Err` describing the invalid object or cause of failure.
pub fn process_deposits<T: EthSpec>(
state: &mut BeaconState<T>,
pub fn process_deposits<E: EthSpec>(
state: &mut BeaconState<E>,
deposits: &[Deposit],
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
let expected_deposit_len = std::cmp::min(
T::MaxDeposits::to_u64(),
E::MaxDeposits::to_u64(),
state.get_outstanding_deposit_len()?,
);
block_verify!(
@@ -369,8 +369,8 @@ pub fn process_deposits<T: EthSpec>(
}
/// Process a single deposit, optionally verifying its merkle proof.
pub fn process_deposit<T: EthSpec>(
state: &mut BeaconState<T>,
pub fn process_deposit<E: EthSpec>(
state: &mut BeaconState<E>,
deposit: &Deposit,
spec: &ChainSpec,
verify_merkle_proof: bool,