feat(miner): remove batch balancer-related functionality (#12919)

Closes: https://github.com/filecoin-project/lotus/issues/12902
This commit is contained in:
tediou5
2025-03-14 15:19:21 +08:00
committed by Rod Vagg
parent 17067d655d
commit 945451c528
14 changed files with 38 additions and 15 deletions

View File

@ -30,6 +30,7 @@
- `DealIDs` has now been removed from the public API's `SectorOnChainInfo` (was deprecated in FIP-0079)
- Removed `--only-cc` from `spcli sectors extend` command
- Change circulating supply calculation for calibnet, butterflynet and 2k for nv25 upgrade; see ([filecoin-project/lotus#12938](https://github.com/filecoin-project/lotus/pull/12938)) for more information
- feat(miner): remove batch balancer-related functionality ([filecoin-project/lotus#12919](https://github.com/filecoin-project/lotus/pull/12919))
# UNRELEASED v.1.32.0

View File

@ -79,6 +79,7 @@ const (
SealRandomnessLookback = ChainFinality
PaychSettleDelay = paych16.SettleDelay
MaxPreCommitRandomnessLookback = builtin16.EpochsInDay + SealRandomnessLookback
DeclarationsMax = 3000
)
var (
@ -842,6 +843,9 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
}
}
// GetDeclarationsMax is deprecated
//
// DEPRECATED: remove after nv25 (FIP 0100)
func GetDeclarationsMax(nwVer network.Version) (int, error) {
v, err := actorstypes.VersionForNetwork(nwVer)
if err != nil {
@ -912,7 +916,7 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
case actorstypes.Version16:
return miner16.DeclarationsMax, nil
return DeclarationsMax, nil
default:
return 0, xerrors.Errorf("unsupported network version")

View File

@ -37,6 +37,7 @@ const (
SealRandomnessLookback = ChainFinality
PaychSettleDelay = paych{{.latestVersion}}.SettleDelay
MaxPreCommitRandomnessLookback = builtin{{.latestVersion}}.EpochsInDay + SealRandomnessLookback
DeclarationsMax = 3000
)
var (
@ -283,6 +284,9 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
}
}
// GetDeclarationsMax is deprecated
//
// DEPRECATED: remove after nv25 (FIP 0100)
func GetDeclarationsMax(nwVer network.Version) (int, error) {
v, err := actorstypes.VersionForNetwork(nwVer)
if err != nil {
@ -294,6 +298,8 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
{{if (eq . 0)}}
// TODO: Should we instead error here since the concept doesn't exist yet?
return miner{{.}}.AddressedPartitionsMax, nil
{{else if (ge . 16)}}
return DeclarationsMax, nil
{{else}}
return miner{{.}}.DeclarationsMax, nil
{{end}}

View File

@ -864,6 +864,7 @@ func SectorsExtendCmd(getActorAddress ActorAddressGetter) *cli.Command {
return err
}
// TODO: remove after nv25 (FIP 0100)
declMax, err := policy.GetDeclarationsMax(nv)
if err != nil {
return err

View File

@ -13,7 +13,6 @@ import (
"github.com/filecoin-project/go-state-types/builtin"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/network"
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/aerrors"
@ -27,7 +26,7 @@ import (
const (
minPreCommitBatchSize = 1
maxPreCommitBatchSize = miner5.PreCommitSectorBatchMaxSize
maxPreCommitBatchSize = 256
)
type PreCommitStage struct {

View File

@ -381,6 +381,7 @@
# env var: LOTUS_SEALING_COMMITBATCHSLACK
#CommitBatchSlack = "1h0m0s"
# DEPRECATED: remove after nv25 (FIP 0100)
# network BaseFee below which to stop doing precommit batching, instead
# sending precommit messages to the chain individually. When the basefee is
# below this threshold, precommit messages will get sent out immediately.
@ -389,6 +390,7 @@
# env var: LOTUS_SEALING_BATCHPRECOMMITABOVEBASEFEE
#BatchPreCommitAboveBaseFee = "0.00000000032 FIL"
# DEPRECATED: remove after nv25 (FIP 0100)
# network BaseFee below which to stop doing commit aggregation, instead
# submitting proofs to the chain individually
#

View File

@ -122,8 +122,8 @@ func DefaultStorageMiner() *StorageMiner {
AvailableBalanceBuffer: types.FIL(big.Zero()),
DisableCollateralFallback: false,
MaxPreCommitBatch: miner5.PreCommitSectorBatchMaxSize, // up to 256 sectors
PreCommitBatchWait: Duration(24 * time.Hour), // this should be less than 31.5 hours, which is the expiration of a precommit ticket
MaxPreCommitBatch: 256,
PreCommitBatchWait: Duration(24 * time.Hour), // this should be less than 31.5 hours, which is the expiration of a precommit ticket
// XXX snap deals wait deals slack if first
PreCommitBatchSlack: Duration(3 * time.Hour), // time buffer for forceful batch submission before sectors/deals in batch would start expiring, higher value will lower the chances for message fail due to expiration

View File

@ -1083,7 +1083,8 @@ This is useful for forcing all deals to be assigned as snap deals to sectors mar
Name: "BatchPreCommitAboveBaseFee",
Type: "types.FIL",
Comment: `network BaseFee below which to stop doing precommit batching, instead
Comment: `DEPRECATED: remove after nv25 (FIP 0100)
network BaseFee below which to stop doing precommit batching, instead
sending precommit messages to the chain individually. When the basefee is
below this threshold, precommit messages will get sent out immediately.`,
},
@ -1091,7 +1092,8 @@ below this threshold, precommit messages will get sent out immediately.`,
Name: "AggregateAboveBaseFee",
Type: "types.FIL",
Comment: `network BaseFee below which to stop doing commit aggregation, instead
Comment: `DEPRECATED: remove after nv25 (FIP 0100)
network BaseFee below which to stop doing commit aggregation, instead
submitting proofs to the chain individually`,
},
{

View File

@ -294,11 +294,13 @@ type SealingConfig struct {
// time buffer for forceful batch submission before sectors/deals in batch would start expiring
CommitBatchSlack Duration
// DEPRECATED: remove after nv25 (FIP 0100)
// network BaseFee below which to stop doing precommit batching, instead
// sending precommit messages to the chain individually. When the basefee is
// below this threshold, precommit messages will get sent out immediately.
BatchPreCommitAboveBaseFee types.FIL
// DEPRECATED: remove after nv25 (FIP 0100)
// network BaseFee below which to stop doing commit aggregation, instead
// submitting proofs to the chain individually
AggregateAboveBaseFee types.FIL

View File

@ -233,7 +233,8 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
individual := (total < cfg.MinCommitBatch) || (total < miner.MinAggregatedSectors) || blackedOut() || !cfg.AggregateCommits
if !individual && !cfg.AggregateAboveBaseFee.Equals(big.Zero()) {
// TODO: remove after nv25 (FIP 0100)
if !individual && !cfg.AggregateAboveBaseFee.Equals(big.Zero()) && nv < network.Version25 {
if ts.MinTicketBlock().ParentBaseFee.LessThan(cfg.AggregateAboveBaseFee) {
individual = true
}

View File

@ -196,8 +196,14 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
return nil, err
}
nv, err := b.api.StateNetworkVersion(b.mctx, ts.Key())
if err != nil {
return nil, xerrors.Errorf("couldn't get network version: %w", err)
}
// TODO: remove after nv25 (FIP 0100)
curBasefeeLow := false
if !cfg.BatchPreCommitAboveBaseFee.Equals(big.Zero()) && ts.MinTicketBlock().ParentBaseFee.LessThan(cfg.BatchPreCommitAboveBaseFee) {
if !cfg.BatchPreCommitAboveBaseFee.Equals(big.Zero()) && ts.MinTicketBlock().ParentBaseFee.LessThan(cfg.BatchPreCommitAboveBaseFee) && nv < network.Version25 {
curBasefeeLow = true
}
@ -207,11 +213,6 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
return nil, nil
}
nv, err := b.api.StateNetworkVersion(b.mctx, ts.Key())
if err != nil {
return nil, xerrors.Errorf("couldn't get network version: %w", err)
}
// For precommits the only method to precommit sectors after nv21(22?) is to use the new precommit_batch2 method
// So we always batch
res, err := b.processBatch(cfg, ts.Key(), ts.MinTicketBlock().ParentBaseFee, nv)

View File

@ -52,7 +52,9 @@ type Config struct {
CommitBatchWait time.Duration
CommitBatchSlack time.Duration
AggregateAboveBaseFee abi.TokenAmount
// DEPRECATED: remove after nv25 (FIP 0100)
AggregateAboveBaseFee abi.TokenAmount
// DEPRECATED: remove after nv25 (FIP 0100)
BatchPreCommitAboveBaseFee abi.TokenAmount
MaxSectorProveCommitsSubmittedPerEpoch uint64

View File

@ -197,6 +197,7 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
break
}
// TODO: remove after nv25 (FIP 0100)
if len(params.Terminations) >= miner.DeclarationsMax {
break
}

View File

@ -544,6 +544,7 @@ func (s *WindowPoStScheduler) BatchPartitions(partitions []api.Partition, nv net
return nil, xerrors.Errorf("getting sectors per partition: %w", err)
}
// TODO: remove after nv25 (FIP 0100)
// Also respect the AddressedPartitionsMax (which is the same as DeclarationsMax (which is all really just MaxPartitionsPerDeadline))
declMax, err := policy.GetDeclarationsMax(nv)
if err != nil {