Merge pull request #9107 from filecoin-project/jen/9104
chore: backport: #9106
This commit is contained in:
commit
201a4ea57c
@ -196,7 +196,7 @@ func (m *Message) ValidForBlockInclusion(minGas int64, version network.Version)
|
||||
}
|
||||
|
||||
if m.GasLimit > build.BlockGasLimit {
|
||||
return xerrors.New("'GasLimit' field cannot be greater than a block's gas limit")
|
||||
return xerrors.Errorf("'GasLimit' field cannot be greater than a block's gas limit (%d > %d)", m.GasLimit, build.BlockGasLimit)
|
||||
}
|
||||
|
||||
// since prices might vary with time, this is technically semantic validation
|
||||
|
@ -2,6 +2,8 @@ package wdpost
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"go.opencensus.io/trace"
|
||||
@ -19,6 +21,18 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var recoveringSectorLimit int64 = 0
|
||||
|
||||
func init() {
|
||||
if rcl := os.Getenv("LOTUS_RECOVERING_SECTOR_LIMIT"); rcl != "" {
|
||||
var err error
|
||||
recoveringSectorLimit, err = strconv.ParseInt(rcl, 10, 64)
|
||||
if err != nil {
|
||||
log.Errorw("parsing LOTUS_RECOVERING_SECTOR_LIMIT", "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// declareRecoveries identifies sectors that were previously marked as faulty
|
||||
// for our miner, but are now recovered (i.e. are now provable again) and
|
||||
// still not reported as such.
|
||||
@ -44,7 +58,7 @@ func (s *WindowPoStScheduler) declareRecoveries(ctx context.Context, dlIdx uint6
|
||||
|
||||
var batchedRecoveryDecls [][]miner.RecoveryDeclaration
|
||||
batchedRecoveryDecls = append(batchedRecoveryDecls, []miner.RecoveryDeclaration{})
|
||||
totalRecoveries := 0
|
||||
totalSectorsToRecover := uint64(0)
|
||||
|
||||
for partIdx, partition := range partitions {
|
||||
unrecovered, err := bitfield.SubtractBitField(partition.FaultySectors, partition.RecoveringSectors)
|
||||
@ -90,10 +104,17 @@ func (s *WindowPoStScheduler) declareRecoveries(ctx context.Context, dlIdx uint6
|
||||
Sectors: recovered,
|
||||
})
|
||||
|
||||
totalRecoveries++
|
||||
totalSectorsToRecover += recoveredCount
|
||||
|
||||
if recoveringSectorLimit > 0 && int64(totalSectorsToRecover) >= recoveringSectorLimit {
|
||||
log.Errorf("reached recovering sector limit %d, only marking %d sectors for recovery now",
|
||||
recoveringSectorLimit,
|
||||
totalSectorsToRecover)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if totalRecoveries == 0 {
|
||||
if totalSectorsToRecover == 0 {
|
||||
if faulty != 0 {
|
||||
log.Warnw("No recoveries to declare", "deadline", dlIdx, "faulty", faulty)
|
||||
}
|
||||
@ -101,6 +122,7 @@ func (s *WindowPoStScheduler) declareRecoveries(ctx context.Context, dlIdx uint6
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
log.Infof("attempting recovery declarations for %d sectors", totalSectorsToRecover)
|
||||
var msgs []*types.SignedMessage
|
||||
for _, recovery := range batchedRecoveryDecls {
|
||||
params := &miner.DeclareFaultsRecoveredParams{
|
||||
@ -122,7 +144,6 @@ func (s *WindowPoStScheduler) declareRecoveries(ctx context.Context, dlIdx uint6
|
||||
if err := s.prepareMessage(ctx, msg, spec); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
sm, err := s.api.MpoolPushMessage(ctx, msg, &api.MessageSendSpec{MaxFee: abi.TokenAmount(s.feeCfg.MaxWindowPoStGasFee)})
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("pushing message to mpool: %w", err)
|
||||
|
Loading…
Reference in New Issue
Block a user