Skip to content

Commit 945451c

Browse files
tediou5rvagg
authored andcommitted
feat(miner): remove batch balancer-related functionality (#12919)
Closes: #12902
1 parent 17067d6 commit 945451c

File tree

14 files changed

+38
-15
lines changed

14 files changed

+38
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- `DealIDs` has now been removed from the public API's `SectorOnChainInfo` (was deprecated in FIP-0079)
3131
- Removed `--only-cc` from `spcli sectors extend` command
3232
- 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
33+
- feat(miner): remove batch balancer-related functionality ([filecoin-project/lotus#12919](https://github.com/filecoin-project/lotus/pull/12919))
3334

3435
# UNRELEASED v.1.32.0
3536

chain/actors/policy/policy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const (
7979
SealRandomnessLookback = ChainFinality
8080
PaychSettleDelay = paych16.SettleDelay
8181
MaxPreCommitRandomnessLookback = builtin16.EpochsInDay + SealRandomnessLookback
82+
DeclarationsMax = 3000
8283
)
8384

8485
var (
@@ -842,6 +843,9 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
842843
}
843844
}
844845

846+
// GetDeclarationsMax is deprecated
847+
//
848+
// DEPRECATED: remove after nv25 (FIP 0100)
845849
func GetDeclarationsMax(nwVer network.Version) (int, error) {
846850
v, err := actorstypes.VersionForNetwork(nwVer)
847851
if err != nil {
@@ -912,7 +916,7 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
912916

913917
case actorstypes.Version16:
914918

915-
return miner16.DeclarationsMax, nil
919+
return DeclarationsMax, nil
916920

917921
default:
918922
return 0, xerrors.Errorf("unsupported network version")

chain/actors/policy/policy.go.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const (
3737
SealRandomnessLookback = ChainFinality
3838
PaychSettleDelay = paych{{.latestVersion}}.SettleDelay
3939
MaxPreCommitRandomnessLookback = builtin{{.latestVersion}}.EpochsInDay + SealRandomnessLookback
40+
DeclarationsMax = 3000
4041
)
4142

4243
var (
@@ -283,6 +284,9 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
283284
}
284285
}
285286

287+
// GetDeclarationsMax is deprecated
288+
//
289+
// DEPRECATED: remove after nv25 (FIP 0100)
286290
func GetDeclarationsMax(nwVer network.Version) (int, error) {
287291
v, err := actorstypes.VersionForNetwork(nwVer)
288292
if err != nil {
@@ -294,6 +298,8 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
294298
{{if (eq . 0)}}
295299
// TODO: Should we instead error here since the concept doesn't exist yet?
296300
return miner{{.}}.AddressedPartitionsMax, nil
301+
{{else if (ge . 16)}}
302+
return DeclarationsMax, nil
297303
{{else}}
298304
return miner{{.}}.DeclarationsMax, nil
299305
{{end}}

cli/spcli/sectors.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ func SectorsExtendCmd(getActorAddress ActorAddressGetter) *cli.Command {
864864
return err
865865
}
866866

867+
// TODO: remove after nv25 (FIP 0100)
867868
declMax, err := policy.GetDeclarationsMax(nv)
868869
if err != nil {
869870
return err

cmd/lotus-sim/simulation/stages/precommit_stage.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/filecoin-project/go-state-types/builtin"
1414
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
1515
"github.com/filecoin-project/go-state-types/network"
16-
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
1716

1817
"github.com/filecoin-project/lotus/chain/actors"
1918
"github.com/filecoin-project/lotus/chain/actors/aerrors"
@@ -27,7 +26,7 @@ import (
2726

2827
const (
2928
minPreCommitBatchSize = 1
30-
maxPreCommitBatchSize = miner5.PreCommitSectorBatchMaxSize
29+
maxPreCommitBatchSize = 256
3130
)
3231

3332
type PreCommitStage struct {

documentation/en/default-lotus-miner-config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@
381381
# env var: LOTUS_SEALING_COMMITBATCHSLACK
382382
#CommitBatchSlack = "1h0m0s"
383383

384+
# DEPRECATED: remove after nv25 (FIP 0100)
384385
# network BaseFee below which to stop doing precommit batching, instead
385386
# sending precommit messages to the chain individually. When the basefee is
386387
# below this threshold, precommit messages will get sent out immediately.
@@ -389,6 +390,7 @@
389390
# env var: LOTUS_SEALING_BATCHPRECOMMITABOVEBASEFEE
390391
#BatchPreCommitAboveBaseFee = "0.00000000032 FIL"
391392

393+
# DEPRECATED: remove after nv25 (FIP 0100)
392394
# network BaseFee below which to stop doing commit aggregation, instead
393395
# submitting proofs to the chain individually
394396
#

node/config/def.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ func DefaultStorageMiner() *StorageMiner {
122122
AvailableBalanceBuffer: types.FIL(big.Zero()),
123123
DisableCollateralFallback: false,
124124

125-
MaxPreCommitBatch: miner5.PreCommitSectorBatchMaxSize, // up to 256 sectors
126-
PreCommitBatchWait: Duration(24 * time.Hour), // this should be less than 31.5 hours, which is the expiration of a precommit ticket
125+
MaxPreCommitBatch: 256,
126+
PreCommitBatchWait: Duration(24 * time.Hour), // this should be less than 31.5 hours, which is the expiration of a precommit ticket
127127
// XXX snap deals wait deals slack if first
128128
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
129129

node/config/doc_gen.go

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/config/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,13 @@ type SealingConfig struct {
294294
// time buffer for forceful batch submission before sectors/deals in batch would start expiring
295295
CommitBatchSlack Duration
296296

297+
// DEPRECATED: remove after nv25 (FIP 0100)
297298
// network BaseFee below which to stop doing precommit batching, instead
298299
// sending precommit messages to the chain individually. When the basefee is
299300
// below this threshold, precommit messages will get sent out immediately.
300301
BatchPreCommitAboveBaseFee types.FIL
301302

303+
// DEPRECATED: remove after nv25 (FIP 0100)
302304
// network BaseFee below which to stop doing commit aggregation, instead
303305
// submitting proofs to the chain individually
304306
AggregateAboveBaseFee types.FIL

storage/pipeline/commit_batch.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
233233

234234
individual := (total < cfg.MinCommitBatch) || (total < miner.MinAggregatedSectors) || blackedOut() || !cfg.AggregateCommits
235235

236-
if !individual && !cfg.AggregateAboveBaseFee.Equals(big.Zero()) {
236+
// TODO: remove after nv25 (FIP 0100)
237+
if !individual && !cfg.AggregateAboveBaseFee.Equals(big.Zero()) && nv < network.Version25 {
237238
if ts.MinTicketBlock().ParentBaseFee.LessThan(cfg.AggregateAboveBaseFee) {
238239
individual = true
239240
}

storage/pipeline/precommit_batch.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,14 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
196196
return nil, err
197197
}
198198

199+
nv, err := b.api.StateNetworkVersion(b.mctx, ts.Key())
200+
if err != nil {
201+
return nil, xerrors.Errorf("couldn't get network version: %w", err)
202+
}
203+
204+
// TODO: remove after nv25 (FIP 0100)
199205
curBasefeeLow := false
200-
if !cfg.BatchPreCommitAboveBaseFee.Equals(big.Zero()) && ts.MinTicketBlock().ParentBaseFee.LessThan(cfg.BatchPreCommitAboveBaseFee) {
206+
if !cfg.BatchPreCommitAboveBaseFee.Equals(big.Zero()) && ts.MinTicketBlock().ParentBaseFee.LessThan(cfg.BatchPreCommitAboveBaseFee) && nv < network.Version25 {
201207
curBasefeeLow = true
202208
}
203209

@@ -207,11 +213,6 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
207213
return nil, nil
208214
}
209215

210-
nv, err := b.api.StateNetworkVersion(b.mctx, ts.Key())
211-
if err != nil {
212-
return nil, xerrors.Errorf("couldn't get network version: %w", err)
213-
}
214-
215216
// For precommits the only method to precommit sectors after nv21(22?) is to use the new precommit_batch2 method
216217
// So we always batch
217218
res, err := b.processBatch(cfg, ts.Key(), ts.MinTicketBlock().ParentBaseFee, nv)

storage/pipeline/sealiface/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ type Config struct {
5252
CommitBatchWait time.Duration
5353
CommitBatchSlack time.Duration
5454

55-
AggregateAboveBaseFee abi.TokenAmount
55+
// DEPRECATED: remove after nv25 (FIP 0100)
56+
AggregateAboveBaseFee abi.TokenAmount
57+
// DEPRECATED: remove after nv25 (FIP 0100)
5658
BatchPreCommitAboveBaseFee abi.TokenAmount
5759

5860
MaxSectorProveCommitsSubmittedPerEpoch uint64

storage/pipeline/terminate_batch.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
197197
break
198198
}
199199

200+
// TODO: remove after nv25 (FIP 0100)
200201
if len(params.Terminations) >= miner.DeclarationsMax {
201202
break
202203
}

storage/wdpost/wdpost_run.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ func (s *WindowPoStScheduler) BatchPartitions(partitions []api.Partition, nv net
544544
return nil, xerrors.Errorf("getting sectors per partition: %w", err)
545545
}
546546

547+
// TODO: remove after nv25 (FIP 0100)
547548
// Also respect the AddressedPartitionsMax (which is the same as DeclarationsMax (which is all really just MaxPartitionsPerDeadline))
548549
declMax, err := policy.GetDeclarationsMax(nv)
549550
if err != nil {

0 commit comments

Comments
 (0)