Skip to content

Commit 211698a

Browse files
authored
fix new_deadline_info_from_offset_and_epoch (#1321)
* fix new_deadline_info_from_offset_and_epoch * remove useless `% policy.wpost_period_deadlines` * add comment to wpost_challenge_window
1 parent f414380 commit 211698a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

actors/miner/src/deadlines.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ pub fn new_deadline_info_from_offset_and_epoch(
138138
) -> DeadlineInfo {
139139
let q = QuantSpec { unit: policy.wpost_proving_period, offset: period_start_seed };
140140
let current_period_start = q.quantize_down(current_epoch);
141-
let current_deadline_idx = ((current_epoch - current_period_start)
142-
/ policy.wpost_challenge_window) as u64
143-
% policy.wpost_period_deadlines;
141+
let current_deadline_idx =
142+
((current_epoch - current_period_start) / policy.wpost_challenge_window) as u64;
144143
new_deadline_info(policy, current_period_start, current_deadline_idx, current_epoch)
145144
}

runtime/src/runtime/policy.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub struct Policy {
3434
/// The period over which all a miner's active sectors will be challenged.
3535
pub wpost_proving_period: ChainEpoch,
3636
/// The duration of a deadline's challenge window, the period before a deadline when the challenge is available.
37+
/// Notice that the challenge window is assumed to have the same duration as a deadline itself both in FIP and implementation.
3738
pub wpost_challenge_window: ChainEpoch,
3839
/// The number of non-overlapping PoSt deadlines in each proving period.
3940
pub wpost_period_deadlines: u64,

0 commit comments

Comments
 (0)