From 5d91f91ed60c857f2042d5a33a9033bc5d79f146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20G=C3=B3mez=20Morales?= Date: Fri, 20 Sep 2024 19:07:02 +0200 Subject: [PATCH 1/7] Update recover_task.go --- tasks/window/recover_task.go | 69 +++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/tasks/window/recover_task.go b/tasks/window/recover_task.go index 07997bf13..c82f197d2 100644 --- a/tasks/window/recover_task.go +++ b/tasks/window/recover_task.go @@ -266,45 +266,48 @@ func (w *WdPostRecoverDeclareTask) processHeadChange(ctx context.Context, revert return nil // not proving anything yet } - // declaring two deadlines ahead - declDeadline := (di.Index + 2) % di.WPoStPeriodDeadlines - - pps := di.PeriodStart - if declDeadline != di.Index+2 { - pps = di.NextPeriodStart() - } - - partitions, err := w.api.StateMinerPartitions(ctx, maddr, declDeadline, apply.Key()) - if err != nil { - return xerrors.Errorf("getting partitions: %w", err) - } - - for pidx, partition := range partitions { - unrecovered, err := bitfield.SubtractBitField(partition.FaultySectors, partition.RecoveringSectors) - if err != nil { - return xerrors.Errorf("subtracting recovered set from fault set: %w", err) + // repeat checks for [2, 4, 6, 8, 10, 12], the closer deadline is prioritized + for i := 0; i < 7; i++ { + // declaring 2*i deadlines ahead + declDeadline := (di.Index + 2*i) % di.WPoStPeriodDeadlines + + pps := di.PeriodStart + if declDeadline != di.Index+2*i { + pps = di.NextPeriodStart() } - uc, err := unrecovered.Count() + partitions, err := w.api.StateMinerPartitions(ctx, maddr, declDeadline, apply.Key()) if err != nil { - return xerrors.Errorf("counting unrecovered sectors: %w", err) + return xerrors.Errorf("getting partitions: %w", err) } - if uc == 0 { - log.Debugw("WdPostRecoverDeclareTask.processHeadChange() uc == 0, skipping", "maddr", maddr, "declDeadline", declDeadline, "pidx", pidx) - continue + for pidx, partition := range partitions { + unrecovered, err := bitfield.SubtractBitField(partition.FaultySectors, partition.RecoveringSectors) + if err != nil { + return xerrors.Errorf("subtracting recovered set from fault set: %w", err) + } + + uc, err := unrecovered.Count() + if err != nil { + return xerrors.Errorf("counting unrecovered sectors: %w", err) + } + + if uc == 0 { + log.Debugw("WdPostRecoverDeclareTask.processHeadChange() uc == 0, skipping", "maddr", maddr, "declDeadline", declDeadline, "pidx", pidx) + continue + } + + tid := wdTaskIdentity{ + SpID: aid, + ProvingPeriodStart: pps, + DeadlineIndex: declDeadline, + PartitionIndex: uint64(pidx), + } + + tf(func(id harmonytask.TaskID, tx *harmonydb.Tx) (bool, error) { + return w.addTaskToDB(id, tid, tx) + }) } - - tid := wdTaskIdentity{ - SpID: aid, - ProvingPeriodStart: pps, - DeadlineIndex: declDeadline, - PartitionIndex: uint64(pidx), - } - - tf(func(id harmonytask.TaskID, tx *harmonydb.Tx) (bool, error) { - return w.addTaskToDB(id, tid, tx) - }) } } From f89b7a63561dcd7ac03bba968e6208d48768a844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20G=C3=B3mez=20Morales?= Date: Fri, 20 Sep 2024 19:14:21 +0200 Subject: [PATCH 2/7] Update recover_task.go --- tasks/window/recover_task.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/window/recover_task.go b/tasks/window/recover_task.go index c82f197d2..10fab9896 100644 --- a/tasks/window/recover_task.go +++ b/tasks/window/recover_task.go @@ -267,12 +267,12 @@ func (w *WdPostRecoverDeclareTask) processHeadChange(ctx context.Context, revert } // repeat checks for [2, 4, 6, 8, 10, 12], the closer deadline is prioritized - for i := 0; i < 7; i++ { + for uint64 i := 0; i < 7; i++ { // declaring 2*i deadlines ahead - declDeadline := (di.Index + 2*i) % di.WPoStPeriodDeadlines + declDeadline := (di.Index + int64(2*i)) % di.WPoStPeriodDeadlines pps := di.PeriodStart - if declDeadline != di.Index+2*i { + if declDeadline != di.Index + int64(2*i) { pps = di.NextPeriodStart() } From d32d96920eed7edc2fa6d8ec5e0deb3f26030bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20G=C3=B3mez=20Morales?= Date: Fri, 20 Sep 2024 19:16:29 +0200 Subject: [PATCH 3/7] Update recover_task.go --- tasks/window/recover_task.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/window/recover_task.go b/tasks/window/recover_task.go index 10fab9896..3d65293f0 100644 --- a/tasks/window/recover_task.go +++ b/tasks/window/recover_task.go @@ -267,7 +267,7 @@ func (w *WdPostRecoverDeclareTask) processHeadChange(ctx context.Context, revert } // repeat checks for [2, 4, 6, 8, 10, 12], the closer deadline is prioritized - for uint64 i := 0; i < 7; i++ { + for i := 0; i < 7; i++ { // declaring 2*i deadlines ahead declDeadline := (di.Index + int64(2*i)) % di.WPoStPeriodDeadlines From 57c6ce06093e9cd165360409aefa95005bf86755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20G=C3=B3mez=20Morales?= Date: Fri, 20 Sep 2024 19:19:01 +0200 Subject: [PATCH 4/7] Update recover_task.go --- tasks/window/recover_task.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/window/recover_task.go b/tasks/window/recover_task.go index 3d65293f0..0754d8014 100644 --- a/tasks/window/recover_task.go +++ b/tasks/window/recover_task.go @@ -269,10 +269,10 @@ func (w *WdPostRecoverDeclareTask) processHeadChange(ctx context.Context, revert // repeat checks for [2, 4, 6, 8, 10, 12], the closer deadline is prioritized for i := 0; i < 7; i++ { // declaring 2*i deadlines ahead - declDeadline := (di.Index + int64(2*i)) % di.WPoStPeriodDeadlines + declDeadline := (di.Index + uint64(2*i)) % di.WPoStPeriodDeadlines pps := di.PeriodStart - if declDeadline != di.Index + int64(2*i) { + if declDeadline != di.Index + uint64(2*i) { pps = di.NextPeriodStart() } From 30d84b10c715c3340c9550b3eb6b4341b320bbac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20G=C3=B3mez=20Morales?= Date: Fri, 20 Sep 2024 19:35:50 +0200 Subject: [PATCH 5/7] Update recover_task.go --- tasks/window/recover_task.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/window/recover_task.go b/tasks/window/recover_task.go index 0754d8014..d58df9bf7 100644 --- a/tasks/window/recover_task.go +++ b/tasks/window/recover_task.go @@ -272,7 +272,7 @@ func (w *WdPostRecoverDeclareTask) processHeadChange(ctx context.Context, revert declDeadline := (di.Index + uint64(2*i)) % di.WPoStPeriodDeadlines pps := di.PeriodStart - if declDeadline != di.Index + uint64(2*i) { + if declDeadline != di.Index+uint64(2*i) { pps = di.NextPeriodStart() } From 6122c8f1aa0f224f6bc9916ed0588f5db94261f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20G=C3=B3mez=20Morales?= Date: Mon, 23 Sep 2024 14:02:09 +0200 Subject: [PATCH 6/7] Update recover_task.go --- tasks/window/recover_task.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/window/recover_task.go b/tasks/window/recover_task.go index d58df9bf7..e1664312e 100644 --- a/tasks/window/recover_task.go +++ b/tasks/window/recover_task.go @@ -267,7 +267,7 @@ func (w *WdPostRecoverDeclareTask) processHeadChange(ctx context.Context, revert } // repeat checks for [2, 4, 6, 8, 10, 12], the closer deadline is prioritized - for i := 0; i < 7; i++ { + for i := 1; i < 7; i++ { // declaring 2*i deadlines ahead declDeadline := (di.Index + uint64(2*i)) % di.WPoStPeriodDeadlines From 364435b522a68dca406cc5f42cd94ba47be91587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20G=C3=B3mez=20Morales?= Date: Wed, 25 Sep 2024 19:44:05 +0200 Subject: [PATCH 7/7] Update recover_task.go --- tasks/window/recover_task.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/window/recover_task.go b/tasks/window/recover_task.go index e1664312e..14c1a8469 100644 --- a/tasks/window/recover_task.go +++ b/tasks/window/recover_task.go @@ -266,8 +266,8 @@ func (w *WdPostRecoverDeclareTask) processHeadChange(ctx context.Context, revert return nil // not proving anything yet } - // repeat checks for [2, 4, 6, 8, 10, 12], the closer deadline is prioritized - for i := 1; i < 7; i++ { + // repeat checks for [2, 4, 6, 8, 10, 12, 14, 16, ... 38], the closer deadline is prioritized + for i := 1; i < 20; i++ { // declaring 2*i deadlines ahead declDeadline := (di.Index + uint64(2*i)) % di.WPoStPeriodDeadlines