chore: remove deprecated code

This commit is contained in:
tediou5
2025-04-22 10:06:24 +08:00
committed by Rod Vagg
parent f1786a9db9
commit 7542c59ea8
15 changed files with 10 additions and 204 deletions

View File

@ -843,86 +843,6 @@ 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 {
return 0, err
}
switch v {
case actorstypes.Version0:
// TODO: Should we instead error here since the concept doesn't exist yet?
return miner0.AddressedPartitionsMax, nil
case actorstypes.Version2:
return miner2.DeclarationsMax, nil
case actorstypes.Version3:
return miner3.DeclarationsMax, nil
case actorstypes.Version4:
return miner4.DeclarationsMax, nil
case actorstypes.Version5:
return miner5.DeclarationsMax, nil
case actorstypes.Version6:
return miner6.DeclarationsMax, nil
case actorstypes.Version7:
return miner7.DeclarationsMax, nil
case actorstypes.Version8:
return miner8.DeclarationsMax, nil
case actorstypes.Version9:
return miner9.DeclarationsMax, nil
case actorstypes.Version10:
return miner10.DeclarationsMax, nil
case actorstypes.Version11:
return miner11.DeclarationsMax, nil
case actorstypes.Version12:
return miner12.DeclarationsMax, nil
case actorstypes.Version13:
return miner13.DeclarationsMax, nil
case actorstypes.Version14:
return miner14.DeclarationsMax, nil
case actorstypes.Version15:
return miner15.DeclarationsMax, nil
case actorstypes.Version16:
return DeclarationsMax, nil
default:
return 0, xerrors.Errorf("unsupported network version")
}
}
func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
v, err := actorstypes.VersionForNetwork(nwVer)
if err != nil {

View File

@ -284,31 +284,6 @@ 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 {
return 0, err
}
switch v {
{{range .versions}}
case actorstypes.Version{{.}}:
{{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}}
{{end}}
default:
return 0, xerrors.Errorf("unsupported network version")
}
}
func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
v, err := actorstypes.VersionForNetwork(nwVer)
if err != nil {

View File

@ -864,12 +864,6 @@ func SectorsExtendCmd(getActorAddress ActorAddressGetter) *cli.Command {
return err
}
// TODO: remove after nv25 (FIP 0100)
declMax, err := policy.GetDeclarationsMax(nv)
if err != nil {
return err
}
addrSectors := sectorsMax
if cctx.Int("max-sectors") != 0 {
addrSectors = cctx.Int("max-sectors")
@ -955,7 +949,7 @@ func SectorsExtendCmd(getActorAddress ActorAddressGetter) *cli.Command {
sectorsInDecl := int(sectorsWithoutClaimsCount) + len(sectorsWithClaims)
scount += sectorsInDecl
if scount > addrSectors || len(p.Extensions) >= declMax {
if scount > addrSectors || len(p.Extensions) >= policy.DeclarationsMax {
params = append(params, p)
p = miner.ExtendSectorExpiration2Params{}
scount = sectorsInDecl

View File

@ -381,23 +381,6 @@
# 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.
#
# type: types.FIL
# 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
#
# type: types.FIL
# env var: LOTUS_SEALING_AGGREGATEABOVEBASEFEE
#AggregateAboveBaseFee = "0.00000000032 FIL"
# When submitting several sector prove commit messages simultaneously, this option allows you to
# stagger the number of prove commits submitted per epoch
# This is done because gas estimates for ProveCommits are non deterministic and increasing as a large

View File

@ -77,8 +77,6 @@ func TestMinerBalanceCollateral(t *testing.T) {
sc.CollateralFromMinerBalance = enabled
sc.AvailableBalanceBuffer = big.Zero()
sc.DisableCollateralFallback = false
sc.AggregateAboveBaseFee = big.Zero()
sc.BatchPreCommitAboveBaseFee = big.Zero()
return sc, nil
}, nil

View File

@ -11,7 +11,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
"github.com/filecoin-project/lotus/api"
@ -65,11 +64,7 @@ func TestPledgeBatching(t *testing.T) {
kit.QuietMiningLogs()
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(!aggregate), kit.MutateSealingConfig(func(sc *config.SealingConfig) {
if aggregate {
sc.AggregateAboveBaseFee = types.FIL(big.Zero())
}
}))
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(!aggregate))
ens.InterconnectAll().BeginMiningMustPost(blockTime)
client.WaitTillChain(ctx, kit.HeightAtLeast(10))

View File

@ -135,9 +135,6 @@ func DefaultStorageMiner() *StorageMiner {
CommitBatchWait: Duration(24 * time.Hour), // this can be up to 30 days
CommitBatchSlack: Duration(1 * 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
BatchPreCommitAboveBaseFee: types.FIL(types.BigMul(types.PicoFil, types.NewInt(320))), // 0.32 nFIL
AggregateAboveBaseFee: types.FIL(types.BigMul(types.PicoFil, types.NewInt(320))), // 0.32 nFIL
TerminateBatchMin: 1,
TerminateBatchMax: 100,
TerminateBatchWait: Duration(5 * time.Minute),

View File

@ -1079,23 +1079,6 @@ This is useful for forcing all deals to be assigned as snap deals to sectors mar
Comment: `time buffer for forceful batch submission before sectors/deals in batch would start expiring`,
},
{
Name: "BatchPreCommitAboveBaseFee",
Type: "types.FIL",
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.`,
},
{
Name: "AggregateAboveBaseFee",
Type: "types.FIL",
Comment: `DEPRECATED: remove after nv25 (FIP 0100)
network BaseFee below which to stop doing commit aggregation, instead
submitting proofs to the chain individually`,
},
{
Name: "MaxSectorProveCommitsSubmittedPerEpoch",
Type: "uint64",

View File

@ -294,17 +294,6 @@ 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
// When submitting several sector prove commit messages simultaneously, this option allows you to
// stagger the number of prove commits submitted per epoch
// This is done because gas estimates for ProveCommits are non deterministic and increasing as a large

View File

@ -449,13 +449,11 @@ func NewSetSealConfigFunc(r repo.LockedRepo) (dtypes.SetSealingConfigFunc, error
PreCommitBatchWait: config.Duration(cfg.PreCommitBatchWait),
PreCommitBatchSlack: config.Duration(cfg.PreCommitBatchSlack),
AggregateCommits: cfg.AggregateCommits,
MinCommitBatch: cfg.MinCommitBatch,
MaxCommitBatch: cfg.MaxCommitBatch,
CommitBatchWait: config.Duration(cfg.CommitBatchWait),
CommitBatchSlack: config.Duration(cfg.CommitBatchSlack),
AggregateAboveBaseFee: types.FIL(cfg.AggregateAboveBaseFee),
BatchPreCommitAboveBaseFee: types.FIL(cfg.BatchPreCommitAboveBaseFee),
AggregateCommits: cfg.AggregateCommits,
MinCommitBatch: cfg.MinCommitBatch,
MaxCommitBatch: cfg.MaxCommitBatch,
CommitBatchWait: config.Duration(cfg.CommitBatchWait),
CommitBatchSlack: config.Duration(cfg.CommitBatchSlack),
TerminateBatchMax: cfg.TerminateBatchMax,
TerminateBatchMin: cfg.TerminateBatchMin,
@ -504,8 +502,6 @@ func ToSealingConfig(dealmakingCfg config.DealmakingConfig, sealingCfg config.Se
MaxCommitBatch: sealingCfg.MaxCommitBatch,
CommitBatchWait: time.Duration(sealingCfg.CommitBatchWait),
CommitBatchSlack: time.Duration(sealingCfg.CommitBatchSlack),
AggregateAboveBaseFee: types.BigInt(sealingCfg.AggregateAboveBaseFee),
BatchPreCommitAboveBaseFee: types.BigInt(sealingCfg.BatchPreCommitAboveBaseFee),
MaxSectorProveCommitsSubmittedPerEpoch: sealingCfg.MaxSectorProveCommitsSubmittedPerEpoch,
TerminateBatchMax: sealingCfg.TerminateBatchMax,

View File

@ -233,13 +233,6 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
individual := (total < cfg.MinCommitBatch) || (total < miner.MinAggregatedSectors) || blackedOut() || !cfg.AggregateCommits
// 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
}
}
// After nv21, we have a new ProveCommitSectors2 method, which supports
// batching without aggregation, but it doesn't support onboarding
// sectors which were precommitted with DealIDs in the precommit message.

View File

@ -201,15 +201,9 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
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) && nv < network.Version25 {
curBasefeeLow = true
}
// if this wasn't an user-forced batch, and we're not at/above the max batch size,
// and we're not above the basefee threshold, don't batch yet
if notif && total < cfg.MaxPreCommitBatch && !curBasefeeLow {
if notif && total < cfg.MaxPreCommitBatch {
return nil, nil
}

View File

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

View File

@ -197,7 +197,6 @@ 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,14 +544,9 @@ 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 {
return nil, xerrors.Errorf("getting max declarations: %w", err)
}
if partitionsPerMsg > declMax {
partitionsPerMsg = declMax
if partitionsPerMsg > policy.DeclarationsMax {
partitionsPerMsg = policy.DeclarationsMax
}
// respect user config if set