update to miner5
This commit is contained in:
parent
7f6c942b81
commit
677afbcb91
@ -19,8 +19,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
||||||
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/blockstore"
|
"github.com/filecoin-project/lotus/blockstore"
|
||||||
@ -490,13 +489,8 @@ var sectorsCheckExpireCmd = &cli.Command{
|
|||||||
tablewriter.Col("MaxExtendNow"))
|
tablewriter.Col("MaxExtendNow"))
|
||||||
|
|
||||||
for _, sector := range sectors {
|
for _, sector := range sectors {
|
||||||
maxLifetime, err := builtin3.SealProofSectorMaximumLifetime(sector.SealProof, nv)
|
MaxExpiration := sector.Activation + policy.GetSectorMaxLifetime(sector.SealProof, nv)
|
||||||
if err != nil {
|
MaxExtendNow := currEpoch + policy.GetMaxSectorExpirationExtension()
|
||||||
return err
|
|
||||||
}
|
|
||||||
MaxExpiration := sector.Activation + maxLifetime
|
|
||||||
|
|
||||||
MaxExtendNow := currEpoch + miner3.MaxSectorExpirationExtension
|
|
||||||
|
|
||||||
if MaxExtendNow > MaxExpiration {
|
if MaxExtendNow > MaxExpiration {
|
||||||
MaxExtendNow = MaxExpiration
|
MaxExtendNow = MaxExpiration
|
||||||
@ -528,7 +522,7 @@ type PseudoExtendSectorExpirationParams struct {
|
|||||||
Extensions []PseudoExpirationExtension
|
Extensions []PseudoExpirationExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPseudoExtendParams(p *miner3.ExtendSectorExpirationParams) (*PseudoExtendSectorExpirationParams, error) {
|
func NewPseudoExtendParams(p *miner5.ExtendSectorExpirationParams) (*PseudoExtendSectorExpirationParams, error) {
|
||||||
res := PseudoExtendSectorExpirationParams{}
|
res := PseudoExtendSectorExpirationParams{}
|
||||||
for _, ext := range p.Extensions {
|
for _, ext := range p.Extensions {
|
||||||
scount, err := ext.Sectors.Count()
|
scount, err := ext.Sectors.Count()
|
||||||
@ -747,7 +741,7 @@ var sectorsRenewCmd = &cli.Command{
|
|||||||
newExp = abi.ChainEpoch(cctx.Int64("new-expiration"))
|
newExp = abi.ChainEpoch(cctx.Int64("new-expiration"))
|
||||||
}
|
}
|
||||||
|
|
||||||
maxExtendNow := currEpoch + miner3.MaxSectorExpirationExtension
|
maxExtendNow := currEpoch + policy.GetMaxSectorExpirationExtension()
|
||||||
if newExp > maxExtendNow {
|
if newExp > maxExtendNow {
|
||||||
newExp = maxExtendNow
|
newExp = maxExtendNow
|
||||||
}
|
}
|
||||||
@ -787,9 +781,9 @@ var sectorsRenewCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var params []miner3.ExtendSectorExpirationParams
|
var params []miner5.ExtendSectorExpirationParams
|
||||||
|
|
||||||
p := miner3.ExtendSectorExpirationParams{}
|
p := miner5.ExtendSectorExpirationParams{}
|
||||||
scount := 0
|
scount := 0
|
||||||
|
|
||||||
for l, exts := range extensions {
|
for l, exts := range extensions {
|
||||||
@ -797,11 +791,11 @@ var sectorsRenewCmd = &cli.Command{
|
|||||||
scount += len(numbers)
|
scount += len(numbers)
|
||||||
if scount > policy.GetAddressedSectorsMax(nv) || len(p.Extensions) == policy.GetDeclarationsMax(nv) {
|
if scount > policy.GetAddressedSectorsMax(nv) || len(p.Extensions) == policy.GetDeclarationsMax(nv) {
|
||||||
params = append(params, p)
|
params = append(params, p)
|
||||||
p = miner3.ExtendSectorExpirationParams{}
|
p = miner5.ExtendSectorExpirationParams{}
|
||||||
scount = len(numbers)
|
scount = len(numbers)
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Extensions = append(p.Extensions, miner3.ExpirationExtension{
|
p.Extensions = append(p.Extensions, miner5.ExpirationExtension{
|
||||||
Deadline: l.Deadline,
|
Deadline: l.Deadline,
|
||||||
Partition: l.Partition,
|
Partition: l.Partition,
|
||||||
Sectors: bitfield.NewFromSet(numbers),
|
Sectors: bitfield.NewFromSet(numbers),
|
||||||
@ -861,11 +855,11 @@ var sectorsRenewCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
smsg, err := fullApi.MpoolPushMessage(ctx, &types.Message{
|
smsg, err := fullApi.MpoolPushMessage(ctx, &types.Message{
|
||||||
From: mi.Worker,
|
From: mi.Worker,
|
||||||
To: maddr,
|
To: maddr,
|
||||||
Method: miner.Methods.ExtendSectorExpiration,
|
Method: miner.Methods.ExtendSectorExpiration,
|
||||||
Value: big.Zero(),
|
Value: big.Zero(),
|
||||||
Params: sp,
|
Params: sp,
|
||||||
}, spec)
|
}, spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("mpool push message: %w", err)
|
return xerrors.Errorf("mpool push message: %w", err)
|
||||||
@ -929,7 +923,7 @@ var sectorsExtendCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var params []miner3.ExtendSectorExpirationParams
|
var params []miner5.ExtendSectorExpirationParams
|
||||||
|
|
||||||
if cctx.Bool("v1-sectors") {
|
if cctx.Bool("v1-sectors") {
|
||||||
|
|
||||||
@ -982,7 +976,7 @@ var sectorsExtendCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the new expiration to 48 hours less than the theoretical maximum lifetime
|
// Set the new expiration to 48 hours less than the theoretical maximum lifetime
|
||||||
newExp := ml - (miner3.WPoStProvingPeriod * 2) + si.Activation
|
newExp := ml - (miner5.WPoStProvingPeriod * 2) + si.Activation
|
||||||
if withinTolerance(si.Expiration, newExp) || si.Expiration >= newExp {
|
if withinTolerance(si.Expiration, newExp) || si.Expiration >= newExp {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -1017,7 +1011,7 @@ var sectorsExtendCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p := miner3.ExtendSectorExpirationParams{}
|
p := miner5.ExtendSectorExpirationParams{}
|
||||||
scount := 0
|
scount := 0
|
||||||
|
|
||||||
for l, exts := range extensions {
|
for l, exts := range extensions {
|
||||||
@ -1025,11 +1019,11 @@ var sectorsExtendCmd = &cli.Command{
|
|||||||
scount += len(numbers)
|
scount += len(numbers)
|
||||||
if scount > policy.GetAddressedSectorsMax(nv) || len(p.Extensions) == policy.GetDeclarationsMax(nv) {
|
if scount > policy.GetAddressedSectorsMax(nv) || len(p.Extensions) == policy.GetDeclarationsMax(nv) {
|
||||||
params = append(params, p)
|
params = append(params, p)
|
||||||
p = miner3.ExtendSectorExpirationParams{}
|
p = miner5.ExtendSectorExpirationParams{}
|
||||||
scount = len(numbers)
|
scount = len(numbers)
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Extensions = append(p.Extensions, miner3.ExpirationExtension{
|
p.Extensions = append(p.Extensions, miner5.ExpirationExtension{
|
||||||
Deadline: l.Deadline,
|
Deadline: l.Deadline,
|
||||||
Partition: l.Partition,
|
Partition: l.Partition,
|
||||||
Sectors: bitfield.NewFromSet(numbers),
|
Sectors: bitfield.NewFromSet(numbers),
|
||||||
@ -1067,11 +1061,11 @@ var sectorsExtendCmd = &cli.Command{
|
|||||||
sectors[*p] = append(sectors[*p], id)
|
sectors[*p] = append(sectors[*p], id)
|
||||||
}
|
}
|
||||||
|
|
||||||
p := miner3.ExtendSectorExpirationParams{}
|
p := miner5.ExtendSectorExpirationParams{}
|
||||||
for l, numbers := range sectors {
|
for l, numbers := range sectors {
|
||||||
|
|
||||||
// TODO: Dedup with above loop
|
// TODO: Dedup with above loop
|
||||||
p.Extensions = append(p.Extensions, miner3.ExpirationExtension{
|
p.Extensions = append(p.Extensions, miner5.ExpirationExtension{
|
||||||
Deadline: l.Deadline,
|
Deadline: l.Deadline,
|
||||||
Partition: l.Partition,
|
Partition: l.Partition,
|
||||||
Sectors: bitfield.NewFromSet(numbers),
|
Sectors: bitfield.NewFromSet(numbers),
|
||||||
|
Loading…
Reference in New Issue
Block a user