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

@@ -6,9 +6,9 @@ use std::borrow::Cow;
use types::consts::altair::{PROPOSER_WEIGHT, SYNC_REWARD_WEIGHT, WEIGHT_DENOMINATOR};
use types::{BeaconState, ChainSpec, EthSpec, PublicKeyBytes, SyncAggregate, Unsigned};
pub fn process_sync_aggregate<T: EthSpec>(
state: &mut BeaconState<T>,
aggregate: &SyncAggregate<T>,
pub fn process_sync_aggregate<E: EthSpec>(
state: &mut BeaconState<E>,
aggregate: &SyncAggregate<E>,
proposer_index: u64,
verify_signatures: VerifySignatures,
spec: &ChainSpec,
@@ -65,8 +65,8 @@ pub fn process_sync_aggregate<T: EthSpec>(
/// Compute the `(participant_reward, proposer_reward)` for a sync aggregate.
///
/// The `state` should be the pre-state from the same slot as the block containing the aggregate.
pub fn compute_sync_aggregate_rewards<T: EthSpec>(
state: &BeaconState<T>,
pub fn compute_sync_aggregate_rewards<E: EthSpec>(
state: &BeaconState<E>,
spec: &ChainSpec,
) -> Result<(u64, u64), BlockProcessingError> {
let total_active_balance = state.get_total_active_balance()?;
@@ -78,8 +78,8 @@ pub fn compute_sync_aggregate_rewards<T: EthSpec>(
let max_participant_rewards = total_base_rewards
.safe_mul(SYNC_REWARD_WEIGHT)?
.safe_div(WEIGHT_DENOMINATOR)?
.safe_div(T::slots_per_epoch())?;
let participant_reward = max_participant_rewards.safe_div(T::SyncCommitteeSize::to_u64())?;
.safe_div(E::slots_per_epoch())?;
let participant_reward = max_participant_rewards.safe_div(E::SyncCommitteeSize::to_u64())?;
let proposer_reward = participant_reward
.safe_mul(PROPOSER_WEIGHT)?
.safe_div(WEIGHT_DENOMINATOR.safe_sub(PROPOSER_WEIGHT)?)?;