mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 10:52:43 +00:00
Do project-wide s/epoch_length/slots_per_epoch/g
This commit is contained in:
@@ -185,7 +185,7 @@ fn per_block_processing_signature_optional(
|
||||
proposer_slashing
|
||||
.proposal_data_1
|
||||
.slot
|
||||
.epoch(spec.epoch_length),
|
||||
.epoch(spec.slots_per_epoch),
|
||||
spec.domain_proposal
|
||||
)
|
||||
),
|
||||
@@ -201,7 +201,7 @@ fn per_block_processing_signature_optional(
|
||||
proposer_slashing
|
||||
.proposal_data_2
|
||||
.slot
|
||||
.epoch(spec.epoch_length),
|
||||
.epoch(spec.slots_per_epoch),
|
||||
spec.domain_proposal
|
||||
)
|
||||
),
|
||||
@@ -341,14 +341,14 @@ fn validate_attestation_signature_optional(
|
||||
) -> Result<(), AttestationValidationError> {
|
||||
trace!(
|
||||
"validate_attestation_signature_optional: attestation epoch: {}",
|
||||
attestation.data.slot.epoch(spec.epoch_length)
|
||||
attestation.data.slot.epoch(spec.slots_per_epoch)
|
||||
);
|
||||
ensure!(
|
||||
attestation.data.slot + spec.min_attestation_inclusion_delay <= state.slot,
|
||||
AttestationValidationError::IncludedTooEarly
|
||||
);
|
||||
ensure!(
|
||||
attestation.data.slot + spec.epoch_length >= state.slot,
|
||||
attestation.data.slot + spec.slots_per_epoch >= state.slot,
|
||||
AttestationValidationError::IncludedTooLate
|
||||
);
|
||||
if attestation.data.slot >= state.current_epoch_start_slot(spec) {
|
||||
@@ -369,7 +369,7 @@ fn validate_attestation_signature_optional(
|
||||
attestation
|
||||
.data
|
||||
.justified_epoch
|
||||
.start_slot(spec.epoch_length),
|
||||
.start_slot(spec.slots_per_epoch),
|
||||
&spec
|
||||
)
|
||||
.ok_or(AttestationValidationError::NoBlockRoot)?,
|
||||
@@ -377,7 +377,7 @@ fn validate_attestation_signature_optional(
|
||||
);
|
||||
let potential_crosslink = Crosslink {
|
||||
shard_block_root: attestation.data.shard_block_root,
|
||||
epoch: attestation.data.slot.epoch(spec.epoch_length),
|
||||
epoch: attestation.data.slot.epoch(spec.slots_per_epoch),
|
||||
};
|
||||
ensure!(
|
||||
(attestation.data.latest_crosslink
|
||||
@@ -407,7 +407,7 @@ fn validate_attestation_signature_optional(
|
||||
PHASE_0_CUSTODY_BIT,
|
||||
get_domain(
|
||||
&state.fork,
|
||||
attestation.data.slot.epoch(spec.epoch_length),
|
||||
attestation.data.slot.epoch(spec.slots_per_epoch),
|
||||
spec.domain_attestation,
|
||||
)
|
||||
),
|
||||
|
||||
@@ -76,7 +76,7 @@ impl EpochProcessable for BeaconState {
|
||||
*/
|
||||
let active_validator_indices = get_active_validator_indices(
|
||||
&self.validator_registry,
|
||||
self.slot.epoch(spec.epoch_length),
|
||||
self.slot.epoch(spec.slots_per_epoch),
|
||||
);
|
||||
let current_total_balance = self.get_total_balance(&active_validator_indices[..], spec);
|
||||
|
||||
@@ -90,7 +90,7 @@ impl EpochProcessable for BeaconState {
|
||||
.latest_attestations
|
||||
.par_iter()
|
||||
.filter(|a| {
|
||||
(a.data.slot / spec.epoch_length).epoch(spec.epoch_length)
|
||||
(a.data.slot / spec.slots_per_epoch).epoch(spec.slots_per_epoch)
|
||||
== self.current_epoch(spec)
|
||||
})
|
||||
.collect();
|
||||
@@ -137,7 +137,7 @@ impl EpochProcessable for BeaconState {
|
||||
.par_iter()
|
||||
.filter(|a| {
|
||||
//TODO: ensure these saturating subs are correct.
|
||||
(a.data.slot / spec.epoch_length).epoch(spec.epoch_length)
|
||||
(a.data.slot / spec.slots_per_epoch).epoch(spec.slots_per_epoch)
|
||||
== self.previous_epoch(spec)
|
||||
})
|
||||
.collect();
|
||||
@@ -320,12 +320,12 @@ impl EpochProcessable for BeaconState {
|
||||
let mut winning_root_for_shards: HashMap<u64, Result<WinningRoot, WinningRootError>> =
|
||||
HashMap::new();
|
||||
|
||||
// for slot in self.slot.saturating_sub(2 * spec.epoch_length)..self.slot {
|
||||
for slot in self.previous_epoch(spec).slot_iter(spec.epoch_length) {
|
||||
// for slot in self.slot.saturating_sub(2 * spec.slots_per_epoch)..self.slot {
|
||||
for slot in self.previous_epoch(spec).slot_iter(spec.slots_per_epoch) {
|
||||
trace!(
|
||||
"Finding winning root for slot: {} (epoch: {})",
|
||||
slot,
|
||||
slot.epoch(spec.epoch_length)
|
||||
slot.epoch(spec.slots_per_epoch)
|
||||
);
|
||||
|
||||
// Clone is used to remove the borrow. It becomes an issue later when trying to mutate
|
||||
@@ -506,7 +506,7 @@ impl EpochProcessable for BeaconState {
|
||||
/*
|
||||
* Crosslinks
|
||||
*/
|
||||
for slot in self.previous_epoch(spec).slot_iter(spec.epoch_length) {
|
||||
for slot in self.previous_epoch(spec).slot_iter(spec.slots_per_epoch) {
|
||||
// Clone is used to remove the borrow. It becomes an issue later when trying to mutate
|
||||
// `self.balances`.
|
||||
let crosslink_committees_at_slot =
|
||||
@@ -615,7 +615,7 @@ impl EpochProcessable for BeaconState {
|
||||
self.latest_attestations = self
|
||||
.latest_attestations
|
||||
.iter()
|
||||
.filter(|a| a.data.slot.epoch(spec.epoch_length) >= current_epoch)
|
||||
.filter(|a| a.data.slot.epoch(spec.slots_per_epoch) >= current_epoch)
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ where
|
||||
previous_block_root: Hash256,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
if (self.slot + 1) % spec.epoch_length == 0 {
|
||||
if (self.slot + 1) % spec.slots_per_epoch == 0 {
|
||||
self.per_epoch_processing(spec)?;
|
||||
self.advance_caches();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user