lints and non parallel

This commit is contained in:
Andrew Jackson (Ajax) committed 2023-11-14 22:58:43 -06:00
1 parent 7ec9eb0a70
commit 4b8aa53806
11 files changed
+56 -49

No files matched your search

+1 -1
View File
@@ -168,7 +168,7 @@ func (s *Sender) Send(ctx context.Context, msg *types.Message, mss *api.MessageS
return cid.Undef, xerrors.Errorf("updating db record: %w", err)
}
if cn != 1 {
return cid.Undef, xerrors.Errorf("updating db record: expected 1 row to be affected, got %d", c)
return cid.Undef, xerrors.Errorf("updating db record: expected 1 row to be affected, got %d", cn)
}
log.Infow("sent message", "cid", sigMsg.Cid(), "from", fromA, "to", msg.To, "nonce", msg.Nonce, "value", msg.Value, "gaslimit", msg.GasLimit)
+7 -6
View File
@@ -207,8 +207,9 @@ func (t *WdPostTask) DoPartition(ctx context.Context, ts *types.TipSet, maddr ad
time.Sleep(5 * time.Second)
continue todo retry loop */
} else if !correct {
_ = correct
/*log.Errorw("generated incorrect window post proof", "post", postOut, "error", err)
continue todo retry loop */
continue todo retry loop*/
}
// Proof generation successful, stop retrying
@@ -322,11 +323,11 @@ func (t *WdPostTask) sectorsForProof(ctx context.Context, maddr address.Address,
if err := allSectors.ForEach(func(sectorNo uint64) error {
if info, found := sectorByID[sectorNo]; found {
proofSectors = append(proofSectors, info)
} else {
//skip
// todo: testing: old logic used to put 'substitute' sectors here
// that probably isn't needed post nv19, but we do need to check that
}
} //else {
//skip
// todo: testing: old logic used to put 'substitute' sectors here
// that probably isn't needed post nv19, but we do need to check that
//}
return nil
}); err != nil {
return nil, xerrors.Errorf("iterating partition sector bitmap: %w", err)
+21 -21
View File
@@ -74,10 +74,10 @@ type WdPostTask struct {
}
type wdTaskIdentity struct {
Sp_id uint64
Proving_period_start abi.ChainEpoch
Deadline_index uint64
Partition_index uint64
SpID uint64
ProvingPeriodStart abi.ChainEpoch
DeadlineIndex uint64
PartitionIndex uint64
}
func NewWdPostTask(db *harmonydb.DB,
@@ -206,11 +206,11 @@ func (t *WdPostTask) CanAccept(ids []harmonytask.TaskID, te *harmonytask.TaskEng
// GetData for tasks
type wdTaskDef struct {
Task_id harmonytask.TaskID
Sp_id uint64
Proving_period_start abi.ChainEpoch
Deadline_index uint64
Partition_index uint64
TaskID harmonytask.TaskID
SpID uint64
ProvingPeriodStart abi.ChainEpoch
DeadlineIndex uint64
PartitionIndex uint64
dlInfo *dline.Info `pgx:"-"`
openTs *types.TipSet
@@ -232,10 +232,10 @@ func (t *WdPostTask) CanAccept(ids []harmonytask.TaskID, te *harmonytask.TaskEng
// Accept those past deadline, then delete them in Do().
for i := range tasks {
tasks[i].dlInfo = wdpost.NewDeadlineInfo(tasks[i].Proving_period_start, tasks[i].Deadline_index, ts.Height())
tasks[i].dlInfo = wdpost.NewDeadlineInfo(tasks[i].ProvingPeriodStart, tasks[i].DeadlineIndex, ts.Height())
if tasks[i].dlInfo.PeriodElapsed() {
return &tasks[i].Task_id, nil
return &tasks[i].TaskID, nil
}
tasks[i].openTs, err = t.api.ChainGetTipSetAfterHeight(context.Background(), tasks[i].dlInfo.Open, ts.Key())
@@ -281,7 +281,7 @@ func (t *WdPostTask) CanAccept(ids []harmonytask.TaskID, te *harmonytask.TaskEng
var r int
err := t.db.QueryRow(context.Background(), `SELECT COUNT(*)
FROM harmony_task_history
WHERE task_id = $1 AND result = false`, d.Task_id).Scan(&r)
WHERE task_id = $1 AND result = false`, d.TaskID).Scan(&r)
if err != nil {
log.Errorf("WdPostTask.CanAccept() failed to queryRow: %v", err)
}
@@ -293,7 +293,7 @@ func (t *WdPostTask) CanAccept(ids []harmonytask.TaskID, te *harmonytask.TaskEng
return tasks[i].dlInfo.Open < tasks[j].dlInfo.Open
})
return &tasks[0].Task_id, nil
return &tasks[0].TaskID, nil
}
var res = storiface.ResourceTable[sealtasks.TTGenerateWindowPoSt]
@@ -353,10 +353,10 @@ func (t *WdPostTask) processHeadChange(ctx context.Context, revert, apply *types
for pidx := range partitions {
tid := wdTaskIdentity{
Sp_id: aid,
Proving_period_start: di.PeriodStart,
Deadline_index: di.Index,
Partition_index: uint64(pidx),
SpID: aid,
ProvingPeriodStart: di.PeriodStart,
DeadlineIndex: di.Index,
PartitionIndex: uint64(pidx),
}
tf := t.windowPoStTF.Val(ctx)
@@ -384,10 +384,10 @@ func (t *WdPostTask) addTaskToDB(taskId harmonytask.TaskID, taskIdent wdTaskIden
partition_index
) VALUES ($1, $2, $3, $4, $5)`,
taskId,
taskIdent.Sp_id,
taskIdent.Proving_period_start,
taskIdent.Deadline_index,
taskIdent.Partition_index,
taskIdent.SpID,
taskIdent.ProvingPeriodStart,
taskIdent.DeadlineIndex,
taskIdent.PartitionIndex,
)
if err != nil {
return false, xerrors.Errorf("insert partition task: %w", err)
+12 -9
View File
@@ -166,7 +166,7 @@ func (w *WdPostRecoverDeclareTask) Do(taskID harmonytask.TaskID, stillOwned func
recDecl := miner.RecoveryDeclaration{
Deadline: dlIdx,
Partition: uint64(partIdx),
Partition: partIdx,
Sectors: recovered,
}
@@ -187,6 +187,9 @@ func (w *WdPostRecoverDeclareTask) Do(taskID harmonytask.TaskID, stillOwned func
}
msg, mss, err := preparePoStMessage(w.api, w.as, maddr, msg, abi.TokenAmount(w.maxDeclareRecoveriesGasFee))
if err != nil {
return false, xerrors.Errorf("sending declare recoveries message: %w", err)
}
mc, err := w.sender.Send(ctx, msg, mss, "declare-recoveries")
if err != nil {
@@ -279,10 +282,10 @@ func (w *WdPostRecoverDeclareTask) processHeadChange(ctx context.Context, revert
}
tid := wdTaskIdentity{
Sp_id: aid,
Proving_period_start: pps,
Deadline_index: declDeadline,
Partition_index: uint64(pidx),
SpID: aid,
ProvingPeriodStart: pps,
DeadlineIndex: declDeadline,
PartitionIndex: uint64(pidx),
}
tf(func(id harmonytask.TaskID, tx *harmonydb.Tx) (bool, error) {
@@ -304,10 +307,10 @@ func (w *WdPostRecoverDeclareTask) addTaskToDB(taskId harmonytask.TaskID, taskId
partition_index
) VALUES ($1, $2, $3, $4, $5)`,
taskId,
taskIdent.Sp_id,
taskIdent.Proving_period_start,
taskIdent.Deadline_index,
taskIdent.Partition_index,
taskIdent.SpID,
taskIdent.ProvingPeriodStart,
taskIdent.DeadlineIndex,
taskIdent.PartitionIndex,
)
if err != nil {
return false, xerrors.Errorf("insert partition task: %w", err)
+1 -1
View File
@@ -257,7 +257,7 @@ func preparePoStMessage(w MsgPrepAPI, as *ctladdr.AddressSelector, maddr address
msg.From = mi.Worker
mss := &api.MessageSendSpec{
MaxFee: abi.TokenAmount(maxFee),
MaxFee: maxFee,
}
// (optimal) initial estimation with some overestimation that guarantees