Skip to content

Commit 7812bdc

Browse files
envestccCopilot
andauthored
doc: add comment explaining historical epoch height calculation bug (#4785)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f0a399b commit 7812bdc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

action/protocol/poll/slasher.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,9 @@ func (sh *Slasher) GetProbationList(ctx context.Context, sr protocol.StateReader
363363
if err != nil {
364364
return nil, uint64(0), err
365365
}
366-
// make sure it's epochStartHeight
366+
// NOTE: GetEpochHeight(GetEpochHeight(targetHeight)) is a historical bug that should have been
367+
// GetEpochHeight(GetEpochNum(targetHeight)). It is kept as-is to ensure historical blocks can
368+
// pass validation. This does not affect current blocks since the input is already epochStartHeight.
367369
targetEpochStartHeight := rp.GetEpochHeight(rp.GetEpochHeight(targetHeight))
368370
if readFromNext {
369371
targetEpochNum := rp.GetEpochNum(targetEpochStartHeight) + 1

0 commit comments

Comments
 (0)