Merge branch 'release/v1.24.0' into release/v1.25.0

This commit is contained in:
Andrew Jackson (Ajax)
2023-10-17 10:19:51 -05:00
104 changed files with 3256 additions and 678 deletions
+5 -1
View File
@@ -10,6 +10,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"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/builtin"
@@ -122,6 +123,8 @@ func DefaultFullNode() *FullNode {
}
func DefaultStorageMiner() *StorageMiner {
// TODO: Should we increase this to nv21, which would push it to 3.5 years?
maxSectorExtentsion, _ := policy.GetMaxSectorExpirationExtension(network.Version20)
cfg := &StorageMiner{
Common: defCommon(),
@@ -143,7 +146,7 @@ func DefaultStorageMiner() *StorageMiner {
// 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
CommittedCapacitySectorLifetime: Duration(builtin.EpochDurationSeconds * uint64(policy.GetMaxSectorExpirationExtension()) * uint64(time.Second)),
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
@@ -158,6 +161,7 @@ func DefaultStorageMiner() *StorageMiner {
TerminateBatchMax: 100,
TerminateBatchWait: Duration(5 * time.Minute),
MaxSectorProveCommitsSubmittedPerEpoch: 20,
UseSyntheticPoRep: false,
},
Proving: ProvingConfig{
+9 -6
View File
@@ -853,13 +853,10 @@ After changing this option, confirm that the new value works in your setup by in
Name: "MaxPartitionsPerPoStMessage",
Type: "int",
Comment: `Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (10 in nv16)
Comment: `Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (3 in nv21)
A single partition may contain up to 2349 32GiB sectors, or 2300 64GiB sectors.
The maximum number of sectors which can be proven in a single PoSt message is 25000 in network version 16, which
means that a single message can prove at most 10 partitions
//
Note that setting this value lower may result in less efficient gas use - more messages will be sent,
to prove each deadline, resulting in more total gas use (but each message will have lower gas limit)
@@ -1150,7 +1147,7 @@ required to have expiration of at least the soonest-ending deal`,
Comment: `CommittedCapacitySectorLifetime is the duration a Committed Capacity (CC) sector will
live before it must be extended or converted into sector containing deals before it is
terminated. Value must be between 180-540 days inclusive`,
terminated. Value must be between 180-1278 days (1278 in nv21, 540 before nv21).`,
},
{
Name: "WaitDealsDelay",
@@ -1295,6 +1292,12 @@ Submitting a smaller number of prove commits per epoch would reduce the possibil
Comment: ``,
},
{
Name: "UseSyntheticPoRep",
Type: "bool",
Comment: `UseSyntheticPoRep, when set to true, will reduce the amount of cache data held on disk after the completion of PreCommit 2 to 11GiB.`,
},
},
"Splitstore": []DocField{
{
+6 -6
View File
@@ -290,13 +290,10 @@ type ProvingConfig struct {
// 'lotus-miner proving compute window-post 0'
DisableWDPoStPreChecks bool
// Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (10 in nv16)
// Maximum number of partitions to prove in a single SubmitWindowPoSt messace. 0 = network limit (3 in nv21)
//
// A single partition may contain up to 2349 32GiB sectors, or 2300 64GiB sectors.
//
// The maximum number of sectors which can be proven in a single PoSt message is 25000 in network version 16, which
// means that a single message can prove at most 10 partitions
//
// //
// Note that setting this value lower may result in less efficient gas use - more messages will be sent,
// to prove each deadline, resulting in more total gas use (but each message will have lower gas limit)
//
@@ -358,7 +355,7 @@ type SealingConfig struct {
// CommittedCapacitySectorLifetime is the duration a Committed Capacity (CC) sector will
// live before it must be extended or converted into sector containing deals before it is
// terminated. Value must be between 180-540 days inclusive
// terminated. Value must be between 180-1278 days (1278 in nv21, 540 before nv21).
CommittedCapacitySectorLifetime Duration
// Period of time that a newly created sector will wait for more deals to be packed in to before it starts to seal.
@@ -429,6 +426,9 @@ type SealingConfig struct {
// todo TargetSealingSectors uint64
// todo TargetSectors - stop auto-pleding new sectors after this many sectors are sealed, default CC upgrade for deals sectors if above
// UseSyntheticPoRep, when set to true, will reduce the amount of cache data held on disk after the completion of PreCommit 2 to 11GiB.
UseSyntheticPoRep bool
}
type SealerConfig struct {
+21 -6
View File
@@ -43,9 +43,11 @@ func (t *HelloMessage) MarshalCBOR(w io.Writer) error {
return err
}
for _, v := range t.HeaviestTipSet {
if err := cbg.WriteCid(w, v); err != nil {
return xerrors.Errorf("failed writing cid field t.HeaviestTipSet: %w", err)
if err := cbg.WriteCid(cw, v); err != nil {
return xerrors.Errorf("failed to write cid field v: %w", err)
}
}
// t.HeaviestTipSetHeight (abi.ChainEpoch) (int64)
@@ -116,12 +118,25 @@ func (t *HelloMessage) UnmarshalCBOR(r io.Reader) (err error) {
}
for i := 0; i < int(extra); i++ {
{
var maj byte
var extra uint64
var err error
_ = maj
_ = extra
_ = err
c, err := cbg.ReadCid(cr)
if err != nil {
return xerrors.Errorf("reading cid field t.HeaviestTipSet failed: %w", err)
{
c, err := cbg.ReadCid(cr)
if err != nil {
return xerrors.Errorf("failed to read cid field t.HeaviestTipSet[i]: %w", err)
}
t.HeaviestTipSet[i] = c
}
}
t.HeaviestTipSet[i] = c
}
// t.HeaviestTipSetHeight (abi.ChainEpoch) (int64)
+1 -1
View File
@@ -197,7 +197,7 @@ func (a *API) dealStarter(ctx context.Context, params *api.StartDealParams, isSt
return nil, xerrors.Errorf("failed to get network version: %w", err)
}
st, err := miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType)
st, err := miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType, false)
if err != nil {
return nil, xerrors.Errorf("failed to get seal proof type: %w", err)
}
+105 -31
View File
@@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"math"
"strconv"
"github.com/ipfs/go-cid"
@@ -19,8 +20,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
market12 "github.com/filecoin-project/go-state-types/builtin/v12/market"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline"
@@ -794,7 +794,7 @@ func (a *StateAPI) StateGetAllocationForPendingDeal(ctx context.Context, dealId
if err != nil {
return nil, err
}
if allocationId == verifregtypes.NoAllocationID {
if allocationId == verifreg.NoAllocationID {
return nil, nil
}
@@ -914,32 +914,31 @@ func (a *StateAPI) StateComputeDataCID(ctx context.Context, maddr address.Addres
return cid.Cid{}, err
}
var ccparams []byte
if nv < network.Version13 {
ccparams, err = actors.SerializeParams(&market2.ComputeDataCommitmentParams{
DealIDs: deals,
SectorType: sectorType,
})
return a.stateComputeDataCIDv1(ctx, maddr, sectorType, deals, tsk)
} else if nv < network.Version21 {
return a.stateComputeDataCIDv2(ctx, maddr, sectorType, deals, tsk)
} else {
ccparams, err = actors.SerializeParams(&market5.ComputeDataCommitmentParams{
Inputs: []*market5.SectorDataSpec{
{
DealIDs: deals,
SectorType: sectorType,
},
},
})
return a.stateComputeDataCIDv3(ctx, maddr, sectorType, deals, tsk)
}
}
func (a *StateAPI) stateComputeDataCIDv1(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error) {
var err error
ccparams, err := actors.SerializeParams(&market2.ComputeDataCommitmentParams{
DealIDs: deals,
SectorType: sectorType,
})
if err != nil {
return cid.Undef, xerrors.Errorf("computing params for ComputeDataCommitment: %w", err)
}
ccmt := &types.Message{
To: market.Address,
From: maddr,
Value: types.NewInt(0),
Method: market.Methods.ComputeDataCommitment,
To: market.Address,
From: maddr,
Value: types.NewInt(0),
// Hard coded, because the method has since been deprecated
Method: 8,
Params: ccparams,
}
r, err := a.StateCall(ctx, ccmt, tsk)
@@ -950,13 +949,42 @@ func (a *StateAPI) StateComputeDataCID(ctx context.Context, maddr address.Addres
return cid.Undef, xerrors.Errorf("receipt for ComputeDataCommitment had exit code %d", r.MsgRct.ExitCode)
}
if nv < network.Version13 {
var c cbg.CborCid
if err := c.UnmarshalCBOR(bytes.NewReader(r.MsgRct.Return)); err != nil {
return cid.Undef, xerrors.Errorf("failed to unmarshal CBOR to CborCid: %w", err)
}
var c cbg.CborCid
if err := c.UnmarshalCBOR(bytes.NewReader(r.MsgRct.Return)); err != nil {
return cid.Undef, xerrors.Errorf("failed to unmarshal CBOR to CborCid: %w", err)
}
return cid.Cid(c), nil
return cid.Cid(c), nil
}
func (a *StateAPI) stateComputeDataCIDv2(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error) {
var err error
ccparams, err := actors.SerializeParams(&market5.ComputeDataCommitmentParams{
Inputs: []*market5.SectorDataSpec{
{
DealIDs: deals,
SectorType: sectorType,
},
},
})
if err != nil {
return cid.Undef, xerrors.Errorf("computing params for ComputeDataCommitment: %w", err)
}
ccmt := &types.Message{
To: market.Address,
From: maddr,
Value: types.NewInt(0),
// Hard coded, because the method has since been deprecated
Method: 8,
Params: ccparams,
}
r, err := a.StateCall(ctx, ccmt, tsk)
if err != nil {
return cid.Undef, xerrors.Errorf("calling ComputeDataCommitment: %w", err)
}
if r.MsgRct.ExitCode != 0 {
return cid.Undef, xerrors.Errorf("receipt for ComputeDataCommitment had exit code %d", r.MsgRct.ExitCode)
}
var cr market5.ComputeDataCommitmentReturn
@@ -971,6 +999,52 @@ func (a *StateAPI) StateComputeDataCID(ctx context.Context, maddr address.Addres
return cid.Cid(cr.CommDs[0]), nil
}
func (a *StateAPI) stateComputeDataCIDv3(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error) {
if len(deals) == 0 {
return cid.Undef, nil
}
var err error
ccparams, err := actors.SerializeParams(&market12.VerifyDealsForActivationParams{
Sectors: []market12.SectorDeals{{
SectorType: sectorType,
SectorExpiry: math.MaxInt64,
DealIDs: deals,
}},
})
if err != nil {
return cid.Undef, xerrors.Errorf("computing params for VerifyDealsForActivation: %w", err)
}
ccmt := &types.Message{
To: market.Address,
From: maddr,
Value: types.NewInt(0),
Method: market.Methods.VerifyDealsForActivation,
Params: ccparams,
}
r, err := a.StateCall(ctx, ccmt, tsk)
if err != nil {
return cid.Undef, xerrors.Errorf("calling VerifyDealsForActivation: %w", err)
}
if r.MsgRct.ExitCode != 0 {
return cid.Undef, xerrors.Errorf("receipt for VerifyDealsForActivation had exit code %d", r.MsgRct.ExitCode)
}
var cr market12.VerifyDealsForActivationReturn
if err := cr.UnmarshalCBOR(bytes.NewReader(r.MsgRct.Return)); err != nil {
return cid.Undef, xerrors.Errorf("failed to unmarshal CBOR to VerifyDealsForActivationReturn: %w", err)
}
if len(cr.UnsealedCIDs) != 1 {
return cid.Undef, xerrors.Errorf("Sectors output must have 1 entry")
}
ucid := cr.UnsealedCIDs[0]
if ucid == nil {
return cid.Undef, xerrors.Errorf("computed data CID is nil")
}
return *ucid, nil
}
func (a *StateAPI) StateChangedActors(ctx context.Context, old cid.Cid, new cid.Cid) (map[string]types.Actor, error) {
store := a.Chain.ActorStore(ctx)
@@ -1040,7 +1114,7 @@ func (a *StateAPI) StateMinerAllocated(ctx context.Context, addr address.Address
return mas.GetAllocatedSectors()
}
func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
if err != nil {
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
@@ -1315,7 +1389,7 @@ func (m *StateModule) MsigGetPending(ctx context.Context, addr address.Address,
var initialPledgeNum = types.NewInt(110)
var initialPledgeDen = types.NewInt(100)
func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr address.Address, pci minertypes.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error) {
func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr address.Address, pci miner.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error) {
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
if err != nil {
return types.EmptyInt, xerrors.Errorf("loading tipset %s: %w", tsk, err)
@@ -1347,7 +1421,7 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
sectorWeight = builtin.QAPowerForWeight(ssize, duration, w, vw)
}
} else {
sectorWeight = minertypes.QAPowerMax(ssize)
sectorWeight = miner.QAPowerMax(ssize)
}
var powerSmoothed builtin.FilterEstimate
@@ -1379,7 +1453,7 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
return types.BigDiv(types.BigMul(deposit, initialPledgeNum), initialPledgeDen), nil
}
func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci minertypes.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error) {
func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci miner.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error) {
// TODO: this repeats a lot of the previous function. Fix that.
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
if err != nil {
+3 -3
View File
@@ -35,7 +35,6 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
builtintypes "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"
"github.com/filecoin-project/lotus/api"
@@ -43,6 +42,7 @@ import (
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin"
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/gen"
"github.com/filecoin-project/lotus/chain/types"
mktsdagstore "github.com/filecoin-project/lotus/markets/dagstore"
@@ -497,7 +497,7 @@ func (sm *StorageMinerAPI) SectorReceive(ctx context.Context, meta api.RemoteSec
return err
}
func (sm *StorageMinerAPI) ComputeWindowPoSt(ctx context.Context, dlIdx uint64, tsk types.TipSetKey) ([]minertypes.SubmitWindowedPoStParams, error) {
func (sm *StorageMinerAPI) ComputeWindowPoSt(ctx context.Context, dlIdx uint64, tsk types.TipSetKey) ([]lminer.SubmitWindowedPoStParams, error) {
var ts *types.TipSet
var err error
if tsk == types.EmptyTSK {
@@ -1404,7 +1404,7 @@ func (sm *StorageMinerAPI) withdrawBalance(ctx context.Context, amount abi.Token
amount = available
}
params, err := actors.SerializeParams(&minertypes.WithdrawBalanceParams{
params, err := actors.SerializeParams(&lminer.WithdrawBalanceParams{
AmountRequested: amount,
})
if err != nil {
+4 -1
View File
@@ -157,7 +157,8 @@ func SealProofType(maddr dtypes.MinerAddress, fnapi v1api.FullNode) (abi.Registe
return 0, err
}
return miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType)
// node seal proof type does not decide whether or not we use synthetic porep
return miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType, false)
}
func AddressSelector(addrConf *config.MinerAddressConfig) func() (*ctladdr.AddressSelector, error) {
@@ -1016,6 +1017,7 @@ func NewSetSealConfigFunc(r repo.LockedRepo) (dtypes.SetSealingConfigFunc, error
TerminateBatchMin: cfg.TerminateBatchMin,
TerminateBatchWait: config.Duration(cfg.TerminateBatchWait),
MaxSectorProveCommitsSubmittedPerEpoch: cfg.MaxSectorProveCommitsSubmittedPerEpoch,
UseSyntheticPoRep: cfg.UseSyntheticPoRep,
}
c.SetSealingConfig(newCfg)
})
@@ -1060,6 +1062,7 @@ func ToSealingConfig(dealmakingCfg config.DealmakingConfig, sealingCfg config.Se
TerminateBatchMax: sealingCfg.TerminateBatchMax,
TerminateBatchMin: sealingCfg.TerminateBatchMin,
TerminateBatchWait: time.Duration(sealingCfg.TerminateBatchWait),
UseSyntheticPoRep: sealingCfg.UseSyntheticPoRep,
}
}