Skip to content

chore(miner): remove deprecated code as a result of FIP-0100 #13049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
- deps(f3): bump go-f3 version to 0.8.6, move power table cache to go-f3 from lotus ([filecoin-project/lotus#13144](https://github.com/filecoin-project/lotus/pull/13144))
- feat(f3): move go-f3 datastore to separate leveldb instance ([filecoin-project/lotus#13174](https://github.com/filecoin-project/lotus/pull/13174))
- chore: bump the pubsub validation queue length to 256 ([filecoin-project/lotus#13176](https://github.com/filecoin-project/lotus/pull/13176))

- feat(miner): Adjust PreCommit & ProveCommit logic for optimal nv25 gas usage:
- remove deprecated pre-nv25 code, including batch balancer calculations
- default to PreCommit batching
- default to ProveCommit aggregation
- remove config options: AggregateCommits, AggregateAboveBaseFee, BatchPreCommitAboveBaseFee

# Node v1.33.0 / 2025-05-08
The Lotus v1.33.0 release introduces experimental v2 APIs with F3 awareness, featuring a new TipSet selection mechanism that significantly enhances how applications interact with the Filecoin blockchain. This release candidate also adds F3-aware Ethereum APIs via the /v2 endpoint. All of the /v2 APIs implement intelligent fallback mechanisms between F3 and Expected Consensus and are exposed through the Lotus Gateway.
Expand Down
123 changes: 0 additions & 123 deletions chain/actors/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,129 +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 {
return big.Zero(), err
}
switch v {
case actorstypes.Version0:
return big.Zero(), nil
case actorstypes.Version2:
return big.Zero(), nil
case actorstypes.Version3:
return big.Zero(), nil
case actorstypes.Version4:
return big.Zero(), nil
case actorstypes.Version5:
return miner5.AggregateNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version6:
return miner6.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version7:
return miner7.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version8:
return miner8.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version9:
return miner9.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version10:
return miner10.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version11:
return miner11.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version12:
return miner12.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version13:
return miner13.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version14:
return miner14.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version15:
return miner15.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version16:
return big.Zero(), nil
default:
return big.Zero(), xerrors.Errorf("unsupported network version")
}
}

func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
v, err := actorstypes.VersionForNetwork(nwVer)
if err != nil {
Expand Down
48 changes: 0 additions & 48 deletions chain/actors/policy/policy.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -284,54 +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 {
return big.Zero(), err
}
switch v {
{{- range .versions}}
case actorstypes.Version{{.}}:
{{- if (ge . 16)}}
return big.Zero(), nil
{{- else if (ge . 6)}}
return miner{{.}}.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
{{- else if (eq . 5)}}
return miner{{.}}.AggregateNetworkFee(aggregateSize, baseFee), nil
{{- else}}
return big.Zero(), nil
{{- end -}}
{{- end}}
default:
return big.Zero(), xerrors.Errorf("unsupported network version")
}
}

func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
v, err := actorstypes.VersionForNetwork(nwVer)
if err != nil {
Expand Down
8 changes: 1 addition & 7 deletions cli/spcli/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
23 changes: 0 additions & 23 deletions documentation/en/default-lotus-miner-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,6 @@
# env var: LOTUS_SEALING_PRECOMMITBATCHSLACK
#PreCommitBatchSlack = "3h0m0s"

# enable / disable commit aggregation (takes effect after nv13)
#
# type: bool
# env var: LOTUS_SEALING_AGGREGATECOMMITS
#AggregateCommits = true

# minimum batched commit size - batches above this size will eventually be sent on a timeout
#
# type: int
Expand All @@ -381,23 +375,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
Expand Down
1 change: 0 additions & 1 deletion itests/direct_data_onboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ func TestOnboardRawPieceSnap(t *testing.T) {
sc.PreferNewSectorsForDeals = false
sc.MakeNewSectorForDeals = false
sc.MakeCCSectorsAvailable = true
sc.AggregateCommits = false
}))
ens.InterconnectAll().BeginMiningMustPost(blocktime)

Expand Down
4 changes: 0 additions & 4 deletions itests/sector_miner_collateral_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ func TestMinerBalanceCollateral(t *testing.T) {
sc.AlwaysKeepUnsealedCopy = true
sc.WaitDealsDelay = time.Hour

sc.AggregateCommits = batching

sc.PreCommitBatchWait = time.Hour
sc.CommitBatchWait = time.Hour

Expand All @@ -77,8 +75,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
Expand Down
7 changes: 1 addition & 6 deletions itests/sector_pledge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 0 additions & 4 deletions node/config/def.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,11 @@ func DefaultStorageMiner() *StorageMiner {

CommittedCapacitySectorLifetime: Duration(builtin.EpochDurationSeconds * uint64(maxSectorExtentsion) * uint64(time.Second)),

AggregateCommits: true,
MinCommitBatch: miner5.MinAggregatedSectors, // per FIP13, we must have at least four proofs to aggregate, where 4 is the cross over point where aggregation wins out on single provecommit gas costs
MaxCommitBatch: miner5.MaxAggregatedSectors, // maximum 819 sectors, this is the maximum aggregation per FIP13
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),
Expand Down
23 changes: 0 additions & 23 deletions node/config/doc_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions node/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ type SealingConfig struct {
// time buffer for forceful batch submission before sectors/deal in batch would start expiring
PreCommitBatchSlack Duration

// enable / disable commit aggregation (takes effect after nv13)
AggregateCommits bool
// minimum batched commit size - batches above this size will eventually be sent on a timeout
MinCommitBatch int
// maximum batched commit size - batches will be sent immediately above this size
Expand All @@ -294,17 +292,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
Expand Down
Loading