mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-14 21:50:52 +00:00
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:
@@ -68,19 +68,19 @@ impl Default for BeaconProposerCache {
|
||||
impl BeaconProposerCache {
|
||||
/// If it is cached, returns the proposer for the block at `slot` where the block has the
|
||||
/// ancestor block root of `shuffling_decision_block` at `end_slot(slot.epoch() - 1)`.
|
||||
pub fn get_slot<T: EthSpec>(
|
||||
pub fn get_slot<E: EthSpec>(
|
||||
&mut self,
|
||||
shuffling_decision_block: Hash256,
|
||||
slot: Slot,
|
||||
) -> Option<Proposer> {
|
||||
let epoch = slot.epoch(T::slots_per_epoch());
|
||||
let epoch = slot.epoch(E::slots_per_epoch());
|
||||
let key = (epoch, shuffling_decision_block);
|
||||
if let Some(cache) = self.cache.get(&key) {
|
||||
// This `if` statement is likely unnecessary, but it feels like good practice.
|
||||
if epoch == cache.epoch {
|
||||
cache
|
||||
.proposers
|
||||
.get(slot.as_usize() % T::SlotsPerEpoch::to_usize())
|
||||
.get(slot.as_usize() % E::SlotsPerEpoch::to_usize())
|
||||
.map(|&index| Proposer {
|
||||
index,
|
||||
fork: cache.fork,
|
||||
@@ -98,7 +98,7 @@ impl BeaconProposerCache {
|
||||
/// The nth slot in the returned `SmallVec` will be equal to the nth slot in the given `epoch`.
|
||||
/// E.g., if `epoch == 1` then `smallvec[0]` refers to slot 32 (assuming `SLOTS_PER_EPOCH ==
|
||||
/// 32`).
|
||||
pub fn get_epoch<T: EthSpec>(
|
||||
pub fn get_epoch<E: EthSpec>(
|
||||
&mut self,
|
||||
shuffling_decision_block: Hash256,
|
||||
epoch: Epoch,
|
||||
|
||||
Reference in New Issue
Block a user