@@ -84,7 +84,7 @@ pub struct CommitteeLengths {
84
84
85
85
impl CommitteeLengths {
86
86
/// Instantiate `Self` using `state.current_epoch()`.
87
- pub fn new < T : EthSpec > ( state : & BeaconState < T > , spec : & ChainSpec ) -> Result < Self , Error > {
87
+ pub fn new < E : EthSpec > ( state : & BeaconState < E > , spec : & ChainSpec ) -> Result < Self , Error > {
88
88
let active_validator_indices_len = if let Ok ( committee_cache) =
89
89
state. committee_cache ( RelativeEpoch :: Current )
90
90
{
@@ -102,21 +102,21 @@ impl CommitteeLengths {
102
102
}
103
103
104
104
/// Get the count of committees per each slot of `self.epoch`.
105
- pub fn get_committee_count_per_slot < T : EthSpec > (
105
+ pub fn get_committee_count_per_slot < E : EthSpec > (
106
106
& self ,
107
107
spec : & ChainSpec ,
108
108
) -> Result < usize , Error > {
109
- T :: get_committee_count_per_slot ( self . active_validator_indices_len , spec) . map_err ( Into :: into)
109
+ E :: get_committee_count_per_slot ( self . active_validator_indices_len , spec) . map_err ( Into :: into)
110
110
}
111
111
112
112
/// Get the length of the committee at the given `slot` and `committee_index`.
113
- pub fn get_committee_length < T : EthSpec > (
113
+ pub fn get_committee_length < E : EthSpec > (
114
114
& self ,
115
115
slot : Slot ,
116
116
committee_index : CommitteeIndex ,
117
117
spec : & ChainSpec ,
118
118
) -> Result < CommitteeLength , Error > {
119
- let slots_per_epoch = T :: slots_per_epoch ( ) ;
119
+ let slots_per_epoch = E :: slots_per_epoch ( ) ;
120
120
let request_epoch = slot. epoch ( slots_per_epoch) ;
121
121
122
122
// Sanity check.
@@ -128,7 +128,7 @@ impl CommitteeLengths {
128
128
}
129
129
130
130
let slots_per_epoch = slots_per_epoch as usize ;
131
- let committees_per_slot = self . get_committee_count_per_slot :: < T > ( spec) ?;
131
+ let committees_per_slot = self . get_committee_count_per_slot :: < E > ( spec) ?;
132
132
let index_in_epoch = compute_committee_index_in_epoch (
133
133
slot,
134
134
slots_per_epoch,
@@ -162,7 +162,7 @@ pub struct AttesterCacheValue {
162
162
163
163
impl AttesterCacheValue {
164
164
/// Instantiate `Self` using `state.current_epoch()`.
165
- pub fn new < T : EthSpec > ( state : & BeaconState < T > , spec : & ChainSpec ) -> Result < Self , Error > {
165
+ pub fn new < E : EthSpec > ( state : & BeaconState < E > , spec : & ChainSpec ) -> Result < Self , Error > {
166
166
let current_justified_checkpoint = state. current_justified_checkpoint ( ) ;
167
167
let committee_lengths = CommitteeLengths :: new ( state, spec) ?;
168
168
Ok ( Self {
@@ -172,14 +172,14 @@ impl AttesterCacheValue {
172
172
}
173
173
174
174
/// Get the justified checkpoint and committee length for some `slot` and `committee_index`.
175
- fn get < T : EthSpec > (
175
+ fn get < E : EthSpec > (
176
176
& self ,
177
177
slot : Slot ,
178
178
committee_index : CommitteeIndex ,
179
179
spec : & ChainSpec ,
180
180
) -> Result < ( JustifiedCheckpoint , CommitteeLength ) , Error > {
181
181
self . committee_lengths
182
- . get_committee_length :: < T > ( slot, committee_index, spec)
182
+ . get_committee_length :: < E > ( slot, committee_index, spec)
183
183
. map ( |committee_length| ( self . current_justified_checkpoint , committee_length) )
184
184
}
185
185
}
@@ -216,12 +216,12 @@ impl AttesterCacheKey {
216
216
/// ## Errors
217
217
///
218
218
/// May error if `epoch` is out of the range of `state.block_roots`.
219
- pub fn new < T : EthSpec > (
219
+ pub fn new < E : EthSpec > (
220
220
epoch : Epoch ,
221
- state : & BeaconState < T > ,
221
+ state : & BeaconState < E > ,
222
222
latest_block_root : Hash256 ,
223
223
) -> Result < Self , Error > {
224
- let slots_per_epoch = T :: slots_per_epoch ( ) ;
224
+ let slots_per_epoch = E :: slots_per_epoch ( ) ;
225
225
let decision_slot = epoch. start_slot ( slots_per_epoch) . saturating_sub ( 1_u64 ) ;
226
226
227
227
let decision_root = if decision_slot. epoch ( slots_per_epoch) == epoch {
@@ -255,7 +255,7 @@ pub struct AttesterCache {
255
255
impl AttesterCache {
256
256
/// Get the justified checkpoint and committee length for the `slot` and `committee_index` in
257
257
/// the state identified by the cache `key`.
258
- pub fn get < T : EthSpec > (
258
+ pub fn get < E : EthSpec > (
259
259
& self ,
260
260
key : & AttesterCacheKey ,
261
261
slot : Slot ,
@@ -265,14 +265,14 @@ impl AttesterCache {
265
265
self . cache
266
266
. read ( )
267
267
. get ( key)
268
- . map ( |cache_item| cache_item. get :: < T > ( slot, committee_index, spec) )
268
+ . map ( |cache_item| cache_item. get :: < E > ( slot, committee_index, spec) )
269
269
. transpose ( )
270
270
}
271
271
272
272
/// Cache the `state.current_epoch()` values if they are not already present in the state.
273
- pub fn maybe_cache_state < T : EthSpec > (
273
+ pub fn maybe_cache_state < E : EthSpec > (
274
274
& self ,
275
- state : & BeaconState < T > ,
275
+ state : & BeaconState < E > ,
276
276
latest_block_root : Hash256 ,
277
277
spec : & ChainSpec ,
278
278
) -> Result < ( ) , Error > {
0 commit comments